[Interop Lab] Catch timeout exception
Handle timeout exception so the test does not exit without proper
cleanup including powering OFF APs.
BUG=chromium:918931
TEST=Tested against an AP in the lab.
Change-Id: I0a04508edf3f91448c550b82186feb192ed71431
Reviewed-on: https://chromium-review.googlesource.com/1394756
Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com>
Tested-by: Harpreet Grewal <harpreet@chromium.org>
Reviewed-by: Shijin Abraham <shijinabraham@google.com>
diff --git a/server/cros/network/chaos_clique_utils.py b/server/cros/network/chaos_clique_utils.py
index cf63441..5536b4c 100644
--- a/server/cros/network/chaos_clique_utils.py
+++ b/server/cros/network/chaos_clique_utils.py
@@ -286,15 +286,22 @@
freq = ap_spec_module.FREQUENCY_TABLE[ap_spec.channel]
wifi_if = capturer.get_wlanif(freq, 'managed')
capturer.host.run('%s link set %s up' % (capturer.cmd_ip, wifi_if))
+
+ logging.info("Scanning for network ssid: %s", ssid)
# We have some APs that need a while to come on-line
- networks = utils.poll_for_condition(
- condition=lambda: capturer.iw_runner.wait_for_scan_result(
- wifi_if,
- ssids=[ssid],
- wait_for_all=True),
- timeout=300,
- sleep_interval=35,
- desc='Timed out getting IWBSSes')
+ networks = list()
+ try:
+ networks = utils.poll_for_condition(
+ condition=lambda: capturer.iw_runner.wait_for_scan_result(
+ wifi_if,
+ ssids=[ssid],
+ wait_for_all=True),
+ timeout=300,
+ sleep_interval=35,
+ desc='Timed out getting IWBSSes')
+ except utils.TimeoutError:
+ pass
+
capturer.remove_interface(wifi_if)
return networks