Parcourir la source

tests: INTERFACE DISABLED/ENABLED events based on ifdown/up

Signed-off-by: Jouni Malinen <j@w1.fi>
Jouni Malinen il y a 11 ans
Parent
commit
d78dd03b98
1 fichiers modifiés avec 22 ajouts et 0 suppressions
  1. 22 0
      tests/hwsim/test_sta_dynamic.py

+ 22 - 0
tests/hwsim/test_sta_dynamic.py

@@ -86,3 +86,25 @@ def test_sta_ap_scan_2(dev, apdev):
     ev = wpas.wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
     if ev is not None:
         raise Exception("Unexpected connection reported")
+
+def test_sta_dynamic_down_up(dev, apdev):
+    """Dynamically added wpa_supplicant interface down/up"""
+    params = hostapd.wpa2_params(ssid="sta-dynamic", passphrase="12345678")
+    hostapd.add_ap(apdev[0]['ifname'], params)
+
+    logger.info("Create a dynamic wpa_supplicant interface and connect")
+    wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+    wpas.interface_add("wlan5")
+    wpas.connect("sta-dynamic", psk="12345678", scan_freq="2412")
+    hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])
+    subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'down'])
+    ev = wpas.wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=10)
+    if ev is None:
+        raise Exception("Disconnection not reported")
+    if wpas.get_status_field("wpa_state") != "INTERFACE_DISABLED":
+        raise Exception("Unexpected wpa_state")
+    subprocess.call(['sudo', 'ifconfig', wpas.ifname, 'up'])
+    ev = wpas.wait_event(["CTRL-EVENT-CONNECTED"], timeout=15)
+    if ev is None:
+        raise Exception("Reconnection not reported")
+    hwsim_utils.test_connectivity(wpas.ifname, apdev[0]['ifname'])