From a544d3857c39cb73e0d74d687ffe9e42bf0af3e8 Mon Sep 17 00:00:00 2001 From: jitendracandela <78074038+jitendracandela@users.noreply.github.com> Date: Thu, 6 Apr 2023 19:31:20 +0530 Subject: [PATCH] Wifi 12301 (#806) * Attached Ap logs if AP is in disconnected state on pre apply check Signed-off-by: jitendracandela * Attached disconnected ap logs Signed-off-by: jitendracandela * Replaced pytest exit with pytest fail Signed-off-by: jitendracandela * Attached ap logs if up0v0 interface is failed to have connectivity Signed-off-by: jitendracandela --------- Signed-off-by: jitendracandela --- libs/tip_2x/ap_lib.py | 2 ++ libs/tip_2x/tip_2x.py | 2 ++ tests/test_connectivity.py | 9 ++++----- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/libs/tip_2x/ap_lib.py b/libs/tip_2x/ap_lib.py index 892126597..d0039a23e 100644 --- a/libs/tip_2x/ap_lib.py +++ b/libs/tip_2x/ap_lib.py @@ -102,6 +102,8 @@ class APLIBS: if output.__contains__("INCOMPLETE") or output.__contains__("FAILED"): logging.error(output) + ap_logs = self.get_dut_logs(idx=idx, print_log=False, attach_allure=False) + allure.attach(body=ap_logs, name="AP logs") pytest.fail("up0v0 interface is failed to have connectivity!!!") def get_uci_show(self, param="ucentral", idx=0, print_log=True, attach_allure=True): diff --git a/libs/tip_2x/tip_2x.py b/libs/tip_2x/tip_2x.py index 37523a076..c2a9bff7c 100644 --- a/libs/tip_2x/tip_2x.py +++ b/libs/tip_2x/tip_2x.py @@ -638,6 +638,8 @@ class tip_2x: ret_val = self.dut_library_object.ubus_call_ucentral_status(idx=idx, attach_allure=False, retry=10) if not ret_val["connected"] or ret_val["connected"] is None: self.dut_library_object.check_connectivity(idx=idx) + ap_logs = self.dut_library_object.get_dut_logs(idx=idx, print_log=False, attach_allure=False) + allure.attach(body=ap_logs, name="AP Log pre_apply_check: ") pytest.fail("AP is in disconnected state from Ucentral gateway!!!") else: allure.step("Connected to Gateway after Restarting the ucentral Process!!!") diff --git a/tests/test_connectivity.py b/tests/test_connectivity.py index 9d9f5aaff..9d9dd97b2 100644 --- a/tests/test_connectivity.py +++ b/tests/test_connectivity.py @@ -202,11 +202,10 @@ class TestResources(object): pytest.exit("Connected With Unexpected HOST" + "\n Current GW HOST: " + str(uci_data[0]) + "\n EXPECTED GW HOST: " + str(gw_host)) else: - logging.error( - "Disconnected from HOST" + "\n Current GW HOST: " + str(uci_data[0]) + "\n EXPECTED GW HOST: " + str( - gw_host)) - pytest.exit("Disconnected from HOST" + "\n Current GW HOST: " + str(uci_data[0]) + - "\n EXPECTED GW HOST: " + str(gw_host)) + ap_logs = get_target_object.get_dut_library_object().get_dut_logs(idx=i, print_log=False, attach_allure=False) + allure.attach(body=ap_logs, name="Disconnected ap logs") + logging.error("AP is in disconnected state from Ucentral gateway!!!") + pytest.fail("AP is in disconnected state from Ucentral gateway!!!") # @pytest.mark.traffic_generator_connectivity # @allure.testcase(name="test_traffic_generator_connectivity", url="")