Skip to content

Commit 2e5c0e3

Browse files
Gfrom2016AharonMalkin
authored andcommitted
[ACL] Include service port into upstream neighbors (sonic-net#18671)
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: Aharon Malkin <[email protected]>
1 parent b2dac33 commit 2e5c0e3

4 files changed

Lines changed: 17 additions & 7 deletions

File tree

tests/acl/test_acl.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import ptf.mask as mask
1111
import ptf.packet as packet
1212
import queue
13+
import re
1314

1415
from abc import ABCMeta, abstractmethod
1516
from collections import defaultdict
@@ -429,10 +430,18 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran
429430
# In multi-asic we need config both in host and namespace.
430431
if namespace:
431432
acl_table_ports[''] += port
432-
if len(port_channels) and (topo in ["t0", "m0_vlan", "m0_l3"]
433-
or tbinfo["topo"]["name"] in ("t1-lag", "t1-64-lag", "t1-64-lag-clet",
434-
"t1-56-lag", "t1-28-lag", "t1-32-lag")
435-
or 't1-isolated' in tbinfo["topo"]["name"]):
433+
if (
434+
len(port_channels)
435+
and (
436+
topo in ["t0", "m0_vlan", "m0_l3"]
437+
or tbinfo["topo"]["name"] in (
438+
"t1-lag", "t1-64-lag", "t1-64-lag-clet",
439+
"t1-56-lag", "t1-28-lag", "t1-32-lag"
440+
)
441+
or 't1-isolated' in tbinfo["topo"]["name"]
442+
)
443+
and not re.match(r"t0-.*s\d+", tbinfo["topo"]["name"])
444+
):
436445

437446
for k, v in list(port_channels.items()):
438447
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
@@ -25,7 +25,7 @@
2525

2626
# Describe ALL upstream neighbor of dut in different topos
2727
UPSTREAM_ALL_NEIGHBOR_MAP = {
28-
"t0": ["t1"],
28+
"t0": ["t1", "pt0"],
2929
"t1": ["t2"],
3030
"m1": ["ma", "mb"],
3131
"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)