3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-29 05:39:24 +01:00

auto-t: added EAP-PWD autotests

One test is for the regular case, the second tests the
fragmentation logic.
This commit is contained in:
James Prestwood 2018-05-01 11:32:52 -07:00 committed by Denis Kenzior
parent a65e5e0800
commit 1523ce1130
9 changed files with 196 additions and 0 deletions

View File

@ -0,0 +1,2 @@
[EAP]
mtu=40

View File

@ -0,0 +1,73 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import PSKAgent
from iwd import NetworkType
class Test(unittest.TestCase):
def test_connection_success(self):
wd = IWD(True)
wd.wait(1)
psk_agent = PSKAgent('eap-pwd-identity', ('eap-pwd-identity', 'secret123'))
wd.register_psk_agent(psk_agent)
devices = wd.list_devices();
self.assertIsNotNone(devices)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_networks = device.get_ordered_networks()
ordered_network = None
for o_n in ordered_networks:
if o_n.name == "ssidEAP-PWD":
ordered_network = o_n
break
self.assertEqual(ordered_network.name, "ssidEAP-PWD")
self.assertEqual(ordered_network.type, NetworkType.eap)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
try:
ordered_network.network_object.connect()
except:
raise
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
device.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
wd.unregister_psk_agent(psk_agent)
del wd
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidEAP-PWD.8021x')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -0,0 +1,67 @@
#!/usr/bin/python3
import unittest
import sys
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import NetworkType
class Test(unittest.TestCase):
def test_connection_success(self):
wd = IWD(True, '/tmp/IWD-Frag')
wd.wait(1)
devices = wd.list_devices();
self.assertIsNotNone(devices)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_networks = device.get_ordered_networks()
ordered_network = None
for o_n in ordered_networks:
if o_n.name == "ssidEAP-PWD-frag":
ordered_network = o_n
break
self.assertEqual(ordered_network.name, "ssidEAP-PWD-frag")
self.assertEqual(ordered_network.type, NetworkType.eap)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
try:
ordered_network.network_object.connect()
except:
raise
condition = 'obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
device.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
del wd
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidEAP-PWD-frag.8021x')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -0,0 +1,9 @@
[SETUP]
num_radios=3
start_iwd=0
max_test_exec_interval_sec=40
tmpfs_extra_stuff=pwd.eap_user:IWD-Frag
[HOSTAPD]
rad0=ssidEAP-PWD.conf
rad1=ssidEAP-PWD-frag.conf

View File

@ -0,0 +1 @@
"eap-pwd-identity" PWD "secret123"

View File

@ -0,0 +1,7 @@
[Security]
EAP-Method=PWD
EAP-Identity=eap-pwd-identity
EAP-PWD-Password=secret123
[Settings]
Autoconnect=false

View File

@ -0,0 +1,16 @@
hw_mode=g
channel=1
driver=nl80211
ieee8021x=1
eap_server=1
ssid=ssidEAP-PWD-frag
eap_user_file=/tmp/pwd.eap_user
wpa=2
wpa_key_mgmt=WPA-EAP
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP TKIP
wpa_passphrase=secret123
channel=1
pwd_group=19
fragment_size=80

View File

@ -0,0 +1,6 @@
[Security]
EAP-Method=PWD
EAP-Identity=eap-pwd-identity
[Settings]
Autoconnect=false

View File

@ -0,0 +1,15 @@
hw_mode=g
channel=1
driver=nl80211
ieee8021x=1
eap_server=1
ssid=ssidEAP-PWD
eap_user_file=/tmp/pwd.eap_user
wpa=2
wpa_key_mgmt=WPA-EAP
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP TKIP
wpa_passphrase=secret123
channel=1
pwd_group=19