blob: 89c58423a9b63128975bc44483d0bb1c3461b1d7 [file] [log] [blame]
# 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 = "Chrome OS Team"
NAME = "network_WiFiChaosPSK"
TIME = "LONG"
TEST_CATEGORY = "Functional"
TEST_CLASS = "network"
TEST_TYPE = "server"
DOC = """
This script iterates through all of the access points in the Chaos lab that
support the PSK security. This test must be run in the Chaos lab.
"""
from autotest_lib.server import packet_capture
from autotest_lib.server.cros.chaos_ap_configurators import ap_batch_locker
from autotest_lib.server.cros.chaos_lib import chaos_base_test
def wifi_chaos_psk(machine):
host = hosts.create_host(machine)
with packet_capture.PacketCaptureManager() as capturer:
capturer.allocate_packet_capture_machine()
helper = chaos_base_test.WiFiChaosConnectionTest(host, capturer)
helper.psk_password = 'chromeos'
psk_security = helper.generic_ap.security_type_wpapsk
with ap_batch_locker.ApBatchLockerManager(
dict(securities=[psk_security])) as batch_locker:
while batch_locker.has_more_aps():
# Specify batch_size=<number>. Default is 15.
ap_batch = batch_locker.get_ap_batch()
if not ap_batch:
logging.info('No more APs to test.')
break
# Power down all of the APs because some can get grumpy
# if they are configured several times and remain on.
helper.power_down_aps(ap_batch)
# For dual-band AP, we can only configure and test one band
# at a time. Hence the use of nested for loops below.
for band, channel in helper.get_bands_and_channels():
for ap_info in helper.config_aps(
ap_batch, band, channel, psk_security):
# Group test output by SSID
mod_ssid = ap_info['ssid'].replace(' ', '_')
job.run_test('network_WiFiChaosPSK', host=host,
helper=helper, ap_info=ap_info, tries=10,
disable_sysinfo=False, tag=mod_ssid)
parallel_simple(wifi_chaos_psk, machines)