Example #1
0
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'])
    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,
    wifi_password=ddwrt_ap_pass,
    radius_ip=radius_ip,
    radius_secret=radius_secret,
    new_ssid=ddwrt_ap_name if str(new_ssid).lower() == "none" else new_ssid,
    channel_bw=channel_bw,
    interface5ghz=interface5ghz,
    serial=serial,
    channel_no=channel_no,
    ipv4_class=reset_ssh_ip)()
Example #3
0
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 a 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')()

#verify in logcat for the message
wifi_generic_steps.check_lease_time(serial=serial,
                                    dhcp_lease_time=dhcp_lease_time)()

#ping the gateway
wifi_generic_steps.ping_gateway(serial=serial)()

##### test end #####
wifi_generic_steps.clear_saved_networks(serial = serial)()

# add 1st Wi-Fi network
wifi_generic_steps.add_network(ssid = ref_ap_name,
                               security = ref_ap_security,
                               password = ref_ap_pw,
                               serial = serial)()
for x in range(0, 11):

    # wait until the device connects to a wifi network
    wifi_generic_steps.wait_until_connected(serial=serial)()

    finish = time.time() + int(duration)
    print "Runnign stability test for " + duration + " seconds"
    while finish > time.time():
        # check we are connected to the correct network.
        wifi_generic_steps.check_connection_info(serial=serial,
                                                 SSID=ref_ap_name,
                                                 state='CONNECTED/CONNECTED')()

        wifi_generic_steps.ping_gateway(serial=serial, trycount="30")()

        print "Connection status OK at " + str(finish - time.time())

    print 'Opening web page repeated count = %d' %(x)
    adb_steps.command(serial=serial, command="am start -a android.intent.action.VIEW -d http://www.google.com")()
    time.sleep(20)
    adb_steps.command(serial=serial, command="am force-stop com.android.chrome")()

    ##### test end #####
Example #5
0
    # 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)()

            time.sleep(3)

            # Check for the connection status
            wifi_generic_steps.check_connection_info(
                serial=args["serial"], state='DISCONNECTED/DISCONNECTED')()

            # Turn OFF the wifi and check if it is successfully turned turned OFF
Example #6
0
        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
    ui_steps.wake_up_device(serial=device)()

    # ensure the device is unlocked
    ui_steps.unlock_device(serial=device, pin=wifi_defaults.wifi['pin'])()

    # go to home screen
    ui_steps.press_home(serial=device)()

    #Launch  menu
Example #7
0
                                                 encryption=encryption,
                                                 serial=serial)()
wifi_generic_steps.check_wifi_state_disconnected(ap_name=ap_name_virt_2,
                                                 security='wpa',
                                                 encryption=encryption,
                                                 serial=serial)()

# WiFI on
wifi_generic_steps.set_wifi(serial=serial, state="ON")()
# 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=ap_name_virt_1,
                                         state='CONNECTED/CONNECTED')()
wifi_generic_steps.ping_gateway(serial=serial, trycount=10, timeout=30)()

count = 0
while count < int(iterations):
    if int(iterations) > 1:
        print "============================ iteration: {} =======================".format(
            count + 1)
    # config AP2 virt ON
    ap_steps.setup_virtual_interface(True,
                                     security,
                                     encryption=encryption,
                                     wifi_password=ap_pass,
                                     radius_ip=radius_ip,
                                     radius_secret=radius_secret,
                                     new_ssid=ap_name_virt_2,
                                     interface5ghz=interface5ghz_ap2,