Updated to hostap_2_6
[mech_eap.git] / libeap / tests / hwsim / test_ap_dynamic.py
index 19eb9c4..33db463 100644 (file)
@@ -4,6 +4,7 @@
 # This software may be distributed under the terms of the BSD license.
 # See README for more details.
 
+from remotehost import remote_compatible
 import time
 import subprocess
 import logging
@@ -12,20 +13,20 @@ import os
 
 import hwsim_utils
 import hostapd
-from utils import alloc_fail
+from utils import alloc_fail, require_under_vm
 from test_ap_acs import force_prev_ap_on_24g
 
+@remote_compatible
 def test_ap_change_ssid(dev, apdev):
     """Dynamic SSID change with hostapd and WPA2-PSK"""
     params = hostapd.wpa2_params(ssid="test-wpa2-psk-start",
                                  passphrase="12345678")
-    hostapd.add_ap(apdev[0]['ifname'], params)
+    hapd = hostapd.add_ap(apdev[0], params)
     id = dev[0].connect("test-wpa2-psk-start", psk="12345678",
                         scan_freq="2412")
     dev[0].request("DISCONNECT")
 
     logger.info("Change SSID dynamically")
-    hapd = hostapd.Hostapd(apdev[0]['ifname'])
     res = hapd.request("SET ssid test-wpa2-psk-new")
     if "OK" not in res:
         raise Exception("SET command failed")
@@ -90,118 +91,116 @@ def test_ap_bss_add_remove(dev, apdev):
 
 def _test_ap_bss_add_remove(dev, apdev):
     for i in range(3):
+        dev[i].flush_scan_cache()
         dev[i].request("SCAN_INTERVAL 1")
     ifname1 = apdev[0]['ifname']
     ifname2 = apdev[0]['ifname'] + '-2'
     ifname3 = apdev[0]['ifname'] + '-3'
     logger.info("Set up three BSSes one by one")
-    hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
+    hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
     multi_check(dev, [ True, False, False ])
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
     multi_check(dev, [ True, True, False ])
-    hostapd.add_bss('phy3', ifname3, 'bss-3.conf')
+    hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove the last BSS and re-add it")
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, True, False ])
-    hostapd.add_bss('phy3', ifname3, 'bss-3.conf')
+    hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove the middle BSS and re-add it")
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, True ])
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove the first BSS and re-add it and other BSSs")
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
-    hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
-    hostapd.add_bss('phy3', ifname3, 'bss-3.conf')
+    hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
+    hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove two BSSes and re-add them")
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, True ])
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, False, False ])
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
     multi_check(dev, [ True, True, False ])
-    hostapd.add_bss('phy3', ifname3, 'bss-3.conf')
+    hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Remove three BSSes in and re-add them")
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, True, False ])
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, False ])
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
-    hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
+    hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
     multi_check(dev, [ True, False, False ])
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
     multi_check(dev, [ True, True, False ])
-    hostapd.add_bss('phy3', ifname3, 'bss-3.conf')
+    hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
     multi_check(dev, [ True, True, True ])
 
     logger.info("Test error handling if a duplicate ifname is tried")
-    hostapd.add_bss('phy3', ifname3, 'bss-3.conf', ignore_error=True)
+    hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf', ignore_error=True)
     multi_check(dev, [ True, True, True ])
 
 def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
     """Dynamic BSS add during HT40 co-ex scan"""
+    for i in range(3):
+        dev[i].flush_scan_cache()
     ifname1 = apdev[0]['ifname']
     ifname2 = apdev[0]['ifname'] + '-2'
-    hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
-    hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
+    hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
     multi_check(dev, [ True, True ], scan_opt=False)
-    hostapd.remove_bss(ifname2)
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname2)
+    hostapd.remove_bss(apdev[0], ifname1)
 
-    hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
-    hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
-    hostapd.remove_bss(ifname2)
+    hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False ], scan_opt=False)
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
 
-    hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
-    hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
-    hostapd.remove_bss(ifname1)
+    hostapd.add_bss(apdev[0], ifname1, 'bss-ht40-1.conf')
+    hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False ])
 
 def test_ap_multi_bss_config(dev, apdev):
     """hostapd start with a multi-BSS configuration file"""
+    for i in range(3):
+        dev[i].flush_scan_cache()
     ifname1 = apdev[0]['ifname']
     ifname2 = apdev[0]['ifname'] + '-2'
     ifname3 = apdev[0]['ifname'] + '-3'
     logger.info("Set up three BSSes with one configuration file")
-    hostapd.add_iface(ifname1, 'multi-bss.conf')
-    hapd = hostapd.Hostapd(ifname1)
+    hapd = hostapd.add_iface(apdev[0], 'multi-bss.conf')
     hapd.enable()
     multi_check(dev, [ True, True, True ])
-    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
     multi_check(dev, [ True, False, True ])
-    hostapd.remove_bss(ifname3)
+    hostapd.remove_bss(apdev[0], ifname3)
     multi_check(dev, [ True, False, False ])
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
 
-    hostapd.add_iface(ifname1, 'multi-bss.conf')
-    hapd = hostapd.Hostapd(ifname1)
+    hapd = hostapd.add_iface(apdev[0], 'multi-bss.conf')
     hapd.enable()
-    hostapd.remove_bss(ifname1)
+    hostapd.remove_bss(apdev[0], ifname1)
     multi_check(dev, [ False, False, False ])
 
-def invalid_ap(hapd_global, ifname):
-    logger.info("Trying to start AP " + ifname + " with invalid configuration")
-    hapd_global.remove(ifname)
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    if not hapd.ping():
-        raise Exception("Could not ping hostapd")
-    hapd.set_defaults()
+def invalid_ap(ap):
+    logger.info("Trying to start AP " + ap['ifname'] + " with invalid configuration")
+    hapd = hostapd.add_ap(ap, {}, no_enable=True)
     hapd.set("ssid", "invalid-config")
     hapd.set("channel", "12345")
     try:
@@ -213,116 +212,97 @@ def invalid_ap(hapd_global, ifname):
         raise Exception("ENABLE command succeeded unexpectedly")
     return hapd
 
+@remote_compatible
 def test_ap_invalid_config(dev, apdev):
     """Try to start AP with invalid configuration and fix configuration"""
-    hapd_global = hostapd.HostapdGlobal()
-    ifname = apdev[0]['ifname']
-    hapd = invalid_ap(hapd_global, ifname)
+    hapd = invalid_ap(apdev[0])
 
     logger.info("Fix configuration and start AP again")
     hapd.set("channel", "1")
     hapd.enable()
     dev[0].connect("invalid-config", key_mgmt="NONE", scan_freq="2412")
 
+@remote_compatible
 def test_ap_invalid_config2(dev, apdev):
     """Try to start AP with invalid configuration and remove interface"""
-    hapd_global = hostapd.HostapdGlobal()
-    ifname = apdev[0]['ifname']
-    hapd = invalid_ap(hapd_global, ifname)
+    hapd = invalid_ap(apdev[0])
     logger.info("Remove interface with failed configuration")
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
 def test_ap_remove_during_acs(dev, apdev):
     """Remove interface during ACS"""
     force_prev_ap_on_24g(apdev[0])
     params = hostapd.wpa2_params(ssid="test-acs-remove", passphrase="12345678")
     params['channel'] = '0'
-    ifname = apdev[0]['ifname']
-    hapd = hostapd.HostapdGlobal()
-    hostapd.add_ap(ifname, params)
-    hapd.remove(ifname)
+    hostapd.add_ap(apdev[0], params)
+    hostapd.remove_bss(apdev[0])
 
 def test_ap_remove_during_acs2(dev, apdev):
     """Remove BSS during ACS in multi-BSS configuration"""
     force_prev_ap_on_24g(apdev[0])
     ifname = apdev[0]['ifname']
     ifname2 = ifname + "-2"
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    hapd.set_defaults()
+    hapd = hostapd.add_ap(apdev[0], {}, no_enable=True)
     hapd.set("ssid", "test-acs-remove")
     hapd.set("channel", "0")
     hapd.set("bss", ifname2)
     hapd.set("ssid", "test-acs-remove2")
     hapd.enable()
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
 def test_ap_remove_during_acs3(dev, apdev):
     """Remove second BSS during ACS in multi-BSS configuration"""
     force_prev_ap_on_24g(apdev[0])
     ifname = apdev[0]['ifname']
     ifname2 = ifname + "-2"
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    hapd.set_defaults()
+    hapd = hostapd.add_ap(apdev[0], {}, no_enable=True)
     hapd.set("ssid", "test-acs-remove")
     hapd.set("channel", "0")
     hapd.set("bss", ifname2)
     hapd.set("ssid", "test-acs-remove2")
     hapd.enable()
-    hapd_global.remove(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
 
+@remote_compatible
 def test_ap_remove_during_ht_coex_scan(dev, apdev):
     """Remove interface during HT co-ex scan"""
     params = hostapd.wpa2_params(ssid="test-ht-remove", passphrase="12345678")
     params['channel'] = '1'
     params['ht_capab'] = "[HT40+]"
     ifname = apdev[0]['ifname']
-    hapd = hostapd.HostapdGlobal()
-    hostapd.add_ap(ifname, params)
-    hapd.remove(ifname)
+    hostapd.add_ap(apdev[0], params)
+    hostapd.remove_bss(apdev[0])
 
 def test_ap_remove_during_ht_coex_scan2(dev, apdev):
     """Remove BSS during HT co-ex scan in multi-BSS configuration"""
     ifname = apdev[0]['ifname']
     ifname2 = ifname + "-2"
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    hapd.set_defaults()
+    hapd = hostapd.add_ap(apdev[0], {}, no_enable=True)
     hapd.set("ssid", "test-ht-remove")
     hapd.set("channel", "1")
     hapd.set("ht_capab", "[HT40+]")
     hapd.set("bss", ifname2)
     hapd.set("ssid", "test-ht-remove2")
     hapd.enable()
-    hapd_global.remove(ifname)
+    hostapd.remove_bss(apdev[0])
 
 def test_ap_remove_during_ht_coex_scan3(dev, apdev):
     """Remove second BSS during HT co-ex scan in multi-BSS configuration"""
     ifname = apdev[0]['ifname']
     ifname2 = ifname + "-2"
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    hapd.set_defaults()
+    hapd = hostapd.add_ap(apdev[0], {}, no_enable=True)
     hapd.set("ssid", "test-ht-remove")
     hapd.set("channel", "1")
     hapd.set("ht_capab", "[HT40+]")
     hapd.set("bss", ifname2)
     hapd.set("ssid", "test-ht-remove2")
     hapd.enable()
-    hapd_global.remove(ifname2)
+    hostapd.remove_bss(apdev[0], ifname2)
 
+@remote_compatible
 def test_ap_enable_disable_reenable(dev, apdev):
     """Enable, disable, re-enable AP"""
-    ifname = apdev[0]['ifname']
-    hapd_global = hostapd.HostapdGlobal()
-    hapd_global.add(ifname)
-    hapd = hostapd.Hostapd(ifname)
-    hapd.set_defaults()
+    hapd = hostapd.add_ap(apdev[0], {}, no_enable=True)
     hapd.set("ssid", "dynamic")
     hapd.enable()
     ev = hapd.wait_event(["AP-ENABLED"], timeout=30)
@@ -343,9 +323,8 @@ def test_ap_enable_disable_reenable(dev, apdev):
 
 def test_ap_double_disable(dev, apdev):
     """Double DISABLE regression test"""
-    hostapd.add_bss('phy3', apdev[0]['ifname'], 'bss-1.conf')
-    hostapd.add_bss('phy3', apdev[0]['ifname'] + '-2', 'bss-2.conf')
-    hapd = hostapd.Hostapd(apdev[0]['ifname'])
+    hapd = hostapd.add_bss(apdev[0], apdev[0]['ifname'], 'bss-1.conf')
+    hostapd.add_bss(apdev[0], apdev[0]['ifname'] + '-2', 'bss-2.conf')
     hapd.disable()
     if "FAIL" not in hapd.request("DISABLE"):
         raise Exception("Second DISABLE accepted unexpectedly")
@@ -361,7 +340,7 @@ def test_ap_bss_add_many(dev, apdev):
     finally:
         dev[0].request("SCAN_INTERVAL 5")
         ifname = apdev[0]['ifname']
-        hapd = hostapd.HostapdGlobal()
+        hapd = hostapd.HostapdGlobal(apdev[0])
         hapd.flush()
         for i in range(16):
             ifname2 = ifname + '-' + str(i)
@@ -373,9 +352,7 @@ def test_ap_bss_add_many(dev, apdev):
 
 def _test_ap_bss_add_many(dev, apdev):
     ifname = apdev[0]['ifname']
-    phy = 'phy3'
-    hostapd.add_bss(phy, ifname, 'bss-1.conf')
-    hapd = hostapd.HostapdGlobal()
+    hostapd.add_bss(apdev[0], ifname, 'bss-1.conf')
     fname = '/tmp/hwsim-bss.conf'
     for i in range(16):
         ifname2 = ifname + '-' + str(i)
@@ -388,7 +365,7 @@ def _test_ap_bss_add_many(dev, apdev):
             f.write("bssid=02:00:00:00:03:%02x\n" % (i + 1))
             f.write("ctrl_interface=/var/run/hostapd\n")
             f.write("ssid=test-%d\n" % i)
-        hostapd.add_bss(phy, ifname2, fname)
+        hostapd.add_bss(apdev[0], ifname2, fname)
         os.remove(fname)
 
     dev[0].request("SCAN_INTERVAL 1")
@@ -400,17 +377,17 @@ def _test_ap_bss_add_many(dev, apdev):
         dev[0].request("DISCONNECT")
         dev[0].wait_disconnected(timeout=5)
         ifname2 = ifname + '-' + str(i)
-        hapd.remove(ifname2)
+        hostapd.remove_bss(apdev[0], ifname2)
 
 def test_ap_bss_add_reuse_existing(dev, apdev):
     """Dynamic BSS add operation reusing existing interface"""
     ifname1 = apdev[0]['ifname']
     ifname2 = apdev[0]['ifname'] + '-2'
-    hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
+    hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
     subprocess.check_call(["iw", "dev", ifname1, "interface", "add", ifname2,
                            "type", "__ap"])
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
-    hostapd.remove_bss(ifname2)
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
+    hostapd.remove_bss(apdev[0], ifname2)
     subprocess.check_call(["iw", "dev", ifname2, "del"])
 
 def hapd_bss_out_of_mem(hapd, phy, confname, count, func):
@@ -422,7 +399,7 @@ def hapd_bss_out_of_mem(hapd, phy, confname, count, func):
 
 def test_ap_bss_add_out_of_memory(dev, apdev):
     """Running out of memory while adding a BSS"""
-    hapd2 = hostapd.add_ap(apdev[1]['ifname'], { "ssid": "open" })
+    hapd2 = hostapd.add_ap(apdev[1], { "ssid": "open" })
 
     ifname1 = apdev[0]['ifname']
     ifname2 = apdev[0]['ifname'] + '-2'
@@ -434,29 +411,26 @@ def test_ap_bss_add_out_of_memory(dev, apdev):
     hapd_bss_out_of_mem(hapd2, 'phy3', 'bss-1.conf',
                         1, 'ieee802_11_build_ap_params')
 
-    hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
+    hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
 
     hapd_bss_out_of_mem(hapd2, 'phy3', 'bss-2.conf',
                         1, 'hostapd_interface_init_bss')
     hapd_bss_out_of_mem(hapd2, 'phy3', 'bss-2.conf',
                         1, 'ieee802_11_build_ap_params')
 
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
-    hostapd.remove_bss(ifname2)
-    hostapd.remove_bss(ifname1)
+    hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
+    hostapd.remove_bss(apdev[0], ifname2)
+    hostapd.remove_bss(apdev[0], ifname1)
 
 def test_ap_multi_bss(dev, apdev):
     """Multiple BSSes with hostapd"""
     ifname1 = apdev[0]['ifname']
     ifname2 = apdev[0]['ifname'] + '-2'
-    hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
-    hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
+    hapd1 = hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
+    hapd2 = hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
     dev[0].connect("bss-1", key_mgmt="NONE", scan_freq="2412")
     dev[1].connect("bss-2", key_mgmt="NONE", scan_freq="2412")
 
-    hapd1 = hostapd.Hostapd(ifname1)
-    hapd2 = hostapd.Hostapd(ifname2)
-
     hwsim_utils.test_connectivity(dev[0], hapd1)
     hwsim_utils.test_connectivity(dev[1], hapd2)
 
@@ -467,12 +441,18 @@ def test_ap_multi_bss(dev, apdev):
     if 'rx_packets' not in sta1 or int(sta1['rx_packets']) < 1:
         raise Exception("sta1 did not report receiving packets")
 
+@remote_compatible
 def test_ap_add_with_driver(dev, apdev):
     """Add hostapd interface with driver specified"""
     ifname = apdev[0]['ifname']
-    hapd_global = hostapd.HostapdGlobal()
+    try:
+       hostname = apdev[0]['hostname']
+    except:
+       hostname = None
+    hapd_global = hostapd.HostapdGlobal(apdev[0])
     hapd_global.add(ifname, driver="nl80211")
-    hapd = hostapd.Hostapd(ifname)
+    port = hapd_global.get_ctrl_iface_port(ifname)
+    hapd = hostapd.Hostapd(ifname, hostname, port)
     hapd.set_defaults()
     hapd.set("ssid", "dynamic")
     hapd.enable()
@@ -483,3 +463,44 @@ def test_ap_add_with_driver(dev, apdev):
     dev[0].request("DISCONNECT")
     dev[0].wait_disconnected()
     hapd.disable()
+
+def test_ap_iapp(dev, apdev):
+    """IAPP and multiple BSSes"""
+    require_under_vm()
+    try:
+        _test_ap_iapp(dev, apdev)
+    finally:
+        subprocess.call(['ifconfig', 'br-multicast', 'down'],
+                        stderr=open('/dev/null', 'w'))
+        subprocess.call(['brctl', 'delbr', 'br-multicast'],
+                        stderr=open('/dev/null', 'w'))
+
+def _test_ap_iapp(dev, apdev):
+    br_ifname = 'br-multicast'
+    subprocess.call(['brctl', 'addbr', br_ifname])
+    subprocess.call(['brctl', 'setfd', br_ifname, '0'])
+    subprocess.call(['ip', 'addr', 'add', '10.174.65.206/31', 'dev', br_ifname])
+    subprocess.call(['ip', 'link', 'set', 'dev', br_ifname, 'up'])
+    subprocess.call(['ip', 'route', 'add', '224.0.0.0/4', 'dev', br_ifname])
+
+    params = { "ssid": "test-1",
+               "bridge": br_ifname,
+               "iapp_interface": br_ifname }
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].scan_for_bss(apdev[0]['bssid'], freq=2412)
+    dev[0].connect("test-1", key_mgmt="NONE", scan_freq="2412")
+    dev[1].connect("test-1", key_mgmt="NONE", scan_freq="2412")
+
+    hapd2 = hostapd.add_ap(apdev[1], params)
+    dev[0].scan_for_bss(apdev[1]['bssid'], freq=2412)
+    dev[0].roam(apdev[1]['bssid'])
+    dev[0].roam(apdev[0]['bssid'])
+
+    dev[0].request("DISCONNECT")
+    dev[1].request("DISCONNECT")
+    dev[0].wait_disconnected()
+    dev[1].wait_disconnected()
+
+    hapd.disable()
+    hapd2.disable()