Skip to content

Commit

Permalink
Fix intermittent issue on reboot in test_lldp_syncd (#15331)
Browse files Browse the repository at this point in the history
At the start of test_lldp_syncd.py::test_lldp_entry_table_after_reboot
the test polls and checks that LLDP_ENTRY_TABLE keys match show lldp table output.

The eth0 port is added last so sometimes the entry keys will have it but the
lldp table output will not.  From debugging, this is the case since the
end of the previous test (I put a check on the keys vs lldp table output
and observed the missing eth0 at the end of
test_lldp_syncd.py::test_lldp_entry_table_after_lldp_restart)

Added a wait_until at the start of test_lldp_entry_table_after_reboot to
wait until the LLDP_ENTRY_TABLE keys match show lldp table output before
the tests starts to reboot.
  • Loading branch information
veronica-arista authored and mssonicbld committed Nov 13, 2024
1 parent d524ed3 commit c20855e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/lldp/test_lldp_syncd.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,13 @@ def get_show_lldp_table_output(duthost):
return interface_list


def check_lldp_table_keys(duthost, db_instance):
# Check if LLDP_ENTRY_TABLE keys match show lldp table output
lldp_entry_keys = get_lldp_entry_keys(db_instance)
show_lldp_table_int_list = get_show_lldp_table_output(duthost)
return sorted(lldp_entry_keys) == sorted(show_lldp_table_int_list)


def assert_lldp_interfaces(
lldp_entry_keys, show_lldp_table_int_list, lldpctl_interface
):
Expand Down Expand Up @@ -322,6 +329,12 @@ def test_lldp_entry_table_after_reboot(
localhost, duthosts, enum_rand_one_per_hwsku_frontend_hostname, db_instance
):
duthost = duthosts[enum_rand_one_per_hwsku_frontend_hostname]

# Verify LLDP_ENTRY_TABLE keys match show lldp table output at the start of test
keys_match = wait_until(30, 5, 0, check_lldp_table_keys, duthost, db_instance)
if not keys_match:
assert keys_match, "LLDP_ENTRY_TABLE keys do not match 'show lldp table' output"

# reboot
logging.info("Run cold reboot on DUT")
reboot(
Expand Down

0 comments on commit c20855e

Please sign in to comment.