def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Parameter for ping controls self._packetsize = 32 self._packnb = 4 self._lossrate = 25 # Record whether Wifi is already connected to handle B2B continuous mode values self._is_wifi_already_connected = None
def set_up(self): """ Setup the test """ LabWifiBase.set_up(self) # Check if the two security are different, otherwise the test is useless if self._security == self._security_2: msg = "The two securities given are identical : %s ! They must be different " % str(self._security_2) self._logger.error(msg) raise AcsConfigException(AcsConfigException.OPERATION_FAILED, msg) return Global.SUCCESS, "no_error"
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) # disconnect wifi as LAB_WIFI_BASE connects it self._networking_api.wifi_disconnect_all() time.sleep(self._wait_btwn_cmd) # Initiate connection to the equipment self._ns.init() # turn off dhcp and clean params in any case self._ns.set_dhcp("off") # then check if it has to be turned on if self._dhcp_enabled in ("True", "TRUE"): self._ns.set_dhcp("on", self._low_excluded_addr, self._high_excluded_addr, self._dhcp_subnet, self._dhcp_subnet_mask, self._lease, self._dhcp_gateway_address) # Close the connection to AP self._ns.release() self._sleep_mode_api.init(self._sleep_mode) # Connect the DUT on the Wifi network self._networking_api.wifi_connect(self._ssid, True, True) time.sleep(5) self._dut_ip = "0.0.0.0" bad_ip_timeout = 15 while (self._dut_ip == "0.0.0.0") and (bad_ip_timeout > 0): self._dut_ip = self._networking_api.get_wifi_ip_address() time.sleep(1) bad_ip_timeout -= 1 if self._dut_ip == "0.0.0.0": msg = "Can't obtain a valid IP address (%s)" % self._dut_ip self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # set Wifi Sleep Policy to "never" self._networking_api.set_wifi_sleep_policy(self._networking_api.WIFI_SLEEP_POLICY["NEVER"]) self._logger.info("Setting wifi policy to never") return Global.SUCCESS, "no errors"
def tear_down(self): """ End and dispose the test """ # Need to reconnect board to bench Network, before calling tear_down if self._computer: self._computer.connect_from_bench_network() LabWifiBase.tear_down(self) # Ensure USB tethering is OFF self._networking_api.stop_usb_tethering(unplug=True) return Global.SUCCESS, "No error"
def run_test(self): """ Execute the test """ # Call LAB_WIFI_BASE Run function LabWifiBase.run_test(self) time.sleep(self._wait_btwn_cmd) # Run Iperf command throughput = self._networking_api.iperf(self._iperf_settings) # Compute verdict depending on throughputs return compute_iperf_verdict(throughput, self._throughput_targets, self._direction)
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) LabWifiKPIBase.set_up(self) # Control REF_CONNECTION_TIME value if self._time_target < 0: msg = "Wrong parameter for REF_CONNECTION_TIME: read value %f" % self._time_target self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ LabWifiBase.run_test(self) # Wifi disconnection self._networking_api.wifi_remove_config(self._ssid) self._logger.info("Waiting %s seconds" % str(self._time2wait)) time.sleep(self._time2wait) # Start log monitoring self._networking_api.start_wifi_connection_log() # Try to connect with the wrong passphrase self._networking_api.set_wificonfiguration( self._ssid, self._wrong_passphrase, self._security, self._ip_setting, self._ip_address, self._netmask, self._gateway, self._dns1, self._dns2) self._networking_api.wifi_connect(self._ssid, False) # Control the connection status connection_status = self._networking_api.\ get_wifi_connection_status_log(self._ssid) self._logger.info("Connection log read: %s" % connection_status) if connection_status != "FAILURE": msg = "Unable to retrieve connection failure information from log" raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Wifi disconnection self._networking_api.wifi_remove_config(self._ssid) self._logger.info("Waiting %s seconds" % str(self._time2wait)) time.sleep(self._time2wait) # Now try to connect with the real passphrase # Start log monitoring self._networking_api.start_wifi_connection_log() self._networking_api.set_wificonfiguration( self._ssid, self._passphrase, self._security, self._ip_setting, self._ip_address, self._netmask, self._gateway, self._dns1, self._dns2) self._networking_api.wifi_connect(self._ssid, True) # Control the connection status connection_status = self._networking_api.\ get_wifi_connection_status_log(self._ssid) self._logger.info("Connection log read: %s" % connection_status) return Global.SUCCESS, "no_error"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Get TC Parameters self._live_server = \ self._tc_parameters.get_param_value("CELLULAR_ADDRESS_TO_PING") self._packetsize = 32 self._count = 10 self._target_ping_packet_loss_rate = 20 self._registration_waiting_time = 15
def run_test(self): """ Execute the test """ LabWifiBase.run_test(self) # Wait for the Wifi to sleep self._logger.info("Waiting %s sec for Wifi to sleep" % self._time_before_wifi_sleep) time.sleep(self._time_before_wifi_sleep) self._logger.info("Wifi should have gone to sleep") # Checks that Wifi is well entered into sleep mode try: packet_loss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._count) except AcsBaseException as e: if "Network is unreachable" in e.get_error_message(): # Then the Exception has been raised # because of a ping connection failure packet_loss = Measure() packet_loss.value = 100 packet_loss.units = "%" else: raise e if packet_loss.value < self._lossrate_disconnected: msg = "Wifi did not manage to enter sleep mode: %s packet loss" \ % str(packet_loss.value) self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Wake up the screen self._phone_system_api.display_on() time.sleep(6 * self._wait_btwn_cmd) self._phone_system_api.display_off() # Check WIFI connection by pinging Wifi AP packet_loss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._count) if packet_loss.value > self._lossrate_connection_ok: msg = "Wifi did not manage to wakes up: %s packet loss" \ % str(packet_loss.value) self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ LabWifiBase.run_test(self) # Reconnect only if needed (B2B continuous mode = True) if self._is_wifi_already_connected is not True: self._networking_api.set_wificonfiguration( self._ssid, self._passphrase, self._security, self._ip_setting, self._ip_address, self._netmask, self._gateway, self._dns1, self._dns2) self._networking_api.wifi_connect(self._ssid) # Check connection to the SSID self._networking_api.check_connection_state(self._ssid) # Check Wifi connection is available packetloss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._packnb) if packetloss.value > self._lossrate: msg = "Fail to recover Wifi connection after enabling WiFi interface " + \ "(ping NOK: %s%% packet loss)" % str(packetloss.value) self._logger.error(msg) raise DeviceException(DeviceException.PROHIBITIVE_MEASURE, msg) # Forget AP SSID self._networking_api.wifi_remove_config(self._ssid) self._is_wifi_already_connected = False time.sleep(self.WAITING_TIME) # Check if SSID is remembered connected_wifi_list = self._networking_api.list_connected_wifi() if self._ssid in connected_wifi_list: msg = "WiFi is connected to %s network and it shouldn't!" % self._ssid self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Confirm connection is still possible self._networking_api.set_wificonfiguration( self._ssid, self._passphrase, self._security, self._ip_setting, self._ip_address, self._netmask, self._gateway, self._dns1, self._dns2) self._networking_api.wifi_connect(self._ssid, True) self._is_wifi_already_connected = True return Global.SUCCESS, "No errors"
def set_up(self): """ Initialize the test """ LiveDualPhoneBTBase.set_up(self) # Check TC Parameters self.__check_tc_parameters() # defines NAP / PAN-User roles if self._nap_or_pan_test == "NAP": self._nap_api = self._bt_api self._nap_addr = self._phone1_addr self._panu_api = self._bt_api2 self._panu_addr = self._phone2_addr self._wifi_api = self._networking_api self._panu_net_api = self._networking_api2 else: self._nap_api = self._bt_api2 self._nap_addr = self._phone2_addr self._panu_api = self._bt_api self._panu_addr = self._phone1_addr self._wifi_api = self._networking_api2 self._panu_net_api = self._networking_api # Connection Wifi LAB Access Point LabWifiBase.set_up_without_flightmode(self, self._wifi_api) # Deactivate DATA on PAN User device self._panu_net_api.deactivate_pdp_context() # Establish bluetooth pairing self._establish_bt_pairing(self._pairing_initiator) # Set NAP back to discoverable and connectable # as _establish_bt_pairing might have set it to "noscan" # breaking the test self._nap_api.set_bt_discoverable("both", 0) # Enable BT tethering self._nap_api.set_bt_tethering_power("1") # Handle LOng LAsting test if self._lola_test: connect_to_nap(self._panu_api, self._nap_api, self._nap_addr, self._who_restarts_bt, self._wait_btwn_cmd) return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) self._connected = \ str(self._tc_parameters.get_param_value("WIFI_CONNECTED")) self._display_state = \ str(self._tc_parameters.get_param_value("DISPLAY")).upper() self._keep_wifi_on = \ str(self._tc_parameters.get_param_value("KEEP_WIFI_ON_DURING_SLEEP")) self._ssid_list_empty = \ str(self._tc_parameters.get_param_value("REMEMBERED_SSID_LIST_EMPTY")) self._usb_pluggedin = \ str(self._tc_parameters.get_param_value("USB_PLUGGED_IN")) self._tolerance = str(self._tc_parameters.get_param_value("TOLERANCE")) # Behavior informations: # 1- Scan period in seconds self._scan = 0 # 2- Time to WiFi turn off in minutes self._wifi_off = 0 # 3- Recommended test duration in seconds self._tduration = 0 self._wifi_mac = "" self._original_screen_timeout = None # USB Connected stated self._usb_connected_status = True # Set tolerance parameter if self._tolerance.isdigit(): self._tolerance = float(self._tolerance) / 100 else: self._tolerance = self.DEFAULT_TOLERANCE self._logger.debug("Tolerance set to %2.2f%%" % (self._tolerance * 100)) # Forbid the usage of the sniffer in LAB_WIFI_BASE self._sniffer = None self._sp_sniffer = None # Get WiFi interface name self._wifi_interface = str(self._dut_config.get("wlanInterface"))
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Get TC Parameters self._direction = self._tc_parameters.get_param_value("DIRECTION") self._packetsize = \ int(self._tc_parameters.get_param_value("PACKET_SIZE")) self._count = int(self._tc_parameters.get_param_value("PACKET_COUNT")) self._target_ping_packet_loss_rate = \ float(self._tc_parameters.get_param_value("TARGET_PACKET_LOSS_RATE")) self._waiting_time = \ int(self._tc_parameters.get_param_value("DELAY_AFTER_PING")) self._dut_ip = None self._computer = None self._all_ip_to_ping = []
def set_up(self): """ Initialize the test """ # pylint: disable=E1101 LabWifiBase.set_up(self) # Checks connection using Ping packetloss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._packnb) if packetloss.value > self._lossrate: msg = "Ping command fails (%s%% loss)" % str(packetloss.value) self._logger.error(msg) raise DeviceException(DeviceException.PROHIBITIVE_MEASURE, msg) self._is_wifi_already_connected = True return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Parameter for ping controls self._packetsize = 32 self._packnb = 4 self._lossrate = 25 self._lossrate_disconnected = 99 # source IP address to use (interface from which the ping will be send) self.__dut_ip_adr = None # Time to wait for the DUT to reconnect after Wifi is back self._wifi_reconnection_time = 60 # Get UECmdLayer for bluetooth self._bt_api = self._device.get_uecmd("LocalConnectivity")
def __init__(self, tc_name, global_config): """ Constructor """ # Call LiveDualPhoneBTBase and LabWifiBase init functions LiveDualPhoneBTBase.__init__(self, tc_name, global_config) LabWifiBase.__init__(self, tc_name, global_config) # Reset unused parameter: self._wrong_passphrase = None self._key_exchange_should_fail = False # Read TC parameters self._nap_or_pan_test = \ str(self._tc_parameters.get_param_value("NAP_OR_PAN_TEST")).upper() self._pairing_initiator = \ str(self._tc_parameters.get_param_value("PAIRING_INITIATOR")).upper() self._who_disconnect = \ str(self._tc_parameters.get_param_value("WHO_DISCONNECT")).upper() self._who_restarts_bt = \ str(self._tc_parameters.get_param_value("WHO_RESTARTS_BT_BEFORE_TEST")).upper() self._bt_tethering_deactivation_test = \ str(self._tc_parameters.get_param_value("ENABLE_BT_TETHERING_DEACTIVATION_TEST", "")) self._lola_test = \ str(self._tc_parameters.get_param_value("ENABLE_LOLA_TEST", "")) self._packet_count = \ str(self._tc_parameters.get_param_value("PACKET_COUNT")) self._packet_size = \ str(self._tc_parameters.get_param_value("PACKET_SIZE")) self._target_packet_loss_rate = \ str(self._tc_parameters.get_param_value("TARGET_PACKET_LOSS_RATE")) # Server to ping self._server_to_ping = self._wifirouter_ip self._nap_api = None self._panu_api = None self._nap_addr = None self._panu_addr = None self._wifi_api = None self._panu_net_api = None self._paired_api = None self._pair_requester_api = None
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) self._dut_ip = self._networking_api.get_wifi_ip_address(self._use_ipv6) if self._direction == "DL": self._all_ip_to_ping = [self._dut_ip] if not self._use_ipv6: # With IPv6,we already have it from LAB_WIFI_BASE self._computer = self._em.get_computer("COMPUTER1") else: if self._use_ipv6: self._all_ip_to_ping = self._computer.get_ipv6_addresses() else: remote_ip = self._wifirouter_ip self._all_ip_to_ping = [remote_ip] return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Get TC Parameters self._browser_type = \ str(self._tc_parameters.get_param_value("BROWSER_TYPE")).lower() self._website_url = \ str(self._tc_parameters.get_param_value("WEBSITE_URL")) self._webpage_loading_timeout = \ int(self._tc_parameters.get_param_value("TIMEOUT")) if self._website_url.upper() in ["", "NONE"]: # In case of empty WEBSITE_URL TC parameter, use the IP server in the bench config self._website_url = self._wifi_server_ip_address # Store current screen timeout (default to 15s in case of failure) self._current_screen_timeout = 15
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Set the screen timeout (in sec) to a very small value self._screen_timeout = 15 # Default value for time to wait for wifi to disconnect all network self._time_before_wifi_sleep = 18 * 60 # Ping fixed parameters self._packetsize = 32 self._count = 4 self._lossrate_connection_ok = 50 self._lossrate_disconnected = 99 self._previous_wifi_sleep_policy = None self._previous_screen_timeout = None
def set_up(self): """ Initialize the test """ # pylint: disable=E1101 LabWifiBase.set_up(self) # Retrieve DUT ip address self.__dut_ip_adr = self._networking_api.get_wifi_ip_address(self._use_ipv6) # Checks connection using Ping packetloss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._packnb, source_address=self.__dut_ip_adr) if packetloss.value > self._lossrate: msg = "Ping command fails (%s%% loss)" % str(packetloss.value) self._logger.error(msg) raise DeviceException(DeviceException.PROHIBITIVE_MEASURE, msg) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ LabWifiBase.run_test(self) # Enable Wifi self._networking_api.set_wifi_power("on") time.sleep(self._registration_waiting_time) # Ping Wifi server self.__ping_server(self._wifirouter_ip, "Wifi network") # Disable Wifi self._networking_api.set_wifi_power("off") time.sleep(self._registration_waiting_time) # Ping Live server self.__ping_server(self._live_server, "Cellular network") return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ LabWifiBase.run_test(self) # Ensure the AP configuration is correct and connect the DUT to the AP if not self.__1st_iteration: if self._bandwidth == "40": # Restore the Bandwidth to 40 MHz self._set_ap_bandwidth('40', False) if self._wifi_mimo: # Restore MIMO activation on AP self._set_ap_mimo(True, False) else: self.__1st_iteration = False # Connect the DUT to AP with connection check if specific feature(s) is(are) enabled (40MHz, MIMO) self._wifi_connect_dut() # Run the FTP tranfer with the parameters extracted from the XML TC file ftp_result = self._launch_ftp_transfer() # Retrieve the FTP throughput throughput = re.findall(self._FTP_THROUGHTPUT_PARSING_PATTERN, ftp_result[1]) if len(throughput) > 0: throughput = int(throughput[0]) else: throughput = -1 # If enhanced features (like 40MHz and/or MIMO) are activated, # we need to compare throughput without these features self._check_enhanced_features(throughput) # Disconnect DUT from AP self._networking_api.wifi_disconnect(self._ssid) return ftp_result
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) # Get the time to wait for wifi to disconnect all network self._time_before_wifi_sleep = self._device.get_time_before_wifi_sleep() # Set WIFI sleep policy to "when screen turns off" self._previous_wifi_sleep_policy = self._networking_api.\ get_wifi_sleep_policy() if self._previous_wifi_sleep_policy != \ self._networking_api.WIFI_SLEEP_POLICY["WHEN_SCREEN_OFF"]: self._networking_api.\ set_wifi_sleep_policy(self._networking_api. WIFI_SLEEP_POLICY["WHEN_SCREEN_OFF"]) # Set screen timeout to a short value self._previous_screen_timeout = self._phone_system_api.get_screen_timeout() if self._previous_screen_timeout != self._screen_timeout: self._phone_system_api.set_screen_timeout(self._screen_timeout) # Remove the potential screen lock ON self._phone_system_api.display_off() # Check WIFI connection by pinging Wifi AP packet_loss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._count) if packet_loss.value > self._lossrate_connection_ok: msg = "Wifi IP connection is bad: %s packet loss" \ % str(packet_loss.value) self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Set the Wifi power saving mode to ON self._networking_api.set_wifi_power_saving_mode("on") return Global.SUCCESS, "No errors"
def tear_down(self): """ End and dispose the test """ LabWifiBase.tear_down(self) # Restore WIFI sleep policy if self._previous_wifi_sleep_policy is not None and \ self._previous_wifi_sleep_policy != \ self._networking_api.WIFI_SLEEP_POLICY["WHEN_SCREEN_OFF"]: self._networking_api.\ set_wifi_sleep_policy(self._previous_wifi_sleep_policy) # Restore the screen timeout if self._previous_screen_timeout is not None and \ self._previous_screen_timeout != self._screen_timeout: self._phone_system_api.set_screen_timeout(self._previous_screen_timeout) # Make sure that the screen lock ON is disabled self._phone_system_api.display_off() return Global.SUCCESS, "No errors"
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) # Recall current screen timeout self._current_screen_timeout = self._phone_system_api.get_screen_timeout( ) # Set the screen timeout to be sure that the screen will on # *15 because the minimum timeout is 1: 1*15 = 15s which is the minimum screen timeout time.sleep(self._wait_btwn_cmd) if self._webpage_loading_timeout > 0: self._phone_system_api.set_screen_timeout( self._webpage_loading_timeout * 15) # Wakes up the phone time.sleep(self._wait_btwn_cmd) self._phone_system_api.wake_screen() return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Retrieve UC parameter self._restart_dut = str( self._tc_parameters.get_param_value("RESTART_DUT", "")).upper() if self._restart_dut in ["", "OFF", "NO", "NONE", "FALSE"]: self._restart_dut = "OFF" self._restart_ap_radio = str_to_bool( str(self._tc_parameters.get_param_value("RESTART_AP_RADIO"))) self._mac_filter = str( self._tc_parameters.get_param_value("MAC_FILTER", "OFF")).upper() if self._mac_filter == "": self._mac_filter = "OFF" self._mac_filter_parameter = str( self._tc_parameters.get_param_value("MAC_FILTER_PARAMETER", "OFF")) if self._mac_filter_parameter == "": self._mac_filter_parameter = "OFF" self._dut_in_mac_filter = False self._connection_time_list = list() self._current_iteration_num = 0 self._expected_connection_time = str( self._tc_parameters.get_param_value("REF_CONNECTION_TIME")) self._tolerance = str(self._tc_parameters.get_param_value("TOLERANCE")) if re.match(r'\d+\.?\d*', self._tolerance) is not None: self._tolerance = float(self._tolerance) / 100 else: self._tolerance = self.DEFAULT_TOLERANCE self._logger.warning("Tolerance not found, set to default value") self._logger.debug("Tolerance set to %2.2f%%" % (self._tolerance * 100))
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) # Get configurable AP dhcp settings self._dhcp_enabled = str(self._configurable_ap. get_param_value("DHCP_ENABLED")) if self._dhcp_enabled == "None" or self._dhcp_enabled == "": self._dhcp_enabled = "False" self._low_excluded_addr = str(self._configurable_ap. get_param_value("LOW_EXCLUDED_IP")) self._high_excluded_addr = str(self._configurable_ap. get_param_value("HIGH_EXCLUDED_IP")) self._dhcp_subnet = str(self._configurable_ap. get_param_value("DHCP_SUBNET")) self._dhcp_subnet_mask = str(self._configurable_ap. get_param_value("DHCP_SUBNET_MASK")) self._dhcp_lease = str(self._configurable_ap. get_param_value("DHCP_LEASE")) self._dhcp_gateway_address = str(self._configurable_ap. get_param_value("DHCP_GATEWAY"))
def set_up(self): """ Initialize the test """ LabWifiBase.set_up(self) # Check if cellular live server is valid if self._live_server in [None, "", "NONE"]: msg = "live cellular server is missing" self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) # Disable Wifi self._networking_api.set_wifi_power("off") # Enable Cellular Data transfer self._networking_api.activate_pdp_context() time.sleep(self._wait_btwn_cmd) # Check cellular connection self.__ping_server(self._live_server, "Cellular network") return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiBase.__init__(self, tc_name, global_config) self._passphrase_2 = None self._security_2 = str(self._tc_parameters.get_param_value("WIFI_SECURITY_2")) self._eap_user_2 = self._tc_parameters.get_param_value("EAP_USER", self.__get_bc_ap_param("EAP_user")) self._eap_password_2 = self.__get_bc_ap_param("EAP_password") if self._security_2 in ["WEP64", "WEP64-OPEN"]: self._passphrase_2 = self._passphrase_wep64 elif self._security_2 in ["WEP128", "WEP128-OPEN"]: self._passphrase_2 = self._passphrase_wep128 elif self._security_2 in ["EAP-WPA", "EAP-WPA2"]: # Get WIFI Router configuration according to WPA-enterprise options self._eap_method_2 = str(self._tc_parameters.get_param_value("EAP_METHOD_2")) self._phase2_auth_2 = str(self._tc_parameters.get_param_value("PHASE2_AUTH_2")) if self._eap_method_2 == "SIM": self._eap_user_2 = self.__get_bc_ap_param("EAP_SIM_user") # If no username is required, we don't need the password if self._eap_user_2 == "": self._eap_password = "" elif self._eap_method_2 == "AKA": self._eap_user_2 = self.__get_bc_ap_param("EAP_AKA_user") # If no username is required, we don't need the password if self._eap_user_2 == "": self._eap_password_2 = "" # Compute passphrase for WPA-ENT (will be parsed by ACS Embedded) self._passphrase_2 = self._eap_method_2 + "-" + self._phase2_auth_2 \ + "_" + self._eap_user_2 + "_" + self._eap_password_2 \ + "_" + self._certificat_name + "_" + str(self._mandatory_cert) elif "WPA2" in self._security_2: self._passphrase_2 = self._passphrase_wpa2 elif "WPA" in self._security_2: self._passphrase_2 = self._passphrase_wpa
def set_up(self): """ Initialize the test """ # store original flight mode self._original_flight_mode = self._networking_api.get_flight_mode() time.sleep(self._wait_btwn_cmd) if self._original_flight_mode != self._use_flight_mode: self._networking_api.set_flight_mode(self._use_flight_mode) time.sleep(self._wait_btwn_cmd) # Configure and connect wifi to the AP LabWifiBase.set_up(self) # Get local computer to run dhclient self._computer = self._em.get_computer("COMPUTER1") # Get access point subnet to add its route to tethered interface self._network = re.sub(r'([0-9]+\.[0-9]+\.[0-9]+).*', r'\1.0', self._wifirouter_ip) return Global.SUCCESS, "No error"