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

[Platform API] : modified test_sfp for 400G ports #3888

Merged
merged 3 commits into from
Jul 31, 2021
Merged
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
23 changes: 19 additions & 4 deletions tests/platform_tests/api/test_sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,20 @@ def compare_value_with_platform_facts(self, key, value, sfp_idx, duthost):

def is_xcvr_optical(self, xcvr_info_dict):
"""Returns True if transceiver is optical, False if copper (DAC)"""
spec_compliance_dict = ast.literal_eval(xcvr_info_dict["specification_compliance"])
compliance_code = spec_compliance_dict.get("10/40G Ethernet Compliance Code")
if compliance_code == "40GBASE-CR4":
return False
#For QSFP-DD specification compliance will return type as passive or active
if xcvr_info_dict["type_abbrv_name"] == "QSFP-DD":
if xcvr_info_dict["specification_compliance"] == "passive_copper_media_interface":
return False
else:
spec_compliance_dict = ast.literal_eval(xcvr_info_dict["specification_compliance"])
if xcvr_info_dict["type_abbrv_name"] == "SFP":
compliance_code = spec_compliance_dict.get("SFP+CableTechnology")
if compliance_code == "Passive Cable":
return False
else:
compliance_code = spec_compliance_dict.get("10/40G Ethernet Compliance Code")
if compliance_code == "40GBASE-CR4":
return False
return True

def is_xcvr_resettable(self, xcvr_info_dict):
Expand Down Expand Up @@ -335,6 +345,11 @@ def test_get_voltage(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost
def test_get_tx_bias(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn):
# TODO: Do more sanity checking on the data we retrieve
for i in self.candidate_sfp:
info_dict = sfp.get_transceiver_info(platform_api_conn, i)
# Determine whether the transceiver type supports TX Bias
if not self.is_xcvr_optical(info_dict):
logger.warning("test_get_tx_bias: Skipping transceiver {} (not applicable for this transceiver type)".format(i))
continue
tx_bias = sfp.get_tx_bias(platform_api_conn, i)
if self.expect(tx_bias is not None, "Unable to retrieve transceiver {} TX bias data".format(i)):
self.expect(isinstance(tx_bias, list) and (all(isinstance(item, float) for item in tx_bias)),
Expand Down