def test_ap_remove_during_acs(dev, apdev): """Remove interface during ACS""" force_prev_ap_on_24g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs-remove", passphrase="12345678") params['channel'] = '0' hostapd.add_ap(apdev[0], params) hostapd.remove_bss(apdev[0])
def _test_ap_bss_add_many(dev, apdev): ifname = apdev[0]['ifname'] hostapd.add_bss(apdev[0], ifname, 'bss-1.conf') 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(apdev[0], 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) hostapd.remove_bss(apdev[0], ifname2)
def hostapd_oom_loop(apdev, params, start_func="main"): hapd = hostapd.add_ap(apdev[0], {"ssid": "ctrl"}) count = 0 for i in range(1, 1000): if "OK" not in hapd.request("TEST_ALLOC_FAIL %d:%s" % (i, start_func)): raise HwsimSkip("TEST_ALLOC_FAIL not supported") try: hostapd.add_ap(apdev[1], params, timeout=2.5) logger.info("Iteration %d - success" % i) hostapd.remove_bss(apdev[1]) state = hapd.request('GET_ALLOC_FAIL') logger.info("GET_ALLOC_FAIL: " + state) hapd.request("TEST_ALLOC_FAIL 0:") if i < 3: raise Exception("AP setup succeeded during out-of-memory") if state.startswith('0:'): count = 0 else: count += 1 if count == 5: break except Exception as e: logger.info("Iteration %d - %s" % (i, str(e)))
def force_prev_ap_on_5g(ap): # For now, make sure the last operating channel was on 5 GHz band to get # sufficient survey data from mac80211_hwsim. hostapd.add_ap(ap, { "ssid": "open", "hw_mode": "a", "channel": "36", "country_code": "US" }) time.sleep(0.1) hostapd.remove_bss(ap)
def test_ap_bss_add_out_of_memory(dev, apdev): """Running out of memory while adding a BSS""" hapd2 = hostapd.add_ap(apdev[1], {"ssid": "open"}) ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' confname1 = hostapd.cfg_file(apdev[0], "bss-1.conf") confname2 = hostapd.cfg_file(apdev[0], "bss-2.conf") hapd_bss_out_of_mem(hapd2, 'phy3', confname1, 1, 'hostapd_add_iface') for i in range(1, 3): hapd_bss_out_of_mem(hapd2, 'phy3', confname1, i, 'hostapd_interface_init_bss') hapd_bss_out_of_mem(hapd2, 'phy3', confname1, 1, 'ieee802_11_build_ap_params') hostapd.add_bss(apdev[0], ifname1, confname1) hapd_bss_out_of_mem(hapd2, 'phy3', confname2, 1, 'hostapd_interface_init_bss') hapd_bss_out_of_mem(hapd2, 'phy3', confname2, 1, 'ieee802_11_build_ap_params') hostapd.add_bss(apdev[0], ifname2, confname2) hostapd.remove_bss(apdev[0], ifname2) hostapd.remove_bss(apdev[0], ifname1)
def test_olbc(dev, apdev): """OLBC detection""" params = { "ssid": "test-olbc", "channel": "6", "ht_capab": "[HT40-]", "ap_table_expiration_time": "2" } hapd = hostapd.add_ap(apdev[0], params) status = hapd.get_status() if status['olbc'] != '0' or status['olbc_ht'] != '0': raise Exception("Unexpected OLBC information") params = { "ssid": "olbc-ap", "hw_mode": "b", "channel": "6", "wmm_enabled": "0" } hostapd.add_ap(apdev[1], params) time.sleep(0.5) status = hapd.get_status() if status['olbc'] != '1' or status['olbc_ht'] != '1': raise Exception("Missing OLBC information") hostapd.remove_bss(apdev[1]) logger.info("Waiting for OLBC state to time out") cleared = False for i in range(0, 15): time.sleep(1) status = hapd.get_status() if status['olbc'] == '0' and status['olbc_ht'] == '0': cleared = True break if not cleared: raise Exception("OLBC state did nto time out")
def test_ap_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" for i in range(3): dev[i].flush_scan_cache() ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' 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, 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, confname1) hostapd.add_bss(apdev[0], ifname2, confname2) hostapd.remove_bss(apdev[0], ifname1) multi_check(apdev[0], dev, [False, False])
def test_ap_remove_during_ht_coex_scan(dev, apdev): """Remove interface during HT co-ex scan""" params = hostapd.wpa2_params(ssid="test-ht-remove", passphrase="12345678") params['channel'] = '1' params['ht_capab'] = "[HT40+]" ifname = apdev[0]['ifname'] hostapd.add_ap(apdev[0], params) hostapd.remove_bss(apdev[0])
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") subprocess.check_call(["iw", "dev", ifname1, "interface", "add", ifname2, "type", "__ap"]) hostapd.add_bss("phy3", ifname2, "bss-2.conf") hostapd.remove_bss(ifname2) subprocess.check_call(["iw", "dev", ifname2, "del"])
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(apdev[0], ifname1, 'bss-1.conf') subprocess.check_call( ["iw", "dev", ifname1, "interface", "add", ifname2, "type", "__ap"]) hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf') hostapd.remove_bss(apdev[0], ifname2) subprocess.check_call(["iw", "dev", ifname2, "del"])
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') subprocess.check_call(["iw", "dev", ifname1, "interface", "add", ifname2, "type", "__ap"]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') hostapd.remove_bss(ifname2) subprocess.check_call(["iw", "dev", ifname2, "del"])
def test_ap_remove_during_ht_coex_scan3(dev, apdev): """Remove second BSS during HT co-ex scan in multi-BSS configuration""" ifname = apdev[0]['ifname'] ifname2 = ifname + "-2" hapd = hostapd.add_ap(apdev[0], {}, no_enable=True) hapd.set("ssid", "test-ht-remove") hapd.set("channel", "1") hapd.set("ht_capab", "[HT40+]") hapd.set("bss", ifname2) hapd.set("ssid", "test-ht-remove2") hapd.enable() hostapd.remove_bss(apdev[0], ifname2)
def test_ap_remove_during_acs3(dev, apdev): """Remove second BSS during ACS in multi-BSS configuration""" force_prev_ap_on_24g(apdev[0]) ifname = apdev[0]['ifname'] ifname2 = ifname + "-2" hapd = hostapd.add_ap(apdev[0], {}, no_enable=True) hapd.set("ssid", "test-acs-remove") hapd.set("channel", "0") hapd.set("bss", ifname2) hapd.set("ssid", "test-acs-remove2") hapd.enable() hostapd.remove_bss(apdev[0], ifname2)
def clear_pbc_overlap(dev, ap): hostapd.remove_bss(ap) dev[0].request("P2P_CANCEL") dev[1].request("P2P_CANCEL") dev[0].p2p_stop_find() dev[1].p2p_stop_find() dev[0].dump_monitor() dev[1].dump_monitor() time.sleep(0.1) dev[0].flush_scan_cache() dev[1].flush_scan_cache() time.sleep(0.1)
def test_ap_bss_add_out_of_memory(dev, apdev): """Running out of memory while adding a BSS""" hapd2 = hostapd.add_ap(apdev[1]["ifname"], {"ssid": "open"}) ifname1 = apdev[0]["ifname"] ifname2 = apdev[0]["ifname"] + "-2" hapd_bss_out_of_mem(hapd2, "phy3", "bss-1.conf", 1, "hostapd_add_iface") for i in range(1, 3): hapd_bss_out_of_mem(hapd2, "phy3", "bss-1.conf", i, "hostapd_interface_init_bss") hapd_bss_out_of_mem(hapd2, "phy3", "bss-1.conf", 1, "ieee802_11_build_ap_params") hostapd.add_bss("phy3", 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.remove_bss(ifname2) hostapd.remove_bss(ifname1)
def test_ap_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" 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_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" 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], scan_opt=False) 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], scan_opt=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_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" 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_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" for i in range(3): 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') multi_check(dev, [ True, True ], scan_opt=False) 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 ], scan_opt=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_bss_add_remove_during_ht_scan(dev, apdev): """Dynamic BSS add during HT40 co-ex scan""" for i in range(3): 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') multi_check(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) 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])
def test_ap_bss_add_out_of_memory(dev, apdev): """Running out of memory while adding a BSS""" hapd2 = hostapd.add_ap(apdev[1]['ifname'], { "ssid": "open" }) ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' hapd_bss_out_of_mem(hapd2, 'phy3', 'bss-1.conf', 1, 'hostapd_add_iface') for i in range(1, 3): hapd_bss_out_of_mem(hapd2, 'phy3', 'bss-1.conf', i, 'hostapd_interface_init_bss') hapd_bss_out_of_mem(hapd2, 'phy3', 'bss-1.conf', 1, 'ieee802_11_build_ap_params') hostapd.add_bss('phy3', 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.remove_bss(ifname2) hostapd.remove_bss(ifname1)
def test_ap_multi_bss_config(dev, apdev): """hostapd start with a multi-BSS configuration file""" for i in range(3): dev[i].flush_scan_cache() ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' ifname3 = apdev[0]['ifname'] + '-3' 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]) hostapd.remove_bss(apdev[0], ifname2) multi_check(dev, [True, False, True]) hostapd.remove_bss(apdev[0], ifname3) multi_check(dev, [True, False, False]) hostapd.remove_bss(apdev[0], ifname1) multi_check(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])
def test_ap_multi_bss_config(dev, apdev): """hostapd start with a multi-BSS configuration file""" ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' ifname3 = apdev[0]['ifname'] + '-3' logger.info("Set up three BSSes with one configuration file") hostapd.add_iface(ifname1, 'multi-bss.conf') hapd = hostapd.Hostapd(ifname1) hapd.enable() multi_check(dev, [ True, True, True ]) hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, True ]) hostapd.remove_bss(ifname3) multi_check(dev, [ True, False, False ]) hostapd.remove_bss(ifname1) multi_check(dev, [ False, False, False ]) hostapd.add_iface(ifname1, 'multi-bss.conf') hapd = hostapd.Hostapd(ifname1) hapd.enable() hostapd.remove_bss(ifname1) multi_check(dev, [ False, False, False ])
def test_ap_multi_bss_config(dev, apdev): """hostapd start with a multi-BSS configuration file""" ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' ifname3 = apdev[0]['ifname'] + '-3' logger.info("Set up three BSSes with one configuration file") hostapd.add_iface(ifname1, 'multi-bss.conf') hapd = hostapd.Hostapd(ifname1) hapd.enable() multi_check(dev, [True, True, True]) hostapd.remove_bss(ifname2) multi_check(dev, [True, False, True]) hostapd.remove_bss(ifname3) multi_check(dev, [True, False, False]) hostapd.remove_bss(ifname1) multi_check(dev, [False, False, False]) hostapd.add_iface(ifname1, 'multi-bss.conf') hapd = hostapd.Hostapd(ifname1) hapd.enable() hostapd.remove_bss(ifname1) multi_check(dev, [False, False, False])
def test_ap_multi_bss_config(dev, apdev): """hostapd start with a multi-BSS configuration file""" for i in range(3): dev[i].flush_scan_cache() ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' ifname3 = apdev[0]['ifname'] + '-3' 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 ]) hostapd.remove_bss(apdev[0], ifname2) multi_check(dev, [ True, False, True ]) hostapd.remove_bss(apdev[0], ifname3) multi_check(dev, [ True, False, False ]) hostapd.remove_bss(apdev[0], ifname1) multi_check(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 ])
def test_ap_invalid_config2(dev, apdev): """Try to start AP with invalid configuration and remove interface""" hapd = invalid_ap(apdev[0]) logger.info("Remove interface with failed configuration") hostapd.remove_bss(apdev[0])
def force_prev_ap_on_24g(ap): # For now, make sure the last operating channel was on 2.4 GHz band to get # sufficient survey data from mac80211_hwsim. hostapd.add_ap(ap, {"ssid": "open"}) time.sleep(0.1) hostapd.remove_bss(ap)
def test_example(devices, setup_params, refs, duts, monitors): """TC example - simple connect and ping test""" try: sta = None ap = None hapd = None wpas = None mon = None # get hosts based on name sta = rutils.get_host(devices, duts[0]) ap = rutils.get_host(devices, refs[0]) # setup log dir local_log_dir = setup_params['local_log_dir'] # setup hw before test rutils.setup_hw([sta, ap], setup_params) # run traces if requested rutils.trace_start([sta], setup_params) # run perf if requested rutils.perf_start([sta], setup_params) # run hostapd/wpa_supplicant rutils.run_wpasupplicant(sta, setup_params) rutils.run_hostapd(ap, setup_params) # get ap_params ap_params = rutils.get_ap_params(channel="1", bw="HT20", country="US", security="open") # Add monitors if requested monitor_hosts = monitor.create(devices, setup_params, refs, duts, monitors) if len(monitor_hosts) > 0: mon = monitor_hosts[0] monitor.add(sta, monitors) monitor.add(ap, monitors) # connect to hostapd/wpa_supplicant UDP CTRL iface hapd = hostapd.add_ap(ap.dev, ap_params) freq = hapd.get_status_field("freq") wpas = WpaSupplicant(hostname=sta.host, global_iface="udp", global_port=sta.port) wpas.interface_add(sta.ifname) # setup standalone monitor based on hapd; could be multi interface # monitor monitor_param = monitor.get_monitor_params(hapd) monitor.setup(mon, [monitor_param]) # run monitors monitor.run(sta, setup_params) monitor.run(ap, setup_params) monitor.run(mon, setup_params) # connect wpa_supplicant to hostapd wpas.connect(ap_params['ssid'], key_mgmt="NONE", scan_freq=freq) # run ping test ap_sta, sta_ap = rutils.check_connectivity(ap, sta, "ipv6") # remove/destroy monitors monitor.remove(sta) monitor.remove(ap) monitor.destroy(devices, monitor_hosts) # hostapd/wpa_supplicant cleanup wpas.interface_remove(sta.ifname) wpas.terminate() hapd.close_ctrl() hostapd.remove_bss(ap.dev) hostapd.terminate(ap.dev) # stop perf rutils.perf_stop([sta], setup_params) # stop traces rutils.trace_stop([sta], setup_params) # get wpa_supplicant/hostapd/tshark logs sta.get_logs(local_log_dir) ap.get_logs(local_log_dir) if mon: mon.get_logs(local_log_dir) return "packet_loss: " + ap_sta + ", " + sta_ap except: rutils.perf_stop([sta], setup_params) rutils.trace_stop([sta], setup_params) if wpas: try: wpas.interface_remove(sta.ifname) wpas.terminate() except: pass if hapd: try: hapd.close_ctrl() hostapd.remove_bss(ap.dev) hostapd.terminate(ap.dev) except: pass if mon: monitor.destroy(devices, monitor_hosts) mon.get_logs(local_log_dir) if sta: monitor.remove(sta) dmesg = setup_params['log_dir'] + setup_params[ 'tc_name'] + "_" + sta.name + "_" + sta.ifname + ".dmesg" sta.execute(["dmesg", "-c", ">", dmesg]) sta.add_log(dmesg) sta.get_logs(local_log_dir) sta.execute(["ifconfig", sta.ifname, "down"]) if ap: monitor.remove(ap) dmesg = setup_params['log_dir'] + setup_params[ 'tc_name'] + "_" + ap.name + "_" + ap.ifname + ".dmesg" ap.execute(["dmesg", "-c", ">", dmesg]) ap.add_log(dmesg) ap.get_logs(local_log_dir) ap.execute(["ifconfig", ap.ifname, " down"]) raise
def test_ap_bss_add_remove(dev, apdev): """Dynamic BSS add/remove operations with hostapd""" ifname1 = apdev[0]['ifname'] 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') multi_check(dev, [ True, False, False ]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [ True, True, True ]) logger.info("Remove the last BSS and re-add it") hostapd.remove_bss(ifname3) multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [ True, True, True ]) logger.info("Remove the middle BSS and re-add it") hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, True ]) hostapd.add_bss('phy3', 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(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') multi_check(dev, [ True, True, True ]) logger.info("Remove two BSSes and re-add them") hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, True ]) hostapd.remove_bss(ifname3) multi_check(dev, [ True, False, False ]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [ True, True, True ]) logger.info("Remove three BSSes in and re-add them") hostapd.remove_bss(ifname3) multi_check(dev, [ True, True, False ]) hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, False ]) hostapd.remove_bss(ifname1) multi_check(dev, [ False, False, False ]) hostapd.add_bss('phy3', ifname1, 'bss-1.conf') multi_check(dev, [ True, False, False ]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', 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) multi_check(dev, [ True, True, True ])
def test_example(devices, setup_params, refs, duts, monitors): """TC example - simple connect and ping test""" try: sta = None ap = None hapd = None wpas = None mon = None # get hosts based on name sta = rutils.get_host(devices, duts[0]) ap = rutils.get_host(devices, refs[0]) # setup log dir local_log_dir = setup_params['local_log_dir'] # setup hw before test rutils.setup_hw([sta, ap], setup_params) # run traces if requested rutils.trace_start([sta], setup_params) # run perf if requested rutils.perf_start([sta], setup_params) # run hostapd/wpa_supplicant rutils.run_wpasupplicant(sta, setup_params) rutils.run_hostapd(ap, setup_params) # get ap_params ap_params = rutils.get_ap_params(channel="1", bw="HT20", country="US", security="open") # Add monitors if requested monitor_hosts = monitor.create(devices, setup_params, refs, duts, monitors) if len(monitor_hosts) > 0: mon = monitor_hosts[0] monitor.add(sta, monitors) monitor.add(ap, monitors) # connect to hostapd/wpa_supplicant UDP CTRL iface hapd = hostapd.add_ap(ap.dev, ap_params) freq = hapd.get_status_field("freq") wpas = WpaSupplicant(hostname = sta.host, global_iface="udp", global_port = sta.port) wpas.interface_add(sta.ifname) # setup standalone monitor based on hapd; could be multi interface # monitor monitor_param = monitor.get_monitor_params(hapd) monitor.setup(mon, [monitor_param]) # run monitors monitor.run(sta, setup_params) monitor.run(ap, setup_params) monitor.run(mon, setup_params) # connect wpa_supplicant to hostapd wpas.connect(ap_params['ssid'], key_mgmt="NONE", scan_freq=freq) # run ping test ap_sta, sta_ap = rutils.check_connectivity(ap, sta, "ipv6") # remove/destroy monitors monitor.remove(sta) monitor.remove(ap) monitor.destroy(devices, monitor_hosts) # hostapd/wpa_supplicant cleanup wpas.interface_remove(sta.ifname) wpas.terminate() hapd.close_ctrl() hostapd.remove_bss(ap.dev) hostapd.terminate(ap.dev) # stop perf rutils.perf_stop([sta], setup_params) # stop traces rutils.trace_stop([sta], setup_params) # get wpa_supplicant/hostapd/tshark logs sta.get_logs(local_log_dir) ap.get_logs(local_log_dir) if mon: mon.get_logs(local_log_dir) return "packet_loss: " + ap_sta + ", " + sta_ap except: rutils.perf_stop([sta], setup_params) rutils.trace_stop([sta], setup_params) if wpas: try: wpas.interface_remove(sta.ifname) wpas.terminate() except: pass if hapd: try: hapd.close_ctrl() hostapd.remove_bss(ap.dev) hostapd.terminate(ap.dev) except: pass if mon: monitor.destroy(devices, monitor_hosts) mon.get_logs(local_log_dir) if sta: monitor.remove(sta) dmesg = setup_params['log_dir'] + setup_params['tc_name'] + "_" + sta.name + "_" + sta.ifname + ".dmesg" sta.execute(["dmesg", "-c", ">", dmesg]) sta.add_log(dmesg) sta.get_logs(local_log_dir) sta.execute(["ifconfig", sta.ifname, "down"]) if ap: monitor.remove(ap) dmesg = setup_params['log_dir'] + setup_params['tc_name'] + "_" + ap.name + "_" + ap.ifname + ".dmesg" ap.execute(["dmesg", "-c", ">", dmesg]) ap.add_log(dmesg) ap.get_logs(local_log_dir) ap.execute(["ifconfig", ap.ifname, " down"]) raise
def _test_ap_bss_add_remove(dev, apdev): for i in range(3): dev[i].request("SCAN_INTERVAL 1") ifname1 = apdev[0]["ifname"] 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") multi_check(dev, [True, False, False]) hostapd.add_bss("phy3", ifname2, "bss-2.conf") multi_check(dev, [True, True, False]) hostapd.add_bss("phy3", ifname3, "bss-3.conf") multi_check(dev, [True, True, True]) logger.info("Remove the last BSS and re-add it") hostapd.remove_bss(ifname3) multi_check(dev, [True, True, False]) hostapd.add_bss("phy3", ifname3, "bss-3.conf") multi_check(dev, [True, True, True]) logger.info("Remove the middle BSS and re-add it") hostapd.remove_bss(ifname2) multi_check(dev, [True, False, True]) hostapd.add_bss("phy3", 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(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") multi_check(dev, [True, True, True]) logger.info("Remove two BSSes and re-add them") hostapd.remove_bss(ifname2) multi_check(dev, [True, False, True]) hostapd.remove_bss(ifname3) multi_check(dev, [True, False, False]) hostapd.add_bss("phy3", ifname2, "bss-2.conf") multi_check(dev, [True, True, False]) hostapd.add_bss("phy3", ifname3, "bss-3.conf") multi_check(dev, [True, True, True]) logger.info("Remove three BSSes in and re-add them") hostapd.remove_bss(ifname3) multi_check(dev, [True, True, False]) hostapd.remove_bss(ifname2) multi_check(dev, [True, False, False]) hostapd.remove_bss(ifname1) multi_check(dev, [False, False, False]) hostapd.add_bss("phy3", ifname1, "bss-1.conf") multi_check(dev, [True, False, False]) hostapd.add_bss("phy3", ifname2, "bss-2.conf") multi_check(dev, [True, True, False]) hostapd.add_bss("phy3", 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) multi_check(dev, [True, True, True])
def _test_ap_bss_add_remove(dev, apdev): for i in range(3): dev[i].flush_scan_cache() dev[i].request("SCAN_INTERVAL 1") ifname1 = apdev[0]['ifname'] 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') multi_check(dev, [ True, False, False ]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [ True, True, True ]) logger.info("Remove the last BSS and re-add it") hostapd.remove_bss(ifname3) multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [ True, True, True ]) logger.info("Remove the middle BSS and re-add it") hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, True ]) hostapd.add_bss('phy3', 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(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') multi_check(dev, [ True, True, True ]) logger.info("Remove two BSSes and re-add them") hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, True ]) hostapd.remove_bss(ifname3) multi_check(dev, [ True, False, False ]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [ True, True, True ]) logger.info("Remove three BSSes in and re-add them") hostapd.remove_bss(ifname3) multi_check(dev, [ True, True, False ]) hostapd.remove_bss(ifname2) multi_check(dev, [ True, False, False ]) hostapd.remove_bss(ifname1) multi_check(dev, [ False, False, False ]) hostapd.add_bss('phy3', ifname1, 'bss-1.conf') multi_check(dev, [ True, False, False ]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [ True, True, False ]) hostapd.add_bss('phy3', 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) multi_check(dev, [ True, True, True ])
def test_ap_config_errors(dev, apdev): """Various hostapd configuration errors""" # IEEE 802.11d without country code params = {"ssid": "foo", "ieee80211d": "1"} hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception( "Unexpected ENABLE success (ieee80211d without country_code)") hostapd.remove_bss(apdev[0]) # IEEE 802.11h without IEEE 802.11d params = {"ssid": "foo", "ieee80211h": "1"} hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception( "Unexpected ENABLE success (ieee80211h without ieee80211d") hostapd.remove_bss(apdev[0]) # Power Constraint without IEEE 802.11d params = {"ssid": "foo", "local_pwr_constraint": "1"} hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception( "Unexpected ENABLE success (local_pwr_constraint without ieee80211d)" ) hostapd.remove_bss(apdev[0]) # Spectrum management without Power Constraint params = {"ssid": "foo", "spectrum_mgmt_required": "1"} hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception( "Unexpected ENABLE success (spectrum_mgmt_required without local_pwr_constraint)" ) hostapd.remove_bss(apdev[0]) # IEEE 802.1X without authentication server params = {"ssid": "foo", "ieee8021x": "1"} hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (ieee8021x)") hostapd.remove_bss(apdev[0]) # RADIUS-PSK without macaddr_acl=2 params = hostapd.wpa2_params(ssid="foo", passphrase="12345678") params["wpa_psk_radius"] = "1" hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (wpa_psk_radius)") hostapd.remove_bss(apdev[0]) # FT without NAS-Identifier params = { "wpa": "2", "wpa_key_mgmt": "FT-PSK", "rsn_pairwise": "CCMP", "wpa_passphrase": "12345678" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception( "Unexpected ENABLE success (FT without nas_identifier)") hostapd.remove_bss(apdev[0]) # Hotspot 2.0 without WPA2/CCMP params = hostapd.wpa2_params(ssid="foo") params['wpa_key_mgmt'] = "WPA-EAP" params['ieee8021x'] = "1" params['auth_server_addr'] = "127.0.0.1" params['auth_server_port'] = "1812" params['auth_server_shared_secret'] = "radius" params['interworking'] = "1" params['hs20'] = "1" params['wpa'] = "1" hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (HS 2.0 without WPA2/CCMP)") hostapd.remove_bss(apdev[0])
def test_ap_config_errors(dev, apdev): """Various hostapd configuration errors""" # IEEE 802.11d without country code params = { "ssid": "foo", "ieee80211d": "1" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (ieee80211d without country_code)") hostapd.remove_bss(apdev[0]) # IEEE 802.11h without IEEE 802.11d params = { "ssid": "foo", "ieee80211h": "1" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (ieee80211h without ieee80211d") hostapd.remove_bss(apdev[0]) # Power Constraint without IEEE 802.11d params = { "ssid": "foo", "local_pwr_constraint": "1" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (local_pwr_constraint without ieee80211d)") hostapd.remove_bss(apdev[0]) # Spectrum management without Power Constraint params = { "ssid": "foo", "spectrum_mgmt_required": "1" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (spectrum_mgmt_required without local_pwr_constraint)") hostapd.remove_bss(apdev[0]) # IEEE 802.1X without authentication server params = { "ssid": "foo", "ieee8021x": "1" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (ieee8021x)") hostapd.remove_bss(apdev[0]) # RADIUS-PSK without macaddr_acl=2 params = hostapd.wpa2_params(ssid="foo", passphrase="12345678") params["wpa_psk_radius"] = "1" hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (wpa_psk_radius)") hostapd.remove_bss(apdev[0]) # FT without NAS-Identifier params = { "wpa": "2", "wpa_key_mgmt": "FT-PSK", "rsn_pairwise": "CCMP", "wpa_passphrase": "12345678" } hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (FT without nas_identifier)") hostapd.remove_bss(apdev[0]) # Hotspot 2.0 without WPA2/CCMP params = hostapd.wpa2_params(ssid="foo") params['wpa_key_mgmt'] = "WPA-EAP" params['ieee8021x'] = "1" params['auth_server_addr'] = "127.0.0.1" params['auth_server_port'] = "1812" params['auth_server_shared_secret'] = "radius" params['interworking'] = "1" params['hs20'] = "1" params['wpa'] = "1" hapd = hostapd.add_ap(apdev[0], params, no_enable=True) if "FAIL" not in hapd.request("ENABLE"): raise Exception("Unexpected ENABLE success (HS 2.0 without WPA2/CCMP)") hostapd.remove_bss(apdev[0])
def _test_ap_bss_add_remove(dev, apdev): for i in range(3): dev[i].flush_scan_cache() dev[i].request("SCAN_INTERVAL 1") ifname1 = apdev[0]['ifname'] ifname2 = apdev[0]['ifname'] + '-2' 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]) hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf') multi_check(dev, [True, True, False]) 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(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(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(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") hostapd.remove_bss(apdev[0], ifname2) multi_check(dev, [True, False, True]) hostapd.remove_bss(apdev[0], ifname3) multi_check(dev, [True, False, False]) hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf') multi_check(dev, [True, True, False]) 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") hostapd.remove_bss(apdev[0], ifname3) multi_check(dev, [True, True, False]) hostapd.remove_bss(apdev[0], ifname2) multi_check(dev, [True, False, False]) hostapd.remove_bss(apdev[0], ifname1) multi_check(dev, [False, False, False]) hostapd.add_bss(apdev[0], ifname1, 'bss-1.conf') multi_check(dev, [True, False, False]) hostapd.add_bss(apdev[0], ifname2, 'bss-2.conf') multi_check(dev, [True, True, False]) 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(apdev[0], ifname3, 'bss-3.conf', ignore_error=True) multi_check(dev, [True, True, True])
def test_ap_bss_add_remove(dev, apdev): """Dynamic BSS add/remove operations with hostapd""" ifname1 = apdev[0]['ifname'] 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') multi_check(dev, [True, False, False]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [True, True, False]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [True, True, True]) logger.info("Remove the last BSS and re-add it") hostapd.remove_bss(ifname3) multi_check(dev, [True, True, False]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [True, True, True]) logger.info("Remove the middle BSS and re-add it") hostapd.remove_bss(ifname2) multi_check(dev, [True, False, True]) hostapd.add_bss('phy3', 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(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') multi_check(dev, [True, True, True]) logger.info("Remove two BSSes and re-add them") hostapd.remove_bss(ifname2) multi_check(dev, [True, False, True]) hostapd.remove_bss(ifname3) multi_check(dev, [True, False, False]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [True, True, False]) hostapd.add_bss('phy3', ifname3, 'bss-3.conf') multi_check(dev, [True, True, True]) logger.info("Remove three BSSes in and re-add them") hostapd.remove_bss(ifname3) multi_check(dev, [True, True, False]) hostapd.remove_bss(ifname2) multi_check(dev, [True, False, False]) hostapd.remove_bss(ifname1) multi_check(dev, [False, False, False]) hostapd.add_bss('phy3', ifname1, 'bss-1.conf') multi_check(dev, [True, False, False]) hostapd.add_bss('phy3', ifname2, 'bss-2.conf') multi_check(dev, [True, True, False]) hostapd.add_bss('phy3', 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) multi_check(dev, [True, True, True])
def force_prev_ap_on_24g(ap): # For now, make sure the last operating channel was on 2.4 GHz band to get # sufficient survey data from mac80211_hwsim. hostapd.add_ap(ap, { "ssid": "open" }) time.sleep(0.1) hostapd.remove_bss(ap)