From f9d1ab4c18e92c1f0480d767cb5930b50dd395c1 Mon Sep 17 00:00:00 2001 From: zitingguo Date: Wed, 28 May 2025 09:18:52 +0000 Subject: [PATCH 1/6] [ACL] Fix service port not included in upstream neighbor Signed-off-by: zitingguo-ms --- tests/acl/test_acl.py | 18 ++++++++++++++---- tests/common/helpers/constants.py | 2 +- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/tests/acl/test_acl.py b/tests/acl/test_acl.py index b13a7fd2a08..c6a72d76a55 100644 --- a/tests/acl/test_acl.py +++ b/tests/acl/test_acl.py @@ -153,6 +153,8 @@ PACKETS_COUNT = "packets_count" BYTES_COUNT = "bytes_count" +TOPOLOGY_WITH_SERVICE_PORT = ["t0-d18u8s4", "t0-isolated-d16u16s1", "t0-isolated-d32u32s2"] + @pytest.fixture(scope="module", autouse=True) def remove_dataacl_table(duthosts): @@ -429,10 +431,18 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran # In multi-asic we need config both in host and namespace. if namespace: acl_table_ports[''] += port - if len(port_channels) and (topo in ["t0", "m0_vlan", "m0_l3"] - or tbinfo["topo"]["name"] in ("t1-lag", "t1-64-lag", "t1-64-lag-clet", - "t1-56-lag", "t1-28-lag", "t1-32-lag") - or 't1-isolated' in tbinfo["topo"]["name"]): + if ( + len(port_channels) + and ( + topo in ["t0", "m0_vlan", "m0_l3"] + or tbinfo["topo"]["name"] in ( + "t1-lag", "t1-64-lag", "t1-64-lag-clet", + "t1-56-lag", "t1-28-lag", "t1-32-lag" + ) + or 't1-isolated' in tbinfo["topo"]["name"] + ) + and tbinfo["topo"]["name"] not in TOPOLOGY_WITH_SERVICE_PORT + ): for k, v in list(port_channels.items()): acl_table_ports[v['namespace']].append(k) diff --git a/tests/common/helpers/constants.py b/tests/common/helpers/constants.py index 6a0cbcb5467..d4e21501936 100644 --- a/tests/common/helpers/constants.py +++ b/tests/common/helpers/constants.py @@ -25,7 +25,7 @@ # Describe ALL upstream neighbor of dut in different topos UPSTREAM_ALL_NEIGHBOR_MAP = { - "t0": ["t1"], + "t0": ["t1", "pt0"], "t1": ["t2"], "m1": ["ma", "mb"], "m0": ["m1"], From 510f6fdc8fbe335fdcc8a9d2536de328badb73c3 Mon Sep 17 00:00:00 2001 From: zitingguo Date: Wed, 28 May 2025 09:20:34 +0000 Subject: [PATCH 2/6] [test_stress_acl] Fix service port not in upsream neighbor issue Signed-off-by: zitingguo-ms --- tests/acl/test_stress_acl.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/acl/test_stress_acl.py b/tests/acl/test_stress_acl.py index 30bfca409f4..11b6a7f6422 100644 --- a/tests/acl/test_stress_acl.py +++ b/tests/acl/test_stress_acl.py @@ -193,9 +193,9 @@ def prepare_test_port(rand_selected_dut, tbinfo): upstream_port_neighbor_ips = {} for interface, neighbor in list(mg_facts["minigraph_neighbors"].items()): port_id = mg_facts["minigraph_ptf_indices"][interface] - if (topo == "t1" and "T2" in neighbor["name"]) or (topo == "t0" and "T1" in neighbor["name"]) or \ - (topo == "m0" and "M1" in neighbor["name"]) or (topo == "mx" and "M0" in neighbor["name"]) or \ - (topo_name in ("t1-isolated-d32", "t1-isolated-d128") and "T0" in neighbor["name"]): + if (topo == "t1" and "T2" in neighbor["name"]) or \ + (topo == "t0" and ("T1" in neighbor["name"] or "PT0" in neighbor["name"])) or \ + (topo == "m0" and "M1" in neighbor["name"]) or (topo == "mx" and "M0" in neighbor["name"]): upstream_ports[neighbor['namespace']].append(interface) upstream_port_ids.append(port_id) ipv4_addr = [bgp_neighbor['addr'] for bgp_neighbor in mg_facts['minigraph_bgp'] From 422cbdcd05182ee329f1cd204dea94890d8b170d Mon Sep 17 00:00:00 2001 From: zitingguo Date: Wed, 28 May 2025 09:31:00 +0000 Subject: [PATCH 3/6] [ptf_helper] Include PT0 neighbor in upstream_links Signed-off-by: zitingguo-ms --- tests/common/helpers/ptf_tests_helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/common/helpers/ptf_tests_helper.py b/tests/common/helpers/ptf_tests_helper.py index 4b3f6486895..6743d8884fe 100644 --- a/tests/common/helpers/ptf_tests_helper.py +++ b/tests/common/helpers/ptf_tests_helper.py @@ -57,7 +57,7 @@ def upstream_links(rand_selected_dut, tbinfo, nbrhosts): duthost = rand_selected_dut def filter(interface, neighbor, mg_facts, tbinfo): - if ((tbinfo["topo"]["type"] == "t0" and "T1" in neighbor["name"]) + if ((tbinfo["topo"]["type"] == "t0" and ("T1" in neighbor["name"] or "PT0" in neighbor["name"])) or (tbinfo["topo"]["type"] == "t1" and "T2" in neighbor["name"])): local_ipv4_addr = None peer_ipv4_addr = None From 005e13b7648e956699f1a038fd0dfb68eb5f0104 Mon Sep 17 00:00:00 2001 From: zitingguo Date: Thu, 29 May 2025 11:31:49 +0000 Subject: [PATCH 4/6] Use regex to find out topo with service port Signed-off-by: zitingguo --- tests/acl/test_acl.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tests/acl/test_acl.py b/tests/acl/test_acl.py index c6a72d76a55..2fdf5def1df 100644 --- a/tests/acl/test_acl.py +++ b/tests/acl/test_acl.py @@ -10,6 +10,7 @@ import ptf.mask as mask import ptf.packet as packet import queue +import re from abc import ABCMeta, abstractmethod from collections import defaultdict @@ -153,8 +154,6 @@ PACKETS_COUNT = "packets_count" BYTES_COUNT = "bytes_count" -TOPOLOGY_WITH_SERVICE_PORT = ["t0-d18u8s4", "t0-isolated-d16u16s1", "t0-isolated-d32u32s2"] - @pytest.fixture(scope="module", autouse=True) def remove_dataacl_table(duthosts): @@ -441,7 +440,7 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran ) or 't1-isolated' in tbinfo["topo"]["name"] ) - and tbinfo["topo"]["name"] not in TOPOLOGY_WITH_SERVICE_PORT + and not re.match(r"t0-.*-s\d+$", tbinfo["topo"]["name"]) ): for k, v in list(port_channels.items()): From bbbf1f8f99202932d7cb065230a84b58e8a35cbf Mon Sep 17 00:00:00 2001 From: zitingguo Date: Tue, 3 Jun 2025 03:22:15 +0000 Subject: [PATCH 5/6] Fix regex Signed-off-by: zitingguo-ms --- tests/acl/test_acl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/acl/test_acl.py b/tests/acl/test_acl.py index 2fdf5def1df..33b2519747b 100644 --- a/tests/acl/test_acl.py +++ b/tests/acl/test_acl.py @@ -440,7 +440,7 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran ) or 't1-isolated' in tbinfo["topo"]["name"] ) - and not re.match(r"t0-.*-s\d+$", tbinfo["topo"]["name"]) + and not re.match(r"t0-.*s\d+", tbinfo["topo"]["name"]) ): for k, v in list(port_channels.items()): From b70673e8ab6a2537013c323e6edd74aaf4e838a8 Mon Sep 17 00:00:00 2001 From: zitingguo Date: Tue, 3 Jun 2025 03:32:34 +0000 Subject: [PATCH 6/6] Fix --- tests/acl/test_stress_acl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/acl/test_stress_acl.py b/tests/acl/test_stress_acl.py index 11b6a7f6422..291324e35f7 100644 --- a/tests/acl/test_stress_acl.py +++ b/tests/acl/test_stress_acl.py @@ -195,7 +195,8 @@ def prepare_test_port(rand_selected_dut, tbinfo): port_id = mg_facts["minigraph_ptf_indices"][interface] if (topo == "t1" and "T2" in neighbor["name"]) or \ (topo == "t0" and ("T1" in neighbor["name"] or "PT0" in neighbor["name"])) or \ - (topo == "m0" and "M1" in neighbor["name"]) or (topo == "mx" and "M0" in neighbor["name"]): + (topo == "m0" and "M1" in neighbor["name"]) or (topo == "mx" and "M0" in neighbor["name"]) or \ + (topo_name in ("t1-isolated-d32", "t1-isolated-d128") and "T0" in neighbor["name"]): upstream_ports[neighbor['namespace']].append(interface) upstream_port_ids.append(port_id) ipv4_addr = [bgp_neighbor['addr'] for bgp_neighbor in mg_facts['minigraph_bgp']