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 logging, re, time | 5 import logging, re, time |
6 from autotest_lib.client.common_lib import error | 6 from autotest_lib.client.common_lib import error |
7 from autotest_lib.server import site_eap_tls | 7 from autotest_lib.server import site_eap_tls |
8 | 8 |
9 def isLinuxRouter(router): | 9 def isLinuxRouter(router): |
10 router_uname = router.run('uname').stdout | 10 router_uname = router.run('uname').stdout |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 def destroy(self, params): | 143 def destroy(self, params): |
144 """ Destroy a previously created device """ | 144 """ Destroy a previously created device """ |
145 # For linux, this is the same as deconfig. | 145 # For linux, this is the same as deconfig. |
146 self.deconfig(params) | 146 self.deconfig(params) |
147 | 147 |
148 | 148 |
149 | 149 |
150 def config(self, params): | 150 def config(self, params): |
151 """ Configure the AP per test requirements """ | 151 """ Configure the AP per test requirements """ |
152 | 152 |
153 if self.hostapd['configured']: | 153 multi_interface = 'multi_interface' in params |
| 154 if multi_interface: |
| 155 params.pop('multi_interface') |
| 156 elif self.hostapd['configured']: |
154 self.deconfig({}) | 157 self.deconfig({}) |
155 | 158 |
156 if self.apmode: | 159 if self.apmode: |
157 # Construct the hostapd.conf file and start hostapd. | 160 # Construct the hostapd.conf file and start hostapd. |
158 conf = self.hostapd['conf'] | 161 conf = self.hostapd['conf'] |
159 htcaps = set() | 162 htcaps = set() |
160 | 163 |
161 conf['driver'] = params.get('hostapd_driver', | 164 conf['driver'] = params.get('hostapd_driver', |
162 self.hostapd['driver']) | 165 self.hostapd['driver']) |
163 | 166 |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 "%s=%s" % kv for kv in conf.iteritems()))) | 280 "%s=%s" % kv for kv in conf.iteritems()))) |
278 | 281 |
279 # Run hostapd. | 282 # Run hostapd. |
280 logging.info("Starting hostapd...") | 283 logging.info("Starting hostapd...") |
281 self.router.run("%s -B %s" % | 284 self.router.run("%s -B %s" % |
282 (self.cmd_hostapd, self.hostapd['file'])) | 285 (self.cmd_hostapd, self.hostapd['file'])) |
283 | 286 |
284 | 287 |
285 # Set up the bridge. | 288 # Set up the bridge. |
286 logging.info("Setting up the bridge...") | 289 logging.info("Setting up the bridge...") |
287 self.router.run("%s setfd %s %d" % | 290 if not multi_interface: |
288 (self.cmd_brctl, self.bridgeif, 0)) | 291 self.router.run("%s setfd %s %d" % |
289 self.router.run("%s addif %s %s" % | 292 (self.cmd_brctl, self.bridgeif, 0)) |
290 (self.cmd_brctl, self.bridgeif, self.wiredif)) | 293 self.router.run("%s addif %s %s" % |
291 self.router.run("%s link set %s up" % | 294 (self.cmd_brctl, self.bridgeif, self.wiredif)) |
292 (self.cmd_ip, self.wiredif)) | 295 self.router.run("%s link set %s up" % |
293 self.router.run("%s link set %s up" % | 296 (self.cmd_ip, self.wiredif)) |
294 (self.cmd_ip, self.bridgeif)) | 297 self.router.run("%s link set %s up" % |
| 298 (self.cmd_ip, self.bridgeif)) |
| 299 self.hostapd['interface'] = conf['interface'] |
295 | 300 |
296 logging.info("AP configured.") | 301 logging.info("AP configured.") |
297 | 302 |
298 # else: | 303 # else: |
299 # # use iw to manually configure interface | 304 # # use iw to manually configure interface |
300 | 305 |
301 self.hostapd['configured'] = True | 306 self.hostapd['configured'] = True |
302 | 307 |
303 | 308 |
304 def deconfig(self, params): | 309 def deconfig(self, params): |
(...skipping 20 matching lines...) Expand all Loading... |
325 else: | 330 else: |
326 raise error.TestFail("Unable to delete bridge %s: %s" % | 331 raise error.TestFail("Unable to delete bridge %s: %s" % |
327 (self.bridgeif, result.stderr)) | 332 (self.bridgeif, result.stderr)) |
328 | 333 |
329 | 334 |
330 self.hostapd['configured'] = False | 335 self.hostapd['configured'] = False |
331 | 336 |
332 | 337 |
333 def get_ssid(self): | 338 def get_ssid(self): |
334 return self.hostapd['conf']['ssid'] | 339 return self.hostapd['conf']['ssid'] |
OLD | NEW |