Skip to content

Commit bf81a50

Browse files
committed
Adjust TSA-TSB related sonic-mgmt testcases
<!-- Please make sure you've read and understood our contributing guidelines; https://github.com/sonic-net/SONiC/blob/gh-pages/CONTRIBUTING.md Please provide following information to help code review process a bit easier: --> ### Description of PR <!-- - Please include a summary of the change and which issue is fixed. - Please also include relevant motivation and context. Where should reviewer start? background context? - List any dependencies that are required for this change. --> Summary: TSA-TSB service Testcases: Adjust the testcases to adhere to new behavior of config_reload ### Type of change <!-- - Fill x for your type of change. - e.g. - [x] Bug fix --> - [ ] Bug fix - [ ] Testbed and Framework(new/improvement) - [ ] New Test case - [ ] Skipped for non-supported platforms - [x] Test case improvement ### Back port request - [ ] 202012 - [ ] 202205 - [ ] 202305 - [ ] 202311 - [x] 202405 - [x] 202411 ### Approach #### What is the motivation for this PR? As a fix for the issue sonic-net/sonic-buildimage#21586, TSA-TSB service is invoked upon swss bring up(sonic-net/sonic-buildimage#21587). This affects config_reload behavior, where after config reload the tsa-tsb service will be restarted, and the device will be in TSA state till timer expires. Adjusting the testcase to explicitly execute TSB for the DUT to be ready for next testcase, #### How did you do it? Enhanced the config_reload api to optionally take exec_tsb parameter. For startup-TSA-TSB and reliable TSA-TSB testcases, pass this flag to True to explicitly execute TSB on the device after config reload. #### How did you verify/test it? Ran the tests on t2 #### Any platform specific information? NA #### Supported testbed topology if it's a new test case? NA ### Documentation <!-- (If it's a new feature, new test case) Did you update documentation/Wiki relevant to your implementation? Link to the wiki page? -->
1 parent 2e2ce62 commit bf81a50

File tree

3 files changed

+18
-15
lines changed

3 files changed

+18
-15
lines changed

tests/bgp/test_reliable_tsa.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -1002,7 +1002,7 @@ def config_reload_linecard_if_unhealthy(lc):
10021002
if not (int_status_result[lc] and crit_process_check[lc] and
10031003
TS_NORMAL == get_traffic_shift_state(lc, cmd='TSC no-stats')):
10041004
logging.info("DUT is not in normal state after supervisor cold reboot, doing config-reload")
1005-
config_reload(lc, safe_reload=True, check_intf_up_ports=True)
1005+
config_reload(lc, safe_reload=True, check_intf_up_ports=True, exec_tsb=True)
10061006

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

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

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

17281728
with SafeThreadPoolExecutor(max_workers=8) as executor:
17291729
for linecard in duthosts.frontend_nodes:

tests/bgp/test_startup_tsa_tsb_service.py

+10-10
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ def config_reload_linecard_if_unhealthy(lc):
332332
)
333333

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

337337
with SafeThreadPoolExecutor(max_workers=8) as executor:
338338
for linecard in frontend_nodes_per_hwsku:
@@ -481,7 +481,7 @@ def config_reload_linecard_if_unhealthy(lc):
481481
)
482482

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

486486
with SafeThreadPoolExecutor(max_workers=8) as executor:
487487
for linecard in frontend_nodes_per_hwsku:
@@ -625,7 +625,7 @@ def config_reload_linecard_if_unhealthy(lc):
625625
)
626626

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

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

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

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

925925
with SafeThreadPoolExecutor(max_workers=8) as executor:
926926
for linecard in frontend_nodes_per_hwsku:
@@ -1070,7 +1070,7 @@ def config_reload_linecard_if_unhealthy(lc):
10701070
)
10711071

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

10751075
with SafeThreadPoolExecutor(max_workers=8) as executor:
10761076
for linecard in frontend_nodes_per_hwsku:
@@ -1209,7 +1209,7 @@ def config_reload_linecard_if_unhealthy(lc):
12091209
)
12101210

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

12141214
with SafeThreadPoolExecutor(max_workers=8) as executor:
12151215
for linecard in frontend_nodes_per_hwsku:
@@ -1359,7 +1359,7 @@ def config_reload_linecard_if_unhealthy(lc):
13591359
)
13601360

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

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

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

15061506
with SafeThreadPoolExecutor(max_workers=8) as executor:
15071507
for linecard in frontend_nodes_per_hwsku:
@@ -1644,7 +1644,7 @@ def config_reload_linecard_if_unhealthy(lc):
16441644
)
16451645

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

16491649
with SafeThreadPoolExecutor(max_workers=8) as executor:
16501650
for linecard in duthosts.frontend_nodes:

tests/common/config_reload.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ def pfcwd_feature_enabled(duthost):
116116
def config_reload(sonic_host, config_source='config_db', wait=120, start_bgp=True, start_dynamic_buffer=True,
117117
safe_reload=False, wait_before_force_reload=0, wait_for_bgp=False,
118118
check_intf_up_ports=False, traffic_shift_away=False, override_config=False,
119-
golden_config_path=DEFAULT_GOLDEN_CONFIG_PATH, is_dut=True):
119+
golden_config_path=DEFAULT_GOLDEN_CONFIG_PATH, is_dut=True, exec_tsb=False):
120120
"""
121121
reload SONiC configuration
122122
:param sonic_host: SONiC host object
@@ -224,3 +224,6 @@ def _config_reload_cmd_wrapper(cmd, executable):
224224
wait_until(wait + 300 + additional_wait, 10, 0, sonic_host.check_bgp_session_state_all_asics, bgp_neighbors), # noqa E501
225225
"Not all bgp sessions are established after config reload",
226226
)
227+
228+
if exec_tsb:
229+
sonic_host.shell("TSB")

0 commit comments

Comments
 (0)