Skip to content

Commit 3c2bbd9

Browse files
authored
Update test_arp_update to make it more stable (sonic-net#17626)
APPL_DB may not be synced when checking mac address of specific vlan and ip Add a loop check for the APPL_DB Change-Id: Ia2544b94748b2d86de99f3ffe49c9be4abec59d8
1 parent 6b5b578 commit 3c2bbd9

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

tests/arp/test_arp_update.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ def neighbor_learned(dut, target_ip):
3535
return neigh_output and ("REACHABLE" in neigh_output or "STALE" in neigh_output)
3636

3737

38+
def appl_db_neighbor_syncd(dut, vlan_name, target_ip, exp_mac):
39+
asic_db_mac = dut.shell(f"sonic-db-cli APPL_DB hget 'NEIGH_TABLE:{vlan_name}:{target_ip}' 'neigh'")['stdout']
40+
logger.info(f"DUT neighbor mac: {asic_db_mac} of entry {vlan_name}:{target_ip}")
41+
return exp_mac.lower() == asic_db_mac.lower()
42+
43+
3844
def ip_version_string(version):
3945
return f"ipv{version}"
4046

@@ -66,10 +72,7 @@ def test_kernel_asic_mac_mismatch(
6672
neighbor_info = rand_selected_dut.shell(f"ip neigh show {target_ip}")["stdout"].split()
6773
pt_assert(neighbor_info[2] == vlan_name)
6874

69-
asic_db_mac = rand_selected_dut.shell(
70-
f"sonic-db-cli APPL_DB hget 'NEIGH_TABLE:{vlan_name}:{target_ip}' 'neigh'"
71-
)['stdout']
72-
pt_assert(neighbor_info[4].lower() == asic_db_mac.lower())
75+
wait_until(5, 1, 0, appl_db_neighbor_syncd, rand_selected_dut, vlan_name, target_ip, neighbor_info[4])
7376

7477
logger.info(f"Neighbor {target_ip} has been learned, APPL_DB and kernel are in sync")
7578

0 commit comments

Comments
 (0)