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