diff --git a/tests/common/helpers/pfcwd_helper.py b/tests/common/helpers/pfcwd_helper.py index 5b5ecd0c1e6..90f78ef5f82 100644 --- a/tests/common/helpers/pfcwd_helper.py +++ b/tests/common/helpers/pfcwd_helper.py @@ -9,6 +9,7 @@ from tests.ptf_runner import ptf_runner from tests.common import constants +from tests.common.cisco_data import is_cisco_device from tests.common.mellanox_data import is_mellanox_device # If the version of the Python interpreter is greater or equal to 3, set the unicode variable to the str class. @@ -490,7 +491,7 @@ def start_background_traffic( @contextlib.contextmanager def send_background_traffic(duthost, ptfhost, storm_hndle, selected_test_ports, test_ports_info): """Send background traffic, stop the background traffic when the context finish """ - if is_mellanox_device(duthost): + if is_mellanox_device(duthost) or is_cisco_device(duthost): background_traffic_params = _prepare_background_traffic_params(duthost, storm_hndle, selected_test_ports, test_ports_info) @@ -498,7 +499,7 @@ def send_background_traffic(duthost, ptfhost, storm_hndle, selected_test_ports, # Ensure the background traffic is running before moving on time.sleep(1) yield - if is_mellanox_device(duthost): + if is_mellanox_device(duthost) or is_cisco_device(duthost): _stop_background_traffic(ptfhost, background_traffic_log) diff --git a/tests/pfcwd/test_pfcwd_function.py b/tests/pfcwd/test_pfcwd_function.py index b9f60a65a59..b6e1b2c01fe 100644 --- a/tests/pfcwd/test_pfcwd_function.py +++ b/tests/pfcwd/test_pfcwd_function.py @@ -738,7 +738,7 @@ def storm_detect_path(self, dut, port, action): if self.pfc_wd['fake_storm']: PfcCmd.set_storm_status(dut, self.queue_oid, "enabled") - if dut.facts['asic_type'] == "mellanox": + if dut.facts['asic_type'] == ["mellanox", "cisco-8000"]: # On Mellanox platform, more time is required for PFC storm being triggered # as PFC pause sent from Non-Mellanox leaf fanout is not continuous sometimes. PFC_STORM_TIMEOUT = 30 @@ -754,11 +754,6 @@ def storm_detect_path(self, dut, port, action): # storm detect logger.info("Verify if PFC storm is detected on port {}".format(port)) - if dut.facts['asic_type'] == "cisco-8000": - # The function get_pkt_cnts() works only if pfcwd is triggered. - # When the WD is not triggered, this redis-cli command returns - # (nil), so this function call fails. - self.traffic_inst.verify_tx_egress(self.tx_action) loganalyzer.analyze(marker) self.stats.get_pkt_cnts(self.queue_oid, begin=True) @@ -924,8 +919,6 @@ def test_pfcwd_actions(self, request, fake_storm, setup_pfc_test, setup_dut_test logger.info("{} on port {}: Tx traffic action {}, Rx traffic action {} ". format(WD_ACTION_MSG_PFX[action], port, self.tx_action, self.rx_action)) self.run_test(self.dut, port, action) - except Exception as e: - pytest.fail(str(e)) finally: if self.storm_hndle: @@ -1014,9 +1007,6 @@ def test_pfcwd_multi_port(self, request, fake_storm, setup_pfc_test, setup_dut_t self.setup_test_params(port, setup_info['vlan'], init=not idx, detect=False, toggle=idx and count) self.run_test(self.dut, port, "drop", detect=False) - except Exception as e: - pytest.fail(str(e)) - finally: logger.info("--- Stop PFC WD ---") self.dut.command("pfcwd stop") @@ -1106,9 +1096,6 @@ def test_pfcwd_mmu_change(self, request, fake_storm, setup_pfc_test, setup_dut_t self.run_test(self.dut, port, "drop", mmu_action=mmu_action) self.dut.command("pfcwd stop") - except Exception as e: - pytest.fail(str(e)) - finally: if self.storm_hndle: logger.info("--- Stop pfc storm on port {}".format(port)) @@ -1214,9 +1201,6 @@ def test_pfcwd_port_toggle(self, request, fake_storm, setup_pfc_test, setup_dut_ if result["total"]["expected_missing_match"] == 0: pytest.fail(result) - except Exception as e: - pytest.fail(str(e)) - finally: if self.storm_hndle: logger.info("--- Stop PFC storm on port {}".format(port))