From 023a8e8d0db856b6d01d97eb2709dc6319db69e6 Mon Sep 17 00:00:00 2001 From: Deepak Singhal <115033986+deepak-singhal0408@users.noreply.github.com> Date: Wed, 12 Feb 2025 13:40:35 -0800 Subject: [PATCH] Adjust TSA-TSB related sonic-mgmt testcases (#16807) TSA-TSB service Testcases: Adjust the testcases to adhere to new behavior of config_reload --- tests/bgp/test_reliable_tsa.py | 8 ++++---- tests/bgp/test_startup_tsa_tsb_service.py | 20 ++++++++++---------- tests/common/config_reload.py | 5 ++++- 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/tests/bgp/test_reliable_tsa.py b/tests/bgp/test_reliable_tsa.py index 5af15098444..394d64ecc71 100644 --- a/tests/bgp/test_reliable_tsa.py +++ b/tests/bgp/test_reliable_tsa.py @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/tests/bgp/test_startup_tsa_tsb_service.py b/tests/bgp/test_startup_tsa_tsb_service.py index 66b66ad6db4..02d8f29a36a 100644 --- a/tests/bgp/test_startup_tsa_tsb_service.py +++ b/tests/bgp/test_startup_tsa_tsb_service.py @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: @@ -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: diff --git a/tests/common/config_reload.py b/tests/common/config_reload.py index f481ba16bcf..a674c979d4e 100644 --- a/tests/common/config_reload.py +++ b/tests/common/config_reload.py @@ -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 @@ -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")