Skip to content
Draft
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
22 changes: 15 additions & 7 deletions tests/platform_tests/api/test_sfp.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,13 @@ def lp_mode_deassert_delay(self, xcvr_info_dict):
return 0.3
return 0

def should_skip_lpmode_check(self, xcvr_info_dict):
return any(
xcvr_info_dict.get("manufacturer", "").strip() == xcvr_to_skip["manufacturer"] and
xcvr_info_dict.get("model", "").strip() == xcvr_to_skip["model"]
for xcvr_to_skip in self.LPMODE_SKIP_LIST
)

def is_xcvr_support_lpmode(self, xcvr_info_dict, port_index=None):
"""Returns True if transceiver is support low power mode, False if not supported"""
xcvr_type = xcvr_info_dict["type"]
Expand All @@ -379,12 +386,10 @@ def is_xcvr_support_lpmode(self, xcvr_info_dict, port_index=None):
return False

# Temporarily add this logic to skip lpmode test for some transceivers with known issue
for xcvr_to_skip in self.LPMODE_SKIP_LIST:
if (xcvr_info_dict["manufacturer"].strip() == xcvr_to_skip["manufacturer"] and
xcvr_info_dict["model"].strip() == xcvr_to_skip["model"]):
logger.info("Temporarily skipping {} - {} due to known issue".format(
xcvr_info_dict["manufacturer"], xcvr_info_dict["model"]))
return False
if self.should_skip_lpmode_check(xcvr_info_dict):
logger.info("Temporarily skipping {} - {} due to known issue".format(
xcvr_info_dict["manufacturer"], xcvr_info_dict["model"]))
return False

return True

Expand Down Expand Up @@ -413,7 +418,10 @@ def get_interfaces_to_flap_after_sfp_reset(self, port_index_to_info_dict, duthos
continue

info_dict = port_index_to_info_dict[sfp_port_idx]
if self.is_xcvr_support_lpmode(info_dict, sfp_port_idx):
if (
self.is_xcvr_support_lpmode(info_dict, sfp_port_idx)
or self.should_skip_lpmode_check(info_dict)
):
logger.info("Flapping interface {} - xcvr supports lpmode and needs to be flapped".format(intf))
interfaces_to_flap.append(intf)
return interfaces_to_flap
Expand Down