1# Copyright (c) 2014 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 = 'asnagarajan, wiley, jabele'
6NAME = 'network_WiFi_ChaosLongConnect.suspend'
7TIME = 'LONG'
8TEST_TYPE = 'server'
9
10DOC = """
11This script iterates through all of the access points in the AP compatibility
12lab and has a chrome device connect to each in series. This test must be
13performed in the AP compatibility lab. This test would hold the connection with
14AP and performs performs a suspend resume cycle and check the liveliness of the
15connection to the AP.
16"""
17
18from autotest_lib.server.cros.ap_configurators import ap_spec
19from autotest_lib.server.cros.chaos_lib import chaos_runner
20from autotest_lib.server.cros.network import connection_worker
21
22def run_chaos_wpa2psk(machine):
23    host = hosts.create_host(machine)
24    # Test with WPA2PSK on both 2.4 and 5 GHz bands
25    ap_specs = [ap_spec.APSpec(security=ap_spec.SECURITY_TYPE_WPA2PSK,
26                               band=ap_spec.BAND_2GHZ),
27                ap_spec.APSpec(security=ap_spec.SECURITY_TYPE_WPA2PSK,
28                               band=ap_spec.BAND_5GHZ),
29                # Non-US models, which are all static
30                ap_spec.APSpec(security=ap_spec.SECURITY_TYPE_WPA2PSK,
31                               band=ap_spec.BAND_5GHZ,
32                               channel=48,
33                               configurator_type=ap_spec.CONFIGURATOR_STATIC)]
34    conn_worker = connection_worker.ConnectionSuspend(suspend_sec=30)
35    for spec in ap_specs:
36        runner = chaos_runner.ChaosRunner(
37                'network_WiFi_ChaosLongConnect', host, spec)
38        runner.run(job, conn_worker=conn_worker)
39
40
41parallel_simple(run_chaos_wpa2psk, machines)
42