3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-22 13:02:44 +01:00

auto-t: added test for EAP-GTC w/ agent

This commit is contained in:
James Prestwood 2018-07-31 12:04:40 -07:00 committed by Denis Kenzior
parent 3d2285ec7e
commit f00c228665
4 changed files with 99 additions and 1 deletions

View File

@ -1,8 +1,9 @@
[SETUP]
num_radios=2
num_radios=3
start_iwd=0
max_test_exec_interval_sec=60
tmpfs_extra_stuff=../misc/certs:eap-user-peap-gtc.text
[HOSTAPD]
rad0=ssidEAP-PEAPv1-GTC.conf
rad1=ssidEAP-PEAPv1-GTC-nosecret.conf

View File

@ -0,0 +1,74 @@
#!/usr/bin/python3
import unittest
import sys
import time
sys.path.append('../util')
import iwd
from iwd import IWD
from iwd import NetworkType
from iwd import PSKAgent
class Test(unittest.TestCase):
def validate_connection(self, wd):
devices = wd.list_devices(1);
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 = ordered_networks[0]
self.assertEqual(ordered_network.name, 'ssidEAP-PEAPv1-GTC-nosecret')
self.assertEqual(ordered_network.type, NetworkType.eap)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
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)
def test_connection_success(self):
wd = IWD(True)
psk_agent = PSKAgent('secure@identity.com',
('secure@identity.com', 'testpasswd'))
wd.register_psk_agent(psk_agent)
try:
self.validate_connection(wd)
except:
del wd
raise
wd.unregister_psk_agent(psk_agent)
del wd
@classmethod
def setUpClass(cls):
IWD.copy_to_storage('ssidEAP-PEAPv1-GTC-nosecret.8021x')
@classmethod
def tearDownClass(cls):
IWD.clear_storage()
if __name__ == '__main__':
unittest.main(exit=True)

View File

@ -0,0 +1,11 @@
[Security]
EAP-Method=PEAP
EAP-Identity=open@identity.com
EAP-PEAP-CACert=/tmp/certs/cert-ca.pem
EAP-PEAP-ClientCert=/tmp/certs/cert-client.pem
EAP-PEAP-ClientKey=/tmp/certs/cert-client-key-pkcs8.pem
EAP-PEAP-Phase2-Method=GTC
EAP-PEAP-Phase2-Identity=secure@identity.com
[Settings]
Autoconnect=false

View File

@ -0,0 +1,12 @@
hw_mode=g
channel=1
ssid=ssidEAP-PEAPv1-GTC-nosecret
wpa=3
wpa_key_mgmt=WPA-EAP
ieee8021x=1
eap_server=1
eap_user_file=/tmp/eap-user-peap-gtc.text
ca_cert=/tmp/certs/cert-ca.pem
server_cert=/tmp/certs/cert-server.pem
private_key=/tmp/certs/cert-server-key.pem