1# Copyright (c) 2018 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 5from autotest_lib.server import autotest 6from autotest_lib.server import site_linux_system 7from autotest_lib.server.cros.network import hostap_config 8from autotest_lib.server.cros.network import wifi_cell_test_base 9 10 11class policy_WiFiAutoconnectServer(wifi_cell_test_base.WiFiCellTestBase): 12 version = 1 13 14 15 def parse_additional_arguments(self, commandline_args, additional_params): 16 """ 17 Hook into super class to take control files parameters. 18 19 @param commandline_args: dict of parsed parameters from the autotest. 20 @param additional_params: HostapConfig object. 21 22 """ 23 self._ap_config = additional_params 24 25 26 def run_once(self, host, autoconnect=None): 27 """ 28 Set up AP then run the client side autoconnect tests. 29 30 @param host: A host object representing the DUT. 31 @param autoconnect: Autoconnect setting for network policy. 32 33 """ 34 self.context.router.require_capabilities( 35 [site_linux_system.LinuxSystem.CAPABILITY_MULTI_AP]) 36 self.context.router.deconfig() 37 self.context.configure(self._ap_config, multi_interface=True) 38 39 client_at = autotest.Autotest(host) 40 41 client_at.run_test('policy_WiFiAutoconnect', 42 ssid=self.context.router.get_ssid(instance=0), 43 autoconnect=autoconnect, 44 check_client_result=True) 45 46 self.context.router.deconfig() 47