mirror of
https://github.com/Telecominfraproject/wlan-lanforge-scripts.git
synced 2025-12-17 19:07:06 +00:00
Added retry logic in save_crashlogs_to_pstore method
Signed-off-by: jitendra-kushavah <jitendra.kushavah@candelatech.com>
This commit is contained in:
@@ -4299,16 +4299,32 @@ class lf_tests(lf_libs):
|
||||
query_ = f"?logType=2&startDate={start_time}&endDate={end_time}"
|
||||
resp = get_target_object.controller_library_object.get_device_reboot_logs(device_name, query=query_)
|
||||
if resp.status_code == 200:
|
||||
allure.attach(body=json.dumps(resp.json(), indent=4), name="device_reboot_logs_per_test_case\n",
|
||||
attachment_type=allure.attachment_type.JSON)
|
||||
|
||||
response = resp.json()
|
||||
# crash log validation
|
||||
if response["values"]:
|
||||
logging.info("AP crashed during the test")
|
||||
allure.attach(body=json.dumps(resp.json(), indent=4), name="device_reboot_logs_per_test_case\n",
|
||||
attachment_type=allure.attachment_type.JSON)
|
||||
else:
|
||||
# retry once after 2 minutes
|
||||
logging.info("retry after 120 seconds to check crash logs in GW")
|
||||
time.sleep(120)
|
||||
resp = get_target_object.controller_library_object.get_device_reboot_logs(device_name, query=query_)
|
||||
if resp.status_code == 200:
|
||||
|
||||
response = resp.json()
|
||||
# crash log validation
|
||||
if response["values"]:
|
||||
logging.info("AP crashed during the test")
|
||||
allure.attach(body=json.dumps(resp.json(), indent=4), name="device_reboot_logs_per_test_case\n",
|
||||
attachment_type=allure.attachment_type.JSON)
|
||||
else:
|
||||
pytest.fail("Crash log is not present, something went wrong while saving crash logs to pstore")
|
||||
else:
|
||||
logging.info("resp.status_code:- " + str(resp.status_code))
|
||||
else:
|
||||
logging.info("resp.status_code:- " + str(resp.status_code))
|
||||
|
||||
|
||||
def multi_ssid_test(self, setup_params_general: dict, no_of_2g_and_5g_stations: int = 2, mode: str = "BRIDGE",
|
||||
|
||||
Reference in New Issue
Block a user