Skip to content

Commit 3900462

Browse files
wrideout-aristaabhishek-nexthop
authored andcommitted
Support running acl tests without any IPv4 management configuration (sonic-net#21155)
* Support running acl tests without any IPv4 management configuration. Signed-off-by: Will Rideout <wrideout@arista.com> Signed-off-by: Abhishek <abhishek@nexthop.ai>
1 parent 62b5273 commit 3900462

5 files changed

Lines changed: 60 additions & 23 deletions

File tree

tests/acl/test_acl.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,8 +537,13 @@ def setup(duthosts, ptfhost, rand_selected_dut, rand_selected_front_end_dut, ran
537537

538538
@pytest.fixture(scope="module", params=["ipv4", "ipv6"])
539539
def ip_version(request, tbinfo, duthosts, rand_one_dut_hostname):
540-
if tbinfo["topo"]["type"] in ["t0"] and request.param == "ipv6":
541-
pytest.skip("IPV6 ACL test not currently supported on t0 testbeds")
540+
v6topo = "isolated-v6" in tbinfo["topo"]["name"]
541+
if request.param == "ipv4":
542+
if v6topo:
543+
pytest.skip("IPV4 ACL test not supported on isolated-v6 testbeds")
544+
else: # ipv6
545+
if tbinfo["topo"]["type"] in ["t0"] and not v6topo:
546+
pytest.skip("IPV6 ACL test not currently supported on t0 testbeds")
542547

543548
return request.param
544549

tests/common/fixtures/ptfhost_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -477,8 +477,8 @@ def run_garp_service(duthost, ptfhost, tbinfo, change_mac_addresses, request):
477477
mux_cable_table = {}
478478
server_ipv4_base_addr, server_ipv6_base_addr = request.getfixturevalue('mock_server_base_ip_addr')
479479
for i, intf in enumerate(request.getfixturevalue('tor_mux_intfs')):
480-
server_ipv4 = str(server_ipv4_base_addr + i)
481-
server_ipv6 = str(server_ipv6_base_addr + i)
480+
server_ipv4 = str(server_ipv4_base_addr + i) if server_ipv4_base_addr else ''
481+
server_ipv6 = str(server_ipv6_base_addr + i) if server_ipv6_base_addr else ''
482482
mux_cable_table[intf] = {}
483483
mux_cable_table[intf]['server_ipv4'] = six.text_type(server_ipv4) # noqa: F821
484484
mux_cable_table[intf]['server_ipv6'] = six.text_type(server_ipv6) # noqa: F821
@@ -490,8 +490,8 @@ def run_garp_service(duthost, ptfhost, tbinfo, change_mac_addresses, request):
490490

491491
for vlan_intf, config in list(mux_cable_table.items()):
492492
ptf_port_index = ptf_indices[vlan_intf]
493-
server_ip = ip_interface(config['server_ipv4']).ip
494-
server_ipv6 = ip_interface(config['server_ipv6']).ip
493+
server_ip = ip_interface(config['server_ipv4']).ip if config['server_ipv4'] else ''
494+
server_ipv6 = ip_interface(config['server_ipv6']).ip if config['server_ipv6'] else ''
495495

496496
garp_config[ptf_port_index] = {
497497
'dut_mac': '{}'.format(dut_mac),

tests/common/plugins/conditional_mark/tests_mark_conditions.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ acl/test_acl.py:
7272
reason: "Skip acl for isolated-v6 topology"
7373
conditions:
7474
- "'isolated-v6' in topo_name and https://github.com/sonic-net/sonic-mgmt/issues/18077"
75+
- "asic_type in ['broadcom']"
7576
xfail:
7677
reason: "Test case has issue on the t0-isolated-d256u256s2 topo."
7778
conditions:

tests/common/plugins/conditional_mark/tests_mark_conditions_acl.yaml

Lines changed: 28 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@ acl/test_acl.py::TestAclWithPortToggle::test_icmp_match_forwarded[ipv6-egress-up
4040
- "platform in ['armhf-nokia_ixs7215_52x-r0']"
4141
- https://github.com/sonic-net/sonic-mgmt/issues/8639
4242

43+
acl/test_acl.py::TestAclWithPortToggle::test_icmp_match_forwarded[ipv6-ingress-uplink->downlink-default-Vlan1000]:
44+
xfail:
45+
reason: "Test issue on isolated-v6 topos"
46+
conditions:
47+
- "'isolated-v6' in topo_name"
48+
- https://github.com/sonic-net/sonic-mgmt/issues/18077
49+
4350
acl/test_acl.py::TestAclWithPortToggle::test_icmp_source_ip_match_dropped[ipv6-egress-uplink->downlink-default-Vlan1000]:
4451
xfail:
4552
reason: "Egress issue in Nokia"
@@ -253,10 +260,8 @@ acl/test_acl.py::TestAclWithPortToggle::test_udp_source_ip_match_dropped[ipv6-eg
253260
acl/test_acl.py::TestAclWithReboot:
254261
skip:
255262
reason: "Skip in t1-lag KVM test due to test time too long and t0 would cover this testbeds, or for isolated-v6 topology"
256-
conditions_logical_operator: or
257263
conditions:
258264
- "topo_type in ['t1'] and asic_type in ['vs']"
259-
- "'isolated-v6' in topo_name and https://github.com/sonic-net/sonic-mgmt/issues/18077"
260265

261266
acl/test_acl.py::TestAclWithReboot::test_dest_ip_match_dropped[ipv6-egress-uplink->downlink-default-Vlan1000]:
262267
xfail:
@@ -324,6 +329,13 @@ acl/test_acl.py::TestAclWithReboot::test_icmp_match_forwarded[ipv6-egress-uplink
324329
conditions:
325330
- "topo_type in ['t1'] and asic_type in ['vs']"
326331

332+
acl/test_acl.py::TestAclWithReboot::test_icmp_match_forwarded[ipv6-ingress-uplink->downlink-default-Vlan1000]:
333+
xfail:
334+
reason: "Test issue on isolated-v6 topos"
335+
conditions:
336+
- "'isolated-v6' in topo_name"
337+
- https://github.com/sonic-net/sonic-mgmt/issues/18077
338+
327339
acl/test_acl.py::TestAclWithReboot::test_icmp_source_ip_match_dropped[ipv6-egress-uplink->downlink-default-Vlan1000]:
328340
xfail:
329341
reason: "Egress issue in Nokia"
@@ -697,6 +709,13 @@ acl/test_acl.py::TestBasicAcl::test_icmp_match_forwarded[ipv6-egress-uplink->dow
697709
- "platform in ['armhf-nokia_ixs7215_52x-r0']"
698710
- https://github.com/sonic-net/sonic-mgmt/issues/8639
699711

712+
acl/test_acl.py::TestBasicAcl::test_icmp_match_forwarded[ipv6-ingress-uplink->downlink-default-Vlan1000]:
713+
xfail:
714+
reason: "Test issue on isolated-v6 topos"
715+
conditions:
716+
- "'isolated-v6' in topo_name"
717+
- https://github.com/sonic-net/sonic-mgmt/issues/18077
718+
700719
acl/test_acl.py::TestBasicAcl::test_icmp_source_ip_match_dropped[ipv6-egress-uplink->downlink-default-Vlan1000]:
701720
xfail:
702721
reason: "Egress issue in Nokia"
@@ -953,6 +972,13 @@ acl/test_acl.py::TestIncrementalAcl::test_icmp_match_forwarded[ipv6-egress-uplin
953972
- "platform in ['armhf-nokia_ixs7215_52x-r0']"
954973
- https://github.com/sonic-net/sonic-mgmt/issues/8639
955974

975+
acl/test_acl.py::TestIncrementalAcl::test_icmp_match_forwarded[ipv6-ingress-uplink->downlink-default-Vlan1000]:
976+
xfail:
977+
reason: "Test issue on isolated-v6 topos"
978+
conditions:
979+
- "'isolated-v6' in topo_name"
980+
- https://github.com/sonic-net/sonic-mgmt/issues/18077
981+
956982
acl/test_acl.py::TestIncrementalAcl::test_icmp_source_ip_match_dropped[ipv6-egress-uplink->downlink-default-Vlan1000]:
957983
xfail:
958984
reason: "Egress issue in Nokia"

tests/scripts/garp_service.py

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,23 +32,27 @@ def gen_garp_packets(self):
3232
source_ipv6_str = config['target_ipv6']
3333
dut_mac = config['dut_mac']
3434
dst_ipv6 = config['dst_ipv6']
35-
source_ip = str(ip_interface(source_ip_str).ip)
36-
source_ipv6 = str(ip_interface(source_ipv6_str).ip)
35+
source_ip = str(ip_interface(source_ip_str).ip) if source_ip_str else None
36+
source_ipv6 = str(ip_interface(source_ipv6_str).ip) if source_ipv6_str else None
3737

3838
# PTF uses Scapy to create packets, so this is ok to create
3939
# packets through PTF even though we are using Scapy to send the packets
40-
garp_pkt = testutils.simple_arp_packet(
41-
eth_src=source_mac,
42-
hw_snd=source_mac,
43-
ip_snd=source_ip,
44-
# Re-use server IP as target IP, since it is within the subnet of the VLAN IP
45-
ip_tgt=source_ip,
46-
arp_op=2)
47-
48-
na_pkt = Ether(src=source_mac, dst=dut_mac) \
49-
/ IPv6(dst=dst_ipv6, src=source_ipv6) \
50-
/ ICMPv6ND_NA(tgt=source_ipv6, S=1, R=0, O=0) \
51-
/ ICMPv6NDOptSrcLLAddr(type=2, lladdr=source_mac)
40+
garp_pkt = None
41+
na_pkt = None
42+
if source_ip:
43+
garp_pkt = testutils.simple_arp_packet(
44+
eth_src=source_mac,
45+
hw_snd=source_mac,
46+
ip_snd=source_ip,
47+
# Re-use server IP as target IP, since it is within the subnet of the VLAN IP
48+
ip_tgt=source_ip,
49+
arp_op=2)
50+
51+
if source_ipv6:
52+
na_pkt = Ether(src=source_mac, dst=dut_mac) \
53+
/ IPv6(dst=dst_ipv6, src=source_ipv6) \
54+
/ ICMPv6ND_NA(tgt=source_ipv6, S=1, R=0, O=0) \
55+
/ ICMPv6NDOptSrcLLAddr(type=2, lladdr=source_mac)
5256

5357
self.packets[intf_name] = [garp_pkt, na_pkt]
5458

@@ -69,7 +73,8 @@ def send_garp_packets(self):
6973
while True:
7074
for socket, packet_list in list(sockets.items()):
7175
for packet in packet_list:
72-
socket.send(packet)
76+
if packet:
77+
socket.send(packet)
7378

7479
if self.interval is None:
7580
break

0 commit comments

Comments
 (0)