tests: Add test case for multi-BSS configuration file
Verify that a single configuration file can be used to initiate multiple BSSes in hostapd and that these BSSes can then be dynamically removed. Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
fee947bfc0
commit
77990cd7a9
3 changed files with 54 additions and 0 deletions
|
@ -24,6 +24,11 @@ class HostapdGlobal:
|
|||
if not "OK" in res:
|
||||
raise Exception("Could not add hostapd interface " + ifname)
|
||||
|
||||
def add_iface(self, ifname, confname):
|
||||
res = self.ctrl.request("ADD " + ifname + " config=" + confname)
|
||||
if not "OK" in res:
|
||||
raise Exception("Could not add hostapd interface")
|
||||
|
||||
def add_bss(self, phy, confname, ignore_error=False):
|
||||
res = self.ctrl.request("ADD bss_config=" + phy + ":" + confname)
|
||||
if not "OK" in res:
|
||||
|
@ -137,6 +142,14 @@ def add_bss(phy, ifname, confname, ignore_error=False):
|
|||
if not hapd.ping():
|
||||
raise Exception("Could not ping hostapd")
|
||||
|
||||
def add_iface(ifname, confname):
|
||||
logger.info("Starting interface " + ifname)
|
||||
hapd_global = HostapdGlobal()
|
||||
hapd_global.add_iface(ifname, confname)
|
||||
hapd = Hostapd(ifname)
|
||||
if not hapd.ping():
|
||||
raise Exception("Could not ping hostapd")
|
||||
|
||||
def remove_bss(ifname):
|
||||
logger.info("Removing BSS " + ifname)
|
||||
hapd_global = HostapdGlobal()
|
||||
|
|
21
tests/hwsim/multi-bss.conf
Normal file
21
tests/hwsim/multi-bss.conf
Normal file
|
@ -0,0 +1,21 @@
|
|||
driver=nl80211
|
||||
|
||||
hw_mode=g
|
||||
channel=1
|
||||
ieee80211n=1
|
||||
|
||||
interface=wlan3
|
||||
ctrl_interface=/var/run/hostapd
|
||||
|
||||
ssid=bss-1
|
||||
|
||||
|
||||
bss=wlan3-2
|
||||
bssid=02:00:00:00:03:01
|
||||
ctrl_interface=/var/run/hostapd
|
||||
ssid=bss-2
|
||||
|
||||
bss=wlan3-3
|
||||
bssid=02:00:00:00:03:02
|
||||
ctrl_interface=/var/run/hostapd
|
||||
ssid=bss-3
|
|
@ -127,6 +127,7 @@ def test_ap_bss_add_remove(dev, apdev):
|
|||
hostapd.remove_bss(ifname2)
|
||||
multi_check(dev, [ True, False, False ])
|
||||
hostapd.remove_bss(ifname1)
|
||||
multi_check(dev, [ False, False, False ])
|
||||
hostapd.add_bss('phy3', ifname1, 'bss-1.conf')
|
||||
multi_check(dev, [ True, False, False ])
|
||||
hostapd.add_bss('phy3', ifname2, 'bss-2.conf')
|
||||
|
@ -138,6 +139,25 @@ def test_ap_bss_add_remove(dev, apdev):
|
|||
hostapd.add_bss('phy3', ifname3, 'bss-3.conf', ignore_error=True)
|
||||
multi_check(dev, [ True, True, True ])
|
||||
|
||||
def test_ap_multi_bss_config(dev, apdev):
|
||||
"""hostapd start with a multi-BSS configuration file"""
|
||||
for d in dev:
|
||||
d.request("SET ignore_old_scan_res 1")
|
||||
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.enable()
|
||||
multi_check(dev, [ True, True, True ])
|
||||
hostapd.remove_bss(ifname1)
|
||||
multi_check(dev, [ False, True, True ])
|
||||
hostapd.remove_bss(ifname2)
|
||||
multi_check(dev, [ False, False, True ])
|
||||
hostapd.remove_bss(ifname3)
|
||||
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)
|
||||
|
|
Loading…
Reference in a new issue