tests: Move csa_supported() into utils.py

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2020-04-18 11:31:49 +03:00
parent 0b21877185
commit 52ed13b78d
6 changed files with 9 additions and 12 deletions

View File

@ -11,7 +11,7 @@ logger = logging.getLogger()
import hwsim_utils import hwsim_utils
import hostapd import hostapd
from utils import HwsimSkip from utils import *
def connect(dev, apdev, scan_freq="2412", **kwargs): def connect(dev, apdev, scan_freq="2412", **kwargs):
params = {"ssid": "ap-csa", params = {"ssid": "ap-csa",
@ -55,13 +55,6 @@ def wait_channel_switch(dev, freq):
if "freq=%d" % freq not in ev: if "freq=%d" % freq not in ev:
raise Exception("Unexpected frequency: " + ev) raise Exception("Unexpected frequency: " + ev)
# This function checks whether the provided dev, which may be either
# WpaSupplicant or Hostapd supports CSA.
def csa_supported(dev):
res = dev.get_driver_status()
if (int(res['capa.flags'], 0) & 0x80000000) == 0:
raise HwsimSkip("CSA not supported")
@remote_compatible @remote_compatible
def test_ap_csa_1_switch(dev, apdev): def test_ap_csa_1_switch(dev, apdev):
"""AP Channel Switch, one switch""" """AP Channel Switch, one switch"""

View File

@ -14,7 +14,6 @@ import hostapd
from wpasupplicant import WpaSupplicant from wpasupplicant import WpaSupplicant
from utils import * from utils import *
import hwsim_utils import hwsim_utils
from test_ap_csa import csa_supported
def test_ap_ht40_scan(dev, apdev): def test_ap_ht40_scan(dev, apdev):
"""HT40 co-ex scan""" """HT40 co-ex scan"""

View File

@ -15,7 +15,6 @@ import hostapd
from wpasupplicant import WpaSupplicant 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
def test_ap_vht80(dev, apdev): def test_ap_vht80(dev, apdev):
"""VHT with 80 MHz channel width""" """VHT with 80 MHz channel width"""

View File

@ -14,7 +14,6 @@ import hostapd
from wpasupplicant import WpaSupplicant 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
def test_he_open(dev, apdev): def test_he_open(dev, apdev):
"""HE AP with open mode configuration""" """HE AP with open mode configuration"""

View File

@ -17,7 +17,7 @@ import hostapd
from wpasupplicant import WpaSupplicant from wpasupplicant import WpaSupplicant
from utils import * from utils import *
from tshark import run_tshark from tshark import run_tshark
from test_ap_csa import switch_channel, wait_channel_switch, csa_supported from test_ap_csa import switch_channel, wait_channel_switch
def check_scan(dev, params, other_started=False, test_busy=False): def check_scan(dev, params, other_started=False, test_busy=False):
if not other_started: if not other_started:

View File

@ -120,6 +120,13 @@ def vht_supported():
return True return True
return False return False
# This function checks whether the provided dev, which may be either
# WpaSupplicant or Hostapd supports CSA.
def csa_supported(dev):
res = dev.get_driver_status()
if (int(res['capa.flags'], 0) & 0x80000000) == 0:
raise HwsimSkip("CSA not supported")
def get_phy(ap, ifname=None): def get_phy(ap, ifname=None):
phy = "phy3" phy = "phy3"
try: try: