|
1 | 1 | from .mock import AaaAirOs, ConverterTest |
2 | 2 |
|
3 | 3 |
|
4 | | -class TestAaaConverter(ConverterTest): |
| 4 | +class TestAaaConverterAccess(ConverterTest): |
5 | 5 |
|
6 | 6 | backend = AaaAirOs |
7 | 7 |
|
@@ -92,6 +92,64 @@ def test_ap_psk_authentication(self): |
92 | 92 | ] |
93 | 93 | self.assertEqualConfig(o.intermediate_data['aaa'], expected) |
94 | 94 |
|
| 95 | + def test_ap_eap_authentication(self): |
| 96 | + o = self.backend({ |
| 97 | + "interfaces": [ |
| 98 | + { |
| 99 | + "type": "wireless", |
| 100 | + "name": "wlan0", |
| 101 | + "wireless": { |
| 102 | + "mode": "access_point", |
| 103 | + "radio": "ath0", |
| 104 | + "ssid": "i-like-pasta", |
| 105 | + "encryption": { |
| 106 | + "protocol": "wpa2_enterprise", |
| 107 | + "key": "secret-radius-key", |
| 108 | + "server": "192.168.1.1", |
| 109 | + "acct_server": "192.168.1.2", |
| 110 | + }, |
| 111 | + }, |
| 112 | + }, |
| 113 | + { |
| 114 | + "type": "bridge", |
| 115 | + "name": "br0", |
| 116 | + "bridge_members": [ |
| 117 | + "wlan0", |
| 118 | + ], |
| 119 | + }, |
| 120 | + ], |
| 121 | + }) |
| 122 | + o.to_intermediate() |
| 123 | + expected = [ |
| 124 | + { |
| 125 | + 'status': 'enabled', |
| 126 | + }, |
| 127 | + { |
| 128 | + '1.br.devname': 'br0', # only in bridge mode? |
| 129 | + '1.devname': 'ath0', |
| 130 | + '1.driver': 'madwifi', |
| 131 | + '1.radius.acct.1.port': 1813, |
| 132 | + '1.radius.acct.1.status': 'enabled', |
| 133 | + '1.radius.acct.1.ip': '192.168.1.2', |
| 134 | + '1.radius.auth.1.ip': '192.168.1.1', |
| 135 | + '1.radius.auth.1.port': 1812, |
| 136 | + '1.radius.auth.1.secret': 'secret-radius-key', |
| 137 | + '1.radius.auth.1.status': 'enabled', |
| 138 | + '1.radius.macacl.status': 'disabled', |
| 139 | + '1.ssid': 'i-like-pasta', |
| 140 | + '1.status': 'enabled', |
| 141 | + '1.wpa.1.pairwise': 'CCMP', |
| 142 | + '1.wpa.key.1.mgmt': 'WPA-EAP', |
| 143 | + '1.wpa.mode': 2, |
| 144 | + } |
| 145 | + ] |
| 146 | + self.assertEqualConfig(o.intermediate_data['aaa'], expected) |
| 147 | + |
| 148 | + |
| 149 | +class TestAaaConverterStation(ConverterTest): |
| 150 | + |
| 151 | + backend = AaaAirOs |
| 152 | + |
95 | 153 | def test_sta_no_authentication(self): |
96 | 154 | o = self.backend({ |
97 | 155 | "interfaces": [ |
@@ -171,3 +229,44 @@ def test_sta_psk_authentication(self): |
171 | 229 | }, |
172 | 230 | ] |
173 | 231 | self.assertEqualConfig(o.intermediate_data['aaa'], expected) |
| 232 | + |
| 233 | + def test_sta_eap_authentication(self): |
| 234 | + o = self.backend({ |
| 235 | + "interfaces": [ |
| 236 | + { |
| 237 | + "type": "wireless", |
| 238 | + "name": "wlan0", |
| 239 | + "wireless": { |
| 240 | + "mode": "station", |
| 241 | + "radio": "ath0", |
| 242 | + "ssid": "i-like-pasta", |
| 243 | + "bssid": "00:11:22:33:44:55", |
| 244 | + "encryption": { |
| 245 | + "protocol": "wpa2_enterprise", |
| 246 | + "identity": "some-fake-identity", |
| 247 | + "password": "password1234", |
| 248 | + }, |
| 249 | + }, |
| 250 | + }, |
| 251 | + { |
| 252 | + "type": "bridge", |
| 253 | + "name": "br0", |
| 254 | + "bridge_members": [ |
| 255 | + "wlan0", |
| 256 | + ], |
| 257 | + }, |
| 258 | + ], |
| 259 | + }) |
| 260 | + o.to_intermediate() |
| 261 | + expected = [ |
| 262 | + { |
| 263 | + 'status': 'disabled', |
| 264 | + }, |
| 265 | + { |
| 266 | + '1.radius.acct.1.port': 1813, |
| 267 | + '1.radius.acct.1.status': 'disabled', |
| 268 | + '1.radius.auth.1.port': 1812, |
| 269 | + '1.status': 'disabled', |
| 270 | + }, |
| 271 | + ] |
| 272 | + self.assertEqualConfig(o.intermediate_data['aaa'], expected) |
0 commit comments