Add ping to IBSS mode tests
Determine what the router IP address is, and allow tests
to ping the router directly if in IBSS mode
BUG=n0ne
TEST=Run both "normal" MatFunc and IBSS tests. Make sure "router"
parameter fails in non-IBSS
Change-Id: Ic177e335b69699c4220008195d87b6df459e3b6e
Reviewed-on: http://gerrit.chromium.org/gerrit/1937
Reviewed-by: Paul Stewart <pstew@chromium.org>
Tested-by: Paul Stewart <pstew@chromium.org>
diff --git a/server/site_linux_router.py b/server/site_linux_router.py
index ce1051d..90cc857 100644
--- a/server/site_linux_router.py
+++ b/server/site_linux_router.py
@@ -34,7 +34,6 @@
# Router host.
self.router = host
-
# hostapd configuration persists throughout the test, subsequent
# 'config' commands only modify it.
self.defssid = defssid
@@ -294,7 +293,9 @@
addr = map(int, addr_str.split('.'))
mask_bits = (-1 << (32-int(bits))) & 0xffffffff
mask = [(mask_bits >> s) & 0xff for s in range(24, -1, -8)]
- if idx == 'netmask':
+ if idx == 'local':
+ return addr_str
+ elif idx == 'netmask':
return '.'.join(map(str, mask))
elif idx == 'broadcast':
offset = [m ^ 0xff for m in mask]
@@ -407,6 +408,13 @@
self.station_config(params)
+ def get_wifi_ip(self):
+ if self.apmode:
+ raise error.TestFail("In AP mode, router has no IP address")
+ else:
+ self.station_local_addr('local')
+
+
def deconfig(self, params):
""" De-configure the AP (will also bring wlan and the bridge down) """
diff --git a/server/site_tests/network_WiFiMatFunc/011CheckIBSS b/server/site_tests/network_WiFiMatFunc/011CheckIBSS
index e8dc501..51a49e8 100644
--- a/server/site_tests/network_WiFiMatFunc/011CheckIBSS
+++ b/server/site_tests/network_WiFiMatFunc/011CheckIBSS
@@ -11,7 +11,7 @@
# There's a delay before the IBSS service becomes ready
[ "sleep", { "time": "5" } ],
[ "connect", { "security":"none", "mode":"adhoc" } ],
- # [ "client_ping", { "count":"10" } ],
+ [ "client_ping", { "count":"10", "dest":"router" } ],
[ "destroy" ],
],
}
diff --git a/server/site_wifitest.py b/server/site_wifitest.py
index b9bee30..04f3bb0 100644
--- a/server/site_wifitest.py
+++ b/server/site_wifitest.py
@@ -762,7 +762,17 @@
def client_ping(self, params):
""" Ping the server from the client """
- ping_ip = params.get('ping_ip', self.server_wifi_ip)
+ if 'ping_ip' in params:
+ ping_ip = params['ping_ip']
+ else:
+ ping_dest = params.get('dest', 'server')
+ if ping_dest == 'server':
+ ping_ip = self.server_wifi_ip
+ elif ping_dest == 'router':
+ ping_ip = self.wifi.get_wifi_ip()
+ else:
+ raise error.TestFail('Unknown ping destination "%s"' %
+ ping_dest)
count = params.get('count', self.defpingcount)
# set timeout for 3s / ping packet
result = self.client.run("ping %s %s" % \