Home | History | Annotate | Download | only in network_WiFi_SimpleConnect
      1 # Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 AUTHOR = 'wiley, pstew, quiche'
      6 NAME = 'network_WiFi_SimpleConnect.wifi_checkWEP104'
      7 TIME = 'SHORT'
      8 TEST_TYPE = 'Server'
      9 ATTRIBUTES = ('suite:wifi_correctness_cros_core, suite:wifi_matfunc, '
     10               'suite:wifi_matfunc_bcm4371, suite:wifi_release, subsystem:wifi,'
     11               'suite:android_wifi_connect')
     12 DEPENDENCIES = 'wificell'
     13 
     14 DOC = """
     15 This test case verifies that the DUT can connect to an AP using WEP both open
     16 and shared system authentication and 104-bit pre-shared keys.
     17 """
     18 
     19 
     20 from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
     21 from autotest_lib.client.common_lib.cros.network import xmlrpc_security_types
     22 from autotest_lib.server.cros.network import hostap_config
     23 
     24 
     25 
     26 def run(machine):
     27     # FYI: D-Bus requires string parameters must be valid UTF-8.
     28     wep_keys = ['0123456789abcdef0123456789',
     29                 'mlk:ihgfedcba',
     30                 # Mix ASCII characters with a 3-byte UTF-8 characters.
     31                 'd\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\xe5\x9b\x9b',
     32                 # Mix different byte length UTF-8 characters.
     33                 '\xe4\xb8\x80\xe4\xba\x8c\xe4\xb8\x89\xc2\xa2\xc2\xa3']
     34     auth_algs = (xmlrpc_security_types.WEPConfig.AUTH_ALGORITHM_OPEN,
     35                  xmlrpc_security_types.WEPConfig.AUTH_ALGORITHM_SHARED)
     36     configurations = []
     37     for auth_algorithm in auth_algs:
     38         for i in range(len(wep_keys)):
     39             wep_config = xmlrpc_security_types.WEPConfig(
     40                     wep_keys,
     41                     wep_default_key=i,
     42                     auth_algorithm=auth_algorithm)
     43             ap_config = hostap_config.HostapConfig(
     44                     frequency=2412,
     45                     mode=hostap_config.HostapConfig.MODE_11G,
     46                     security_config=wep_config)
     47             assoc_params = xmlrpc_datatypes.AssociationParameters(
     48                     security_config=wep_config)
     49             configurations.append((ap_config, assoc_params))
     50     host = hosts.create_host(machine)
     51     job.run_test('network_WiFi_SimpleConnect',
     52                  tag=NAME.split('.')[1],
     53                  host=host,
     54                  raw_cmdline_args=args,
     55                  additional_params=configurations)
     56 
     57 
     58 parallel_simple(run, machines)
     59