diff --git a/tests/platform_tests/api/conftest.py b/tests/platform_tests/api/conftest.py index ef59bed69f5..97ed18fbbf0 100644 --- a/tests/platform_tests/api/conftest.py +++ b/tests/platform_tests/api/conftest.py @@ -111,3 +111,6 @@ def check_not_implemented_warnings(duthosts, enum_rand_one_per_hwsku_hostname): loganalyzer.match_regex.extend(['WARNING pmon#platform_api_server.py: API.+not implemented']) loganalyzer.analyze(marker) + +def pytest_addoption(parser): + parser.addoption("--unresettable_xcvr_types", action="append", default=[], help="unsupported resettable xcvr types") diff --git a/tests/platform_tests/api/test_sfp.py b/tests/platform_tests/api/test_sfp.py index c93f5a165f0..d4dc773851f 100644 --- a/tests/platform_tests/api/test_sfp.py +++ b/tests/platform_tests/api/test_sfp.py @@ -181,11 +181,10 @@ def is_xcvr_optical(self, xcvr_info_dict): return False return True - def is_xcvr_resettable(self, xcvr_info_dict): + def is_xcvr_resettable(self, request, xcvr_info_dict): + not_resettable_xcvr_type = request.config.getoption("--unresettable_xcvr_types") xcvr_type = xcvr_info_dict.get("type_abbrv_name") - if xcvr_type == "SFP": - return False - return True + return xcvr_type not in not_resettable_xcvr_type def is_xcvr_support_lpmode(self, xcvr_info_dict): """Returns True if transceiver is support low power mode, False if not supported""" @@ -487,7 +486,7 @@ def test_get_tx_power(self, duthosts, enum_rand_one_per_hwsku_hostname, localhos "Transceiver {} TX power data appears incorrect".format(i)) self.assert_expectations() - def test_reset(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): + def test_reset(self, request, duthosts, enum_rand_one_per_hwsku_hostname, localhost, platform_api_conn): # TODO: Verify that the transceiver was actually reset duthost = duthosts[enum_rand_one_per_hwsku_hostname] skip_release_for_platform(duthost, ["202012"], ["arista", "mlnx"]) @@ -498,7 +497,7 @@ def test_reset(self, duthosts, enum_rand_one_per_hwsku_hostname, localhost, plat continue ret = sfp.reset(platform_api_conn, i) - if self.is_xcvr_resettable(info_dict): + if self.is_xcvr_resettable(request, info_dict): self.expect(ret is True, "Failed to reset transceiver {}".format(i)) else: self.expect(ret is False, "Resetting transceiver {} succeeded but should have failed".format(i))