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[1].connect("vht", key_mgmt="NONE", scan_freq="5180",
64 disable_vht="1", wait_connect=False)
65 dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
66 ev = dev[1].wait_event(["CTRL-EVENT-ASSOC-REJECT"])
68 raise Exception("Association rejection timed out")
69 if "status_code=104" not in ev:
70 raise Exception("Unexpected rejection status code")
71 dev[1].request("DISCONNECT")
72 hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
74 if isinstance(e, Exception) and str(e) == "AP startup failed":
75 if not vht_supported():
76 logger.info("80 MHz channel not supported in regulatory information")
80 subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
82 def test_ap_vht_20(devs, apdevs):
86 params = { "ssid": "test-vht20",
94 "vht_oper_chwidth": "0",
95 "vht_oper_centr_freq_seg0_idx": "0",
96 "supported_rates": "60 120 240 360 480 540",
99 hostapd.add_ap(ap['ifname'], params)
100 dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
101 hwsim_utils.test_connectivity(dev.ifname, ap['ifname'])
103 subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])