[PATCH 11/12] tests: fix multi_check()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Don't use hardcoded bssid. Instead
use real bssid.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@xxxxxxxxx>
---
 tests/hwsim/test_ap_dynamic.py | 63 +++++++++++++++++-----------------
 1 file changed, 32 insertions(+), 31 deletions(-)

diff --git a/tests/hwsim/test_ap_dynamic.py b/tests/hwsim/test_ap_dynamic.py
index 7a2ddcc7d..c99f05683 100644
--- a/tests/hwsim/test_ap_dynamic.py
+++ b/tests/hwsim/test_ap_dynamic.py
@@ -15,6 +15,7 @@ import hwsim_utils
 import hostapd
 from utils import alloc_fail, require_under_vm, get_phy
 from test_ap_acs import force_prev_ap_on_24g
+import hostapd_conf
 
 @remote_compatible
 def test_ap_change_ssid(dev, apdev):
@@ -37,7 +38,7 @@ def test_ap_change_ssid(dev, apdev):
     dev[0].set_network_quoted(id, "ssid", "test-wpa2-psk-new")
     dev[0].connect_network(id)
 
-def multi_check(dev, check, scan_opt=True):
+def multi_check(apdev, dev, check, scan_opt=True):
     id = []
     num_bss = len(check)
     for i in range(0, num_bss):
@@ -51,7 +52,7 @@ def multi_check(dev, check, scan_opt=True):
     for i in range(num_bss):
         if not check[i]:
             continue
-        bssid = '02:00:00:00:03:0' + str(i)
+        bssid = hostapd_conf.bssid_inc(apdev, i)
         if scan_opt:
             dev[i].scan_for_bss(bssid, freq=2412)
         id.append(dev[i].connect("bss-" + str(i + 1), key_mgmt="NONE",
@@ -98,59 +99,59 @@ def _test_ap_bss_add_remove(dev, apdev):
     ifname3 = apdev[0]['ifname'] + '-3'
     logger.info("Set up three BSSes one by one")
     hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
-    multi_check(dev, [True, False, False])
+    multi_check(apdev[0], dev, [True, False, False])
     hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
-    multi_check(dev, [True, True, False])
+    multi_check(apdev[0], dev, [True, True, False])
     hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
 
     logger.info("Remove the last BSS and re-add it")
     hostapd.remove_bss(apdev[0], ifname3)
-    multi_check(dev, [True, True, False])
+    multi_check(apdev[0], dev, [True, True, False])
     hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
 
     logger.info("Remove the middle BSS and re-add it")
     hostapd.remove_bss(apdev[0], ifname2)
-    multi_check(dev, [True, False, True])
+    multi_check(apdev[0], dev, [True, False, True])
     hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
 
     logger.info("Remove the first BSS and re-add it and other BSSs")
     hostapd.remove_bss(apdev[0], ifname1)
-    multi_check(dev, [False, False, False])
+    multi_check(apdev[0], dev, [False, False, False])
     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])
+    multi_check(apdev[0], dev, [True, True, True])
 
     logger.info("Remove two BSSes and re-add them")
     hostapd.remove_bss(apdev[0], ifname2)
-    multi_check(dev, [True, False, True])
+    multi_check(apdev[0], dev, [True, False, True])
     hostapd.remove_bss(apdev[0], ifname3)
-    multi_check(dev, [True, False, False])
+    multi_check(apdev[0], dev, [True, False, False])
     hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
-    multi_check(dev, [True, True, False])
+    multi_check(apdev[0], dev, [True, True, False])
     hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
 
     logger.info("Remove three BSSes in and re-add them")
     hostapd.remove_bss(apdev[0], ifname3)
-    multi_check(dev, [True, True, False])
+    multi_check(apdev[0], dev, [True, True, False])
     hostapd.remove_bss(apdev[0], ifname2)
-    multi_check(dev, [True, False, False])
+    multi_check(apdev[0], dev, [True, False, False])
     hostapd.remove_bss(apdev[0], ifname1)
-    multi_check(dev, [False, False, False])
+    multi_check(apdev[0], dev, [False, False, False])
     hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
-    multi_check(dev, [True, False, False])
+    multi_check(apdev[0], dev, [True, False, False])
     hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf')
-    multi_check(dev, [True, True, False])
+    multi_check(apdev[0], dev, [True, True, False])
     hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf')
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
 
     logger.info("Test error handling if a duplicate ifname is tried")
     hostapd.add_bss(apdev[0], ifname3, 'bss-3.conf', ignore_error=True)
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
 
 def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
     """Dynamic BSS add during HT40 co-ex scan"""
@@ -160,20 +161,20 @@ def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
     ifname2 = apdev[0]['ifname'] + '-2'
     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)
+    multi_check(apdev[0], dev, [True, True], scan_opt=False)
     hostapd.remove_bss(apdev[0], ifname2)
     hostapd.remove_bss(apdev[0], 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], ifname2)
-    multi_check(dev, [True, False], scan_opt=False)
+    multi_check(apdev[0], dev, [True, False], scan_opt=False)
     hostapd.remove_bss(apdev[0], 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])
+    multi_check(apdev[0], dev, [False, False])
 
 def test_ap_multi_bss_config(dev, apdev):
     """hostapd start with a multi-BSS configuration file"""
@@ -185,18 +186,18 @@ def test_ap_multi_bss_config(dev, apdev):
     logger.info("Set up three BSSes with one configuration file")
     hapd = hostapd.add_iface(apdev[0], 'multi-bss.conf')
     hapd.enable()
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
     hostapd.remove_bss(apdev[0], ifname2)
-    multi_check(dev, [True, False, True])
+    multi_check(apdev[0], dev, [True, False, True])
     hostapd.remove_bss(apdev[0], ifname3)
-    multi_check(dev, [True, False, False])
+    multi_check(apdev[0], dev, [True, False, False])
     hostapd.remove_bss(apdev[0], ifname1)
-    multi_check(dev, [False, False, False])
+    multi_check(apdev[0], dev, [False, False, False])
 
     hapd = hostapd.add_iface(apdev[0], 'multi-bss.conf')
     hapd.enable()
     hostapd.remove_bss(apdev[0], ifname1)
-    multi_check(dev, [False, False, False])
+    multi_check(apdev[0], dev, [False, False, False])
 
 def invalid_ap(ap):
     logger.info("Trying to start AP " + ap['ifname'] + " with invalid configuration")
@@ -507,7 +508,7 @@ def test_ap_bss_config_file(dev, apdev, params):
     res = subprocess.check_call(cmd)
     if res != 0:
         raise Exception("Could not start hostapd: %s" % str(res))
-    multi_check(dev, [True, True, True])
+    multi_check(apdev[0], dev, [True, True, True])
     for i in range(0, 3):
         dev[i].request("DISCONNECT")
 
-- 
2.17.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux