def config_wifi_connected(self, state, toggle_off = True): print "====================== config_wifi_connected ======================" # make sure there are no saved networks wifi_generic_steps.clear_saved_networks(serial = self.wifi_trafic_serial)() if toggle_off: wifi_generic_steps.set_wifi(state="OFF",serial = serial)() wifi_generic_steps.set_wifi(state="OFF",serial = serial2)() wifi_generic_steps.set_wifi(state="ON",serial = serial)() wifi_generic_steps.set_wifi(state="ON",serial = serial2)() if interface5ghz == "1": ap_steps.setup(mode="n", security = "wpa2", wifi_password= attrs["passphrase"], new_ssid= attrs["ap_name"] if str(attrs["new_ssid"]).lower() == "none" else attrs["new_ssid"], interface5ghz=interface5ghz, encryption="aes", channel_no=channel_no)() if state: # add the Wi-Fi network wifi_generic_steps.add_network(ssid = attrs["ap_name"] if str(attrs["new_ssid"]).lower() == "none" else attrs["new_ssid"], security = attrs["dut_security"], password = attrs["passphrase"], identity = attrs["radius_identity"], EAP_method = attrs["EAP_method"], phase_2_auth = attrs["phase_2_auth"], user_certificate = attrs["user_certificate"], serial = self.wifi_trafic_serial)() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial = self.wifi_trafic_serial)()
def connect_to_ap(serial, condition, mode='bg', security='none', dut_security=None, ddwrt_ap_name='ddwrt', ddwrt_ap_pass='******', encryption=None, iteration=1, q=None): for _ in range(0, iteration): # configure ap ap_steps.setup(mode, security, encryption=encryption, wifi_password=ddwrt_ap_pass, new_ssid=ddwrt_ap_name, serial=serial)() # turn display on, if turned off ui_steps.wake_up_device(serial=serial)() # ensure the device is unlocked ui_steps.unlock_device(serial=serial, pin=wifi_defaults.wifi['pin'])() # go to home screen ui_steps.press_home(serial=serial)() # make sure there are no saved networks wifi_generic_steps.clear_saved_networks(serial=serial)() # add the Wi-Fi network wifi_generic_steps.add_network(ssid=ddwrt_ap_name, security=dut_security, password=ddwrt_ap_pass, serial=serial)() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial=serial)() # check we are connected to the correct network. wifi_generic_steps.check_connection_info(serial=serial, SSID=ddwrt_ap_name, state='CONNECTED/CONNECTED')() # check connection obj = wifi_generic_steps.ping_gateway(serial=serial) obj() if 'passed' in obj.resolution.lower(): return True if q is None else q.put(['Pass']) else: return False if q is None else q.put(['Success'])
wifi_generic_steps.clear_saved_networks(serial=serial)() # add the Wi-Fi network wifi_generic_steps.add_network( ssid=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, security=dut_security, password=ddwrt_ap_pass, identity=radius_identity, EAP_method=EAP_method, phase_2_auth=phase_2_auth, user_certificate=user_certificate, ca_certificate=ca_certificates, serial=serial)() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial=serial)() # check we are connected to the correct network. wifi_generic_steps.check_connection_info( serial=serial, SSID=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, state='CONNECTED/CONNECTED')() # check connection wifi_generic_steps.ping_gateway(trycount=trycount, serial=serial)() ap_steps.setup( mode, security, ssh_host=ipv4_class, encryption=encryption,
if test_type == "auto_roam": # add the physical wifi network wifi_generic_steps.add_network(ssid = ddwrt_ap_name+"_virt", security = dut_security, password = ddwrt_ap_pass, identity = radius_identity, EAP_method = EAP_method, phase_2_auth = phase_2_auth, user_certificate = user_certificate, serial = serial)() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial = serial)() # clear logcat adb_steps.command("logcat -c", serial = serial)() # add the Wi-Fi network wifi_generic_steps.add_network(ssid = ddwrt_ap_name, security = "WPA2", password = "******", serial = serial)() # verify that DUT is not connected wifi_generic_steps.check_wifi_state_disconnected(ap_name = ddwrt_ap_name, security = 'wpa', encryption = encryption,
# go to home screen ui_steps.press_home(serial=args["serial"])() # make sure there are no saved networks wifi_generic_steps.clear_saved_networks(serial=args["serial"])() if script_params["execute_add_network_and_test_ping"] == "True": # add the Wi-Fi network wifi_generic_steps.add_network(ssid=script_params["ap_name"], security=script_params["dut_security"], password=script_params["passphrase"], serial=args["serial"])() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial=args["serial"])() # check we are connected to the correct network. wifi_generic_steps.check_connection_info(serial=args["serial"], SSID=script_params["ap_name"], state='CONNECTED/CONNECTED')() # check connection wifi_generic_steps.ping_gateway(trycount=5, serial=args["serial"])() if script_params["iterate_connect_disconnect"] == "True": for x in xrange(int(script_params["iterations"])): # Turn ON the wifi and check if it is successfully turned ON wifi_generic_steps.set_wifi(serial=args["serial"], state="OFF", use_adb=False)()
wifi_generic_steps.clear_saved_networks(serial=devices[i])() # add the Wi-Fi network wifi_generic_steps.add_network( ssid=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, security=dut_security, password=ddwrt_ap_pass, identity=radius_identity, EAP_method=EAP_method, phase_2_auth=phase_2_auth, user_certificate=user_certificate, ca_certificate=ca_certificates, serial=devices[i])() # wait until the device connects to a wifi network wifi_generic_steps.wait_until_connected(serial=devices[i])() # check we are connected to the correct network. wifi_generic_steps.check_connection_info( serial=devices[i], SSID=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid, state='CONNECTED/CONNECTED')() # check connection wifi_generic_steps.ping_gateway(trycount=trycount, serial=devices[i])() try: # Install APK from the defined path #adb_steps.install_apk(serial = device, apk_path = ftp_server_apk, install_time=60)() # turn display on, if turned off