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

test pfcwd with no traffic support in snappi #16552

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def run_pfcwd_basic_test(api,
prio_list,
prio_dscp_map,
trigger_pfcwd,
have_data_flow=True,
snappi_extra_params=None):
"""
Run a basic PFC watchdog test
Expand Down Expand Up @@ -128,18 +129,25 @@ def run_pfcwd_basic_test(api,
exp_dur_sec = flow2_delay_sec + flow2_dur_sec + 1
cisco_platform = "Cisco" in egress_duthost.facts['hwsku']

data_flow_name_list = []
if have_data_flow:
data_flow_name_list += [WARM_UP_TRAFFIC_NAME, DATA_FLOW1_NAME, DATA_FLOW2_NAME]

data_flow_delay_sec_list = []
data_flow_dur_sec_list = []
if have_data_flow:
data_flow_delay_sec_list += [warm_up_traffic_delay_sec, flow1_delay_sec, flow2_delay_sec]
data_flow_dur_sec_list += [warm_up_traffic_dur_sec, flow1_dur_sec, flow2_dur_sec]

""" Generate traffic config """
__gen_traffic(testbed_config=testbed_config,
port_config_list=port_config_list,
port_id=0,
pause_flow_name=PAUSE_FLOW_NAME,
pause_flow_dur_sec=pfc_storm_dur_sec,
data_flow_name_list=[WARM_UP_TRAFFIC_NAME,
DATA_FLOW1_NAME, DATA_FLOW2_NAME],
data_flow_delay_sec_list=[
warm_up_traffic_delay_sec, flow1_delay_sec, flow2_delay_sec],
data_flow_dur_sec_list=[
warm_up_traffic_dur_sec, flow1_dur_sec, flow2_dur_sec],
data_flow_name_list=data_flow_name_list,
data_flow_delay_sec_list=data_flow_delay_sec_list,
data_flow_dur_sec_list=data_flow_dur_sec_list,
data_pkt_size=DATA_PKT_SIZE,
prio_list=prio_list,
prio_dscp_map=prio_dscp_map,
Expand Down Expand Up @@ -167,11 +175,20 @@ def run_pfcwd_basic_test(api,

logger.info('Total PFCWD drop packets before and after the test:{}'.format(loss_packets))

__verify_results(rows=flow_stats,
data_flow_name_list=[DATA_FLOW1_NAME, DATA_FLOW2_NAME],
data_flow_min_loss_rate_list=[flow1_min_loss_rate, 0],
data_flow_max_loss_rate_list=[flow1_max_loss_rate, 0],
loss_packets=loss_packets)
if have_data_flow:
__verify_results(rows=flow_stats,
data_flow_name_list=[DATA_FLOW1_NAME, DATA_FLOW2_NAME],
data_flow_min_loss_rate_list=[flow1_min_loss_rate, 0],
data_flow_max_loss_rate_list=[flow1_max_loss_rate, 0],
loss_packets=loss_packets)
else:
if trigger_pfcwd:
# PFC WD storm detection is not expected with no data traffic
for k in fin_stats.keys():
if 'DETECT' in k:
storm_detected = (int(fin_stats[k]) - int(ini_stats[k]))
pytest_assert(storm_detected == 0,
'PFC WD Trigger not expected when no data traffic')


def get_stats(duthost, port, prio):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ def number_of_tx_rx_ports():


@pytest.fixture(autouse=False)
def save_restore_config(setup_ports_and_dut):
def save_restore_config(setup_ports_and_dut # noqa: F811
):
testbed_config, port_config_list, snappi_ports = setup_ports_and_dut
timestamp = time.time()
dest = f'~/{timestamp}'
Expand All @@ -52,7 +53,11 @@ def save_restore_config(setup_ports_and_dut):
config_reload(duthost)


@pytest.mark.parametrize("trigger_pfcwd", [True, False])
@pytest.mark.parametrize("trigger_pfcwd, have_data_flow", [
(True, True),
(True, False), # Inject PFC Storm with no traffic: Expected no WD triger
(False, True),
])
def test_pfcwd_basic_single_lossless_prio(snappi_api, # noqa: F811
conn_graph_facts, # noqa: F811
fanout_graph_facts_multidut, # noqa: F811
Expand All @@ -62,6 +67,7 @@ def test_pfcwd_basic_single_lossless_prio(snappi_api, # noqa:
prio_dscp_map, # noqa F811
setup_ports_and_dut, # noqa: F811
trigger_pfcwd, # noqa: F811
have_data_flow # noqa: F811
):
"""
Run PFC watchdog basic test on a single lossless priority
Expand Down Expand Up @@ -94,6 +100,7 @@ def test_pfcwd_basic_single_lossless_prio(snappi_api, # noqa:
prio_list=[lossless_prio],
prio_dscp_map=prio_dscp_map,
trigger_pfcwd=trigger_pfcwd,
have_data_flow=have_data_flow,
snappi_extra_params=snappi_extra_params)


Expand Down
Loading