1# Copyright (c) 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 = 'krisr, tienchang, bmahadev'
6NAME = 'network_WiFi_SuspendStress.24HT40'
7TIME = 'MEDIUM'
8TEST_TYPE = 'Server'
9DEPENDENCIES = 'servo, wificell'
10ATTRIBUTES = 'suite:wifi_matfunc, suite:wifi_matfunc_bcm4371'
11
12DOC = """
13This test uses servo to simulate lid close and open events and checks that the
14wifi adapter is brought back up and connects to a 802.11n network on 2.4 GHz.
15"""
16
17from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
18from autotest_lib.server.cros.network import hostap_config
19from autotest_lib.server import utils
20
21args_dict = utils.args_to_dict(args)
22servo_args = hosts.CrosHost.get_servo_arguments(args_dict)
23
24def run(machine):
25    try:
26        host = hosts.create_host(machine, servo_args=servo_args)
27    except IOError:
28        # We probably failed to connect to the servo. That's probably
29        # because the cell doesn't have a servo.
30        #
31        # Ideally, we'd raise TestNAError here, and be done. But the
32        # test isn't actually running yet. So we instantiate a host
33        # without servo, and let the network_WiFi_SuspendStress
34        # instance report the TestNAError.
35        host = hosts.create_host(machine)
36
37    caps = [hostap_config.HostapConfig.N_CAPABILITY_GREENFIELD,
38            hostap_config.HostapConfig.N_CAPABILITY_HT40]
39    n = hostap_config.HostapConfig.MODE_11N_PURE
40    configurations = [(hostap_config.HostapConfig(frequency=2437, mode=n,
41                                                  n_capabilities=caps),
42                       xmlrpc_datatypes.AssociationParameters())]
43    job.run_test('network_WiFi_SuspendStress',
44                 host=host,
45                 tag=NAME.split('.')[1],
46                 suspends=5,
47                 raw_cmdline_args=args,
48                 additional_params=configurations)
49
50parallel_simple(run, machines)
51