Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Unified Diff: server/site_wifitest.py

Issue 6689026: Add a route backwards from the DUT to the test host (Closed) Base URL: http://git.chromium.org/git/autotest.git@master
Patch Set: Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « server/site_host_route.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/site_wifitest.py
diff --git a/server/site_wifitest.py b/server/site_wifitest.py
index e05f303334b749fa3395df7f5d313fd017f42114..1274e36c3d79d9cd59ec8eb5b9a86aad9be3fa4d 100644
--- a/server/site_wifitest.py
+++ b/server/site_wifitest.py
@@ -9,6 +9,7 @@ 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_host_route
from autotest_lib.server import site_eap_certs
from autotest_lib.server import test
from autotest_lib.client.common_lib import error
@@ -154,6 +155,7 @@ class WiFiTest(object):
self.__client_discover_commands(client)
self.profile_save({})
self.firewall_rules = []
+ self.host_route_args = {}
# interface name on client
self.client_wlanif = client.get('wlandev',
@@ -1230,6 +1232,10 @@ class WiFiTest(object):
# Must get 'ca_certificate', 'client-certificate' and 'client-key'.
cert_pathnames = params.get('files', {})
+ # Set up a host route on the DUT so that the VPN doesn't prevent us
thutt 2011/04/01 21:43:06 Can you make this comment more clear? It's rather
+ # from having IP traffic from it return to us
thutt 2011/04/01 21:43:06 This comment too. In my implementation, I split th
Paul Stewart 2011/04/01 21:52:45 Feel free to move it where you'd like, and change
+ __add_host_route(self.client)
+
if self.vpn_kind is None:
raise error.TestFail('No VPN kind specified for this test.')
elif self.vpn_kind == 'openvpn':
@@ -1268,6 +1274,28 @@ class WiFiTest(object):
'for VPN kind (%s)' % self.vpn_kind)
self.vpn_kind = None
+ __del_host_route(self.client)
+
+ def __add_host_route(self, host):
+ # What is the local address we use to get to the test host?
+ local_ip = site_host_route.LocalHostRoute(host.ip).route_info["src"]
+
+ # How does the test host currently get to this local address?
+ host_route = site_host_route.RemoteHostRoute(host, local_ip).route_info
+
+ # Flatten the returned dict into a single string
+ route_args = " ".join(" ".join(x) for x in host_route.iteritems())
+
+ self.host_route_args[host.ip] = "%s %s" % (local_ip, route_args)
+ host.run("ip route add %s" % self.host_route_args[host.ip])
+
+ def __del_host_route(self, host):
+ if host.ip not in self.host_route_args:
+ return
+
+ host.run("ip route del %s" % self.host_route_args.pop(host.ip))
+
+
class HelperThread(threading.Thread):
# Class that wraps a ping command in a thread so it can run in the bg.
def __init__(self, client, cmd):
« no previous file with comments | « server/site_host_route.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698