blob: dfa481f74bdb0de337ea0ad8b4986a7e66a36fb5 [file] [log] [blame]
# Copyright (c) 2011 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"
TIME = "LONG"
NAME = "NetworkWiFi"
SUITE = "network_wifi"
TEST_CATEGORY = "Stress"
TEST_CLASS = "suite"
TEST_TYPE = "server"
DOC = """
This test suite runs automated WiFi enclosure tests that should all pass.
WiFiMatFunc and WiFiSecMat make up a suite of 3-machine tests to validate
basic WiFi functionality. One client, one server, and one programmable WiFi
AP/Router are required (either off-the-shelf with a network-accesible CLI or a
Linux/BSD system with a WiFi card that supports HostAP functionality).
Configuration information to run_test:
server - the IP address of the server (automatically filled in)
client - the IP address of the client (automatically filled in)
router - the IP address of the WiFi AP/Router and the names of the
wifi and wired devices to configure
"""
import os
import time
from autotest_lib.client.common_lib import error
from autotest_lib.server import site_host_attributes
from autotest_lib.server import site_wifitest
from autotest_lib.server.hosts import ssh_host
# Time in seconds to leave power off during power cycle.
POWER_CYCLE_TIME_SECS = 1
# Timeout in seconds for waiting for APs to come back from power cycle.
POWER_CYCLE_TIMEOUT_SECS = 120
# Time to wait between each ssh check to
POWER_CYCLE_SLEEP_SECS = 30
def run_server_tests(machine):
client_attributes = site_host_attributes.HostAttributes(machine)
client = hosts.create_host(machine)
if client.has_power():
client.power_on()
else:
raise error.TestNAError('No power switch configured.')
# Power cycle the entire unit prior to testing. Not expecting any exceptions,
# but shouldn't leave power off no matter what happens.
try:
client.power_off()
time.sleep(POWER_CYCLE_TIME_SECS)
finally:
client.power_on()
# Wait for devices to come back.
router = ssh_host.SSHHost(client_attributes.router_addr)
server = ssh_host.SSHHost(client_attributes.server_addr)
timeout = time.time() + POWER_CYCLE_TIMEOUT_SECS
while True:
time.sleep(POWER_CYCLE_SLEEP_SECS)
if router.is_up() and server.is_up():
break
if time.time() > timeout:
raise error.TestFail('Network hardware did not come back after power '
'cycle.')
args.append('router_addr=' + str(client_attributes.router_addr))
args.append('server_addr=' + str(client_attributes.server_addr))
site_wifitest.run_test_dir('network_WiFiSecMat' , job, args, machine)
site_wifitest.run_test_dir('network_WiFiMatFunc', job, args, machine)
site_wifitest.run_test_dir('network_WiFiManager', job, args, machine)
site_wifitest.run_test_dir('network_VPN' , job, args, machine)
parallel_simple(run_server_tests, machines)