From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.linux.dev
Cc: James Prestwood <prestwoj@gmail.com>
Subject: [PATCH 6/6] auto-t: Add test for BasicServiceSets
Date: Fri, 16 Aug 2024 05:52:14 -0700 [thread overview]
Message-ID: <20240816125214.1162415-6-prestwoj@gmail.com> (raw)
In-Reply-To: <20240816125214.1162415-1-prestwoj@gmail.com>
---
.../basic_service_set_test.py | 100 ++++++++++++++++++
autotests/testBasicServiceSet/hw.conf | 7 ++
autotests/testBasicServiceSet/ssidTKIP-1.conf | 7 ++
autotests/testBasicServiceSet/ssidTKIP-2.conf | 7 ++
autotests/testBasicServiceSet/ssidTKIP.psk | 5 +
5 files changed, 126 insertions(+)
create mode 100644 autotests/testBasicServiceSet/basic_service_set_test.py
create mode 100644 autotests/testBasicServiceSet/hw.conf
create mode 100644 autotests/testBasicServiceSet/ssidTKIP-1.conf
create mode 100644 autotests/testBasicServiceSet/ssidTKIP-2.conf
create mode 100644 autotests/testBasicServiceSet/ssidTKIP.psk
diff --git a/autotests/testBasicServiceSet/basic_service_set_test.py b/autotests/testBasicServiceSet/basic_service_set_test.py
new file mode 100644
index 00000000..c99f1901
--- /dev/null
+++ b/autotests/testBasicServiceSet/basic_service_set_test.py
@@ -0,0 +1,100 @@
+#! /usr/bin/python3
+
+import unittest
+import sys, os
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+from hwsim import Hwsim
+from hostapd import HostapdCLI
+import testutil
+
+class Test(unittest.TestCase):
+ def test_bss_unregister(self):
+ device = self.wd.list_devices(1)[0]
+
+ ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True)
+ network = ordered_network.network_object
+
+ self.assertEqual(len(network.extended_service_set), 2)
+
+ ends = [parts.split('/')[-1] for parts in network.extended_service_set]
+
+ self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
+ self.assertIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
+
+ self.rule_bss1.enabled = True
+
+ # Even with flushing, the kernel still seems to return the scan
+ # results
+ self.wd.wait(40)
+ ordered_network = device.get_ordered_network('ssidTKIP', full_scan=True)
+ network = ordered_network.network_object
+
+ ends = [parts.split('/')[-1] for parts in network.extended_service_set]
+
+ self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
+ self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
+
+ self.rule_bss0.enabled = True
+
+ self.wd.wait(40)
+ ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True)
+ self.assertIsNone(ordered_networks)
+
+ self.rule_bss0.enabled = False
+
+ ordered_networks = device.get_ordered_networks('ssidTKIP', full_scan=True)
+ ends = [parts.split('/')[-1] for parts in network.extended_service_set]
+
+ self.assertIn(self.bss_hostapd[0].bssid.replace(':', ''), ends)
+ self.assertNotIn(self.bss_hostapd[1].bssid.replace(':', ''), ends)
+
+ def tearDown(self):
+ self.rule_bss0.enabled = False
+ self.rule_bss1.enabled = False
+
+ self.wd.stop()
+ self.wd.wait(10)
+ self.wd = None
+
+ def setUp(self):
+ self.wd = IWD(True)
+
+ @classmethod
+ def setUpClass(cls):
+ hwsim = Hwsim()
+
+ IWD.copy_to_storage('ssidTKIP.psk')
+
+ cls.bss_hostapd = [ HostapdCLI(config='ssidTKIP-1.conf'),
+ HostapdCLI(config='ssidTKIP-2.conf') ]
+
+
+ rad0 = hwsim.get_radio('rad0')
+ rad1 = hwsim.get_radio('rad1')
+
+ cls.rule_bss0 = hwsim.rules.create()
+ cls.rule_bss0.source = rad0.addresses[0]
+ cls.rule_bss0.bidirectional = True
+ cls.rule_bss0.drop = True
+
+ cls.rule_bss1 = hwsim.rules.create()
+ cls.rule_bss1.source = rad1.addresses[0]
+ cls.rule_bss1.bidirectional = True
+ cls.rule_bss1.drop = True
+
+
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+ cls.bss_hostapd = None
+ cls.rule_bss0.remove()
+ cls.rule_bss1.remove()
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
diff --git a/autotests/testBasicServiceSet/hw.conf b/autotests/testBasicServiceSet/hw.conf
new file mode 100644
index 00000000..ff1075fa
--- /dev/null
+++ b/autotests/testBasicServiceSet/hw.conf
@@ -0,0 +1,7 @@
+[SETUP]
+num_radios=3
+hwsim_medium=yes
+
+[HOSTAPD]
+rad0=ssidTKIP-1.conf
+rad1=ssidTKIP-2.conf
diff --git a/autotests/testBasicServiceSet/ssidTKIP-1.conf b/autotests/testBasicServiceSet/ssidTKIP-1.conf
new file mode 100644
index 00000000..11ef15f0
--- /dev/null
+++ b/autotests/testBasicServiceSet/ssidTKIP-1.conf
@@ -0,0 +1,7 @@
+hw_mode=g
+channel=1
+ssid=ssidTKIP
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret123
diff --git a/autotests/testBasicServiceSet/ssidTKIP-2.conf b/autotests/testBasicServiceSet/ssidTKIP-2.conf
new file mode 100644
index 00000000..0ed132c1
--- /dev/null
+++ b/autotests/testBasicServiceSet/ssidTKIP-2.conf
@@ -0,0 +1,7 @@
+hw_mode=g
+channel=2
+ssid=ssidTKIP
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret123
diff --git a/autotests/testBasicServiceSet/ssidTKIP.psk b/autotests/testBasicServiceSet/ssidTKIP.psk
new file mode 100644
index 00000000..85d25d8d
--- /dev/null
+++ b/autotests/testBasicServiceSet/ssidTKIP.psk
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=secret123
+
+[Settings]
+AutoConnect=False
--
2.34.1
prev parent reply other threads:[~2024-08-16 12:52 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-16 12:52 [PATCH 1/6] network: add __network_path_append_bss James Prestwood
2024-08-16 12:52 ` [PATCH 2/6] station: move BasicServiceSet DBus management into station James Prestwood
2024-08-19 15:22 ` Denis Kenzior
2024-08-16 12:52 ` [PATCH 3/6] network: remove BasicServiceSet DBus registration code James Prestwood
2024-08-16 12:52 ` [PATCH 4/6] network: add back network_bss_list_clear James Prestwood
2024-08-16 12:52 ` [PATCH 5/6] auto-t: Add ExtendedServiceSet property James Prestwood
2024-08-16 12:52 ` James Prestwood [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240816125214.1162415-6-prestwoj@gmail.com \
--to=prestwoj@gmail.com \
--cc=iwd@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox