[PATCH v2 4/4] auto-t: add test for known network removal of a PMKSA network

James Prestwood
2026-03-24T19:21:02Z

Tests that IWD cannot connect to the network once the profile has
been removed (after a PMKSA cache has been established).
---
autotests/testPMKSA-SAE/connection_test.py | 32 +++++++++++++++++++++-
1 file changed, 31 insertions(+), 1 deletion(-)

diff --git a/autotests/testPMKSA-SAE/connection_test.py b/autotests/testPMKSA-SAE/connection_test.py
index 5bab3ff8..749ebd44 100644
--- a/autotests/testPMKSA-SAE/connection_test.py
+++ b/autotests/testPMKSA-SAE/connection_test.py
@@ -4,7 +4,7 @@ import unittest
import sys

sys.path.append('../util')
-from iwd import IWD
+from iwd import IWD, FailedEx
from iwd import PSKAgent
from iwd import NetworkType
from hostapd import HostapdCLI
@@ -94,6 +94,36 @@ class Test(unittest.TestCase):
self.hostapd.wait_for_event("AP-ENABLED")
self.validate_connection(self.wd, "ssidSAE", self.hostapd, 19)

+ def test_pmksa_forget_network(self):
+ psk_agent = PSKAgent(["secret123", "wrong_password"])
+ self.wd.register_psk_agent(psk_agent)
+
+ devices = self.wd.list_devices(1)
+ self.assertIsNotNone(devices)
+ device = devices[0]
+
+ device.disconnect()
+
+ network = device.get_ordered_network("ssidSAE", full_scan=True)
+
+ self.assertEqual(network.type, NetworkType.psk)
+
+ network.network_object.connect()
+
+ condition = 'obj.state == DeviceState.connected'
+ self.wd.wait_for_object_condition(device, condition)
+
+ self.wd.wait(2)
+
+ testutil.test_iface_operstate(intf=device.name)
+ testutil.test_ifaces_connected(if0=device.name, if1=self.hostapd.ifname)
+
+ known_network = self.wd.list_known_networks()[0]
+ known_network.forget()
+
+ with self.assertRaises(FailedEx):
+ network.network_object.connect()
+
def setUp(self):
self.hostapd.default()
self.wd = IWD(True)
--
2.34.1