1# Copyright 2015 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 = 'samueltan, ejcaruso' 6NAME = 'network_WiFi_ReconnectInDarkResume.Stress' 7TIME = 'MEDIUM' 8TEST_TYPE = 'Server' 9DEPENDENCIES = 'servo_state:WORKING, wificell, lucidsleep' 10ATTRIBUTES = 'suite:wifi_lucidsleep' 11 12DOC = """ 13This test verifies that the DUT successfully reconnects to a network in dark 14resume after getting disconnected from that same network while suspended. 15This test simulates the cases where multiple disconnect and SSID appearance 16events take place over a single period of suspension. The test is conducted as 17follows: 18 191) AP ("AP 1") is brought up, and DUT connects to it 202) AP 1 is brought down, disconnecting the DUT from it 213) Another AP ("AP 2") is brought up, and DUT connects to it 224) DUT suspends while connected to AP 2 235) AP 2 is brought down, disconnecting the DUT from it while suspended 246) AP 2 is brought up again 257) Repeat steps 5-6 another 4 times (for 5 total iterations) 268) The DUT is woken from suspend 279) Verify that the DUT is connected to AP 2 upon resuming from suspend 28 29We verify the connectivity status of the DUT on resume by parsing shill logs, 30since the delays involved in waking a DUT from suspend using autotest framework 31make real-time checks inaccurate. 32 33Note: this test suspends the DUT for long periods of time, which may lead to 34flakiness if the ssh connection from the autotest host to the DUT has a 35ServerAliveInterval setting that is too low (i.e. less than the total suspend 36time). This test was verified stable with the ServerAliveInterval set to 900. 37""" 38 39from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes 40from autotest_lib.client.common_lib.cros.network import xmlrpc_security_types 41from autotest_lib.server.cros.network import hostap_config 42from autotest_lib.server import utils 43 44args_dict = utils.args_to_dict(args) 45servo_args = hosts.CrosHost.get_servo_arguments(args_dict) 46 47def run(machine): 48 host = hosts.create_host(machine, servo_args=servo_args) 49 job.run_test('network_WiFi_ReconnectInDarkResume', 50 host=host, 51 tag=NAME.split('.')[1], 52 disconnect_before_suspend=False, 53 reconnect_to_same_ap=True, 54 num_iterations=5, 55 raw_cmdline_args=args) 56 57parallel_simple(run, machines) 58