Exemplo n.º 1
0
    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)()
Exemplo n.º 2
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'])
Exemplo n.º 3
0
if ip_split_01 == ip_split_02:
    print 'IP Successfully assigned'
else:
    print 'IP Change unsuccessful'

# 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 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)()
Exemplo n.º 4
0
 def disconnect_wifi(self, serial):
     wifi_generic_steps.clear_saved_networks(serial=serial)()
Exemplo n.º 5
0
'''initialization '''
args = parse_args()
script_params = args["script_args"]
''' test start '''

# turn display on, if turned off
ui_steps.wake_up_device(serial=args["serial"])()

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

# 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"],
Exemplo n.º 6
0
    serial=serial,
    channel_no=channel_no,
    ipv4_class=ipv4_class)()

for i in range(len(device_list)):
    #turn display on, if turned off
    ui_steps.wake_up_device(serial=devices[i])()

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

    # go to home screen
    ui_steps.press_home(serial=devices[i])()

    # make sure there are no saved networks
    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])()