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 isBSDRouter(router): | 7 def isBSDRouter(router): |
8 router_uname = router.run('uname').stdout | 8 router_uname = router.run('uname').stdout |
9 return re.search('BSD', router_uname) | 9 return re.search('BSD', router_uname) |
10 | 10 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 else: | 47 else: |
48 self.phydev = params['phydev'] | 48 self.phydev = params['phydev'] |
49 # default to 1st available wired nic | 49 # default to 1st available wired nic |
50 if "wiredev" not in params: | 50 if "wiredev" not in params: |
51 self.wiredif = find_ifnet(host, ".*media:.Ethernet.*") | 51 self.wiredif = find_ifnet(host, ".*media:.Ethernet.*") |
52 if self.wiredif is None: | 52 if self.wiredif is None: |
53 raise Exception("No wired NIC found") | 53 raise Exception("No wired NIC found") |
54 else: | 54 else: |
55 self.wiredif = params['wiredev'] | 55 self.wiredif = params['wiredev'] |
56 self.defssid = defssid; | 56 self.defssid = defssid; |
| 57 self.ssid = defssid |
57 self.wlanif = None | 58 self.wlanif = None |
58 self.bridgeif = None | 59 self.bridgeif = None |
59 | 60 |
60 self.hostapd_keys = ("wpa", "wpa_passphrase", "wpa_key_mgmt", | 61 self.hostapd_keys = ("wpa", "wpa_passphrase", "wpa_key_mgmt", |
61 "wpa_pairwise", "wpa_group_rekey", "wpa_strict_rekey", | 62 "wpa_pairwise", "wpa_group_rekey", "wpa_strict_rekey", |
62 "wpa_gmk_rekey", "wpa_ptk_rekey", | 63 "wpa_gmk_rekey", "wpa_ptk_rekey", |
63 "rsn_pairwise", | 64 "rsn_pairwise", |
64 "rsn_preauth", "rsh_preauth_interfaces", | 65 "rsn_preauth", "rsh_preauth_interfaces", |
65 "peerkey") | 66 "peerkey") |
66 self.hostapd_conf = None | 67 self.hostapd_conf = None |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 128 |
128 | 129 |
129 def config(self, params): | 130 def config(self, params): |
130 """ | 131 """ |
131 Configure the AP per test requirements. This can be done | 132 Configure the AP per test requirements. This can be done |
132 entirely with ifconfig unless we need an authenticator in | 133 entirely with ifconfig unless we need an authenticator in |
133 which case we must also setup hostapd. | 134 which case we must also setup hostapd. |
134 """ | 135 """ |
135 | 136 |
136 if 'ssid' not in params: | 137 if 'ssid' not in params: |
137 params['ssid'] = self.defssid | 138 params['ssid'] = self.defssid + params.get('ssid_suffix', '') |
| 139 self.ssid = params['ssid'] |
138 | 140 |
139 args = "" | 141 args = "" |
140 hostapd_args = "" | 142 hostapd_args = "" |
141 if "wpa" in params: | 143 if "wpa" in params: |
142 # | 144 # |
143 # WPA/RSN requires hostapd as an authenticator; split out | 145 # WPA/RSN requires hostapd as an authenticator; split out |
144 # ifconfig args from hostapd configuration and setup to | 146 # ifconfig args from hostapd configuration and setup to |
145 # construct the hostapd.conf file below. | 147 # construct the hostapd.conf file below. |
146 # | 148 # |
147 for (k, v) in params.items(): | 149 for (k, v) in params.items(): |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 raise NotImplemented("check_client_event_countermeasures") | 211 raise NotImplemented("check_client_event_countermeasures") |
210 | 212 |
211 | 213 |
212 def router_force_mic_error(self, params): | 214 def router_force_mic_error(self, params): |
213 """ | 215 """ |
214 Force a Michael MIC error on the next packet. Note this requires | 216 Force a Michael MIC error on the next packet. Note this requires |
215 a driver that uses software crypto and a kernel with the support | 217 a driver that uses software crypto and a kernel with the support |
216 to fire oneshot MIC errors (first appeared in FreeBSD 8.1). | 218 to fire oneshot MIC errors (first appeared in FreeBSD 8.1). |
217 """ | 219 """ |
218 raise NotImplemented("force_mic_error") | 220 raise NotImplemented("force_mic_error") |
| 221 |
| 222 def get_ssid(self): |
| 223 return self.ssid |
OLD | NEW |