diff --git a/tests/snappi_tests/multidut/pfc/files/lossless_response_to_external_pause_storms_helper.py b/tests/snappi_tests/multidut/pfc/files/lossless_response_to_external_pause_storms_helper.py index 79223c283d1..88ec47e38b9 100644 --- a/tests/snappi_tests/multidut/pfc/files/lossless_response_to_external_pause_storms_helper.py +++ b/tests/snappi_tests/multidut/pfc/files/lossless_response_to_external_pause_storms_helper.py @@ -10,7 +10,7 @@ from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401 from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, stop_pfcwd, \ - disable_packet_aging, sec_to_nanosec # noqa: F401 + disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401 from tests.common.snappi_tests.port import select_ports # noqa: F401 from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.snappi_tests.traffic_generation import run_traffic, verify_pause_flow, \ @@ -23,8 +23,8 @@ BG_FLOW_NAME = 'Background Flow' BG_FLOW_AGGR_RATE_PERCENT = 25 DATA_PKT_SIZE = 1024 -DATA_FLOW_DURATION_SEC = 20 -PAUSE_FLOW_DURATION_SEC = 10 +DATA_FLOW_DURATION_SEC = 10 +PAUSE_FLOW_DURATION_SEC = 5 PAUSE_FLOW_DELAY_SEC = 5 DATA_FLOW_DELAY_SEC = 0 SNAPPI_POLL_DELAY_SEC = 2 @@ -78,6 +78,7 @@ def run_lossless_response_to_external_pause_storms_test(api, tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1], snappi_extra_params.multi_dut_params.multi_dut_ports[2]] + ingress_duthost = tx_port[0]['duthost'] tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]] # add ingress DUT into the set dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value'])) @@ -128,6 +129,21 @@ def run_lossless_response_to_external_pause_storms_test(api, exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC, snappi_extra_params=snappi_extra_params) + tx_port1 = tx_port[0]['peer_port'] + tx_port2 = tx_port[1]['peer_port'] + # Fetch relevant statistics + pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail'] + pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail'] + rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts'] + rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts'] + # Calculate the total packet drop + pkt_drop = pkt_drop1 + pkt_drop2 + # Calculate the total received packets + total_rx_pkts = rx_pkts_1 + rx_pkts_2 + # Calculate the drop percentage + drop_percentage = 100 * pkt_drop / total_rx_pkts + pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters') + verify_external_pause_storm_result(flow_stats, tx_port, rx_port) diff --git a/tests/snappi_tests/multidut/pfc/files/lossless_response_to_throttling_pause_storms_helper.py b/tests/snappi_tests/multidut/pfc/files/lossless_response_to_throttling_pause_storms_helper.py index c77e13a6922..a07222e5bcd 100644 --- a/tests/snappi_tests/multidut/pfc/files/lossless_response_to_throttling_pause_storms_helper.py +++ b/tests/snappi_tests/multidut/pfc/files/lossless_response_to_throttling_pause_storms_helper.py @@ -10,7 +10,8 @@ from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401 from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, stop_pfcwd, disable_packet_aging, \ - get_pfcwd_poll_interval, get_pfcwd_detect_time, get_pfcwd_restore_time, sec_to_nanosec # noqa: F401 + get_pfcwd_poll_interval, get_pfcwd_detect_time, get_pfcwd_restore_time, sec_to_nanosec, \ + get_interface_stats # noqa: F401 from tests.common.snappi_tests.port import select_ports # noqa: F401 from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.snappi_tests.traffic_generation import run_traffic, verify_pause_flow, \ @@ -27,11 +28,11 @@ BG_FLOW_AGGR_RATE_PERCENT = 25 PAUSE_FLOW_RATE = 15 DATA_PKT_SIZE = 1024 -DATA_FLOW_DURATION_SEC = 20 +DATA_FLOW_DURATION_SEC = 10 DATA_FLOW_DELAY_SEC = 0 SNAPPI_POLL_DELAY_SEC = 2 TOLERANCE_THRESHOLD = 0.05 -PAUSE_FLOW_DURATION_SEC = 10 +PAUSE_FLOW_DURATION_SEC = 5 PAUSE_FLOW_DELAY_SEC = 5 @@ -83,6 +84,7 @@ def run_lossless_response_to_throttling_pause_storms_test(api, tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1], snappi_extra_params.multi_dut_params.multi_dut_ports[2]] + ingress_duthost = tx_port[0]['duthost'] tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]] # add ingress DUT into the set dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value'])) @@ -134,6 +136,22 @@ def run_lossless_response_to_throttling_pause_storms_test(api, exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC, snappi_extra_params=snappi_extra_params) + tx_port1 = tx_port[0]['peer_port'] + tx_port2 = tx_port[1]['peer_port'] + # Fetch relevant statistics + pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail'] + pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail'] + rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts'] + rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts'] + # Calculate the total packet drop + pkt_drop = pkt_drop1 + pkt_drop2 + # Calculate the total received packets + total_rx_pkts = rx_pkts_1 + rx_pkts_2 + # Calculate the drop percentage + drop_percentage = 100 * pkt_drop / total_rx_pkts + pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters') + + """ Verify Results """ verify_throttling_pause_storm_result(flow_stats, tx_port, rx_port) diff --git a/tests/snappi_tests/multidut/pfc/files/m2o_fluctuating_lossless_helper.py b/tests/snappi_tests/multidut/pfc/files/m2o_fluctuating_lossless_helper.py index cb2d69d9c0c..2561831ec24 100644 --- a/tests/snappi_tests/multidut/pfc/files/m2o_fluctuating_lossless_helper.py +++ b/tests/snappi_tests/multidut/pfc/files/m2o_fluctuating_lossless_helper.py @@ -4,12 +4,13 @@ from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401 from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, stop_pfcwd, \ - disable_packet_aging, sec_to_nanosec # noqa: F401 + disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401 from tests.common.snappi_tests.port import select_ports # noqa: F401 from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.snappi_tests.traffic_generation import run_traffic, \ setup_base_traffic_config # noqa: F401 from tests.snappi_tests.variables import pfcQueueGroupSize, pfcQueueValueDict +from math import ceil logger = logging.getLogger(__name__) PAUSE_FLOW_NAME = 'Pause Storm' @@ -18,8 +19,8 @@ BG_FLOW_NAME = 'Background Flow' BG_FLOW_AGGR_RATE_PERCENT = [20, 20] DATA_PKT_SIZE = 1024 -DATA_FLOW_DURATION_SEC = 20 -DATA_FLOW_DELAY_SEC = 10 +DATA_FLOW_DURATION_SEC = 10 +DATA_FLOW_DELAY_SEC = 5 SNAPPI_POLL_DELAY_SEC = 2 @@ -70,6 +71,7 @@ def run_m2o_fluctuating_lossless_test(api, tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1], snappi_extra_params.multi_dut_params.multi_dut_ports[2]] + ingress_duthost = tx_port[0]['duthost'] tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]] # add ingress DUT into the set dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value'])) @@ -116,6 +118,22 @@ def run_m2o_fluctuating_lossless_test(api, exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC, snappi_extra_params=snappi_extra_params) + tx_port1 = tx_port[0]['peer_port'] + tx_port2 = tx_port[1]['peer_port'] + # Fetch relevant statistics + pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail'] + pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail'] + rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts'] + rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts'] + # Calculate the total packet drop + pkt_drop = pkt_drop1 + pkt_drop2 + # Calculate the total received packets + total_rx_pkts = rx_pkts_1 + rx_pkts_2 + # Calculate the drop percentage + drop_percentage = 100 * pkt_drop / total_rx_pkts + pytest_assert(ceil(drop_percentage) == 8, 'FAIL: Drop packets must be around 8 percent') + + """ Verify Results """ verify_m2o_fluctuating_lossless_result(flow_stats, tx_port, rx_port) diff --git a/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_helper.py b/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_helper.py index a6878d42868..948a370ba49 100644 --- a/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_helper.py +++ b/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_helper.py @@ -10,7 +10,7 @@ from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401 from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \ - stop_pfcwd, disable_packet_aging, sec_to_nanosec # noqa: F401 + stop_pfcwd, disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401 from tests.common.snappi_tests.port import select_ports # noqa: F401 from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.snappi_tests.traffic_generation import setup_base_traffic_config, \ @@ -24,8 +24,8 @@ BG_FLOW_NAME = 'Background Flow' BG_FLOW_AGGR_RATE_PERCENT = 25 DATA_PKT_SIZE = 1024 -DATA_FLOW_DURATION_SEC = 20 -DATA_FLOW_DELAY_SEC = 10 +DATA_FLOW_DURATION_SEC = 10 +DATA_FLOW_DELAY_SEC = 5 SNAPPI_POLL_DELAY_SEC = 2 TOLERANCE_THRESHOLD = 0.05 @@ -73,6 +73,7 @@ def run_m2o_oversubscribe_lossless_test(api, tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1], snappi_extra_params.multi_dut_params.multi_dut_ports[2]] + ingress_duthost = tx_port[0]['duthost'] tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]] # add ingress DUT into the set dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value'])) @@ -121,6 +122,22 @@ def run_m2o_oversubscribe_lossless_test(api, exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC, snappi_extra_params=snappi_extra_params) + tx_port1 = tx_port[0]['peer_port'] + tx_port2 = tx_port[1]['peer_port'] + # Fetch relevant statistics + pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail'] + pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail'] + rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts'] + rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts'] + # Calculate the total packet drop + pkt_drop = pkt_drop1 + pkt_drop2 + # Calculate the total received packets + total_rx_pkts = rx_pkts_1 + rx_pkts_2 + # Calculate the drop percentage + drop_percentage = 100 * pkt_drop / total_rx_pkts + pytest_assert(ceil(drop_percentage) == 0, 'FAIL: There should be no packet drops in ingress dut counters') + + """ Verify Results """ verify_m2o_oversubscribe_lossless_result(flow_stats, tx_port, rx_port) diff --git a/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_lossy_helper.py b/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_lossy_helper.py index 6adda32474a..5d8f740044f 100644 --- a/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_lossy_helper.py +++ b/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossless_lossy_helper.py @@ -10,7 +10,7 @@ from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401 from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \ - stop_pfcwd, disable_packet_aging, sec_to_nanosec # noqa: F401 + stop_pfcwd, disable_packet_aging, sec_to_nanosec, get_interface_stats # noqa: F401 from tests.common.snappi_tests.port import select_ports # noqa: F401 from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.snappi_tests.traffic_generation import run_traffic, \ @@ -25,8 +25,8 @@ BG_FLOW_NAME = 'Background Flow' BG_FLOW_AGGR_RATE_PERCENT = [20, 40] DATA_PKT_SIZE = 1024 -DATA_FLOW_DURATION_SEC = 20 -DATA_FLOW_DELAY_SEC = 10 +DATA_FLOW_DURATION_SEC = 10 +DATA_FLOW_DELAY_SEC = 5 SNAPPI_POLL_DELAY_SEC = 2 TOLERANCE_THRESHOLD = 0.05 @@ -78,6 +78,7 @@ def run_pfc_m2o_oversubscribe_lossless_lossy_test(api, tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1], snappi_extra_params.multi_dut_params.multi_dut_ports[2]] + ingress_duthost = tx_port[0]['duthost'] tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]] # add ingress DUT into the set dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value'])) @@ -124,6 +125,22 @@ def run_pfc_m2o_oversubscribe_lossless_lossy_test(api, exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC, snappi_extra_params=snappi_extra_params) + tx_port1 = tx_port[0]['peer_port'] + tx_port2 = tx_port[1]['peer_port'] + # Fetch relevant statistics + pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail'] + pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail'] + rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts'] + rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts'] + # Calculate the total packet drop + pkt_drop = pkt_drop1 + pkt_drop2 + # Calculate the total received packets + total_rx_pkts = rx_pkts_1 + rx_pkts_2 + # Calculate the drop percentage + drop_percentage = 100 * pkt_drop / total_rx_pkts + pytest_assert(ceil(drop_percentage) == 5, 'FAIL: Drop packets must be around 5 percent') + + """ Verify Results """ verify_m2o_oversubscribe_lossless_lossy_result(flow_stats, tx_port, rx_port) diff --git a/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossy_helper.py b/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossy_helper.py index 68b85b6d927..261ab507f75 100644 --- a/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossy_helper.py +++ b/tests/snappi_tests/multidut/pfc/files/m2o_oversubscribe_lossy_helper.py @@ -10,7 +10,7 @@ from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id # noqa: F401 from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, \ - stop_pfcwd, disable_packet_aging # noqa: F401 + stop_pfcwd, disable_packet_aging, get_interface_stats # noqa: F401 from tests.common.snappi_tests.port import select_ports # noqa: F401 from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.snappi_tests.traffic_generation import setup_base_traffic_config, \ @@ -24,8 +24,8 @@ BG_FLOW_NAME = 'Background Flow' BG_FLOW_AGGR_RATE_PERCENT = 25 DATA_PKT_SIZE = 1024 -DATA_FLOW_DURATION_SEC = 5 -DATA_FLOW_DELAY_SEC = 2 +DATA_FLOW_DURATION_SEC = 10 +DATA_FLOW_DELAY_SEC = 5 SNAPPI_POLL_DELAY_SEC = 2 TOLERANCE_THRESHOLD = 0.05 @@ -77,6 +77,7 @@ def run_pfc_m2o_oversubscribe_lossy_test(api, tx_port = [snappi_extra_params.multi_dut_params.multi_dut_ports[1], snappi_extra_params.multi_dut_params.multi_dut_ports[2]] + ingress_duthost = tx_port[0]['duthost'] tx_port_id_list = [tx_port[0]["port_id"], tx_port[1]["port_id"]] # add ingress DUT into the set dut_asics_to_be_configured.add((tx_port[0]['duthost'], tx_port[0]['asic_value'])) @@ -126,6 +127,20 @@ def run_pfc_m2o_oversubscribe_lossy_test(api, exp_dur_sec=DATA_FLOW_DURATION_SEC + DATA_FLOW_DELAY_SEC, snappi_extra_params=snappi_extra_params) + tx_port1 = tx_port[0]['peer_port'] + tx_port2 = tx_port[1]['peer_port'] + pkt_drop1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_fail'] + pkt_drop2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_fail'] + rx_pkts_1 = get_interface_stats(ingress_duthost, tx_port1)[ingress_duthost.hostname][tx_port1]['rx_pkts'] + rx_pkts_2 = get_interface_stats(ingress_duthost, tx_port2)[ingress_duthost.hostname][tx_port2]['rx_pkts'] + # Calculate the total packet drop + pkt_drop = pkt_drop1 + pkt_drop2 + # Calculate the total received packets + total_rx_pkts = rx_pkts_1 + rx_pkts_2 + # Calculate the drop percentage + drop_percentage = 100 * pkt_drop / total_rx_pkts + pytest_assert(ceil(drop_percentage) == 10, 'FAIL: Drop packets must be around 10 percent') + """ Verify Results """ verify_m2o_oversubscribe_lossy_result(flow_stats, tx_port,