diff --git a/tests/arp/arp_utils.py b/tests/arp/arp_utils.py index 3b4c73270a6..de6504a6b4b 100644 --- a/tests/arp/arp_utils.py +++ b/tests/arp/arp_utils.py @@ -10,11 +10,12 @@ BASE_MAC_PREFIX = "00:00:01" -def clear_dut_arp_cache(duthost, ns_option=None): +def clear_dut_arp_cache(duthost, ns_option=None, is_ipv6=False): logger.info("Clearing {} neighbor table".format(duthost.hostname)) - arp_flush_cmd = "ip -stats neigh flush all" + ipv6_cmd = '-6' if is_ipv6 else '' + arp_flush_cmd = "ip {} -stats neigh flush all".format(ipv6_cmd) if ns_option: - arp_flush_cmd = "ip -stats {} neigh flush all".format(ns_option) + arp_flush_cmd = "ip {} -stats {} neigh flush all".format(ipv6_cmd, ns_option) duthost.shell(arp_flush_cmd) diff --git a/tests/arp/test_stress_arp.py b/tests/arp/test_stress_arp.py index a5253aa123f..61ced3ad495 100644 --- a/tests/arp/test_stress_arp.py +++ b/tests/arp/test_stress_arp.py @@ -9,7 +9,7 @@ from scapy.all import Ether, IPv6, ICMPv6ND_NS, ICMPv6NDOptSrcLLAddr, in6_getnsmac, \ in6_getnsma, inet_pton, inet_ntop, socket from ipaddress import ip_address, ip_network -from tests.common.utilities import wait_until, increment_ipv6_addr +from tests.common.utilities import wait_until, increment_ipv6_addr, is_ipv6_only_topology from tests.common.errors import RunAnsibleModuleFail @@ -37,9 +37,10 @@ @pytest.fixture(autouse=True) def arp_cache_fdb_cleanup(duthosts, rand_one_dut_hostname, tbinfo): + is_ipv6_only = is_ipv6_only_topology(tbinfo) duthost = duthosts[rand_one_dut_hostname] try: - clear_dut_arp_cache(duthost) + clear_dut_arp_cache(duthost, is_ipv6=is_ipv6_only) fdb_cleanup(duthost) except RunAnsibleModuleFail as e: if 'Failed to send flush request: No such file or directory' in str(e): @@ -55,7 +56,7 @@ def arp_cache_fdb_cleanup(duthosts, rand_one_dut_hostname, tbinfo): try: dut_list = duthosts if "dualtor-aa" in tbinfo["topo"]["name"] else [duthost] for dut in dut_list: - clear_dut_arp_cache(dut) + clear_dut_arp_cache(dut, is_ipv6=is_ipv6_only) fdb_cleanup(dut) except RunAnsibleModuleFail as e: if 'Failed to send flush request: No such file or directory' in str(e): @@ -112,7 +113,6 @@ def test_ipv4_arp(duthosts, enum_rand_one_per_hwsku_frontend_hostname, pytest_assert(ipv4_available > 0 and fdb_available > 0, "Entries have been filled") arp_available = min(min(ipv4_available, fdb_available), ENTRIES_NUMBERS) - # Neighbor support is dependant on NH scale for some cisco platforms. # Limit ARP scale based on available NH entries asic_type = duthost.facts["asic_type"] if 'cisco-8000' in asic_type: @@ -197,6 +197,7 @@ def test_ipv6_nd(duthosts, enum_rand_one_per_hwsku_frontend_hostname, ptfhost, config_facts, tbinfo, ip_and_intf_info, ptfadapter, get_function_completeness_level, proxy_arp_enabled): duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] + is_ipv6_only = is_ipv6_only_topology(tbinfo) _, _, ptf_intf_ipv6_addr, _, ptf_intf_index = ip_and_intf_info ptf_intf_ipv6_addr = increment_ipv6_addr(ptf_intf_ipv6_addr) pytest_require(proxy_arp_enabled, 'Proxy ARP not enabled for all VLANs') @@ -230,7 +231,7 @@ def test_ipv6_nd(duthosts, enum_rand_one_per_hwsku_frontend_hostname, "Neighbor Table Add failed") finally: try: - clear_dut_arp_cache(duthost) + clear_dut_arp_cache(duthost, is_ipv6=is_ipv6_only) fdb_cleanup(duthost) except RunAnsibleModuleFail as e: if 'Failed to send flush request: No such file or directory' in str(e): @@ -259,12 +260,11 @@ def send_ipv6_echo_request(ptfadapter, dut_mac, ip_and_intf_info, ptf_intf_index testutils.send_packet(ptfadapter, ptf_intf_index, er_pkt) -def test_ipv6_nd_incomplete(duthosts, enum_rand_one_per_hwsku_frontend_hostname, - ptfhost, config_facts, tbinfo, ip_and_intf_info, +def test_ipv6_nd_incomplete(duthost, ptfhost, config_facts, tbinfo, ip_and_intf_info, ptfadapter, get_function_completeness_level, proxy_arp_enabled): - duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname] _, _, ptf_intf_ipv6_addr, _, ptf_intf_index = ip_and_intf_info ptf_intf_ipv6_addr = increment_ipv6_addr(ptf_intf_ipv6_addr) + is_ipv6_only = is_ipv6_only_topology(tbinfo) pytest_require(proxy_arp_enabled, 'Proxy ARP not enabled for all VLANs') pytest_require(ptf_intf_ipv6_addr is not None, 'No IPv6 VLAN address configured on device') @@ -291,7 +291,7 @@ def test_ipv6_nd_incomplete(duthosts, enum_rand_one_per_hwsku_frontend_hostname, logger.info("original nf_conntrack_icmpv6_timeout: {}".format(orig_conntrack_icmpv6_timeout)) try: - clear_dut_arp_cache(duthost) + clear_dut_arp_cache(duthost, is_ipv6=is_ipv6_only) duthost.command("conntrack -F") @@ -321,4 +321,4 @@ def test_ipv6_nd_incomplete(duthosts, enum_rand_one_per_hwsku_frontend_hostname, duthost.command("conntrack -F") - clear_dut_arp_cache(duthost) + clear_dut_arp_cache(duthost, is_ipv6=is_ipv6_only) diff --git a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml index c2ef7332849..317d91019c2 100644 --- a/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml +++ b/tests/common/plugins/conditional_mark/tests_mark_conditions.yaml @@ -128,6 +128,12 @@ arp/test_neighbor_mac_noptf.py: conditions: - "'standalone' in topo_name" +arp/test_stress_arp.py::test_ipv4_arp: + xfail: + reason: "skip for IPv6-only topologies" + conditions: + - "'-v6-' in topo_name" + arp/test_unknown_mac.py: skip: reason: "Behavior on cisco-8000 & (Marvell) platform for unknown MAC is flooding rather than DROP, hence skipping."