diff --git a/autotests/testEAP-SIM-ofono/connection_test.py b/autotests/testEAP-SIM-ofono/connection_test.py new file mode 100644 index 00000000..46bfd499 --- /dev/null +++ b/autotests/testEAP-SIM-ofono/connection_test.py @@ -0,0 +1,67 @@ +#!/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 +from hlrauc import AuthCenter +from ofono import Ofono + +class Test(unittest.TestCase): + + def test_connection_success(self): + auth = AuthCenter('/tmp/hlrauc.sock', '/tmp/sim.db') + + ofono = Ofono() + ofono.enable_modem('/phonesim') + ofono.wait_for_sim_auth() + + wd = IWD() + + 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 = ordered_networks[0] + + self.assertEqual(ordered_network.name, "ssidEAP-SIM") + 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) + + auth.stop() + + @classmethod + def setUpClass(cls): + IWD.copy_to_storage('ssidEAP-SIM.8021x') + + @classmethod + def tearDownClass(cls): + IWD.clear_storage() + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testEAP-SIM-ofono/hw.conf b/autotests/testEAP-SIM-ofono/hw.conf new file mode 100644 index 00000000..5f4fc8e4 --- /dev/null +++ b/autotests/testEAP-SIM-ofono/hw.conf @@ -0,0 +1,8 @@ +[SETUP] +num_radios=2 +max_test_exec_interval_sec=40 +tmpfs_extra_stuff=sim.eap_user:sim.db:../misc/phonesim/phonesim.conf +sim_keys=ofono + +[HOSTAPD] +rad0=ssidEAP-SIM.conf diff --git a/autotests/testEAP-SIM-ofono/sim.db b/autotests/testEAP-SIM-ofono/sim.db new file mode 100644 index 00000000..d1aaff15 --- /dev/null +++ b/autotests/testEAP-SIM-ofono/sim.db @@ -0,0 +1 @@ +12345678:673fb8cd35f98800:1fb1e3b5:DDDDDDDDDDDDDDDDDDDDDDDDDDDDDDDD \ No newline at end of file diff --git a/autotests/testEAP-SIM-ofono/sim.eap_user b/autotests/testEAP-SIM-ofono/sim.eap_user new file mode 100644 index 00000000..46d8bd8e --- /dev/null +++ b/autotests/testEAP-SIM-ofono/sim.eap_user @@ -0,0 +1 @@ +"112345678@phonesim.org" SIM \ No newline at end of file diff --git a/autotests/testEAP-SIM-ofono/ssidEAP-SIM.8021x b/autotests/testEAP-SIM-ofono/ssidEAP-SIM.8021x new file mode 100644 index 00000000..c32879e2 --- /dev/null +++ b/autotests/testEAP-SIM-ofono/ssidEAP-SIM.8021x @@ -0,0 +1,2 @@ +[Security] +EAP-Method=SIM diff --git a/autotests/testEAP-SIM-ofono/ssidEAP-SIM.conf b/autotests/testEAP-SIM-ofono/ssidEAP-SIM.conf new file mode 100644 index 00000000..6071e301 --- /dev/null +++ b/autotests/testEAP-SIM-ofono/ssidEAP-SIM.conf @@ -0,0 +1,16 @@ +hw_mode=g +channel=1 + +driver=nl80211 +ieee8021x=1 +eap_server=1 +ssid=ssidEAP-SIM +eap_user_file=/tmp/sim.eap_user +eap_sim_db=unix:/tmp/hlrauc.sock +wpa=2 +wpa_key_mgmt=WPA-EAP +wpa_pairwise=TKIP CCMP +rsn_pairwise=CCMP TKIP +wpa_passphrase=secret123 +channel=1 +eap_sim_aka_result_ind=1