]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - tests/hwsim/hostapd.py
tests: Wait for AP-STA-CONNECT before running connectivity test
[thirdparty/hostap.git] / tests / hwsim / hostapd.py
index 91748c56a5489a3991e5d2401cb624abefe2d5f4..db941b6c170cbe52c94ddd70daad902e981abca3 100644 (file)
@@ -262,6 +262,13 @@ class Hostapd:
                 break
         return None
 
+    def wait_sta(self, addr=None, timeout=2):
+        ev = self.wait_event("AP-STA-CONNECT", timeout=timeout)
+        if ev is None:
+            raise Exception("AP did not report STA connection")
+        if addr and addr not in ev:
+            raise Exception("Unexpected STA address in connection event: " + ev)
+
     def get_status(self):
         res = self.request("STATUS")
         lines = res.splitlines()