[PATCH 11/44] test: FT ft_bridge dummy generation

michael-dev at fami-braun.de michael-dev at fami-braun.de
Wed Feb 24 03:53:17 PST 2016


From: Michael Braun <michael-dev at fami-braun.de>

Signed-off-by: Michael Braun <michael-dev at fami-braun.de>
---
 tests/hwsim/test_ap_ft.py | 39 ++++++++++++++++++++++++++++++++++++++-
 1 file changed, 38 insertions(+), 1 deletion(-)

diff --git a/tests/hwsim/test_ap_ft.py b/tests/hwsim/test_ap_ft.py
index 6fb6287..c63e427 100644
--- a/tests/hwsim/test_ap_ft.py
+++ b/tests/hwsim/test_ap_ft.py
@@ -13,10 +13,16 @@ logger = logging.getLogger()
 
 import hwsim_utils
 import hostapd
-from utils import HwsimSkip, alloc_fail, fail_test, skip_with_fips
+from utils import HwsimSkip, alloc_fail, fail_test, skip_with_fips, iface_is_in_bridge
 from wlantest import Wlantest
 from test_ap_psk import check_mib, find_wpas_process, read_process_memory, verify_not_present, get_key_locations
 
+try:
+    import netifaces
+    netifaces_imported = True
+except ImportError:
+    netifaces_imported = False
+
 def ft_base_rsn():
     params = { "wpa": "2",
                "wpa_key_mgmt": "FT-PSK",
@@ -1120,3 +1126,34 @@ def test_ap_ft_ptk_rekey_ap(dev, apdev):
     else:
         hapd = hapd1
     hwsim_utils.test_connectivity(dev[0], hapd)
+
+def test_ap_ft_bridge(dev, apdev):
+    """FT AP bridge"""
+    ssid = "test-ft"
+    passphrase="12345678"
+
+    try:
+        subprocess.call(['brctl', 'addbr', "brft"])
+        subprocess.call(['brctl', 'setfd', "brft", '0'])
+        subprocess.call(['ip', 'link', 'set', 'dev', "brft", 'up'])
+
+        params = ft_params1(ssid=ssid, passphrase=passphrase)
+        params["ft_bridge"] = "brft"
+        hapd = hostapd.add_ap(apdev[0]['ifname'], params)
+
+        if not iface_is_in_bridge("brft", "ftwlan3"):
+            raise Exception("ftwlan3 not in brft")
+
+        hapd.request("DISABLE")
+        time.sleep(5)
+
+        if iface_is_in_bridge("brft", "ftwlan3"):
+            raise Exception("ftwlan3 in brft")
+
+        if netifaces_imported:
+            ifaces = netifaces.interfaces()
+            if "ftwlan3" in ifaces:
+                raise Exception("device ftwlan3 has not been cleaned up")
+    finally:
+        subprocess.call(['ip', 'link', 'set', 'dev', "brft", 'down'])
+        subprocess.call(['brctl', 'delbr', "brft"])
-- 
1.9.1




More information about the Hostap mailing list