Skip to content

Commit e955e58

Browse files
authored
get_error_description should return 'OK' instead of None when there is no error (sonic-net#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]>
1 parent 0f2e22f commit e955e58

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

sonic_platform_base/sonic_xcvr/api/public/cmis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3152,6 +3152,6 @@ def get_error_description(self):
31523152
if state != CmisCodes.MODULE_STATE[3]:
31533153
return state
31543154

3155-
return None
3155+
return 'OK'
31563156

31573157
# TODO: other XcvrApi methods

tests/sonic_xcvr/test_cmis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3066,7 +3066,7 @@ def test_get_error_description(self):
30663066
self.api.xcvr_eeprom.read.return_value = 0x10
30673067

30683068
result = self.api.get_error_description()
3069-
assert result is None
3069+
assert result is 'OK'
30703070

30713071
def test_random_read_fail(self):
30723072
def mock_read_raw(offset, size):

0 commit comments

Comments
 (0)