# Copyright (c) 2013 The Chromium OS Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

AUTHOR = 'wiley, pstew, quiche'
TIME = 'SHORT'
NAME = 'network_WiFi_RoamSuspendSSID.wpa'
TEST_TYPE = 'Server'
DOC = """
This test verifies that the connection manager connects to a
previously connected network on resume from suspend when an
SSID disappears during suspend.

"""

from autotest_lib.server.cros.network import hostap_config


def run(machine):
    wpa_config0 = xmlrpc_security_types.WPAConfig(
            psk='chromeos0',
            wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA)
    wpa_config1 = xmlrpc_security_types.WPAConfig(
            psk='chromeos1',
            wpa_mode=xmlrpc_security_types.WPAConfig.MODE_PURE_WPA)
    ap_config0 = hostap_config.HostapConfig(channel=44,
                                            security_config=wpa_config0)
    ap_config1 = hostap_config.HostapConfig(channel=11,
                                            security_config=wpa_config1)
    job.run_test('network_WiFi_RoamSuspendSSID',
                 tag=NAME.split('.')[1],
                 host=hosts.create_host(machine),
                 raw_cmdline_args=args,
                 additional_params=(ap_config0, ap_config1))


parallel_simple(run, machines)