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 <kebol@nvidia.com>
  • Loading branch information
keboliu authored Dec 9, 2024
1 parent 0f2e22f commit e955e58
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 @@ -3152,6 +3152,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 @@ -3066,7 +3066,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 e955e58

Please sign in to comment.