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 | 5 import logging, re |
6 | 6 |
7 def isLinuxRouter(router): | 7 def isLinuxRouter(router): |
8 router_uname = router.run('uname').stdout | 8 router_uname = router.run('uname').stdout |
9 return re.search('Linux', router_uname) | 9 return re.search('Linux', router_uname) |
10 | 10 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 break | 48 break |
49 else: | 49 else: |
50 raise error.TestFail("No Wireless NIC detected on the device") | 50 raise error.TestFail("No Wireless NIC detected on the device") |
51 else: | 51 else: |
52 self.phydev2 = params['phydev2'] | 52 self.phydev2 = params['phydev2'] |
53 self.phydev5 = params.get('phydev5', self.phydev2) | 53 self.phydev5 = params.get('phydev5', self.phydev2) |
54 | 54 |
55 | 55 |
56 # hostapd configuration persists throughout the test, subsequent | 56 # hostapd configuration persists throughout the test, subsequent |
57 # 'config' commands only modify it. | 57 # 'config' commands only modify it. |
| 58 self.defssid = defssid |
58 self.hostapd = { | 59 self.hostapd = { |
59 'configured': False, | 60 'configured': False, |
60 'file': "/tmp/hostapd-test.conf", | 61 'file': "/tmp/hostapd-test.conf", |
61 'driver': "nl80211", | 62 'driver': "nl80211", |
62 'conf': { | 63 'conf': { |
63 'ssid': defssid, | 64 'ssid': defssid, |
64 'bridge': self.bridgeif, | 65 'bridge': self.bridgeif, |
65 'hw_mode': 'g' | 66 'hw_mode': 'g' |
66 } | 67 } |
67 } | 68 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 # Construct the hostapd.conf file and start hostapd. | 137 # Construct the hostapd.conf file and start hostapd. |
137 conf = self.hostapd['conf'] | 138 conf = self.hostapd['conf'] |
138 htcaps = set() | 139 htcaps = set() |
139 | 140 |
140 conf['driver'] = params.get('hostapd_driver', | 141 conf['driver'] = params.get('hostapd_driver', |
141 self.hostapd['driver']) | 142 self.hostapd['driver']) |
142 | 143 |
143 for k, v in params.iteritems(): | 144 for k, v in params.iteritems(): |
144 if k == 'ssid': | 145 if k == 'ssid': |
145 conf['ssid'] = v | 146 conf['ssid'] = v |
| 147 elif k == 'ssid_suffix': |
| 148 conf['ssid'] = self.defssid + v |
146 elif k == 'channel': | 149 elif k == 'channel': |
147 freq = int(v) | 150 freq = int(v) |
148 | 151 |
149 # 2.4GHz | 152 # 2.4GHz |
150 if freq <= 2484: | 153 if freq <= 2484: |
151 # Make sure hw_mode is set | 154 # Make sure hw_mode is set |
152 if conf.get('hw_mode') == 'a': | 155 if conf.get('hw_mode') == 'a': |
153 conf['hw_mode'] = 'g' | 156 conf['hw_mode'] = 'g' |
154 | 157 |
155 # Freq = 5 * chan + 2407, except channel 14 | 158 # Freq = 5 * chan + 2407, except channel 14 |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True) | 289 self.router.run("pkill hostapd >/dev/null 2>&1", ignore_status=True) |
287 # self.router.run("rm -f %s" % self.hostapd['file']) | 290 # self.router.run("rm -f %s" % self.hostapd['file']) |
288 | 291 |
289 # Tear down the bridge. | 292 # Tear down the bridge. |
290 self.router.run("%s link set %s down" % (self.cmd_ip, self.bridgeif), | 293 self.router.run("%s link set %s down" % (self.cmd_ip, self.bridgeif), |
291 ignore_status=True) | 294 ignore_status=True) |
292 self.router.run("%s delbr %s" % (self.cmd_brctl, self.bridgeif), | 295 self.router.run("%s delbr %s" % (self.cmd_brctl, self.bridgeif), |
293 ignore_status=True) | 296 ignore_status=True) |
294 | 297 |
295 self.hostapd['configured'] = False | 298 self.hostapd['configured'] = False |
| 299 |
| 300 |
| 301 def get_ssid(self): |
| 302 return self.hostapd['conf']['ssid'] |
OLD | NEW |