| 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, fnmatch, logging, os, re, string, threading, time | 5 import common, 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 |
| 11 from autotest_lib.server import site_eap_tls |
| 11 | 12 |
| 12 class NotImplemented(Exception): | 13 class NotImplemented(Exception): |
| 13 def __init__(self, what): | 14 def __init__(self, what): |
| 14 self.what = what | 15 self.what = what |
| 15 | 16 |
| 16 | 17 |
| 17 def __str__(self): | 18 def __str__(self): |
| 18 return repr("Test method '%s' not implemented" % self.what) | 19 return repr("Test method '%s' not implemented" % self.what) |
| 19 | 20 |
| 20 | 21 |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 """ Connect client to AP/router """ | 204 """ Connect client to AP/router """ |
| 204 | 205 |
| 205 # copy site_wlan_connect.py over | 206 # copy site_wlan_connect.py over |
| 206 script_name = 'site_wlan_connect.py' | 207 script_name = 'site_wlan_connect.py' |
| 207 script_client_file = self.client.get_tmp_dir() + '/' + script_name | 208 script_client_file = self.client.get_tmp_dir() + '/' + script_name |
| 208 self.client.send_file( | 209 self.client.send_file( |
| 209 os.path.dirname(os.path.realpath(__file__)) + '/' + script_name, | 210 os.path.dirname(os.path.realpath(__file__)) + '/' + script_name, |
| 210 script_client_file, | 211 script_client_file, |
| 211 delete_dest=True) | 212 delete_dest=True) |
| 212 | 213 |
| 214 if 'eap-tls' in params: |
| 215 params.update(site_eap_tls.client_config(self.client, |
| 216 params['eap-tls'])) |
| 217 |
| 213 result = self.client.run('python "%s" "%s" "%s" "%s" "%d" "%d"' % | 218 result = self.client.run('python "%s" "%s" "%s" "%s" "%d" "%d"' % |
| 214 (script_client_file, | 219 (script_client_file, |
| 215 params.get('ssid', self.wifi.get_ssid()), | 220 params.get('ssid', self.wifi.get_ssid()), |
| 216 params.get('security', ''), | 221 params.get('security', ''), |
| 217 params.get('psk', ''), | 222 params.get('psk', ''), |
| 218 params.get('assoc_timeout', self.deftimeout), | 223 params.get('assoc_timeout', self.deftimeout), |
| 219 params.get('config_timeout', self.deftimeout))).stdout.rstrip() | 224 params.get('config_timeout', self.deftimeout))).stdout.rstrip() |
| 220 | 225 |
| 221 result_times = re.match("OK ([0-9\.]*) ([0-9\.]*) .*", result) | 226 result_times = re.match("OK ([0-9\.]*) ([0-9\.]*) .*", result) |
| 222 | 227 |
| (...skipping 449 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 if server_addr is None and hasattr(client_attributes, 'server_addr'): | 677 if server_addr is None and hasattr(client_attributes, 'server_addr'): |
| 673 server_addr = client_attributes.server_addr | 678 server_addr = client_attributes.server_addr |
| 674 if server_addr is not None: | 679 if server_addr is not None: |
| 675 server['addr'] = server_addr; | 680 server['addr'] = server_addr; |
| 676 # TODO(sleffler) check for wifi_addr when no control address | 681 # TODO(sleffler) check for wifi_addr when no control address |
| 677 | 682 |
| 678 # tag jobs w/ the router's address on the control network | 683 # tag jobs w/ the router's address on the control network |
| 679 config['tagname'] = router['addr'] | 684 config['tagname'] = router['addr'] |
| 680 | 685 |
| 681 return config | 686 return config |
| OLD | NEW |