tests: Pass apdev to hostapd.add_bss()

Pass apdev param to hostapd.add_bss(). Kill hardcoded phy param and get
phy base on apdev. These are needed to support operation with a remote
test host.

Signed-off-by: Janusz Dziedzic <janusz.dziedzic@tieto.com>
This commit is contained in:
Janusz Dziedzic 2016-04-07 07:38:02 +02:00 committed by Jouni Malinen
parent 29444a0863
commit 9cd6f4c015
6 changed files with 68 additions and 39 deletions

View file

@ -96,31 +96,31 @@ def _test_ap_bss_add_remove(dev, apdev):
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(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(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(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")
@ -128,9 +128,9 @@ def _test_ap_bss_add_remove(dev, apdev):
multi_check(dev, [ True, False, True ])
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")
@ -140,15 +140,15 @@ def _test_ap_bss_add_remove(dev, apdev):
multi_check(dev, [ True, False, False ])
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):
@ -157,20 +157,20 @@ def test_ap_bss_add_remove_during_ht_scan(dev, apdev):
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(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.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(apdev[0], ifname1)
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')
hostapd.remove_bss(apdev[0], ifname1)
multi_check(dev, [ False, False ])
@ -348,8 +348,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')
hostapd.add_bss(apdev[0], apdev[0]['ifname'], 'bss-1.conf')
hostapd.add_bss(apdev[0], apdev[0]['ifname'] + '-2', 'bss-2.conf')
hapd = hostapd.Hostapd(apdev[0]['ifname'])
hapd.disable()
if "FAIL" not in hapd.request("DISABLE"):
@ -378,8 +378,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')
hostapd.add_bss(apdev[0], ifname, 'bss-1.conf')
hapd = hostapd.HostapdGlobal()
fname = '/tmp/hwsim-bss.conf'
for i in range(16):
@ -393,7 +392,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")
@ -411,10 +410,10 @@ 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.add_bss(apdev[0], ifname2, 'bss-2.conf')
hostapd.remove_bss(apdev[0], ifname2)
subprocess.check_call(["iw", "dev", ifname2, "del"])
@ -439,14 +438,14 @@ 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.add_bss(apdev[0], ifname2, 'bss-2.conf')
hostapd.remove_bss(apdev[0], ifname2)
hostapd.remove_bss(apdev[0], ifname1)
@ -454,8 +453,8 @@ 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')
hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf')
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")