Skip to content

Commit 685c750

Browse files
committed
[airos] added tests for wireless authentication in aaa section
1 parent 8713a6c commit 685c750

1 file changed

Lines changed: 134 additions & 1 deletion

File tree

tests/airos/test_aaa.py

Lines changed: 134 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,142 @@ def test_aaa_key(self):
1212
})
1313
o.to_intermediate()
1414
expected = [
15+
{
16+
'status': 'disabled',
17+
},
18+
]
19+
self.assertEqualConfig(o.intermediate_data['aaa'], expected)
20+
21+
def test_ap_no_authentication(self):
22+
o = self.backend({
23+
"interfaces": [
1524
{
16-
'status': 'disabled',
25+
"type": "wireless",
26+
"name": "wlan0",
27+
"wireless": {
28+
"mode": "access_point",
29+
"radio": "ath0",
30+
"ssid": "i-like-pasta",
31+
},
1732
},
33+
],
34+
})
35+
o.to_intermediate()
36+
expected = [
37+
{
38+
'status': 'disabled',
39+
},
40+
{
41+
'1.radius.acct.1.port': 1813,
42+
'1.radius.acct.1.status': 'disabled',
43+
'1.radius.auth.1.port': 1812,
44+
'1.radius.auth.1.status': 'disabled',
45+
'1.status': 'disabled',
46+
},
1847
]
48+
self.assertEqualConfig(o.intermediate_data['aaa'], expected)
49+
50+
def test_ap_psk_authentication(self):
51+
o = self.backend({
52+
"interfaces": [
53+
{
54+
"type": "wireless",
55+
"name": "wlan0",
56+
"wireless": {
57+
"mode": "access_point",
58+
"radio": "ath0",
59+
"ssid": "i-like-pasta",
60+
"encryption": {
61+
"proto": "wpa2_personal",
62+
"key": "and-pizza-too",
63+
},
64+
},
65+
},
66+
],
67+
})
68+
o.to_intermediate()
69+
expected = [
70+
{
71+
'status': 'enabled',
72+
},
73+
{
74+
'1.radius.acct.1.port': 1813,
75+
'1.radius.acct.1.status': 'disabled',
76+
'1.radius.auth.1.port': 1812,
77+
'1.radius.auth.1.status': 'disabled',
78+
'1.status': 'enabled',
79+
# here begins magic
80+
'1.radius.macacl.status': 'disabled', # move to radius method
81+
'1.ssid': 'i-like-pasta',
82+
'1.br.devname': 'br0', # only in bridge mode?
83+
'1.devname': 'ath0',
84+
'1.driver': 'madwifi',
85+
'1.wpa.1.pairwise': 'CCMP',
86+
'1.wpa.key.1.mgmt': 'WPA-PSK',
87+
'1.wpa.mode': 2,
88+
'1.wpa.psk': 'and-pizza-too',
89+
}
90+
]
91+
self.assertEqualConfig(o.intermediate_data['aaa'], expected)
1992

93+
def test_sta_no_authentication(self):
94+
o = self.backend({
95+
"interfaces": [
96+
{
97+
"type": "wireless",
98+
"name": "wlan0",
99+
"wireless": {
100+
"mode": "station",
101+
"radio": "ath0",
102+
"ssid": "i-like-pasta",
103+
},
104+
},
105+
],
106+
})
107+
o.to_intermediate()
108+
expected = [
109+
{
110+
'status': 'disabled',
111+
},
112+
{
113+
'1.radius.acct.1.port': 1813,
114+
'1.radius.acct.1.status': 'disabled',
115+
'1.radius.auth.1.port': 1812,
116+
'1.radius.auth.1.status': 'disabled',
117+
'1.status': 'disabled',
118+
},
119+
]
120+
self.assertEqualConfig(o.intermediate_data['aaa'], expected)
121+
122+
def test_sta_psk_authentication(self):
123+
o = self.backend({
124+
"interfaces": [
125+
{
126+
"type": "wireless",
127+
"name": "wlan0",
128+
"wireless": {
129+
"mode": "station",
130+
"radio": "ath0",
131+
"ssid": "i-like-pasta",
132+
"encryption": {
133+
"proto": "wpa2_personal",
134+
"key": "and-pizza-too",
135+
},
136+
},
137+
},
138+
],
139+
})
140+
o.to_intermediate()
141+
expected = [
142+
{
143+
'status': 'disabled',
144+
},
145+
{
146+
'1.radius.acct.1.port': 1813,
147+
'1.radius.acct.1.status': 'disabled',
148+
'1.radius.auth.1.port': 1812,
149+
'1.radius.auth.1.status': 'disabled',
150+
'1.status': 'disabled',
151+
},
152+
]
20153
self.assertEqualConfig(o.intermediate_data['aaa'], expected)

0 commit comments

Comments
 (0)