Skip to content

Commit

Permalink
get_error_description should return 'OK' instead of None when there i…
Browse files Browse the repository at this point in the history
…s no error (#518)

- Description
The "get_error_description" function should return 'OK' instead of 'None' when there are no errors.

- Motivation and Context
When there are no errors on the cable, get_error_description currently returns 'None'. In this case, we should return 'OK' so that the CLI (show interface transceiver error-description) provides a proper output.

- How Has This Been Tested?
Call this API directly on different cables with different error statuses.

Signed-off-by: Kebo Liu <[email protected]>
  • Loading branch information
keboliu authored and mssonicbld committed Dec 18, 2024
1 parent 101fe2e commit 000f89b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2724,6 +2724,6 @@ def get_error_description(self):
if state != CmisCodes.MODULE_STATE[3]:
return state

return None
return 'OK'

# TODO: other XcvrApi methods
2 changes: 1 addition & 1 deletion tests/sonic_xcvr/test_cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -2664,7 +2664,7 @@ def test_get_error_description(self):
self.api.xcvr_eeprom.read.return_value = 0x10

result = self.api.get_error_description()
assert result is None
assert result is 'OK'

def test_random_read_fail(self):
def mock_read_raw(offset, size):
Expand Down

0 comments on commit 000f89b

Please sign in to comment.