Skip to content

Commit

Permalink
[CMIS]The "get_error_description" function should return 'OK' instead…
Browse files Browse the repository at this point in the history
… of None when there are no errors. (#528)

<!-- Provide a general summary of your changes in the Title above -->

#### 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.

#### Additional Information (Optional)
  • Loading branch information
mssonicbld authored Jan 13, 2025
1 parent 0f2e22f commit 89e8827
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 89e8827

Please sign in to comment.