From: Jouni Malinen Date: Sat, 20 Dec 2014 15:13:00 +0000 (+0200) Subject: tests: Large number of BSS add operations with hostapd X-Git-Tag: hostap_2_4~733 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b97a7bf6720869fe5d13c4a52b8f45f8e690ddd4;p=thirdparty%2Fhostap.git tests: Large number of BSS add operations with hostapd Signed-off-by: Jouni Malinen --- diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py index 85075e2fc..8b2ec0c82 100644 --- a/tests/hwsim/test_ap_dynamic.py +++ b/tests/hwsim/test_ap_dynamic.py @@ -8,6 +8,7 @@ import time import subprocess import logging logger = logging.getLogger() +import os import hwsim_utils import hostapd @@ -323,3 +324,51 @@ def test_ap_double_disable(dev, apdev): hapd.disable() if "FAIL" not in hapd.request("DISABLE"): raise Exception("Second DISABLE accepted unexpectedly") + +def test_ap_bss_add_many(dev, apdev): + """Large number of BSS add operations with hostapd""" + try: + _test_ap_bss_add_many(dev, apdev) + finally: + dev[0].request("SCAN_INTERVAL 5") + ifname = apdev[0]['ifname'] + hapd = hostapd.HostapdGlobal() + hapd.flush() + for i in range(16): + ifname2 = ifname + '-' + str(i) + hapd.remove(ifname2) + try: + os.remove('/tmp/hwsim-bss.conf') + except: + pass + +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() + fname = '/tmp/hwsim-bss.conf' + for i in range(16): + ifname2 = ifname + '-' + str(i) + with open(fname, 'w') as f: + f.write("driver=nl80211\n") + f.write("hw_mode=g\n") + f.write("channel=1\n") + f.write("ieee80211n=1\n") + f.write("interface=%s\n" % ifname2) + 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) + os.remove(fname) + + dev[0].request("SCAN_INTERVAL 1") + dev[0].connect("bss-1", key_mgmt="NONE", scan_freq="2412") + dev[0].request("DISCONNECT") + dev[0].wait_disconnected(timeout=5) + for i in range(16): + dev[0].connect("test-%d" % i, key_mgmt="NONE", scan_freq="2412") + dev[0].request("DISCONNECT") + dev[0].wait_disconnected(timeout=5) + ifname2 = ifname + '-' + str(i) + hapd.remove(ifname2)