1 # Test cases for VHT operations with hostapd
2 # Copyright (c) 2014, Qualcomm Atheros, Inc.
3 # Copyright (c) 2013, Intel Corporation
5 # This software may be distributed under the terms of the BSD license.
6 # See README for more details.
9 logger = logging.getLogger()
10 import subprocess, time
16 cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE)
17 reg = cmd.stdout.read()
18 if "@ 80)" in reg or "@ 160)" in reg:
22 def test_ap_vht80(dev, apdev):
23 """VHT with 80 MHz channel width"""
25 params = { "ssid": "vht",
29 "ht_capab": "[HT40+]",
32 "vht_oper_chwidth": "1",
33 "vht_oper_centr_freq_seg0_idx": "42" }
34 hapd = hostapd.add_ap(apdev[0]['ifname'], params)
36 dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
37 hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
39 if isinstance(e, Exception) and str(e) == "AP startup failed":
40 if not vht_supported():
41 logger.info("80 MHz channel not supported in regulatory information")
45 subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
47 def test_ap_vht80_params(dev, apdev):
48 """VHT with 80 MHz channel width and number of optional features enabled"""
50 params = { "ssid": "vht",
54 "ht_capab": "[HT40+][SHORT-GI-40][DSS_CCK-40]",
57 "vht_oper_chwidth": "1",
58 "vht_capab": "[MAX-MPDU-11454][RXLDPC][SHORT-GI-80][TX-STBC-2BY1][RX-STBC-1][MAX-A-MPDU-LEN-EXP0]",
59 "vht_oper_centr_freq_seg0_idx": "42",
61 hapd = hostapd.add_ap(apdev[0]['ifname'], params)
63 dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
64 hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
66 if isinstance(e, Exception) and str(e) == "AP startup failed":
67 if not vht_supported():
68 logger.info("80 MHz channel not supported in regulatory information")
72 subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
74 def test_ap_vht_20(devs, apdevs):
78 params = { "ssid": "test-vht20",
86 "vht_oper_chwidth": "0",
87 "vht_oper_centr_freq_seg0_idx": "0",
90 hostapd.add_ap(ap['ifname'], params)
91 dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
92 hwsim_utils.test_connectivity(dev.ifname, ap['ifname'])
94 subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])