Browse Source

tests: Verify BSS additional/removal during HT co-ex scan

This verifies that hostapd can add and remove a secondary BSS
during an ongoing HT co-ex scan.

Signed-hostap: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 11 years ago
parent
commit
dd6f538ea5
3 changed files with 53 additions and 5 deletions
  1. 12 0
      tests/hwsim/bss-ht40-1.conf
  2. 12 0
      tests/hwsim/bss-ht40-2.conf
  3. 29 5
      tests/hwsim/test_ap_dynamic.py

+ 12 - 0
tests/hwsim/bss-ht40-1.conf

@@ -0,0 +1,12 @@
+driver=nl80211
+
+hw_mode=g
+channel=1
+ieee80211n=1
+ht_capab=[HT40+]
+
+interface=wlan3
+bssid=02:00:00:00:03:00
+ctrl_interface=/var/run/hostapd
+
+ssid=bss-1

+ 12 - 0
tests/hwsim/bss-ht40-2.conf

@@ -0,0 +1,12 @@
+driver=nl80211
+
+hw_mode=g
+channel=1
+ieee80211n=1
+ht_capab=[HT40+]
+
+interface=wlan3-2
+bssid=02:00:00:00:03:01
+ctrl_interface=/var/run/hostapd
+
+ssid=bss-2

+ 29 - 5
tests/hwsim/test_ap_dynamic.py

@@ -37,27 +37,28 @@ def test_ap_change_ssid(dev, apdev):
 
 def multi_check(dev, check):
     id = []
-    for i in range(0, 3):
+    num_bss = len(check)
+    for i in range(0, num_bss):
         dev[i].request("BSS_FLUSH 0")
         dev[i].dump_monitor()
         id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE",
                                  scan_freq="2412", wait_connect=check[i]))
-    for i in range(0, 3):
+    for i in range(0, num_bss):
         if not check[i]:
             ev = dev[i].wait_event(["CTRL-EVENT-CONNECTED"], timeout=0.2)
             if ev:
                 raise Exception("Unexpected connection")
 
-    for i in range(0, 3):
+    for i in range(0, num_bss):
         dev[i].remove_network(id[i])
 
     time.sleep(0.3)
 
     res = ''
-    for i in range(0, 3):
+    for i in range(0, num_bss):
         res = res + dev[i].request("BSS RANGE=ALL MASK=0x2")
 
-    for i in range(0, 3):
+    for i in range(0, num_bss):
         if not check[i]:
             bssid = '02:00:00:00:03:0' + str(i)
             if bssid in res:
@@ -126,6 +127,29 @@ 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_bss_add_remove_during_ht_scan(dev, apdev):
+    """Dynamic BSS add during HT40 co-ex scan"""
+    for d in dev:
+        d.request("SET ignore_old_scan_res 1")
+    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')
+    multi_check(dev, [ True, True ])
+    hostapd.remove_bss(ifname2)
+    hostapd.remove_bss(ifname1)
+
+    hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
+    hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
+    hostapd.remove_bss(ifname2)
+    multi_check(dev, [ True, False ])
+    hostapd.remove_bss(ifname1)
+
+    hostapd.add_bss('phy3', ifname1, 'bss-ht40-1.conf')
+    hostapd.add_bss('phy3', ifname2, 'bss-ht40-2.conf')
+    hostapd.remove_bss(ifname1)
+    multi_check(dev, [ False, False ])
+
 def test_ap_multi_bss_config(dev, apdev):
     """hostapd start with a multi-BSS configuration file"""
     for d in dev: