Skip to content

Commit

Permalink
Adjust TSA-TSB related sonic-mgmt testcases (#16807)
Browse files Browse the repository at this point in the history
TSA-TSB service Testcases: Adjust the testcases to adhere to new behavior of config_reload
  • Loading branch information
deepak-singhal0408 authored Feb 12, 2025
1 parent ce2f9b2 commit 023a8e8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
8 changes: 4 additions & 4 deletions tests/bgp/test_reliable_tsa.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,7 +1002,7 @@ def config_reload_linecard_if_unhealthy(lc):
if not (int_status_result[lc] and crit_process_check[lc] and
TS_NORMAL == get_traffic_shift_state(lc, cmd='TSC no-stats')):
logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

# Make sure linecards are in Normal state, if not do config-reload on the dut
with SafeThreadPoolExecutor(max_workers=8) as executor:
Expand Down Expand Up @@ -1230,7 +1230,7 @@ def config_reload_linecard_if_unhealthy(lc):
if not (int_status_result[lc] and crit_process_check[lc] and
TS_NORMAL == get_traffic_shift_state(lc, cmd='TSC no-stats')):
logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

# Make sure linecards are in Normal state, if not do config-reload on the dut to recover
with SafeThreadPoolExecutor(max_workers=8) as executor:
Expand Down Expand Up @@ -1613,7 +1613,7 @@ def config_reload_linecard_if_unhealthy(lc):
if not (int_status_result[lc] and crit_process_check[lc] and
TS_NORMAL == get_traffic_shift_state(lc, cmd='TSC no-stats')):
logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

# Make sure linecards are in Normal state, if not do config-reload on the dut to recover
with SafeThreadPoolExecutor(max_workers=8) as executor:
Expand Down Expand Up @@ -1723,7 +1723,7 @@ def config_reload_linecard_if_unhealthy(lc):
if not (int_status_result and crit_process_check and
TS_NORMAL == get_traffic_shift_state(lc, cmd='TSC no-stats')):
logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in duthosts.frontend_nodes:
Expand Down
20 changes: 10 additions & 10 deletions tests/bgp/test_startup_tsa_tsb_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in frontend_nodes_per_hwsku:
Expand Down Expand Up @@ -481,7 +481,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after abnormal reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in frontend_nodes_per_hwsku:
Expand Down Expand Up @@ -625,7 +625,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

# Make sure DUT is in normal state after supervisor cold reboot
with SafeThreadPoolExecutor(max_workers=8) as executor:
Expand Down Expand Up @@ -792,7 +792,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after SUP abnormal reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

# Make sure DUT is in normal state after supervisor abnormal reboot
with SafeThreadPoolExecutor(max_workers=8) as executor:
Expand Down Expand Up @@ -920,7 +920,7 @@ def run_tsb_and_config_reload(lc):
# Recover to Normal state
lc.shell("TSB")
lc.shell('sudo config save -y')
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in frontend_nodes_per_hwsku:
Expand Down Expand Up @@ -1070,7 +1070,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in frontend_nodes_per_hwsku:
Expand Down Expand Up @@ -1209,7 +1209,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in frontend_nodes_per_hwsku:
Expand Down Expand Up @@ -1359,7 +1359,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

# Make sure linecards are in Normal state and save the config to proceed further
with SafeThreadPoolExecutor(max_workers=8) as executor:
Expand Down Expand Up @@ -1501,7 +1501,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in frontend_nodes_per_hwsku:
Expand Down Expand Up @@ -1644,7 +1644,7 @@ def config_reload_linecard_if_unhealthy(lc):
)

logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)

with SafeThreadPoolExecutor(max_workers=8) as executor:
for linecard in duthosts.frontend_nodes:
Expand Down
5 changes: 4 additions & 1 deletion tests/common/config_reload.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def pfcwd_feature_enabled(duthost):
def config_reload(sonic_host, config_source='config_db', wait=120, start_bgp=True, start_dynamic_buffer=True,
safe_reload=False, wait_before_force_reload=0, wait_for_bgp=False,
check_intf_up_ports=False, traffic_shift_away=False, override_config=False,
golden_config_path=DEFAULT_GOLDEN_CONFIG_PATH, is_dut=True):
golden_config_path=DEFAULT_GOLDEN_CONFIG_PATH, is_dut=True, exec_tsb=False):
"""
reload SONiC configuration
:param sonic_host: SONiC host object
Expand Down Expand Up @@ -220,3 +220,6 @@ def _config_reload_cmd_wrapper(cmd, executable):
wait_until(wait + 120, 10, 0, sonic_host.check_bgp_session_state_all_asics, bgp_neighbors),
"Not all bgp sessions are established after config reload",
)

if exec_tsb:
sonic_host.shell("TSB")

0 comments on commit 023a8e8

Please sign in to comment.