Skip to content

Commit 1688e81

Browse files
committed
[airos] updated ebtable module for router and wpa2_personal
1 parent 9f877f6 commit 1688e81

2 files changed

Lines changed: 19 additions & 14 deletions

File tree

netjsonconfig/backends/airos/converters.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ def bridge_intermediate(self):
168168
return ebtables_from_interface(self.wireless[0])
169169

170170
def router_intermediate(self):
171-
return [{}]
171+
result = ebtables_from_interface(self.wireless[0])
172+
del result['sys']['fw']
173+
return result
172174

173175
def to_intermediate(self):
174176
result = getattr(self, '{netmode}_intermediate'.format(netmode=self.netmode))()
Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
1-
from .interface import mode, protocol, radio
21
import copy
32

3+
from .interface import mode, protocol, radio
4+
5+
6+
_base = {
7+
'sys': {
8+
'fw': {'status': 'disabled'},
9+
'status': 'enabled',
10+
},
11+
}
12+
413

514
def default(interace):
615
return {}
@@ -12,23 +21,18 @@ def station(interface):
1221
for an interface in ``station`` mode with ``wpa2_enterpise``
1322
or ``wpa2_personal`` authentication
1423
"""
15-
return {
24+
base = copy.deepcopy(_base)
25+
base['sys'].update({
1626
'eap': [
1727
{
1828
'devname': radio(interface),
1929
'status': 'enabled',
2030
}
2131
],
2232
'eap.status': 'enabled',
23-
}
24-
33+
})
34+
return base
2535

26-
_base = {
27-
'sys': {
28-
'fw': {'status': 'disabled'},
29-
'status': 'enabled',
30-
},
31-
}
3236

3337
_status = {
3438
'status': 'enabled',
@@ -38,7 +42,7 @@ def station(interface):
3842
_mapping = {
3943
'access_point': {
4044
'none': default,
41-
'wpa2_personal': default,
45+
'wpa2_personal': station,
4246
'wpa2_enterprise': default,
4347
},
4448
'station': {
@@ -50,7 +54,6 @@ def station(interface):
5054

5155

5256
def ebtables_from_interface(interface):
53-
base = copy.deepcopy(_base)
5457
status = _status.copy()
55-
base['sys'].update(_mapping[mode(interface)][protocol(interface)](interface))
58+
base = _mapping[mode(interface)][protocol(interface)](interface)
5659
return [status, base]

0 commit comments

Comments
 (0)