Skip to content

Commit

Permalink
Stabilize stress ARP test (#16662)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingwang-ms authored and mssonicbld committed Jan 24, 2025
1 parent 80595c6 commit 902ae08
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions tests/arp/test_stress_arp.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def add_arp(ptf_intf_ipv4_addr, intf1_index, ptfadapter):
hw_snd=arp_src_mac,
hw_tgt='ff:ff:ff:ff:ff:ff'
)
# Add a short delay to avoid packet loss
time.sleep(0.001)
testutils.send_packet(ptfadapter, intf1_index, pkt)
logger.info("Sending {} arp entries".format(ip_num))

Expand Down Expand Up @@ -121,7 +123,7 @@ def test_ipv4_arp(duthost, garp_enabled, ip_and_intf_info, intfs_for_test,
# The entries we add will not exceed 10000, so the number we tolerate is 100
logger.debug("Expected route number: {}, real route number {}"
.format(arp_available, get_fdb_dynamic_mac_count(duthost)))
pytest_assert(wait_until(20, 1, 0,
pytest_assert(wait_until(40, 1, 0,
lambda: abs(arp_available - get_fdb_dynamic_mac_count(duthost)) < 250),
"ARP Table Add failed")
finally:
Expand Down Expand Up @@ -173,7 +175,8 @@ def add_nd(ptfadapter, ip_and_intf_info, ptf_intf_index, nd_available):
nd_entry_mac = IntToMac(MacToInt(ARP_SRC_MAC) + entry)
fake_src_addr = generate_global_addr(nd_entry_mac)
ns_pkt = ipv6_packets_for_test(ip_and_intf_info, nd_entry_mac, fake_src_addr)

# Add a short delay to avoid packet loss
time.sleep(0.01)
testutils.send_packet(ptfadapter, ptf_intf_index, ns_pkt)
logger.info("Sending {} ipv6 neighbor entries".format(nd_available))

Expand Down Expand Up @@ -205,7 +208,7 @@ def test_ipv6_nd(duthost, ptfhost, config_facts, tbinfo, ip_and_intf_info,
# The entries we add will not exceed 10000, so the number we tolerate is 100
logger.debug("Expected route number: {}, real route number {}"
.format(nd_available, get_fdb_dynamic_mac_count(duthost)))
pytest_assert(wait_until(20, 1, 0,
pytest_assert(wait_until(40, 1, 0,
lambda: abs(nd_available - get_fdb_dynamic_mac_count(duthost)) < 250),
"Neighbor Table Add failed")
finally:
Expand Down

0 comments on commit 902ae08

Please sign in to comment.