[PATCH v4 3/5] auto-t: test BasicServiceSet RSN property
Aleksman4o <[email protected]> Tue, 28 Jul 2026 18:46:42 +0300
| Newsgroups | dev.linux.lists.iwd |
|---|---|
| Message-ID | <[email protected]> |
From: Aleks Man <[email protected]> Verify the exact D-Bus key management and cipher capabilities for WPA2-PSK, SAE, and transition BSSes. --- .../testBasicServiceSetRSN/bss_rsn_test.py | 70 +++++++++++++++++++ autotests/testBasicServiceSetRSN/hw.conf | 9 +++ autotests/testBasicServiceSetRSN/ssidSAE.conf | 11 +++ .../ssidTransition.conf | 12 ++++ .../testBasicServiceSetRSN/ssidWPA2.conf | 8 +++ 5 files changed, 110 insertions(+) create mode 100644 autotests/testBasicServiceSetRSN/bss_rsn_test.py create mode 100644 autotests/testBasicServiceSetRSN/hw.conf create mode 100644 autotests/testBasicServiceSetRSN/ssidSAE.conf create mode 100644 autotests/testBasicServiceSetRSN/ssidTransition.conf create mode 100644 autotests/testBasicServiceSetRSN/ssidWPA2.conf diff --git a/autotests/testBasicServiceSetRSN/bss_rsn_test.py b/autotests/testBasicServiceSetRSN/bss_rsn_test.py new file mode 100644 index 00000000..20e0b62c --- /dev/null +++ b/autotests/testBasicServiceSetRSN/bss_rsn_test.py @@ -0,0 +1,70 @@ +#! /usr/bin/python3 + +import unittest +import sys + +import dbus + +sys.path.append('../util') +import iwd +from iwd import IWD +from hwsim import Hwsim +from hostapd import HostapdCLI + +BSS_INTERFACE = 'net.connman.iwd.BasicServiceSet' + + +class Test(unittest.TestCase): + def _get_rsn(self, device, ssid): + ordered_network = device.get_ordered_network(ssid, full_scan=True) + network = ordered_network.network_object + self.assertEqual(len(network.extended_service_set), 1) + + path = network.extended_service_set[0] + proxy = self.wd._bus.get_object(iwd.IWD_SERVICE, path) + properties = dbus.Interface(proxy, iwd.DBUS_PROPERTIES) + + return properties.GetAll(BSS_INTERFACE)['RSN'] + + def test_rsn(self): + device = self.wd.list_devices(1)[0] + + rsn = self._get_rsn(device, 'ssidWPA2') + self.assertEqual(set(map(str, rsn['KeyMgmt'])), {'wpa-psk'}) + self.assertEqual(set(map(str, rsn['Pairwise'])), {'ccmp'}) + self.assertEqual(str(rsn['Group']), 'ccmp') + + rsn = self._get_rsn(device, 'ssidSAE') + self.assertEqual(set(map(str, rsn['KeyMgmt'])), {'sae'}) + self.assertEqual(set(map(str, rsn['Pairwise'])), {'ccmp'}) + self.assertEqual(str(rsn['Group']), 'ccmp') + + rsn = self._get_rsn(device, 'ssidTransition') + self.assertEqual(set(map(str, rsn['KeyMgmt'])), + {'wpa-psk', 'sae'}) + self.assertEqual(set(map(str, rsn['Pairwise'])), {'ccmp'}) + self.assertEqual(str(rsn['Group']), 'ccmp') + + def setUp(self): + self.wd = IWD(True) + + def tearDown(self): + self.wd.stop() + self.wd = None + + @classmethod + def setUpClass(cls): + Hwsim() + cls.hostapd = [ + HostapdCLI(config='ssidWPA2.conf'), + HostapdCLI(config='ssidSAE.conf'), + HostapdCLI(config='ssidTransition.conf'), + ] + + @classmethod + def tearDownClass(cls): + cls.hostapd = None + + +if __name__ == '__main__': + unittest.main(exit=True) diff --git a/autotests/testBasicServiceSetRSN/hw.conf b/autotests/testBasicServiceSetRSN/hw.conf new file mode 100644 index 00000000..a43062d9 --- /dev/null +++ b/autotests/testBasicServiceSetRSN/hw.conf @@ -0,0 +1,9 @@ +[SETUP] +num_radios=4 +hwsim_medium=yes +start_iwd=no + +[HOSTAPD] +rad0=ssidWPA2.conf +rad1=ssidSAE.conf +rad2=ssidTransition.conf diff --git a/autotests/testBasicServiceSetRSN/ssidSAE.conf b/autotests/testBasicServiceSetRSN/ssidSAE.conf new file mode 100644 index 00000000..2ec9ae61 --- /dev/null +++ b/autotests/testBasicServiceSetRSN/ssidSAE.conf @@ -0,0 +1,11 @@ +hw_mode=g +channel=2 +ssid=ssidSAE + +wpa=2 +wpa_key_mgmt=SAE +wpa_pairwise=CCMP +sae_password=secret123 +sae_groups=19 +ieee80211w=2 +sae_pwe=0 diff --git a/autotests/testBasicServiceSetRSN/ssidTransition.conf b/autotests/testBasicServiceSetRSN/ssidTransition.conf new file mode 100644 index 00000000..00170772 --- /dev/null +++ b/autotests/testBasicServiceSetRSN/ssidTransition.conf @@ -0,0 +1,12 @@ +hw_mode=g +channel=3 +ssid=ssidTransition + +wpa=2 +wpa_key_mgmt=WPA-PSK SAE +wpa_pairwise=CCMP +wpa_passphrase=secret123 +sae_password=secret123 +sae_groups=19 +ieee80211w=1 +sae_pwe=0 diff --git a/autotests/testBasicServiceSetRSN/ssidWPA2.conf b/autotests/testBasicServiceSetRSN/ssidWPA2.conf new file mode 100644 index 00000000..d706142b --- /dev/null +++ b/autotests/testBasicServiceSetRSN/ssidWPA2.conf @@ -0,0 +1,8 @@ +hw_mode=g +channel=1 +ssid=ssidWPA2 + +wpa=2 +wpa_key_mgmt=WPA-PSK +wpa_pairwise=CCMP +wpa_passphrase=secret123 -- 2.55.0