Skip to content

Commit 0941608

Browse files
committed
[airos] add password and identity to wpa2_enterprise converter
1 parent bdc4096 commit 0941608

2 files changed

Lines changed: 8 additions & 7 deletions

File tree

netjsonconfig/backends/airos/wpasupplicant.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
from interface import ssid
1+
from interface import encryption, ssid
2+
23

34
def ap_no_encryption(interface):
45
"""
@@ -23,7 +24,7 @@ def ap_wpa2_personal(interface):
2324
in ``access_point`` mode
2425
"""
2526
return {
26-
'psk': interface['wireless']['encryption']['key'],
27+
'psk': encryption(interface)['key'],
2728
'ssid': ssid(interface),
2829
'key_mgmt': [
2930
{
@@ -59,7 +60,7 @@ def sta_wpa2_personal(interface):
5960
"""
6061
return {
6162
'ssid': ssid(interface),
62-
'psk': interface['wireless']['encryption']['key'],
63+
'psk': encryption(interface)['key'],
6364
# no advanced authentication methods
6465
# with psk
6566
'eap': [
@@ -104,8 +105,8 @@ def sta_wpa2_enterprise(interface):
104105
'status': 'enabled',
105106
},
106107
],
107-
'password': 'TODO',
108-
'identity': 'TODO',
108+
'password': encryption(interface)['password'],
109+
'identity': encryption(interface)['identity'],
109110
'anonymous_identity': 'TODO',
110111
'pairwise': [
111112
{

tests/airos/test_wpasupplicant.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ def test_wpa2_enterprise(self):
157157
'profile.1.network.1.phase2=auth': 'MSCHAPV2',
158158
'profile.1.network.1.eap.1.status': 'enabled',
159159
'profile.1.network.1.eap.1.name': 'TTLS',
160-
'profile.1.network.1.password': 'TODO',
161-
'profile.1.network.1.identity': 'TODO',
160+
'profile.1.network.1.password': 'password1234',
161+
'profile.1.network.1.identity': 'definitely-fake-identity',
162162
'profile.1.network.1.anonymous_identity': 'TODO',
163163
'profile.1.network.1.pairwise.1.name': 'CCMP',
164164
'profile.1.network.1.proto.1.name': 'RSN',

0 commit comments

Comments
 (0)