Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -1867,7 +1867,7 @@ def get_application_advertisement(self):
# Read the application advertisement in page01
try:
dic.update(self.xcvr_eeprom.read(consts.APPLS_ADVT_FIELD_PAGE01))
except TypeError as e:
except (TypeError, AttributeError) as e:
logger.error('Failed to read APPLS_ADVT_FIELD_PAGE01: ' + str(e))
return ret

Expand Down
6 changes: 6 additions & 0 deletions tests/sonic_xcvr/test_cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1970,6 +1970,12 @@ def test_get_application_advertisement(self):
assert result[1]['media_lane_count'] == 4
assert result[1]['host_lane_assignment_options'] == 0x01

def test_get_application_advertisement_non_support(self):
self.api.xcvr_eeprom.read = MagicMock(return_value = None)
self.api.is_flat_memory = MagicMock(return_value = False)
result = self.api.get_application_advertisement()
assert result == {}

def test_get_application(self):
self.api.xcvr_eeprom.read = MagicMock()
self.api.xcvr_eeprom.read.return_value = 0x20
Expand Down