From 8be236e7a152c5d81bd076dd5185e4b5404fe60a Mon Sep 17 00:00:00 2001 From: sreejithsreekumaran <60534136+sreejithsreekumaran@users.noreply.github.com> Date: Mon, 9 Dec 2024 00:23:08 +0000 Subject: [PATCH] ECN IXIA test for verifying equal marking due to traffic causing congestion (#15849) Description of PR Summary: Fixes # (issue) Approach What is the motivation for this PR? Make the test case multi Topo capable. Add ecn marking ratio check for flow percent where both lossless TC are >= 50 to have equal marking How did you do it? Ixia testcase enhancement How did you verify/test it? On Ixia connected DUT co-authorized by: jianquanye@microsoft.com --- tests/snappi_tests/multidut/ecn/files/multidut_helper.py | 8 +++++++- .../ecn/test_multidut_ecn_marking_with_snappi.py | 9 +++++---- 2 files changed, 12 insertions(+), 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 33c078ffb2e..7b3a3f8b37b 100644 --- a/tests/snappi_tests/multidut/ecn/files/multidut_helper.py +++ b/tests/snappi_tests/multidut/ecn/files/multidut_helper.py @@ -142,11 +142,17 @@ def verify_ecn_counters_for_flow_percent(ecn_counters, test_flow_percent): 'Must not have ecn marked packets on flow 4, percent {}'. format(test_flow_percent)) - if test_flow_percent[0] == 50 and test_flow_percent[1] == 50: + if test_flow_percent[0] >= 50 and test_flow_percent[1] >= 50: pytest_assert( flow3_ecn > 0 and flow4_ecn > 0, 'Must have ecn marked packets on flows 3, 4, percent {}'. format(test_flow_percent)) + flow_ecn_ratio = round(float(flow3_ecn/flow4_ecn), 2) + pytest_assert( + round(abs(flow_ecn_ratio - 1), 3) <= 0.05, + "The packet flow ecn ratio {} deviation more than tolerance for \ + flow percent {} flow 3 ecn -> {} flow 4 ecn -> {}". + format(flow_ecn_ratio, test_flow_percent, flow3_ecn, flow4_ecn)) def run_ecn_test(api, diff --git a/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py b/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py index 425476e3af9..79992795ef4 100644 --- a/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py +++ b/tests/snappi_tests/multidut/ecn/test_multidut_ecn_marking_with_snappi.py @@ -2,10 +2,11 @@ import logging from tabulate import tabulate # noqa F401 from tests.common.helpers.assertions import pytest_assert # noqa: F401 -from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts_multidut # noqa: F401 +from tests.common.fixtures.conn_graph_facts import conn_graph_facts, fanout_graph_facts, \ + fanout_graph_facts_multidut # noqa: F401 from tests.common.snappi_tests.snappi_fixtures import snappi_api_serv_ip, snappi_api_serv_port, \ snappi_api, snappi_dut_base_config, get_snappi_ports, get_snappi_ports_for_rdma, cleanup_config, \ - is_snappi_multidut, get_snappi_ports_multi_dut # noqa: F401 + 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 @@ -13,7 +14,7 @@ from tests.common.snappi_tests.snappi_test_params import SnappiTestParams from tests.common.cisco_data import is_cisco_device logger = logging.getLogger(__name__) -pytestmark = [pytest.mark.topology('multidut-tgen')] +pytestmark = [pytest.mark.topology('multidut-tgen', 'tgen')] def validate_snappi_ports(snappi_ports): @@ -110,7 +111,7 @@ def test_ecn_marking_port_toggle( cleanup_config(duthosts, snappi_ports) -test_flow_percent_list = [[90, 15], [53, 49], [15, 90], [49, 49], [50, 50]] +test_flow_percent_list = [[90, 15], [53, 49], [15, 90], [49, 49], [50, 50], [60, 60], [60, 90], [90, 60]] @pytest.mark.parametrize("test_flow_percent", test_flow_percent_list)