diff --git a/libs/tip_2x/tip_2x.py b/libs/tip_2x/tip_2x.py index ec86f251e..5c728613c 100644 --- a/libs/tip_2x/tip_2x.py +++ b/libs/tip_2x/tip_2x.py @@ -425,9 +425,9 @@ class tip_2x: pytest.fail("Config is not Properly Applied on AP") self.dut_library_object.get_active_config(idx=i, print_log=True, attach_allure=False) - logging.info("Waiting for 30 Seconds for All interfaces to come up") + logging.info("Waiting for 45 Seconds for All interfaces to come up") # wait time interfaces to come up - time.sleep(30) + time.sleep(45) # x = 0 # while uuid_before_apply == uuid_after_apply: @@ -502,15 +502,30 @@ class tip_2x: n = len(temp_data[dut]) lst = list(range(0, n)) ret_val[dut]["ssid_data"] = dict.fromkeys(lst) + fields = ["SSID", "Encryption", "Password", "Band", "BSSID"] for j in ret_val[dut]["ssid_data"]: - a = temp_data[dut][j].copy() - a = dict.fromkeys(["ssid", "encryption", "password", "band", "bssid"]) - a["ssid"] = temp_data[dut][j][0] - a["encryption"] = temp_data[dut][j][1] - a["password"] = temp_data[dut][j][2] - a["band"] = temp_data[dut][j][3] - a["bssid"] = temp_data[dut][j][4] - ret_val[dut]["ssid_data"][j] = a + ssid_entry = temp_data[dut][j] + expected_length = 5 + if len(ssid_entry) < expected_length: + missing_fields = [] + # Check each field for its presence + for index, field in enumerate(fields): + if len(ssid_entry) <= index: + missing_fields.append(field) + if missing_fields: + logging.error( + f"Error: Missing field(s) {', '.join(missing_fields)} for SSID entry '{ssid_entry[0]}' in {ssid_entry}. Please check iwinfo") + pytest.fail( + f"Error: Missing field(s) {', '.join(missing_fields)} for SSID entry '{ssid_entry[0]}' in {ssid_entry}. Please check iwinfo") + else: + a = temp_data[dut][j].copy() + a = dict.fromkeys(["ssid", "encryption", "password", "band", "bssid"]) + a["ssid"] = temp_data[dut][j][0] + a["encryption"] = temp_data[dut][j][1] + a["password"] = temp_data[dut][j][2] + a["band"] = temp_data[dut][j][3] + a["bssid"] = temp_data[dut][j][4] + ret_val[dut]["ssid_data"][j] = a temp = ret_val[dut]["radio_data"].copy() logging.info(f"temp:{temp}") for j in temp: @@ -660,14 +675,19 @@ class tip_2x: band = "2G" elif o[i + 9].__contains__("5."): band = "5G" + elif "unknown" in o[i + 9]: + logging.info(f"Error: {o[i - 1]} has an unknown channel frequency from iwinfo") + pytest.fail(f"Error: {o[i - 1]} has an unknown channel frequency from iwinfo") else: band = "6G" iwinfo_bssid_data[o[i - 1]] = [o[i + 1].replace('"', ''), o[i + 4], band] + logging.info(f"iwinfo_bssid_data:{iwinfo_bssid_data}") for p in iwinfo_bssid_data: for q in ssid_info_sdk: if iwinfo_bssid_data[p][0] == q[0] and iwinfo_bssid_data[p][2] == q[3]: q.append(iwinfo_bssid_data[p][1]) ssid_info_sdk.append(channel_info) + logging.info(f"ssid_info_sdk:{ssid_info_sdk}") return ssid_info_sdk def get_dut_version(self):