Skip to content

Commit

Permalink
Wait BGP sessions after changing mgmt IP (#15936)
Browse files Browse the repository at this point in the history
  • Loading branch information
bingwang-ms authored and mssonicbld committed Dec 7, 2024
1 parent bc20e93 commit 8e905d5
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/common/fixtures/duthost_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,17 @@ def check_bgp_router_id(duthost, mgFacts):
logger.error("Error loading BGP routerID - {}".format(e))


def wait_bgp_sessions(duthost, timeout=120):
"""
A helper function to wait bgp sessions on DUT
"""
bgp_neighbors = duthost.get_bgp_neighbors_per_asic(state="all")
pytest_assert(
wait_until(timeout, 10, 0, duthost.check_bgp_session_state_all_asics, bgp_neighbors),
"Not all bgp sessions are established after config reload",
)


@pytest.fixture(scope="module")
def convert_and_restore_config_db_to_ipv6_only(duthosts):
"""Convert the DUT's mgmt-ip to IPv6 only
Expand Down Expand Up @@ -767,6 +778,7 @@ def convert_and_restore_config_db_to_ipv6_only(duthosts):
# Wait until all critical processes are up,
# especially snmpd as it needs to be up for SNMP status verification
wait_critical_processes(duthost)
wait_bgp_sessions(duthost)

# Verify mgmt-interface status
mgmt_intf_name = "eth0"
Expand Down

0 comments on commit 8e905d5

Please sign in to comment.