Index: server/site_wifitest.py |
diff --git a/server/site_wifitest.py b/server/site_wifitest.py |
index a358457366f035f5b9968fe72583cbfb0a9a12da..045408060e415a8e190c2c63f8c63bf05d38a5b6 100644 |
--- a/server/site_wifitest.py |
+++ b/server/site_wifitest.py |
@@ -1,4 +1,5 @@ |
-# Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
+ |
+# Copyright (c) 2010, 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. |
@@ -7,6 +8,7 @@ import common, datetime, fnmatch, logging, os, re, string, threading, time |
from autotest_lib.server import autotest, hosts, subcommand |
from autotest_lib.server import site_bsd_router |
from autotest_lib.server import site_linux_router |
+from autotest_lib.server import site_linux_server |
from autotest_lib.server import site_host_attributes |
from autotest_lib.server import site_eap_certs |
from autotest_lib.server import test |
@@ -54,6 +56,8 @@ class WiFiTest(object): |
server_iperf run iperf on the server to the client |
client_netperf run netperf on the client to the server |
server_netperf run netperf on the server to the client |
+ vpn_launch_client launch a VPN client to connect with the |
+ VPN server |
Steps that are done on the client or server machine are implemented in |
this class. Steps that are done on the wifi router are implemented in |
@@ -77,6 +81,14 @@ class WiFiTest(object): |
self.cur_security = None; |
router = config['router'] |
+ # |
+ # The server machine may be multi-homed or only on the wifi |
+ # network. When only on the wifi net we suppress server_* |
+ # requests since we cannot initiate them from the control machine. |
+ # |
+ server = config['server'] |
+ # NB: server may not be reachable on the control network |
+ |
self.router = hosts.create_host(router['addr']) |
# NB: truncate SSID to 32 characters |
self.defssid = self.__get_defssid(router['addr'])[0:32] |
@@ -116,13 +128,6 @@ class WiFiTest(object): |
self.client_wifi_device_path = None # client's flimflam wifi path |
self.client_installed_scripts = {} |
- # |
- # The server machine may be multi-homed or only on the wifi |
- # network. When only on the wifi net we suppress server_* |
- # requests since we cannot initiate them from the control machine. |
- # |
- server = config['server'] |
- # NB: server may not be reachable on the control network |
if 'addr' in server: |
self.server = hosts.create_host(server['addr']) |
self.server_at = autotest.Autotest(self.server) |
@@ -134,6 +139,10 @@ class WiFiTest(object): |
# NB: wifi address must be set if not reachable from control |
self.server_wifi_ip = server['wifi_addr'] |
+ # hosting_server is a machine which hosts network services, |
+ # such as VPN. |
+ self.hosting_server = site_linux_server.LinuxServer(self.server, server) |
+ |
# potential bg thread for ping untilstop |
self.ping_thread = None |
@@ -262,6 +271,8 @@ class WiFiTest(object): |
func = getattr(self, method, None) |
if func is None: |
func = getattr(self.wifi, method, None) |
+ if func is None: |
+ func = getattr(self.hosting_server, method, None) |
if func is not None: |
try: |
func(params) |
@@ -359,8 +370,10 @@ class WiFiTest(object): |
system = self.router |
elif systemname == 'client': |
system = self.client |
+ elif systemname == 'server': |
+ system = self.server |
else: |
- raise error.TestFail('install_files: Must specify router or client') |
+ raise error.TestFail('install_files: Must specify router, server or client') |
for name,contents in params.get('files', {}).iteritems(): |
self.insert_file(system, name, contents) |
@@ -1167,6 +1180,19 @@ class WiFiTest(object): |
system.run('date -u %s' % |
datetime.datetime.utcnow().strftime(datefmt)) |
+ def vpn_launch_client(self, params): |
Paul Stewart
2011/03/03 23:18:42
I suggest you call these "openvpn_*" instead of "v
|
+ result = self.client.run('modprobe tun'); |
+ # connect-vpn openvpn <name> <host> <domain> <cafile> <certfile> |
+ result = self.client.run('%s/test/connect-vpn openvpn ' |
+ 'vpn-name 192.168.2.254 vpn-domain ' |
+ '/tmp/ca.crt ' |
+ '/tmp/client.crt ' |
+ '/tmp/client.key ' % |
+ self.client_cmd_flimflam_lib) |
+ |
+ def vpn_kill_client(self, params): |
+ """ Kill the VPN client. """ |
+ self.server.run("pkill openvpn") |
class HelperThread(threading.Thread): |
# Class that wraps a ping command in a thread so it can run in the bg. |