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_checkHiddenWPA'
7TIME = 'SHORT'
8TEST_TYPE = 'Server'
9ATTRIBUTES = ('suite:wifi_correctness_cros_core, suite:wifi_matfunc, '
10              'suite:wifi_matfunc_bcm4371, suite:wifi_release')
11SUITE = ('wifi_matfunc, wifi_matfunc_bcm4371, '
12         'wifi_correctness_cros_core, wifi_release')
13DEPENDENCIES = 'wificell'
14
15DOC = """
16This test verifies that we can connect to hidden WPA networks.  It checks
17several common configurations of hidden networks such as pure WPA/WPA2 and
18mixed WPA/WPA2 networks.
19"""
20
21from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
22from autotest_lib.client.common_lib.cros.network import xmlrpc_security_types
23from autotest_lib.server.cros.network import hostap_config
24
25
26def get_configurations():
27    wpa_configs = [
28            xmlrpc_security_types.WPAConfig(
29                    psk='chromeos',
30                    wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA,
31                    wpa_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_TKIP]),
32            xmlrpc_security_types.WPAConfig(
33                    psk='chromeos',
34                    wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA,
35                    wpa_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_TKIP,
36                                 xmlrpc_security_types.WPAConfig.CIPHER_CCMP]),
37            xmlrpc_security_types.WPAConfig(
38                    psk='chromeos',
39                    wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA2,
40                    wpa2_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_CCMP]),
41            xmlrpc_security_types.WPAConfig(
42                    psk='chromeos',
43                    wpa_mode=xmlrpc_security_types.WPAConfig.MODE_MIXED_WPA,
44                    wpa_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_TKIP,
45                                 xmlrpc_security_types.WPAConfig.CIPHER_CCMP],
46                    wpa2_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_CCMP]),
47    ]
48    for wpa_config in wpa_configs:
49        ap_config = hostap_config.HostapConfig(
50                hide_ssid=True,
51                frequency=2412,
52                mode=hostap_config.HostapConfig.MODE_11G,
53                security_config=wpa_config)
54        assoc_params = xmlrpc_datatypes.AssociationParameters(
55                is_hidden=True,
56                security_config=wpa_config)
57        configurations = [(ap_config, assoc_params)]
58    return configurations
59
60
61def run(machine):
62    host = hosts.create_host(machine)
63    job.run_test('network_WiFi_SimpleConnect',
64                 tag=NAME.split('.')[1],
65                 host=host,
66                 raw_cmdline_args=args,
67                 additional_params=get_configurations())
68
69
70parallel_simple(run, machines)
71