From e0e79a913a2f83224a99547bde9e405f73524fc5 Mon Sep 17 00:00:00 2001 From: Sreejith Sreekumaran <60534136+sreejithsreekumaran@users.noreply.github.com> Date: Fri, 15 Nov 2024 08:46:49 -0800 Subject: [PATCH 1/3] Added test case for ecn counter verification pre and post port state toggle --- tests/snappi_tests/multidut/ecn/files/multidut_helper.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py index f1779bb2461..6c12fc4ebec 100644 --- a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py +++ b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py @@ -71,7 +71,6 @@ def verify_ecn_counters(ecn_counters, link_state_toggled=False): 'Must have ecn marked packets on flow 4{}'. format(toggle_msg)) - def verify_ecn_counters_for_flow_percent(ecn_counters, test_flow_percent): # verify that each flow had packets @@ -148,7 +147,6 @@ def verify_ecn_counters_for_flow_percent(ecn_counters, test_flow_percent): 'Must have ecn marked packets on flows 3, 4, percent {}'. format(test_flow_percent)) - def run_ecn_test(api, testbed_config, port_config_list, @@ -310,7 +308,6 @@ def run_ecn_test(api, return result - def toggle_dut_port_state(api): # Get the current configuration config = api.get_config() @@ -330,7 +327,6 @@ def toggle_dut_port_state(api): api.set_link_state(link_state) logger.info("All Snappi ports are set to UP") - def run_ecn_marking_port_toggle_test( api, testbed_config, @@ -502,7 +498,6 @@ def run_ecn_marking_port_toggle_test( verify_ecn_counters(ecn_counters, link_state_toggled=True) - def run_ecn_marking_test(api, testbed_config, port_config_list, From c0d75046a1630a92be52a76a0cb2e2c012d20adc Mon Sep 17 00:00:00 2001 From: Sreejith Sreekumaran <60534136+sreejithsreekumaran@users.noreply.github.com> Date: Thu, 21 Nov 2024 12:31:43 -0800 Subject: [PATCH 2/3] Added support based on PR 15099 --- .../multidut/ecn/files/multidut_helper.py | 34 ++++++++++++------- 1 file changed, 21 insertions(+), 13 deletions(-) diff --git a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py index 6c12fc4ebec..656708932d5 100644 --- a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py +++ b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py @@ -6,7 +6,7 @@ snappi_api # noqa: F401 from tests.common.snappi_tests.snappi_helpers import get_dut_port_id from tests.common.snappi_tests.common_helpers import pfc_class_enable_vector, config_wred, \ - enable_ecn, config_ingress_lossless_buffer_alpha, stop_pfcwd, disable_packet_aging, \ + enable_ecn, config_ingress_lossless_buffer_alpha, stop_pfcwd, disable_packet_aging,\ config_capture_pkt, traffic_flow_mode, calc_pfc_pause_flow_rate # noqa: F401 from tests.common.snappi_tests.read_pcap import get_ipv4_pkts from tests.common.snappi_tests.snappi_test_params import SnappiTestParams @@ -327,6 +327,26 @@ def toggle_dut_port_state(api): api.set_link_state(link_state) logger.info("All Snappi ports are set to UP") +def toggle_dut_port_state(api): + # Get the current configuration + config = api.get_config() + # Collect all port names + port_names = [port.name for port in config.ports] + # Create a link state object for all ports + link_state = api.link_state() + # Apply the state to all ports + link_state.port_names = port_names + # Set all ports down (shut) + link_state.state = link_state.DOWN + api.set_link_state(link_state) + logger.info("All Snappi ports are set to DOWN") + time.sleep(0.2) + # Unshut all ports + link_state.state = link_state.UP + api.set_link_state(link_state) + logger.info("All Snappi ports are set to UP") + + def run_ecn_marking_port_toggle_test( api, testbed_config, @@ -371,18 +391,6 @@ def run_ecn_marking_port_toggle_test( rx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[0] egress_duthost = rx_port['duthost'] - tx_port = snappi_extra_params.multi_dut_params.multi_dut_ports[1] - ingress_duthost = tx_port['duthost'] - - pytest_assert(testbed_config is not None, 'Failed to get L2/3 testbed config') - - logger.info("Stopping PFC watchdog") - stop_pfcwd(egress_duthost, rx_port['asic_value']) - stop_pfcwd(ingress_duthost, tx_port['asic_value']) - logger.info("Disabling packet aging if necessary") - disable_packet_aging(egress_duthost) - disable_packet_aging(ingress_duthost) - duthost = egress_duthost init_ctr_3 = get_npu_voq_queue_counters(duthost, dut_port, test_prio_list[0]) From c05e954a10b37151e53459fe0e4866a793ce4b94 Mon Sep 17 00:00:00 2001 From: Sreejith Sreekumaran <60534136+sreejithsreekumaran@users.noreply.github.com> Date: Tue, 26 Nov 2024 04:42:17 -0800 Subject: [PATCH 3/3] Removed duplicate code from rebase conflict --- .../multidut/ecn/files/multidut_helper.py | 21 +++---------------- 1 file changed, 3 insertions(+), 18 deletions(-) diff --git a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py index 656708932d5..33c078ffb2e 100644 --- a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py +++ b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py @@ -71,6 +71,7 @@ def verify_ecn_counters(ecn_counters, link_state_toggled=False): 'Must have ecn marked packets on flow 4{}'. format(toggle_msg)) + def verify_ecn_counters_for_flow_percent(ecn_counters, test_flow_percent): # verify that each flow had packets @@ -147,6 +148,7 @@ def verify_ecn_counters_for_flow_percent(ecn_counters, test_flow_percent): 'Must have ecn marked packets on flows 3, 4, percent {}'. format(test_flow_percent)) + def run_ecn_test(api, testbed_config, port_config_list, @@ -308,24 +310,6 @@ def run_ecn_test(api, return result -def toggle_dut_port_state(api): - # Get the current configuration - config = api.get_config() - # Collect all port names - port_names = [port.name for port in config.ports] - # Create a link state object for all ports - link_state = api.link_state() - # Apply the state to all ports - link_state.port_names = port_names - # Set all ports down (shut) - link_state.state = link_state.DOWN - api.set_link_state(link_state) - logger.info("All Snappi ports are set to DOWN") - time.sleep(0.2) - # Unshut all ports - link_state.state = link_state.UP - api.set_link_state(link_state) - logger.info("All Snappi ports are set to UP") def toggle_dut_port_state(api): # Get the current configuration @@ -506,6 +490,7 @@ def run_ecn_marking_port_toggle_test( verify_ecn_counters(ecn_counters, link_state_toggled=True) + def run_ecn_marking_test(api, testbed_config, port_config_list,