tests: Generate BSS config files in ap_bss_add_remove_during_ht_scan

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-02-23 17:13:04 +02:00
parent a066644fcb
commit 92f08a3ccd
2 changed files with 15 additions and 8 deletions

View file

@ -806,10 +806,10 @@ def cfg_file(apdev, conf, ifname=None):
# put cfg file in /tmp directory
fname = os.path.join("/tmp", conf)
match = re.search(r'^bss-\d+', conf)
match = re.search(r'^bss-.+', conf)
if match:
with open(fname, 'w') as f:
idx = ''.join(filter(str.isdigit, conf))
idx = ''.join(filter(str.isdigit, conf.split('-')[-1]))
if ifname is None:
ifname = apdev['ifname']
if idx != '1':
@ -820,6 +820,8 @@ def cfg_file(apdev, conf, ifname=None):
f.write("hw_mode=g\n")
f.write("channel=1\n")
f.write("ieee80211n=1\n")
if conf.startswith('bss-ht40-'):
f.write("ht_capab=[HT40+]\n")
f.write("interface=%s\n" % ifname)
f.write("ssid=bss-%s\n" % idx)

View file

@ -158,20 +158,25 @@ 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(apdev[0], ifname1, 'bss-ht40-1.conf')
hostapd.add_bss(apdev[0], ifname2, 'bss-ht40-2.conf')
confname1 = hostapd.cfg_file(apdev[0], "bss-ht40-1.conf")
confname2 = hostapd.cfg_file(apdev[0], "bss-ht40-2.conf")
hapd_global = hostapd.HostapdGlobal(apdev)
hapd_global.send_file(confname1, confname1)
hapd_global.send_file(confname2, confname2)
hostapd.add_bss(apdev[0], ifname1, confname1)
hostapd.add_bss(apdev[0], ifname2, confname2)
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.add_bss(apdev[0], ifname1, confname1)
hostapd.add_bss(apdev[0], ifname2, confname2)
hostapd.remove_bss(apdev[0], ifname2)
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.add_bss(apdev[0], ifname1, confname1)
hostapd.add_bss(apdev[0], ifname2, confname2)
hostapd.remove_bss(apdev[0], ifname1)
multi_check(apdev[0], dev, [False, False])