tests: Channel switch with VHT80

Signed-off-by: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2014-10-25 11:29:28 +03:00
parent aed8d4d1ff
commit d4792c0cb7

View file

@ -13,6 +13,7 @@ import subprocess, time
import hwsim_utils import hwsim_utils
import hostapd import hostapd
from test_dfs import wait_dfs_event from test_dfs import wait_dfs_event
from test_ap_csa import csa_supported
def vht_supported(): def vht_supported():
cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE)
@ -275,3 +276,53 @@ def test_ap_vht80plus80(dev, apdev):
raise raise
finally: finally:
subprocess.call(['sudo', 'iw', 'reg', 'set', '00']) subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
def test_ap_vht80_csa(dev, apdev):
"""VHT with 80 MHz channel width and CSA"""
if not csa_supported(dev[0]):
return "skip"
try:
params = { "ssid": "vht",
"country_code": "US",
"hw_mode": "a",
"channel": "149",
"ht_capab": "[HT40+]",
"ieee80211n": "1",
"ieee80211ac": "1",
"vht_oper_chwidth": "1",
"vht_oper_centr_freq_seg0_idx": "155" }
hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745")
hwsim_utils.test_connectivity(dev[0], hapd)
hapd.request("CHAN_SWITCH 5 5180 ht vht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80")
ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10)
if ev is None:
raise Exception("CSA finished event timed out")
if "freq=5180" not in ev:
raise Exception("Unexpected channel in CSA finished event")
time.sleep(0.5)
hwsim_utils.test_connectivity(dev[0], hapd)
hapd.request("CHAN_SWITCH 5 5745")
ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10)
if ev is None:
raise Exception("CSA finished event timed out")
if "freq=5745" not in ev:
raise Exception("Unexpected channel in CSA finished event")
time.sleep(0.5)
hwsim_utils.test_connectivity(dev[0], hapd)
# This CSA to same channel will fail in kernel, so use this only for
# extra code coverage.
hapd.request("CHAN_SWITCH 5 5745")
hapd.wait_event(["AP-CSA-FINISHED"], timeout=1)
except Exception, e:
if isinstance(e, Exception) and str(e) == "AP startup failed":
if not vht_supported():
logger.info("80 MHz channel not supported in regulatory information")
return "skip"
raise
finally:
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])