Skip to content

Commit ea27f1f

Browse files
committed
[ACL] Include service port into upstream neighbors
Summary: Fixes # (issue) In the topology with service ports, like t0-d18u8s4, t0-isolated-d16u16s1, t0-isolated-d32u32s2. we should include the PT0 neighbor port in the upstream neighbor list. With the enhancement in sonic-net#18516, we can achieve this by adding pt0 in UPSTREAM_ALL_NEIGHBOR_MAP. Signed-off-by: zitingguo-ms <zitingguo@microsoft.com>
1 parent 4d16bbf commit ea27f1f

File tree

4 files changed

+17
-8
lines changed

4 files changed

+17
-8
lines changed

tests/acl/test_acl.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import ptf.testutils as testutils
1010
import ptf.mask as mask
1111
import ptf.packet as packet
12+
import re
1213

1314
from abc import ABCMeta, abstractmethod
1415
from collections import defaultdict
@@ -423,11 +424,18 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran
423424
# In multi-asic we need config both in host and namespace.
424425
if namespace:
425426
acl_table_ports[''] += port
426-
if len(port_channels) and topo in ["t0", "m0_vlan", "m0_l3"] or tbinfo["topo"]["name"] in ("t1-lag", "t1-64-lag",
427-
"t1-64-lag-clet",
428-
"t1-56-lag",
429-
"t1-28-lag",
430-
"t1-32-lag"):
427+
if (
428+
len(port_channels)
429+
and (
430+
topo in ["t0", "m0_vlan", "m0_l3"]
431+
or tbinfo["topo"]["name"] in (
432+
"t1-lag", "t1-64-lag", "t1-64-lag-clet",
433+
"t1-56-lag", "t1-28-lag", "t1-32-lag"
434+
)
435+
or 't1-isolated' in tbinfo["topo"]["name"]
436+
)
437+
and not re.match(r"t0-.*s\d+", tbinfo["topo"]["name"])
438+
):
431439

432440
for k, v in list(port_channels.items()):
433441
acl_table_ports[v['namespace']].append(k)

tests/acl/test_stress_acl.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,8 @@ def prepare_test_port(rand_selected_dut, tbinfo):
193193
upstream_port_neighbor_ips = {}
194194
for interface, neighbor in list(mg_facts["minigraph_neighbors"].items()):
195195
port_id = mg_facts["minigraph_ptf_indices"][interface]
196-
if (topo == "t1" and "T2" in neighbor["name"]) or (topo == "t0" and "T1" in neighbor["name"]) or \
196+
if (topo == "t1" and "T2" in neighbor["name"]) or \
197+
(topo == "t0" and ("T1" in neighbor["name"] or "PT0" in neighbor["name"])) or \
197198
(topo == "m0" and "M1" in neighbor["name"]) or (topo == "mx" and "M0" in neighbor["name"]) or \
198199
(topo_name in ("t1-isolated-d32", "t1-isolated-d128") and "T0" in neighbor["name"]):
199200
upstream_ports[neighbor['namespace']].append(interface)

tests/common/helpers/constants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
# Describe ALL upstream neighbor of dut in different topos
2525
UPSTREAM_ALL_NEIGHBOR_MAP = {
26-
"t0": ["t1"],
26+
"t0": ["t1", "pt0"],
2727
"t1": ["t2"],
2828
"m1": ["ma", "mb"],
2929
"m0": ["m1"],

tests/common/helpers/ptf_tests_helper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def upstream_links(rand_selected_dut, tbinfo, nbrhosts):
5757
duthost = rand_selected_dut
5858

5959
def filter(interface, neighbor, mg_facts, tbinfo):
60-
if ((tbinfo["topo"]["type"] == "t0" and "T1" in neighbor["name"])
60+
if ((tbinfo["topo"]["type"] == "t0" and ("T1" in neighbor["name"] or "PT0" in neighbor["name"]))
6161
or (tbinfo["topo"]["type"] == "t1" and "T2" in neighbor["name"])):
6262
local_ipv4_addr = None
6363
peer_ipv4_addr = None

0 commit comments

Comments
 (0)