• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5AUTHOR = 'wiley, pstew, quiche'
6NAME = 'network_WiFi_SimpleConnect.wifi_checkWEP40'
7TIME = 'SHORT'
8TEST_TYPE = 'Server'
9ATTRIBUTES = ('suite:wifi_matfunc, suite:wifi_release, subsystem:wifi')
10DEPENDENCIES = 'wificell'
11
12DOC = """
13This test case verifies that the DUT can connect to an AP using
14WEP both open and shared system authentication and 40-bit
15pre-shared keys.
16"""
17
18
19from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
20from autotest_lib.client.common_lib.cros.network import xmlrpc_security_types
21from autotest_lib.server.cros.network import hostap_config
22
23
24def run(machine):
25    # FYI: D-Bus requires string parameters must be valid UTF-8.
26    wep_keys = ['abcde', # Interpretted as ASCII.
27                'fedcba9876',  # Interpretted as hex.
28                # Mix ASCII characters with a 3-byte UTF-8 character.
29                'ab\xe4\xb8\x89',
30                # Mix different byte length UTF-8 characters.
31                '\xe4\xb8\x89\xc2\xa2']
32    auth_algs = (xmlrpc_security_types.WEPConfig.AUTH_ALGORITHM_OPEN,
33                 xmlrpc_security_types.WEPConfig.AUTH_ALGORITHM_SHARED)
34    configurations = []
35    for auth_algorithm in auth_algs:
36        for i in range(len(wep_keys)):
37            wep_config = xmlrpc_security_types.WEPConfig(
38                    wep_keys,
39                    wep_default_key=i,
40                    auth_algorithm=auth_algorithm)
41            ap_config = hostap_config.HostapConfig(
42                    frequency=2412,
43                    mode=hostap_config.HostapConfig.MODE_11G,
44                    security_config=wep_config)
45            assoc_params = xmlrpc_datatypes.AssociationParameters(
46                    security_config=wep_config)
47            configurations.append((ap_config, assoc_params))
48    host = hosts.create_host(machine)
49    job.run_test('network_WiFi_SimpleConnect',
50                 tag=NAME.split('.')[1],
51                 host=host,
52                 raw_cmdline_args=args,
53                 additional_params=configurations)
54
55
56parallel_simple(run, machines)
57