tests: Move clear_scan_cache() and set_world_reg() to utils.py
Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
parent
1bba048d78
commit
0b21877185
11 changed files with 25 additions and 32 deletions
|
@ -10,7 +10,6 @@ import time
|
||||||
|
|
||||||
import hostapd
|
import hostapd
|
||||||
from utils import *
|
from utils import *
|
||||||
from test_ap_ht import clear_scan_cache
|
|
||||||
from test_dfs import wait_dfs_event
|
from test_dfs import wait_dfs_event
|
||||||
|
|
||||||
def force_prev_ap_on_24g(ap):
|
def force_prev_ap_on_24g(ap):
|
||||||
|
|
|
@ -12,27 +12,10 @@ import struct
|
||||||
|
|
||||||
import hostapd
|
import hostapd
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
from utils import HwsimSkip, alloc_fail, parse_ie, clear_regdom
|
from utils import *
|
||||||
import hwsim_utils
|
import hwsim_utils
|
||||||
from test_ap_csa import csa_supported
|
from test_ap_csa import csa_supported
|
||||||
|
|
||||||
def clear_scan_cache(apdev):
|
|
||||||
ifname = apdev['ifname']
|
|
||||||
hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'up'])
|
|
||||||
hostapd.cmd_execute(apdev, ['iw', ifname, 'scan', 'trigger', 'freq', '2412',
|
|
||||||
'flush'])
|
|
||||||
time.sleep(0.1)
|
|
||||||
hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'down'])
|
|
||||||
|
|
||||||
def set_world_reg(apdev0=None, apdev1=None, dev0=None):
|
|
||||||
if apdev0:
|
|
||||||
hostapd.cmd_execute(apdev0, ['iw', 'reg', 'set', '00'])
|
|
||||||
if apdev1:
|
|
||||||
hostapd.cmd_execute(apdev1, ['iw', 'reg', 'set', '00'])
|
|
||||||
if dev0:
|
|
||||||
dev0.cmd_execute(['iw', 'reg', 'set', '00'])
|
|
||||||
time.sleep(0.1)
|
|
||||||
|
|
||||||
def test_ap_ht40_scan(dev, apdev):
|
def test_ap_ht40_scan(dev, apdev):
|
||||||
"""HT40 co-ex scan"""
|
"""HT40 co-ex scan"""
|
||||||
clear_scan_cache(apdev[0])
|
clear_scan_cache(apdev[0])
|
||||||
|
|
|
@ -18,7 +18,6 @@ from tshark import run_tshark
|
||||||
from utils import *
|
from utils import *
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
from wlantest import WlantestCapture
|
from wlantest import WlantestCapture
|
||||||
from test_ap_ht import set_world_reg
|
|
||||||
|
|
||||||
@remote_compatible
|
@remote_compatible
|
||||||
def test_ap_open(dev, apdev):
|
def test_ap_open(dev, apdev):
|
||||||
|
|
|
@ -16,7 +16,6 @@ from wpasupplicant import WpaSupplicant
|
||||||
from utils import *
|
from utils import *
|
||||||
from test_dfs import wait_dfs_event
|
from test_dfs import wait_dfs_event
|
||||||
from test_ap_csa import csa_supported
|
from test_ap_csa import csa_supported
|
||||||
from test_ap_ht import clear_scan_cache
|
|
||||||
|
|
||||||
def test_ap_vht80(dev, apdev):
|
def test_ap_vht80(dev, apdev):
|
||||||
"""VHT with 80 MHz channel width"""
|
"""VHT with 80 MHz channel width"""
|
||||||
|
|
|
@ -15,7 +15,6 @@ from wpasupplicant import WpaSupplicant
|
||||||
from utils import *
|
from utils import *
|
||||||
from test_dfs import wait_dfs_event
|
from test_dfs import wait_dfs_event
|
||||||
from test_ap_csa import csa_supported
|
from test_ap_csa import csa_supported
|
||||||
from test_ap_ht import clear_scan_cache
|
|
||||||
|
|
||||||
def test_he_open(dev, apdev):
|
def test_he_open(dev, apdev):
|
||||||
"""HE AP with open mode configuration"""
|
"""HE AP with open mode configuration"""
|
||||||
|
|
|
@ -12,9 +12,8 @@ logger = logging.getLogger()
|
||||||
import hostapd
|
import hostapd
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
import hwsim_utils
|
import hwsim_utils
|
||||||
from utils import HwsimSkip
|
from utils import *
|
||||||
|
|
||||||
from test_ap_ht import set_world_reg
|
|
||||||
from test_ap_psk import parse_eapol, build_eapol, pmk_to_ptk, eapol_key_mic, recv_eapol, send_eapol, reply_eapol, build_eapol_key_3_4, aes_wrap, pad_key_data
|
from test_ap_psk import parse_eapol, build_eapol, pmk_to_ptk, eapol_key_mic, recv_eapol, send_eapol, reply_eapol, build_eapol_key_3_4, aes_wrap, pad_key_data
|
||||||
|
|
||||||
#TODO: Refuse setting up AP with OCV but without MFP support
|
#TODO: Refuse setting up AP with OCV but without MFP support
|
||||||
|
|
|
@ -13,8 +13,7 @@ import time
|
||||||
import hwsim_utils
|
import hwsim_utils
|
||||||
import hostapd
|
import hostapd
|
||||||
from p2p_utils import *
|
from p2p_utils import *
|
||||||
from test_ap_ht import clear_scan_cache
|
from utils import *
|
||||||
from utils import HwsimSkip
|
|
||||||
|
|
||||||
@remote_compatible
|
@remote_compatible
|
||||||
def test_concurrent_autogo(dev, apdev):
|
def test_concurrent_autogo(dev, apdev):
|
||||||
|
|
|
@ -17,7 +17,6 @@ import time
|
||||||
import hostapd
|
import hostapd
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
from utils import *
|
from utils import *
|
||||||
from test_ap_ht import clear_scan_cache
|
|
||||||
from remotehost import remote_compatible
|
from remotehost import remote_compatible
|
||||||
|
|
||||||
def check_rrm_support(dev):
|
def check_rrm_support(dev):
|
||||||
|
|
|
@ -77,7 +77,7 @@ def test_ssid_utf8(dev, apdev):
|
||||||
if "[UTF-8]" not in dev[0].request("SCAN_RESULTS"):
|
if "[UTF-8]" not in dev[0].request("SCAN_RESULTS"):
|
||||||
raise Exception("[UTF-8] flag not included in SCAN_RESULTS")
|
raise Exception("[UTF-8] flag not included in SCAN_RESULTS")
|
||||||
|
|
||||||
def clear_scan_cache(hapd, dev):
|
def clear_scan_cache2(hapd, dev):
|
||||||
# clear BSS table to avoid issues in following test cases
|
# clear BSS table to avoid issues in following test cases
|
||||||
dev[0].request("REMOVE_NETWORK all")
|
dev[0].request("REMOVE_NETWORK all")
|
||||||
dev[1].request("REMOVE_NETWORK all")
|
dev[1].request("REMOVE_NETWORK all")
|
||||||
|
@ -97,7 +97,7 @@ def test_ssid_hidden(dev, apdev):
|
||||||
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
|
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
|
||||||
if ev is not None:
|
if ev is not None:
|
||||||
raise Exception("Unexpected connection")
|
raise Exception("Unexpected connection")
|
||||||
clear_scan_cache(hapd, dev)
|
clear_scan_cache2(hapd, dev)
|
||||||
|
|
||||||
@remote_compatible
|
@remote_compatible
|
||||||
def test_ssid_hidden2(dev, apdev):
|
def test_ssid_hidden2(dev, apdev):
|
||||||
|
@ -110,7 +110,7 @@ def test_ssid_hidden2(dev, apdev):
|
||||||
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
|
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
|
||||||
if ev is not None:
|
if ev is not None:
|
||||||
raise Exception("Unexpected connection")
|
raise Exception("Unexpected connection")
|
||||||
clear_scan_cache(hapd, dev)
|
clear_scan_cache2(hapd, dev)
|
||||||
|
|
||||||
@remote_compatible
|
@remote_compatible
|
||||||
def test_ssid_hidden_wpa2(dev, apdev):
|
def test_ssid_hidden_wpa2(dev, apdev):
|
||||||
|
@ -124,4 +124,4 @@ def test_ssid_hidden_wpa2(dev, apdev):
|
||||||
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
|
ev = dev[1].wait_event(["CTRL-EVENT-CONNECTED"], timeout=1)
|
||||||
if ev is not None:
|
if ev is not None:
|
||||||
raise Exception("Unexpected connection")
|
raise Exception("Unexpected connection")
|
||||||
clear_scan_cache(hapd, dev)
|
clear_scan_cache2(hapd, dev)
|
||||||
|
|
|
@ -18,7 +18,6 @@ import hostapd
|
||||||
from wpasupplicant import WpaSupplicant
|
from wpasupplicant import WpaSupplicant
|
||||||
from utils import *
|
from utils import *
|
||||||
from tshark import run_tshark, run_tshark_json
|
from tshark import run_tshark, run_tshark_json
|
||||||
from test_ap_ht import set_world_reg
|
|
||||||
from test_sae import build_sae_commit, sae_rx_commit_token_req
|
from test_sae import build_sae_commit, sae_rx_commit_token_req
|
||||||
from hwsim_utils import set_group_map
|
from hwsim_utils import set_group_map
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,7 @@ import time
|
||||||
import remotehost
|
import remotehost
|
||||||
import logging
|
import logging
|
||||||
logger = logging.getLogger()
|
logger = logging.getLogger()
|
||||||
|
import hostapd
|
||||||
|
|
||||||
def get_ifnames():
|
def get_ifnames():
|
||||||
ifnames = []
|
ifnames = []
|
||||||
|
@ -224,3 +225,20 @@ def start_monitor(ifname, freq=2412):
|
||||||
def stop_monitor(ifname):
|
def stop_monitor(ifname):
|
||||||
subprocess.call(["ip", "link", "set", "dev", ifname, "down"])
|
subprocess.call(["ip", "link", "set", "dev", ifname, "down"])
|
||||||
subprocess.call(["iw", ifname, "set", "type", "managed"])
|
subprocess.call(["iw", ifname, "set", "type", "managed"])
|
||||||
|
|
||||||
|
def clear_scan_cache(apdev):
|
||||||
|
ifname = apdev['ifname']
|
||||||
|
hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'up'])
|
||||||
|
hostapd.cmd_execute(apdev, ['iw', ifname, 'scan', 'trigger', 'freq', '2412',
|
||||||
|
'flush'])
|
||||||
|
time.sleep(0.1)
|
||||||
|
hostapd.cmd_execute(apdev, ['ifconfig', ifname, 'down'])
|
||||||
|
|
||||||
|
def set_world_reg(apdev0=None, apdev1=None, dev0=None):
|
||||||
|
if apdev0:
|
||||||
|
hostapd.cmd_execute(apdev0, ['iw', 'reg', 'set', '00'])
|
||||||
|
if apdev1:
|
||||||
|
hostapd.cmd_execute(apdev1, ['iw', 'reg', 'set', '00'])
|
||||||
|
if dev0:
|
||||||
|
dev0.cmd_execute(['iw', 'reg', 'set', '00'])
|
||||||
|
time.sleep(0.1)
|
||||||
|
|
Loading…
Reference in a new issue