Skip to content

Commit

Permalink
tests/route/test_route_consistency.py: add wait_util for all BGP sess…
Browse files Browse the repository at this point in the history
…ions to come up
  • Loading branch information
BYGX-wcr committed Nov 4, 2024
1 parent 786d760 commit 644ad86
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/route/test_route_consistency.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from tests.common.helpers.assertions import pytest_assert
from tests.common.helpers.dut_utils import get_program_info
from tests.common.config_reload import config_reload
from tests.common.utilities import kill_process_by_pid
from tests.common.utilities import kill_process_by_pid, wait_until

pytestmark = [
pytest.mark.topology('any')
Expand Down Expand Up @@ -40,6 +40,15 @@ def check_and_kill_process(duthost, container_name, program_name):
.format(program_name, container_name))


def is_all_neighbor_session_established(duthost):
# handle both multi-asic and single-asic
bgp_facts = duthost.bgp_facts(num_npus=duthost.sonichost.num_asics())["ansible_facts"]
for neighbor in bgp_facts["bgp_neighbors"]:
if bgp_facts["bgp_neighbors"][neighbor]["state"] != "established":
return False
return True


class TestRouteConsistency():
""" TestRouteConsistency class for testing route consistency across all the Frontend DUTs in the testbed
It verifies route consistency by taking a snapshot of route table from ASIC_DB from all the DUTs before the test
Expand Down Expand Up @@ -226,6 +235,7 @@ def test_critical_process_crash_and_recover(self, duthosts, container_name, prog

logger.info("Recover containers on {}".format(duthost.hostname))
config_reload(duthost)
wait_until(300, 10, 0, is_all_neighbor_session_established, duthost)
time.sleep(self.sleep_interval)

# take the snapshot of route table from all the DUTs
Expand Down

0 comments on commit 644ad86

Please sign in to comment.