From 491918afdf5d907cb7e1dcebe79baa150057e5d7 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Fri, 21 Jun 2019 18:15:28 -0700 Subject: [PATCH] [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 --- .../test/files/ptftests/advanced-reboot.py | 17 +++++++++++++---- .../advanced_reboot/reboot-image-handle.yml | 4 ++++ 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/ansible/roles/test/files/ptftests/advanced-reboot.py b/ansible/roles/test/files/ptftests/advanced-reboot.py index 2bc7cb777e3..9e05c0cf09c 100644 --- a/ansible/roles/test/files/ptftests/advanced-reboot.py +++ b/ansible/roles/test/files/ptftests/advanced-reboot.py @@ -140,8 +140,8 @@ def __init__(self): self.check_param('lo_v6_prefix', 'fc00:1::/64', required=False) self.check_param('arista_vms', [], required=True) self.check_param('min_bgp_gr_timeout', 15, required=False) - self.check_param('warm_up_timeout_secs', 180, required=False) - self.check_param('dut_stabilize_secs', 20, required=False) + self.check_param('warm_up_timeout_secs', 300, required=False) + self.check_param('dut_stabilize_secs', 30, required=False) self.check_param('preboot_files', None, required = False) self.check_param('preboot_oper', None, required = False) 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): warm_up_timeout_secs = int(self.test_params['warm_up_timeout_secs']) start_time = datetime.datetime.now() + up_time = None # First wait until DUT data/control planes are up while True: dataplane = self.asic_state.get() ctrlplane = self.cpu_state.get() elapsed = (datetime.datetime.now() - start_time).total_seconds() - if dataplane == 'up' and ctrlplane == 'up' and elapsed > dut_stabilize_secs: - break; + if dataplane == 'up' and ctrlplane == 'up': + if not up_time: + up_time = datetime.datetime.now() + up_secs = (datetime.datetime.now() - up_time).total_seconds() + if up_secs > dut_stabilize_secs: + break; + else: + # reset up_time + up_time = None + if elapsed > warm_up_timeout_secs: raise Exception("Control plane didn't come up within warm up timeout") time.sleep(1) diff --git a/ansible/roles/test/tasks/advanced_reboot/reboot-image-handle.yml b/ansible/roles/test/tasks/advanced_reboot/reboot-image-handle.yml index ed5f5d8a99c..62fd8334c3d 100755 --- a/ansible/roles/test/tasks/advanced_reboot/reboot-image-handle.yml +++ b/ansible/roles/test/tasks/advanced_reboot/reboot-image-handle.yml @@ -47,3 +47,7 @@ - name: Installing new SONiC image shell: sonic_installer install -y {{ new_image_location }} become: true + + - name: Remove config_db.json so the new image will reload minigraph + file: path=/host/old_config/config_db.json state=absent + become: true