mirror of
				https://github.com/Telecominfraproject/wlan-testing.git
				synced 2025-10-30 18:38:06 +00:00 
			
		
		
		
	Wifi 14747 (#1058)
* Update the path to check the controller URL Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com> * Update test_access_points_connectivity for better error handling Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com> --------- Signed-off-by: bhargavi-ct <bhargavimamidipaka@candelatech.com> Co-authored-by: bhargavi-ct <bhargavimamidipaka@candelatech.com>
This commit is contained in:
		| @@ -107,13 +107,31 @@ class APLIBS: | |||||||
|             pytest.fail("up0v0 interface is failed to have connectivity!!!") |             pytest.fail("up0v0 interface is failed to have connectivity!!!") | ||||||
|  |  | ||||||
|     def get_uci_show(self, param="ucentral", idx=0, print_log=True, attach_allure=True): |     def get_uci_show(self, param="ucentral", idx=0, print_log=True, attach_allure=True): | ||||||
|         output = self.run_generic_command(cmd="uci show " + param, idx=idx, |         command = "uci show " + param | ||||||
|  |         if "server" in param: | ||||||
|  |             output = self.run_generic_command(cmd=command, idx=idx, | ||||||
|  |                                               print_log=print_log, | ||||||
|  |                                               attach_allure=attach_allure, | ||||||
|  |                                               expected_attachment_type=allure.attachment_type.TEXT) | ||||||
|  |             ret_val = str(output).split("=")[1] | ||||||
|  |             if "cicd.lab.wlan.tip.build" in ret_val: | ||||||
|  |                 logging.info(f"we are fetching server url with the command: {command}") | ||||||
|  |             else: | ||||||
|  |                 command = "cat /etc/ucentral/gateway.json" | ||||||
|  |                 logging.info(f"we are fetching server url with the command: {command}") | ||||||
|  |                 output = self.run_generic_command(cmd=command, idx=idx, | ||||||
|  |                                                   print_log=print_log, | ||||||
|  |                                                   attach_allure=attach_allure, | ||||||
|  |                                                   expected_attachment_type=allure.attachment_type.TEXT) | ||||||
|  |         else: | ||||||
|  |             logging.info(f"command:{command}") | ||||||
|  |             output = self.run_generic_command(cmd=command, idx=idx, | ||||||
|                                               print_log=print_log, |                                               print_log=print_log, | ||||||
|                                               attach_allure=attach_allure, |                                               attach_allure=attach_allure, | ||||||
|                                               expected_attachment_type=allure.attachment_type.TEXT) |                                               expected_attachment_type=allure.attachment_type.TEXT) | ||||||
|  |  | ||||||
|         return output |         return output | ||||||
|  |  | ||||||
|  |  | ||||||
|     def restart_ucentral_service(self, idx=0, print_log=True, attach_allure=True): |     def restart_ucentral_service(self, idx=0, print_log=True, attach_allure=True): | ||||||
|         output = self.run_generic_command(cmd="/etc/init.d/ucentral restart", idx=idx, |         output = self.run_generic_command(cmd="/etc/init.d/ucentral restart", idx=idx, | ||||||
|                                           print_log=print_log, |                                           print_log=print_log, | ||||||
|   | |||||||
| @@ -182,8 +182,29 @@ class TestResources(object): | |||||||
|         uci_data = [] |         uci_data = [] | ||||||
|         for i in range(0, len(get_target_object.device_under_tests_info)): |         for i in range(0, len(get_target_object.device_under_tests_info)): | ||||||
|             ret_val = get_target_object.get_dut_library_object().get_uci_show(idx=i, param="ucentral.config.server") |             ret_val = get_target_object.get_dut_library_object().get_uci_show(idx=i, param="ucentral.config.server") | ||||||
|  |  | ||||||
|  |             logging.info(f"ret_val from get_uci_show:{ret_val}") | ||||||
|  |             if "ucentral.config.server" in ret_val: | ||||||
|                 ret_val = str(ret_val).split("=")[1] |                 ret_val = str(ret_val).split("=")[1] | ||||||
|                 uci_data.append(ret_val) |                 uci_data.append(ret_val) | ||||||
|  |             else: | ||||||
|  |                 ret_val_dict = json.loads(ret_val) | ||||||
|  |                 if not ret_val_dict.get("valid") or "server" not in ret_val_dict: | ||||||
|  |                     logging.warning( | ||||||
|  |                         "First attempt to fetch 'server' from gateway.json failed. Retrying in 5 seconds...") | ||||||
|  |                     time.sleep(5) | ||||||
|  |                     # Retry | ||||||
|  |                     ret_val = get_target_object.get_dut_library_object().get_uci_show(idx=i, | ||||||
|  |                                                                                       param="ucentral.config.server") | ||||||
|  |                     ret_val_dict = json.loads(ret_val) | ||||||
|  |  | ||||||
|  |                     if not ret_val_dict.get("valid") or "server" not in ret_val_dict: | ||||||
|  |                         logging.error("Invalid or missing 'server' after retry. Exiting test.") | ||||||
|  |                         pytest.exit("No valid 'server' value found in gateway.json after retry") | ||||||
|  |  | ||||||
|  |                 uci_data.append(ret_val_dict["server"]) | ||||||
|  |  | ||||||
|  |             logging.info(f"uci_data::{uci_data}") | ||||||
|         gw_host = get_target_object.controller_library_object.gw_host.hostname |         gw_host = get_target_object.controller_library_object.gw_host.hostname | ||||||
|         expected_host = True |         expected_host = True | ||||||
|         for j in uci_data: |         for j in uci_data: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 bhargavi-ct
					bhargavi-ct