tests: Add a helper function for clearing scan cache
This makes it more convenient and consistent to clear the cached scan results from cfg80211 and wpa_supplicant. Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
This commit is contained in:
parent
92e3c0b14c
commit
243dcc4ae4
6 changed files with 19 additions and 24 deletions
|
@ -476,6 +476,7 @@ def test_ap_hs20_connect_api(dev, apdev):
|
||||||
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
|
||||||
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
|
wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
|
||||||
wpas.hs20_enable()
|
wpas.hs20_enable()
|
||||||
|
wpas.flush_scan_cache()
|
||||||
id = wpas.add_cred_values({ 'realm': "example.com",
|
id = wpas.add_cred_values({ 'realm': "example.com",
|
||||||
'username': "hs20-test",
|
'username': "hs20-test",
|
||||||
'password': "password",
|
'password': "password",
|
||||||
|
@ -2114,7 +2115,7 @@ def test_ap_hs20_random_mac_addr(dev, apdev):
|
||||||
wpas.request("SET preassoc_mac_addr 1")
|
wpas.request("SET preassoc_mac_addr 1")
|
||||||
wpas.request("SET rand_addr_lifetime 60")
|
wpas.request("SET rand_addr_lifetime 60")
|
||||||
wpas.hs20_enable()
|
wpas.hs20_enable()
|
||||||
wpas.scan(freq="2412", only_new=True)
|
wpas.flush_scan_cache()
|
||||||
id = wpas.add_cred_values({ 'realm': "example.com",
|
id = wpas.add_cred_values({ 'realm': "example.com",
|
||||||
'username': "hs20-test",
|
'username': "hs20-test",
|
||||||
'password': "password",
|
'password': "password",
|
||||||
|
|
|
@ -556,11 +556,7 @@ def test_ap_wps_reg_config(dev, apdev):
|
||||||
|
|
||||||
logger.info("Re-configure back to open")
|
logger.info("Re-configure back to open")
|
||||||
dev[0].request("REMOVE_NETWORK all")
|
dev[0].request("REMOVE_NETWORK all")
|
||||||
dev[0].request("BSS_FLUSH 0")
|
dev[0].flush_scan_cache()
|
||||||
dev[0].request("SCAN freq=2412 only_new=1")
|
|
||||||
ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 15)
|
|
||||||
if ev is None:
|
|
||||||
raise Exception("Scan timed out")
|
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
dev[0].wps_reg(apdev[0]['bssid'], appin, "wps-open", "OPEN", "NONE", "")
|
dev[0].wps_reg(apdev[0]['bssid'], appin, "wps-open", "OPEN", "NONE", "")
|
||||||
status = dev[0].get_status()
|
status = dev[0].get_status()
|
||||||
|
|
|
@ -207,10 +207,8 @@ def test_autogo_following_bss(dev, apdev):
|
||||||
def test_go_neg_with_bss_connected(dev, apdev):
|
def test_go_neg_with_bss_connected(dev, apdev):
|
||||||
"""P2P channel selection: GO negotiation when station interface is connected"""
|
"""P2P channel selection: GO negotiation when station interface is connected"""
|
||||||
|
|
||||||
dev[0].request("BSS_FLUSH 0")
|
dev[0].flush_scan_cache()
|
||||||
dev[0].request("SCAN freq=2412 only_new=1")
|
dev[1].flush_scan_cache()
|
||||||
dev[1].request("BSS_FLUSH 0")
|
|
||||||
dev[1].request("SCAN freq=2412 only_new=1")
|
|
||||||
dev[0].request("SET p2p_no_group_iface 0")
|
dev[0].request("SET p2p_no_group_iface 0")
|
||||||
|
|
||||||
hapd = hostapd.add_ap(apdev[0]['ifname'],
|
hapd = hostapd.add_ap(apdev[0]['ifname'],
|
||||||
|
@ -281,10 +279,8 @@ def test_go_neg_with_bss_on_disallowed_chan(dev, apdev):
|
||||||
hapd = hostapd.add_ap(apdev[0]['ifname'],
|
hapd = hostapd.add_ap(apdev[0]['ifname'],
|
||||||
{ "ssid": 'bss-2.4ghz', "channel": '1' })
|
{ "ssid": 'bss-2.4ghz', "channel": '1' })
|
||||||
# make sure PBC overlap from old test cases is not maintained
|
# make sure PBC overlap from old test cases is not maintained
|
||||||
dev[0].request("BSS_FLUSH 0")
|
dev[0].flush_scan_cache()
|
||||||
dev[0].request("SCAN freq=2412 only_new=1")
|
dev[1].flush_scan_cache()
|
||||||
dev[1].request("BSS_FLUSH 0")
|
|
||||||
dev[1].request("SCAN freq=2412 only_new=1")
|
|
||||||
wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
|
wpas.connect("bss-2.4ghz", key_mgmt="NONE", scan_freq="2412")
|
||||||
wpas.request("P2P_SET disallow_freq 2412")
|
wpas.request("P2P_SET disallow_freq 2412")
|
||||||
|
|
||||||
|
@ -343,8 +339,7 @@ def test_go_neg_forced_freq_diff_than_bss_freq(dev, apdev):
|
||||||
raise Exception("New radio does not support MCC")
|
raise Exception("New radio does not support MCC")
|
||||||
|
|
||||||
# Clear possible PBC session overlap from previous test case
|
# Clear possible PBC session overlap from previous test case
|
||||||
dev[1].request("BSS_FLUSH 0")
|
dev[1].flush_scan_cache()
|
||||||
dev[1].request("SCAN freq=2412 only_new=1")
|
|
||||||
|
|
||||||
wpas.request("SET p2p_no_group_iface 0")
|
wpas.request("SET p2p_no_group_iface 0")
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,7 @@ def test_concurrent_grpform_while_connecting2(dev, apdev):
|
||||||
logger.info("Start connection to an infrastructure AP")
|
logger.info("Start connection to an infrastructure AP")
|
||||||
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" })
|
hapd = hostapd.add_ap(apdev[0]['ifname'], { "ssid": "test-open" })
|
||||||
dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False)
|
dev[0].connect("test-open", key_mgmt="NONE", wait_connect=False)
|
||||||
dev[1].request("BSS_FLUSH 0")
|
dev[1].flush_scan_cache()
|
||||||
dev[1].scan(freq="2412", only_new=True)
|
|
||||||
|
|
||||||
logger.info("Form a P2P group while connecting to an AP")
|
logger.info("Form a P2P group while connecting to an AP")
|
||||||
dev[0].request("SET p2p_no_group_iface 0")
|
dev[0].request("SET p2p_no_group_iface 0")
|
||||||
|
|
|
@ -603,16 +603,16 @@ def test_go_neg_two_peers(dev):
|
||||||
def clear_pbc_overlap(dev, ifname):
|
def clear_pbc_overlap(dev, ifname):
|
||||||
hapd_global = hostapd.HostapdGlobal()
|
hapd_global = hostapd.HostapdGlobal()
|
||||||
hapd_global.remove(ifname)
|
hapd_global.remove(ifname)
|
||||||
|
dev[0].request("P2P_CANCEL")
|
||||||
|
dev[1].request("P2P_CANCEL")
|
||||||
dev[0].p2p_stop_find()
|
dev[0].p2p_stop_find()
|
||||||
dev[1].p2p_stop_find()
|
dev[1].p2p_stop_find()
|
||||||
dev[0].dump_monitor()
|
dev[0].dump_monitor()
|
||||||
dev[1].dump_monitor()
|
dev[1].dump_monitor()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
dev[0].request("BSS_FLUSH 0")
|
dev[0].flush_scan_cache()
|
||||||
dev[0].request("SCAN freq=2412 only_new=1")
|
dev[1].flush_scan_cache()
|
||||||
dev[1].request("BSS_FLUSH 0")
|
time.sleep(0.1)
|
||||||
dev[1].request("SCAN freq=2412 only_new=1")
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
def test_grpform_pbc_overlap(dev, apdev):
|
def test_grpform_pbc_overlap(dev, apdev):
|
||||||
"""P2P group formation during PBC overlap"""
|
"""P2P group formation during PBC overlap"""
|
||||||
|
|
|
@ -809,7 +809,7 @@ class WpaSupplicant:
|
||||||
else:
|
else:
|
||||||
cmd = "SCAN"
|
cmd = "SCAN"
|
||||||
if freq:
|
if freq:
|
||||||
cmd = cmd + " freq=" + freq
|
cmd = cmd + " freq=" + str(freq)
|
||||||
if only_new:
|
if only_new:
|
||||||
cmd += " only_new=1"
|
cmd += " only_new=1"
|
||||||
if not no_wait:
|
if not no_wait:
|
||||||
|
@ -831,6 +831,10 @@ class WpaSupplicant:
|
||||||
return
|
return
|
||||||
raise Exception("Could not find BSS " + bssid + " in scan")
|
raise Exception("Could not find BSS " + bssid + " in scan")
|
||||||
|
|
||||||
|
def flush_scan_cache(self):
|
||||||
|
self.request("BSS_FLUSH 0")
|
||||||
|
self.scan(freq=2412, only_new=True)
|
||||||
|
|
||||||
def roam(self, bssid, fail_test=False):
|
def roam(self, bssid, fail_test=False):
|
||||||
self.dump_monitor()
|
self.dump_monitor()
|
||||||
if "OK" not in self.request("ROAM " + bssid):
|
if "OK" not in self.request("ROAM " + bssid):
|
||||||
|
|
Loading…
Reference in a new issue