| OLD | NEW |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. | 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import common, datetime, fnmatch, logging, os, re, string, threading, time | 5 import common, datetime, fnmatch, logging, os, re, string, threading, time |
| 6 | 6 |
| 7 from autotest_lib.server import autotest, hosts, subcommand | 7 from autotest_lib.server import autotest, hosts, subcommand |
| 8 from autotest_lib.server import site_bsd_router | 8 from autotest_lib.server import site_bsd_router |
| 9 from autotest_lib.server import site_linux_router | 9 from autotest_lib.server import site_linux_router |
| 10 from autotest_lib.server import site_host_attributes | 10 from autotest_lib.server import site_host_attributes |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 | 184 |
| 185 def __get_wlan_devs(self, host): | 185 def __get_wlan_devs(self, host): |
| 186 ret = [] | 186 ret = [] |
| 187 result = host.run("%s dev" % self.client_cmd_iw) | 187 result = host.run("%s dev" % self.client_cmd_iw) |
| 188 current_if = None | 188 current_if = None |
| 189 for line in result.stdout.splitlines(): | 189 for line in result.stdout.splitlines(): |
| 190 ifmatch = re.search("Interface (\S*)", line) | 190 ifmatch = re.search("Interface (\S*)", line) |
| 191 if ifmatch is not None: | 191 if ifmatch is not None: |
| 192 current_if = ifmatch.group(1) | 192 current_if = ifmatch.group(1) |
| 193 elif 'type managed' in line and current_if: | 193 elif ('type managed' in line or 'type IBSS' in line) and current_if: |
| 194 ret.append(current_if) | 194 ret.append(current_if) |
| 195 logging.info("Found wireless interfaces %s" % str(ret)) | 195 logging.info("Found wireless interfaces %s" % str(ret)) |
| 196 return ret | 196 return ret |
| 197 | 197 |
| 198 | 198 |
| 199 def __server_discover_commands(self, server): | 199 def __server_discover_commands(self, server): |
| 200 self.server_cmd_netperf = server.get('cmd_netperf_client', | 200 self.server_cmd_netperf = server.get('cmd_netperf_client', |
| 201 '/usr/bin/netperf') | 201 '/usr/bin/netperf') |
| 202 self.server_cmd_netserv = server.get('cmd_netperf_server', | 202 self.server_cmd_netserv = server.get('cmd_netperf_server', |
| 203 '/usr/bin/netserver') | 203 '/usr/bin/netserver') |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 """ Connect client to AP/router """ | 370 """ Connect client to AP/router """ |
| 371 | 371 |
| 372 script_client_file = self.install_script('site_wlan_connect.py', | 372 script_client_file = self.install_script('site_wlan_connect.py', |
| 373 'site_wlan_wait_state.py') | 373 'site_wlan_wait_state.py') |
| 374 | 374 |
| 375 flags = [] | 375 flags = [] |
| 376 if params.get('debug', True): | 376 if params.get('debug', True): |
| 377 flags.append('--debug') | 377 flags.append('--debug') |
| 378 if params.get('hidden', False): | 378 if params.get('hidden', False): |
| 379 flags.append('--hidden') | 379 flags.append('--hidden') |
| 380 if 'mode' in params: |
| 381 flags.append('--mode=%s' % params['mode']) |
| 380 | 382 |
| 381 result = self.client.run('python "%s" %s "%s" "%s" "%s" "%d" "%d"' % | 383 result = self.client.run('python "%s" %s "%s" "%s" "%s" "%d" "%d"' % |
| 382 (script_client_file, | 384 (script_client_file, |
| 383 ' '.join(flags), | 385 ' '.join(flags), |
| 384 params.get('ssid', self.wifi.get_ssid()), | 386 params.get('ssid', self.wifi.get_ssid()), |
| 385 params.get('security', ''), | 387 params.get('security', ''), |
| 386 params.get('psk', ''), | 388 params.get('psk', ''), |
| 387 params.get('assoc_timeout', self.deftimeout), | 389 params.get('assoc_timeout', self.deftimeout), |
| 388 params.get('config_timeout', self.deftimeout))).stdout.rstrip() | 390 params.get('config_timeout', self.deftimeout))).stdout.rstrip() |
| 389 | 391 |
| (...skipping 905 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1295 except error.TestFail: | 1297 except error.TestFail: |
| 1296 if 'expect_failure' in testcase: | 1298 if 'expect_failure' in testcase: |
| 1297 self.expect_failure(name, testcase['expect_failure']) | 1299 self.expect_failure(name, testcase['expect_failure']) |
| 1298 else: | 1300 else: |
| 1299 raise | 1301 raise |
| 1300 except Exception, e: | 1302 except Exception, e: |
| 1301 if 'expect_failure' in testcase: | 1303 if 'expect_failure' in testcase: |
| 1302 self.expect_failure(name, testcase['expect_failure']) | 1304 self.expect_failure(name, testcase['expect_failure']) |
| 1303 else: | 1305 else: |
| 1304 raise | 1306 raise |
| OLD | NEW |