• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2019 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 = 'timkovich'
6TIME = 'SHORT'
7NAME = 'policy_WiFiPrecedenceServer.connectable_vs_not_connectable'
8TEST_TYPE = 'Server'
9ATTRIBUTES = 'suite:ent-wificell'
10DEPENDENCIES = 'wificell'
11
12DOC = """
13'policy_WiFiPrecedenceServer.connectable_vs_not_connectable' sets up both
14a WPA-PSK and Open network. The client test is given a network policy for
15both networks with AutoConnect=True, but the PSK network is given the wrong
16password.
17
18The open network should connect as the PSK network is inaccessible.
19
20"""
21
22
23from autotest_lib.client.common_lib.cros.network import xmlrpc_security_types
24from autotest_lib.client.cros.enterprise.network_config import NetworkConfig
25from autotest_lib.server.cros.network import hostap_config
26
27
28def run(machine):
29    password = 'chromeos'
30    incorrect_password = 'android'
31    ssid1 = 'Network1'
32    ssid2 = 'Network2'
33    n_mode = hostap_config.HostapConfig.MODE_11N_MIXED
34
35    ap_configs = []
36    ap_configs.append(hostap_config.HostapConfig(
37            channel=5,
38            mode=n_mode,
39            ssid=ssid1))
40
41    wpa_config = xmlrpc_security_types.WPAConfig(
42            psk=password,
43            wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA2,
44            wpa2_ciphers=[xmlrpc_security_types.WPAConfig.CIPHER_CCMP])
45    ap_configs.append(hostap_config.HostapConfig(
46            channel=149,
47            mode=n_mode,
48            ssid=ssid2,
49            security_config=wpa_config))
50
51    # Client network configurations.
52    network1_config = NetworkConfig(ssid1, autoconnect=True)
53    network2_config = NetworkConfig(ssid2,
54                                    security='WPA-PSK',
55                                    password=incorrect_password,
56                                    autoconnect=True)
57
58    host = hosts.create_host(machine)
59    job.run_test('policy_WiFiPrecedenceServer',
60                 raw_cmdline_args=args,
61                 host=host,
62                 ap_configs=ap_configs,
63                 network1_config=network1_config,
64                 network2_config=network2_config,
65                 precedence=1)
66
67
68parallel_simple(run, machines)
69