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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 def deconfig(self, params): | 304 def deconfig(self, params): |
305 """ De-configure the AP (will also bring wlan and the bridge down) """ | 305 """ De-configure the AP (will also bring wlan and the bridge down) """ |
306 | 306 |
307 if not self.hostapd['configured']: | 307 if not self.hostapd['configured']: |
308 return | 308 return |
309 | 309 |
310 # Taking down hostapd takes wlan0 and mon.wlan0 down. | 310 # Taking down hostapd takes wlan0 and mon.wlan0 down. |
311 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True) | 311 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True) |
312 # self.router.run("rm -f %s" % self.hostapd['file']) | 312 # self.router.run("rm -f %s" % self.hostapd['file']) |
313 | 313 |
314 # Tear down the bridge. | |
315 self.router.run("%s link set %s down" % (self.cmd_ip, self.bridgeif), | |
316 ignore_status=True) | |
317 | |
318 # Try a couple times to remove the bridge; hostapd may still be exiting | 314 # Try a couple times to remove the bridge; hostapd may still be exiting |
319 for attempt in range(3): | 315 for attempt in range(3): |
| 316 self.router.run("%s link set %s down" % |
| 317 (self.cmd_ip, self.bridgeif), ignore_status=True) |
| 318 |
320 result = self.router.run("%s delbr %s" % | 319 result = self.router.run("%s delbr %s" % |
321 (self.cmd_brctl, self.bridgeif), | 320 (self.cmd_brctl, self.bridgeif), |
322 ignore_status=True) | 321 ignore_status=True) |
323 if not result.stderr: | 322 if not result.stderr: |
324 break | 323 break |
325 time.sleep(1) | 324 time.sleep(1) |
326 else: | 325 else: |
327 raise error.TestFail("Unable to delete bridge %s: %s" % | 326 raise error.TestFail("Unable to delete bridge %s: %s" % |
328 (self.bridgeif, result.stderr)) | 327 (self.bridgeif, result.stderr)) |
329 | 328 |
330 | 329 |
331 self.hostapd['configured'] = False | 330 self.hostapd['configured'] = False |
332 | 331 |
333 | 332 |
334 def get_ssid(self): | 333 def get_ssid(self): |
335 return self.hostapd['conf']['ssid'] | 334 return self.hostapd['conf']['ssid'] |
OLD | NEW |