Skip to content

Commit daafceb

Browse files
markx-aristaabhishek-nexthop
authored andcommitted
Fix test_acl.py [ipv6-ingress-uplink->downlink-*] cases for v6 topo (sonic-net#21760)
* Fix acl [ipv6-ingress-uplink->downlink-*] cases for v6 topo Signed-off-by: Abhishek <[email protected]>
1 parent 12dbddf commit daafceb

File tree

3 files changed

+96
-1
lines changed

3 files changed

+96
-1
lines changed

tests/acl/templates/acltb_v6_test_rules.j2

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,6 +582,36 @@
582582
"destination-ip-address": "fc02:1000:0:1::7/128"
583583
}
584584
}
585+
},
586+
"38": {
587+
"actions": {
588+
"config": {
589+
"forwarding-action": "ACCEPT"
590+
}
591+
},
592+
"config": {
593+
"sequence-id": 38
594+
},
595+
"ip": {
596+
"config": {
597+
"destination-ip-address": "2064:100:0::C0A8:0000:1/128"
598+
}
599+
}
600+
},
601+
"39": {
602+
"actions": {
603+
"config": {
604+
"forwarding-action": "DROP"
605+
}
606+
},
607+
"config": {
608+
"sequence-id": 39
609+
},
610+
"ip": {
611+
"config": {
612+
"destination-ip-address": "2064:100:0::C0A8:0000:9/128"
613+
}
614+
}
585615
}
586616
}
587617
}

tests/acl/templates/acltb_v6_test_rules_part_2.j2

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,36 @@
540540
"destination-ip-address": "fc02:1000:0:1::7/128"
541541
}
542542
}
543+
},
544+
"38": {
545+
"actions": {
546+
"config": {
547+
"forwarding-action": "ACCEPT"
548+
}
549+
},
550+
"config": {
551+
"sequence-id": 38
552+
},
553+
"ip": {
554+
"config": {
555+
"destination-ip-address": "2064:100:0::C0A8:0000:1/128"
556+
}
557+
}
558+
},
559+
"39": {
560+
"actions": {
561+
"config": {
562+
"forwarding-action": "DROP"
563+
}
564+
},
565+
"config": {
566+
"sequence-id": 39
567+
},
568+
"ip": {
569+
"config": {
570+
"destination-ip-address": "2064:100:0::C0A8:0000:9/128"
571+
}
572+
}
543573
}
544574
}
545575
}

tests/acl/test_acl.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
from tests.common.sai_validation.sonic_db import start_db_monitor, wait_for_n_keys, stop_db_monitor
3535
from tests.common.validation.sai.acl_validation import validate_acl_asicdb_entries
3636
from tests.common.utilities import is_ipv4_address
37+
from tests.common.utilities import is_ipv6_only_topology
3738
from tests.common.dualtor.dual_tor_utils import show_muxcable_status
3839
from tests.common.fixtures.duthost_utils import is_multi_binding_acl_enabled # noqa: F401
3940

@@ -97,6 +98,21 @@
9798
"ipv6": "20c0:a800::11ac:d765:2523:e5e4"
9899
}
99100

101+
# Below T1 V6 topo IPs are announced to DUT by annouce_route.py
102+
# IPv4 addrs are placeholders only
103+
DOWNSTREAM_DST_IP_V6_TOPO = {
104+
"ipv4": "192.168.0.253",
105+
"ipv6": "2064:100:0::C0A8:0000:14"
106+
}
107+
DOWNSTREAM_IP_TO_ALLOW_V6_TOPO = {
108+
"ipv4": "192.168.0.252",
109+
"ipv6": "2064:100:0::C0A8:0000:1"
110+
}
111+
DOWNSTREAM_IP_TO_BLOCK_V6_TOPO = {
112+
"ipv4": "192.168.0.251",
113+
"ipv6": "2064:100:0::C0A8:0000:9"
114+
}
115+
100116
# Below M0_L3 IPs are announced to DUT by annouce_route.py, it point to neighbor mx
101117
DOWNSTREAM_DST_IP_M0_L3 = {
102118
"ipv4": "192.168.1.65",
@@ -350,6 +366,15 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran
350366
DOWNSTREAM_DST_IP = DOWNSTREAM_DST_IP_M0_L3
351367
DOWNSTREAM_IP_TO_ALLOW = DOWNSTREAM_IP_TO_ALLOW_M0_L3
352368
DOWNSTREAM_IP_TO_BLOCK = DOWNSTREAM_IP_TO_BLOCK_M0_L3
369+
elif is_ipv6_only_topology(tbinfo):
370+
if tbinfo['topo']['type'] in ['t0']:
371+
DOWNSTREAM_DST_IP = DOWNSTREAM_DST_IP_VLAN
372+
DOWNSTREAM_IP_TO_ALLOW = DOWNSTREAM_IP_TO_ALLOW_VLAN
373+
DOWNSTREAM_IP_TO_BLOCK = DOWNSTREAM_IP_TO_BLOCK_VLAN
374+
else:
375+
DOWNSTREAM_DST_IP = DOWNSTREAM_DST_IP_V6_TOPO
376+
DOWNSTREAM_IP_TO_ALLOW = DOWNSTREAM_IP_TO_ALLOW_V6_TOPO
377+
DOWNSTREAM_IP_TO_BLOCK = DOWNSTREAM_IP_TO_BLOCK_V6_TOPO
353378
elif tbinfo['topo']['type'] in ['t0']:
354379
try:
355380
vlan_config = tbinfo['topo']['properties']['topology']['DUT']['vlan_configs']['default_vlan_config']
@@ -1064,7 +1089,7 @@ def check_rule_counters(self, duthost):
10641089
return True
10651090

10661091
logger.info('Wait all rule counters are ready')
1067-
return wait_until(60, 2, 0, self.check_rule_counters_internal, duthost)
1092+
return wait_until(120, 2, 0, self.check_rule_counters_internal, duthost)
10681093

10691094
def check_rule_counters_internal(self, duthost):
10701095
for asic_id in duthost.get_frontend_asic_ids():
@@ -1266,6 +1291,11 @@ def test_dest_ip_match_forwarded(self, setup, direction, ptfadapter,
12661291
rule_id = 33 if vlan_name == "Vlan1000" else 2
12671292
logging.info("topo: {} vlan_config: {} vlan_name: {} rule_id: {} ".format(
12681293
setup["topo"], setup["vlan_config"], vlan_name, rule_id))
1294+
elif "-v6-" in setup["topo_name"]:
1295+
if setup["topo"] in ['t0']:
1296+
rule_id = 34
1297+
else:
1298+
rule_id = 38
12691299
else:
12701300
rule_id = 2
12711301
else:
@@ -1294,6 +1324,11 @@ def test_dest_ip_match_dropped(self, setup, direction, ptfadapter,
12941324
rule_id = 32 if vlan_name == "Vlan1000" else 15
12951325
logging.info("topo: {} vlan_config: {} vlan_name: {} rule_id: {} ".format(
12961326
setup["topo"], setup["vlan_config"], vlan_name, rule_id))
1327+
elif "-v6-" in setup["topo_name"]:
1328+
if setup["topo"] in ['t0']:
1329+
rule_id = 35
1330+
else:
1331+
rule_id = 39
12971332
else:
12981333
rule_id = 15
12991334
else:

0 commit comments

Comments
 (0)