Skip to content

Commit af43f22

Browse files
committed
[fast/warm reboot] improve fast/warm reboot handling code (#973)
- Improve the data test warm up code: Let the data plane IO stablize for 30 seconds before testing. We observed ptf instability causing the test to fail. - Remove config_db.json when fast-reboot into a new image. We want the new image to reload minigraph in this case. Signed-off-by: Ying Xie <[email protected]>
1 parent c5846e1 commit af43f22

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

ansible/roles/test/files/ptftests/advanced-reboot.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,8 @@ def __init__(self):
140140
self.check_param('lo_v6_prefix', 'fc00:1::/64', required=False)
141141
self.check_param('arista_vms', [], required=True)
142142
self.check_param('min_bgp_gr_timeout', 15, required=False)
143-
self.check_param('warm_up_timeout_secs', 180, required=False)
144-
self.check_param('dut_stabilize_secs', 20, required=False)
143+
self.check_param('warm_up_timeout_secs', 300, required=False)
144+
self.check_param('dut_stabilize_secs', 30, required=False)
145145
self.check_param('preboot_files', None, required = False)
146146
self.check_param('preboot_oper', None, required = False)
147147
if not self.test_params['preboot_oper'] or self.test_params['preboot_oper'] == 'None':
@@ -1109,14 +1109,23 @@ def wait_dut_to_warm_up(self):
11091109
warm_up_timeout_secs = int(self.test_params['warm_up_timeout_secs'])
11101110

11111111
start_time = datetime.datetime.now()
1112+
up_time = None
11121113

11131114
# First wait until DUT data/control planes are up
11141115
while True:
11151116
dataplane = self.asic_state.get()
11161117
ctrlplane = self.cpu_state.get()
11171118
elapsed = (datetime.datetime.now() - start_time).total_seconds()
1118-
if dataplane == 'up' and ctrlplane == 'up' and elapsed > dut_stabilize_secs:
1119-
break;
1119+
if dataplane == 'up' and ctrlplane == 'up':
1120+
if not up_time:
1121+
up_time = datetime.datetime.now()
1122+
up_secs = (datetime.datetime.now() - up_time).total_seconds()
1123+
if up_secs > dut_stabilize_secs:
1124+
break;
1125+
else:
1126+
# reset up_time
1127+
up_time = None
1128+
11201129
if elapsed > warm_up_timeout_secs:
11211130
raise Exception("Control plane didn't come up within warm up timeout")
11221131
time.sleep(1)

ansible/roles/test/tasks/advanced_reboot/reboot-image-handle.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,3 +47,7 @@
4747
- name: Installing new SONiC image
4848
shell: sonic_installer install -y {{ new_image_location }}
4949
become: true
50+
51+
- name: Remove config_db.json so the new image will reload minigraph
52+
file: path=/host/old_config/config_db.json state=absent
53+
become: true

0 commit comments

Comments
 (0)