Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify test_get_transceiver_info to handle get_transceiver_info_firmware_versions API #11708

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
4 changes: 4 additions & 0 deletions tests/common/helpers/platform_api/sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ def get_transceiver_info(conn, index):
return sfp_api(conn, index, 'get_transceiver_info')


def get_transceiver_info_firmware_versions(conn, index):
return sfp_api(conn, index, 'get_transceiver_info_firmware_versions')


def get_transceiver_bulk_status(conn, index):
return sfp_api(conn, index, 'get_transceiver_bulk_status')

Expand Down
14 changes: 11 additions & 3 deletions tests/platform_tests/api/test_sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,17 +97,18 @@ class TestSfpApi(PlatformApiTestBase):
]

# some new keys added for QSFP-DD and OSFP in 202205 or later branch
EXPECTED_XCVR_NEW_QSFP_DD_OSFP_INFO_KEYS = ['active_firmware',
'host_lane_count',
EXPECTED_XCVR_NEW_QSFP_DD_OSFP_INFO_KEYS = ['host_lane_count',
'media_lane_count',
'cmis_rev',
'host_lane_assignment_option',
'inactive_firmware',
'media_interface_technology',
'media_interface_code',
'host_electrical_interface',
'media_lane_assignment_option']

EXPECTED_XCVR_NEW_QSFP_DD_OSFP_FIRMWARE_INFO_KEYS = ['active_firmware',
'inactive_firmware']

# These are fields which have been added in the common parsers
# in sonic-platform-common/sonic_sfp, but since some vendors are
# using their own custom parsers, they do not yet provide these
Expand Down Expand Up @@ -389,7 +390,14 @@ def test_get_transceiver_info(self, duthosts, enum_rand_one_per_hwsku_hostname,
active_apsel_hostlane_count = 8
UPDATED_EXPECTED_XCVR_INFO_KEYS = self.EXPECTED_XCVR_INFO_KEYS + \
self.EXPECTED_XCVR_NEW_QSFP_DD_OSFP_INFO_KEYS + \
self.EXPECTED_XCVR_NEW_QSFP_DD_OSFP_FIRMWARE_INFO_KEYS + \
["active_apsel_hostlane{}".format(n) for n in range(1, active_apsel_hostlane_count + 1)]
firmware_info_dict = sfp.get_transceiver_info_firmware_versions(platform_api_conn, i)
if self.expect(firmware_info_dict is not None,
"Unable to retrieve transceiver {} firmware info".format(i)):
if self.expect(isinstance(firmware_info_dict, dict),
"Transceiver {} firmware info appears incorrect".format(i)):
actual_keys.extend(list(firmware_info_dict.keys()))
if 'ZR' in info_dict['media_interface_code']:
UPDATED_EXPECTED_XCVR_INFO_KEYS = UPDATED_EXPECTED_XCVR_INFO_KEYS + \
self.QSFPZR_EXPECTED_XCVR_INFO_KEYS
Expand Down
Loading