Skip to content
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
9 changes: 4 additions & 5 deletions tests/common/helpers/pfcwd_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,12 +494,13 @@ def start_background_traffic(


@contextlib.contextmanager
def send_background_traffic(duthost, ptfhost, storm_hndle, selected_test_ports, test_ports_info):
def send_background_traffic(duthost, ptfhost, storm_hndle, selected_test_ports, test_ports_info, pkt_count=100000):
"""Send background traffic, stop the background traffic when the context finish """
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)
test_ports_info,
pkt_count)
background_traffic_log = _send_background_traffic(ptfhost, background_traffic_params)
# Ensure the background traffic is running before moving on
time.sleep(1)
Expand All @@ -508,7 +509,7 @@ def send_background_traffic(duthost, ptfhost, storm_hndle, selected_test_ports,
_stop_background_traffic(ptfhost, background_traffic_log)


def _prepare_background_traffic_params(duthost, queues, selected_test_ports, test_ports_info):
def _prepare_background_traffic_params(duthost, queues, selected_test_ports, test_ports_info, pkt_count):
src_ports = []
dst_ports = []
src_ips = []
Expand All @@ -524,8 +525,6 @@ def _prepare_background_traffic_params(duthost, queues, selected_test_ports, tes
src_ips.append(selected_test_port_info["rx_neighbor_addr"])

router_mac = duthost.get_dut_iface_mac(selected_test_ports[0])
# Send enough packets to make sure the background traffic is running during the test
pkt_count = 100000

ptf_params = {'router_mac': router_mac,
'src_ports': src_ports,
Expand Down
22 changes: 20 additions & 2 deletions tests/pfcwd/test_pfcwd_all_port_storm.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,23 @@ def set_storm_params(duthost, fanout_graph, fanouthosts, peer_params):
return storm_hndle


def resolve_arp(duthost, ptfhost, test_ports_info):
"""
Populate ARP info for the DUT vlan port

Args:
ptfhost: ptf host instance
test_ports_info: test ports information
"""
for port, port_info in test_ports_info.items():
if port_info['test_port_type'] == 'vlan':
neighbor_ip = port_info['test_neighbor_addr']
ptf_port = f"eth{port_info['test_port_id']}"
ptfhost.command(f"ifconfig {ptf_port} {neighbor_ip}")
duthost.command(f"docker exec -i swss arping {neighbor_ip} -c 5")
break


@pytest.mark.usefixtures('degrade_pfcwd_detection', 'stop_pfcwd', 'storm_test_setup_restore', 'start_background_traffic') # noqa E501
class TestPfcwdAllPortStorm(object):
""" PFC storm test class """
Expand Down Expand Up @@ -234,8 +251,9 @@ def test_all_port_storm_restore(self, duthosts, enum_rand_one_per_hwsku_frontend
test_port = device_conn[intf]['peerport']
if test_port in setup_pfc_test['test_ports']:
selected_test_ports.append(test_port)

with send_background_traffic(duthost, ptfhost, queues, selected_test_ports, setup_pfc_test['test_ports']):
resolve_arp(duthost, ptfhost, setup_pfc_test['test_ports'])
with send_background_traffic(duthost, ptfhost, queues, selected_test_ports, setup_pfc_test['test_ports'],
pkt_count=500):
self.run_test(duthost,
storm_hndle,
expect_regex=[EXPECT_PFC_WD_DETECT_RE + fetch_vendor_specific_diagnosis_re(duthost)],
Expand Down
Loading