def __init__(self, tc_name, global_config): """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) # AP must not be hidden self._hidden = False self._hidden_ap2 = False # Get the parameter test phases self._2_4ghz_test = self._tc_parameters.\ get_param_value("RUN_2_4_GHZ_TEST") self._5ghz_test = self._tc_parameters.get_param_value("RUN_5_GHZ_TEST") self._auto_test = self._tc_parameters.get_param_value("RUN_AUTO_TEST") if str(self._2_4ghz_test).lower() in ["1", "true"]: self._2_4ghz_test = True else: self._2_4ghz_test = False if str(self._5ghz_test).lower() in ["1", "true"]: self._5ghz_test = True else: self._5ghz_test = False if str(self._auto_test).lower() in ["1", "true"]: self._auto_test = True else: self._auto_test = False
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) LabWifiDfs.__init__(self, tc_name, global_config)
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) self._wrong_passphrase = None
def run_test(self): """ Execute the test """ LabWifiDualBase.run_test(self) for (cur_band, ssid) in self._test_sequence: # Set the new band self._networking_api.set_wifi_frequency_band( cur_band, False, self._dut_wlan_iface) sleep(self._wait_btwn_cmd) # Check the new band selection res_band = self._networking_api.get_wifi_frequency_band( self._dut_wlan_iface) # Compare it to what has been set if res_band != cur_band: msg = "Got band %s instead of %s" % (res_band, cur_band) self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) # Check auto re-connection the other ssid self._logger.info("Waiting % sec to reconnect" % self._reconnection_time) sleep(self._reconnection_time) self._networking_api.check_connection_state(ssid) return Global.SUCCESS, "No error"
def set_up(self): """ Initialize the test """ LabWifiDualBase.set_up(self) # Check TC parameters if self._ftp_transfer and not self._dl_filename_param: msg = "Missing TC parameter: FTP_DL_FILENAME: " + str( self._dl_filename_param) self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) if self._xfer_timeout in (None, ""): self._xfer_timeout = 200 else: self._xfer_timeout = float(self._xfer_timeout) # Set Wifi sleep policy to "Never Sleep" self._networking_api.set_wifi_sleep_policy( self._networking_api.WIFI_SLEEP_POLICY["NEVER"]) # Warn the user if the AP are not Cisco 12xx if not self._ns.get_model().startswith("CISCO_12") \ or not self._ns_ap2.get_model().startswith("CISCO_12"): self._logger.warning( "You will have better reliability using 2 CISCO 12xx APs") return Global.SUCCESS, "No errors"
def set_up(self): """ Initialize the test """ LabWifiDualBase.set_up(self) # Disconnect Wifi from both APs self._networking_api.wifi_disconnect_all() return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) # Parameter for ping controls self._packetsize = 32 self._packnb = 4 self._lossrate = 25
def tear_down(self): """ End and dispose the test """ LabWifiDualBase.tear_down(self) # Reset the Frequency Band parameter to "auto" self._networking_api.set_wifi_frequency_band("auto", False, self._dut_wlan_iface) return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): # pylint: disable=W0231 """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) if self._ssid != self._ssid_ap2: msg = "SSID AP2 name [%s] different of SSID AP1. Force SSID AP2 name to [%s]" \ % (self._ssid_ap2, self._ssid) self._logger.warning(msg) self._ssid_ap2 = self._ssid
def set_up(self): """ Initialize the test """ LabWifiDualBase.set_up(self) # Connect DUT to AP 1 self._networking_api.wifi_connect(self._ssid, False) # call the generic LabWifiDsf._set_up() method self._set_up() return Global.SUCCESS, "no_error"
def run_test(self): """ Execute the test """ LabWifiDualBase.run_test(self) if self._ftp_transfer: self.__run_test_ftp() else: self.__run_test_ping() return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ # pylint: disable=E1101 LabWifiDualBase.run_test(self) # Remove the 2nd SSID in known network list self._networking_api.wifi_remove_config(self._ssid_ap2) # And add the corrupted one self._networking_api.set_wificonfiguration( self._ssid_ap2, self._wrong_passphrase, self._security_ap2, self._ip_setting_ap2, self._ip_address_ap2, self._netmask_ap2, self._gateway_ap2, self._dns1_ap2, self._dns2_ap2) time.sleep(self._wait_btwn_cmd) # Start log monitoring self._networking_api.start_wifi_connection_log() # Try to connect with the wrong passphrase self._networking_api.wifi_connect(self._ssid_ap2, False) # Control the connection status connection_status = self._networking_api.\ get_wifi_connection_status_log(self._ssid_ap2) 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) # Set SSID back to ENABLE # (since wifi_connect automatically disables all other known SSIDs) self._networking_api.set_autoconnect_mode(self._ssid, AUTO_CONNECT_STATE.on) # Now wait for the connection back to the 1st AP time.sleep(self._wait_btwn_cmd) self._networking_api.check_connection_state(self._ssid) # Connect to the 2nd SSID with the Good passphrase self._networking_api.wifi_remove_config(self._ssid_ap2) self._networking_api.set_wificonfiguration( self._ssid_ap2, self._passphrase_ap2, self._security_ap2, self._ip_setting_ap2, self._ip_address_ap2, self._netmask_ap2, self._gateway_ap2, self._dns1_ap2, self._dns2_ap2) time.sleep(self._wait_btwn_cmd) # Connect and check the SSID connection self._networking_api.wifi_connect(self._ssid_ap2) return Global.SUCCESS, "no_error"
def set_up(self): """ Initialize the test """ # pylint: disable=E1101 LabWifiDualBase.set_up(self) # Control that the TC parameters has been correctly set. if self._standard not in ["a", "n5G"]: msg = "AP1 is not set to 5GHz. Standard set: %s" % self._standard self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) if self._standard_ap2 not in ["gb", "ngb", "n2.4G"]: msg = "AP2 is not set to 2.4GHz. Standard set: %s" \ % self._standard_ap2 self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) if self._channel != "1": self._logger.warning("AP1 channel is not 1 as advise: %s" % self._channel) if self._channel_ap2 != "1": self._logger.warning("AP2 channel is not 1 as advise: %s" % self._channel_ap2) if not self._24to5 and not self._5to24: msg = "At least 1 of the parameter 2_4_TO_5_GHZ or 5_TO_2_4_GHZ " msg += "should be enabled" self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) # Set band selection to "auto" self._networking_api.set_wifi_frequency_band("auto", False, self._dut_wlan_iface) if self._24to5: # Connect to 2.4GHz AP self._networking_api.wifi_connect(self._ssid_ap2) self._test_sequence += [["5GHz", self._ssid]] if self._5to24: if not self._24to5: # Connect to 5GHz AP self._networking_api.wifi_connect(self._ssid) self._test_sequence += [["2.4GHz", self._ssid_ap2]] # Set autoconnect for both SSIDs self._networking_api.set_autoconnect_mode(self._ssid, AUTO_CONNECT_STATE.on) self._networking_api.set_autoconnect_mode(self._ssid_ap2, AUTO_CONNECT_STATE.on) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ LabWifiDualBase.run_test(self) if self._auto_test: ssids = self.__run_band_scan("auto") if self._ssid not in ssids: msg = "auto: Unable to scan 2.4GHz AP" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) if self._ssid_ap2 not in ssids: msg = "auto: Unable to scan 5GHz AP" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) if self._2_4ghz_test: ssids = self.__run_band_scan("2.4GHz") if self._ssid_ap2 not in ssids: msg = "2.4GHz: Unable to scan 2.4GHz AP" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) if self._ssid in ssids: msg = "2.4GHz: Able to scan 5GHz AP" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) if self._5ghz_test: ssids = self.__run_band_scan("5GHz") if self._ssid not in ssids: msg = "5GHz: Unable to scan 5GHz AP" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) if self._ssid_ap2 in ssids: msg = "5GHz: Able to scan 2.4GHz AP" self._logger.error(msg) raise DeviceException(DeviceException.OPERATION_FAILED, msg) return Global.SUCCESS, "No errors"
def run_test(self): """ Execute the test """ LabWifiDualBase.run_test(self) # Connect DUT to the 1st AP and check connection SSID self._networking_api.wifi_connect(self._ssid, True) time.sleep(self._wait_btwn_cmd) # Waiting for an IP address from DHCP self._networking_api.wait_for_wifi_dhcp_connected() # retrieve DUT ip address dut_ip_address = self._networking_api.get_wifi_ip_address() # Checks connection using Ping packetloss = self._networking_api.ping(self._wifirouter_ip, self._packetsize, self._packnb, source_address=dut_ip_address) if packetloss.value > self._lossrate: msg = "AP1: Ping command fails (%s% loss)" % str(packetloss.value) self._logger.error(msg) raise DeviceException(DeviceException.PROHIBITIVE_MEASURE, msg) # Connect DUT to the 2nd AP check connection SSID self._networking_api.wifi_connect(self._ssid_ap2, True) time.sleep(self._wait_btwn_cmd) # Waiting for an IP address from DHCP self._networking_api.wait_for_wifi_dhcp_connected() # retrieve DUT ip address dut_ip_address = self._networking_api.get_wifi_ip_address() # Checks connection using Ping packetloss = self._networking_api.ping(self._wifirouter_ip_ap2, self._packetsize, self._packnb, source_address=dut_ip_address) if packetloss.value > self._lossrate: msg = "AP2: Ping command fails (%s% loss)" % str(packetloss.value) self._logger.error(msg) raise DeviceException(DeviceException.PROHIBITIVE_MEASURE, msg) return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) # Do we use the same SSID on both Access Points? self._same_ssid = self._tc_parameters.get_param_value( "AP2_USES_SAME_SSID_AND_SECURITY") if str(self._same_ssid).upper() in ("YES", "TRUE"): self._same_ssid = True # Overwrite LabWifiDualBase parameter initialization self._ssid_ap2 = self._ssid self._security_ap2 = self._security self._passphrase_ap2 = self._passphrase else: self._same_ssid = False # Do we test roaming while FTP transfer? self._ftp_transfer = self._tc_parameters.\ get_param_value("SWITCH_BETWEEN_AP_DURING_FTP_TRANSFER") if str(self._ftp_transfer).upper() in ("YES", "TRUE"): self._ftp_transfer = True else: self._ftp_transfer = False # Get UECmdLayer self._phonesystem_api = self._device.get_uecmd("PhoneSystem") # Parameter for ping controls self._packetsize = 32 self._packnb = 4 self._lossrate = 25 # Parameter for FTP transfer self._direction = "DL" self._dl_filename_param = self._tc_parameters.get_param_value( "FTP_DL_FILENAME") self._xfer_timeout = self._tc_parameters.get_param_value( "XFER_TIMEOUT") self._dl_filename = os.path.join(self._ftp_path, self._dl_filename_param) self._dut_mac_address_for_connection_check = ""
def set_up(self): """ Initialize the test """ LabWifiDualBase.set_up(self) # Control that the security is not OPEN if str(self._security_ap2).upper() in ["NONE", "OPEN"]: msg = "WIFI_SECURITY_AP2 UseCase parameter should not be " + \ "undefined nor OPEN: %s" % str(self._security_ap2) self._logger.error(msg) raise AcsConfigException(AcsConfigException.INVALID_PARAMETER, msg) # Generate a corrupted passphrase if self._security_ap2 == "EAP-WPA" or self._security_ap2 == "EAP-WPA2": self._wrong_passphrase = self._eap_method_ap2 + "-" \ + self._phase2_auth_ap2 + "_" + self._eap_user \ + "_" + self._corrupt_pass(self._eap_password) + "_" \ + self._certificat_name + "_" + str(self._mandatory_cert) else: self._wrong_passphrase = self._corrupt_pass(self._passphrase_ap2) return Global.SUCCESS, "No errors"
def __init__(self, tc_name, global_config): """ Constructor """ LabWifiDualBase.__init__(self, tc_name, global_config) self._24to5 = str(self._tc_parameters.get_param_value("2_4_TO_5_GHZ")) self._5to24 = str(self._tc_parameters.get_param_value("5_TO_2_4_GHZ")) if self._24to5.lower() in ["true", "1", "yes"]: self._24to5 = True else: self._24to5 = False if self._5to24.lower() in ["true", "1", "yes"]: self._5to24 = True else: self._5to24 = False self._test_sequence = [] # AP must not be hidden self._hidden = False self._hidden_ap2 = False self._reconnection_time = 10