diff --git a/tests/common/snappi_tests/common_helpers.py b/tests/common/snappi_tests/common_helpers.py index 2f3c9943731..55ce452b6df 100644 --- a/tests/common/snappi_tests/common_helpers.py +++ b/tests/common/snappi_tests/common_helpers.py @@ -438,7 +438,7 @@ def get_wred_profiles(host_ans, asic_value=None): return None -def config_wred(host_ans, kmin, kmax, pmax, gdrop=None, profile=None, asic_value=None): +def config_wred(host_ans, kmin, kmax, pmax, kdrop=None, profile=None, asic_value=None): """ Config a WRED/ECN profile of a SONiC switch Args: @@ -457,10 +457,10 @@ def config_wred(host_ans, kmin, kmax, pmax, gdrop=None, profile=None, asic_value if not isinstance(kmin, int) or \ not isinstance(kmax, int) or \ not isinstance(pmax, int) or \ - (gdrop is not None and not isinstance(gdrop, int)): + (kdrop is not None and not isinstance(kdrop, int)): return False - if kmin < 0 or kmax < 0 or pmax < 0 or pmax > 100 or kmin > kmax or (gdrop and (gdrop < 0 or gdrop > 100)): + if kmin < 0 or kmax < 0 or pmax < 0 or pmax > 100 or kmin > kmax or (kdrop and (kdrop < 0 or kdrop > 100)): return False profiles = get_wred_profiles(host_ans, asic_value) """ Cannot find any WRED/ECN profiles """ @@ -479,6 +479,7 @@ def config_wred(host_ans, kmin, kmax, pmax, gdrop=None, profile=None, asic_value kmax_arg = '-{}max'.format(color[0]) kmin_arg = '-{}min'.format(color[0]) + kdrop_arg = '-{}drop'.format(color[0]) for p in profiles: """ This is not the profile to configure """ @@ -487,7 +488,7 @@ def config_wred(host_ans, kmin, kmax, pmax, gdrop=None, profile=None, asic_value kmin_old = int(profiles[p]['{}_min_threshold'.format(color)]) kmax_old = int(profiles[p]['{}_max_threshold'.format(color)]) - gdrop_old = int(profiles[p]['{}_drop_probability'.format(color)]) + kdrop_old = int(profiles[p]['{}_drop_probability'.format(color)]) if kmin_old > kmax_old: return False @@ -496,10 +497,12 @@ def config_wred(host_ans, kmin, kmax, pmax, gdrop=None, profile=None, asic_value kmax_cmd = ' '.join(['sudo ecnconfig -p {}', kmax_arg, '{}']) kmin_cmd = ' '.join(['sudo ecnconfig -p {}', kmin_arg, '{}']) + kdrop_cmd = ' '.join(['sudo ecnconfig -p {}', kdrop_arg, '{}']) if asic_value is not None: kmax_cmd = ' '.join(['sudo ip netns exec', asic_value, 'ecnconfig -p {}', kmax_arg, '{}']) kmin_cmd = ' '.join(['sudo ip netns exec', asic_value, 'ecnconfig -p {}', kmin_arg, '{}']) + kdrop_cmd = ' '.join(['sudo ip netns exec', asic_value, 'ecnconfig -p {}', kdrop_arg, '{}']) if asic_type == 'broadcom': disable_packet_aging(host_ans, asic_value) @@ -510,8 +513,8 @@ def config_wred(host_ans, kmin, kmax, pmax, gdrop=None, profile=None, asic_value host_ans.shell(kmin_cmd.format(p, kmin)) host_ans.shell(kmax_cmd.format(p, kmax)) - if gdrop and gdrop != gdrop_old: - host_ans.shell('sudo ecnconfig -p {} -gdrop {}'.format(p, gdrop)) + if kdrop and kdrop != kdrop_old: + host_ans.shell(kdrop_cmd.format(p, kdrop)) return True diff --git a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py index 83b5ef958da..e4465810410 100644 --- a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py +++ b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py @@ -715,6 +715,10 @@ def run_ecn_marking_with_pfc_quanta_variance( "flow_traffic_type": traffic_flow_mode.FIXED_PACKETS } + asic_namespace = None + if duthost.is_multi_asic: + asic = duthost.get_port_asic_instance(dut_port) + asic_namespace = asic.namespace gmin, gmax, gdrop = test_ecn_config # Configure WRED/ECN thresholds @@ -724,7 +728,8 @@ def run_ecn_marking_with_pfc_quanta_variance( kmin=gmin * 1024 * 1024, kmax=gmax * 1024 * 1024, pmax=0, - gdrop=gdrop) + kdrop=gdrop, + asic_value=asic_namespace) pytest_assert(config_result is True, 'Failed to configure WRED/ECN at the DUT') diff --git a/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_pfc_quanta_variance_with_snappi.py b/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_pfc_quanta_variance_with_snappi.py index a2c7508c2cb..5bc4fd46428 100644 --- a/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_pfc_quanta_variance_with_snappi.py +++ b/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_pfc_quanta_variance_with_snappi.py @@ -10,7 +10,7 @@ is_snappi_multidut, get_snappi_ports_multi_dut, get_snappi_ports_single_dut # noqa: F401 from tests.common.snappi_tests.qos_fixtures import prio_dscp_map, \ lossless_prio_list, disable_pfcwd # noqa F401 -from tests.snappi_tests.files.helper import multidut_port_info, setup_ports_and_dut # noqa: F401 +from tests.snappi_tests.files.helper import multidut_port_info, setup_ports_and_dut, enable_debug_shell # noqa: F401 from tests.snappi_tests.multidut.ecn.files.multidut_helper import run_ecn_marking_with_pfc_quanta_variance from tests.common.snappi_tests.snappi_test_params import SnappiTestParams logger = logging.getLogger(__name__)