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 5 import logging 6 import time 7 8 from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes 9 from autotest_lib.server.cros.network import wifi_cell_test_base 10 11 class network_WiFi_RoamSuspendTimeout(wifi_cell_test_base.WiFiCellTestBase): 12 """Tests behavior on resume during which the client has been de-authed. 13 14 This test places the DUT in a suspend-to-RAM state, de-authenticates the 15 sleeping DUT, then makes sure that the DUT detects and corrects this 16 de-authentication on resume. 17 18 """ 19 version = 1 20 21 22 def parse_additional_arguments(self, commandline_args, additional_params): 23 """Hook into super class to take control files parameters. 24 25 @param commandline_args dict of parsed parameters from the autotest. 26 @param additional_params HostapConfig 27 28 """ 29 self._router_conf = additional_params 30 31 32 def run_once(self): 33 """Test body.""" 34 logging.info("- Set up AP, connect.") 35 self.context.configure(self._router_conf) 36 37 client_conf = xmlrpc_datatypes.AssociationParameters( 38 ssid=self.context.router.get_ssid(), 39 security_config=self._router_conf.security_config) 40 self.context.assert_connect_wifi(client_conf) 41 self.context.assert_ping_from_dut() 42 43 # Suspend the DUT then, locally, wait 15 seconds to make sure the 44 # DUT is really asleep before we proceed. Then, deauth the DUT 45 # while it sleeps. 46 logging.info("- Suspend & deauthenticate during suspend.") 47 self.context.client.do_suspend_bg(20) 48 time.sleep(15) 49 self.context.router.deauth_client(self.context.client.wifi_mac) 50 51 # If the DUT realizes that it has been deauthed, then it should 52 # reassociate quickly and the ping below should succeed. 53 logging.info("- Verify that we roam back to same network.") 54 self.context.wait_for_connection(client_conf.ssid) 55 56 self.context.router.deconfig() 57