subprocess.call(['iw', 'reg', 'set', '00'])
def test_ap_vht160(dev, apdev):
- """VHT with 160 MHz channel width"""
+ """VHT with 160 MHz channel width (1)"""
try:
hapd = None
- hapd2 = None
params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz")
raise Exception("Unexpected interface state: " + state)
- params = { "ssid": "vht2",
+ logger.info("Waiting for CAC to complete")
+
+ ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
+ if "success=1" not in ev:
+ raise Exception("CAC failed")
+ if "freq=5180" not in ev:
+ raise Exception("Unexpected DFS freq result")
+
+ ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
+ if not ev:
+ raise Exception("AP setup timed out")
+
+ state = hapd.get_status_field("state")
+ if state != "ENABLED":
+ raise Exception("Unexpected interface state")
+
+ dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+ hwsim_utils.test_connectivity(dev[0], hapd)
+ sig = dev[0].request("SIGNAL_POLL").splitlines()
+ if "FREQUENCY=5180" not in sig:
+ raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
+ if "WIDTH=160 MHz" not in sig:
+ raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
+ except Exception, e:
+ if isinstance(e, Exception) and str(e) == "AP startup failed":
+ if not vht_supported():
+ raise HwsimSkip("80/160 MHz channel not supported in regulatory information")
+ raise
+ finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ subprocess.call(['iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
+
+def test_ap_vht160b(dev, apdev):
+ """VHT with 160 MHz channel width (2)"""
+ try:
+ hapd = None
+
+ params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
"channel": "104",
"vht_oper_centr_freq_seg0_idx": "114",
'ieee80211d': '1',
'ieee80211h': '1' }
- hapd2 = hostapd.add_ap(apdev[1], params, wait_enabled=False)
+ hapd = hostapd.add_ap(apdev[1], params, wait_enabled=False)
- ev = wait_dfs_event(hapd2, "DFS-CAC-START", 5)
+ ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
if "DFS-CAC-START" not in ev:
raise Exception("Unexpected DFS event(2)")
- state = hapd2.get_status_field("state")
+ state = hapd.get_status_field("state")
if state != "DFS":
- raise Exception("Unexpected interface state(2): " + state)
+ if state == "DISABLED" and not os.path.exists("dfs"):
+ # Not all systems have recent enough CRDA version and
+ # wireless-regdb changes to support 160 MHz and DFS. For now,
+ # do not report failures for this test case.
+ raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz")
+ raise Exception("Unexpected interface state: " + state)
logger.info("Waiting for CAC to complete")
ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70)
- if "success=1" not in ev:
- raise Exception("CAC failed")
- if "freq=5180" not in ev:
- raise Exception("Unexpected DFS freq result")
-
- ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
- if not ev:
- raise Exception("AP setup timed out")
-
- state = hapd.get_status_field("state")
- if state != "ENABLED":
- raise Exception("Unexpected interface state")
-
- ev = wait_dfs_event(hapd2, "DFS-CAC-COMPLETED", 70)
if "success=1" not in ev:
raise Exception("CAC failed(2)")
if "freq=5520" not in ev:
raise Exception("Unexpected DFS freq result(2)")
- ev = hapd2.wait_event(["AP-ENABLED"], timeout=5)
+ ev = hapd.wait_event(["AP-ENABLED"], timeout=5)
if not ev:
raise Exception("AP setup timed out(2)")
- state = hapd2.get_status_field("state")
+ state = hapd.get_status_field("state")
if state != "ENABLED":
raise Exception("Unexpected interface state(2)")
- freq = hapd2.get_status_field("freq")
+ freq = hapd.get_status_field("freq")
if freq != "5520":
raise Exception("Unexpected frequency(2)")
- dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+ dev[0].connect("vht", key_mgmt="NONE", scan_freq="5520")
hwsim_utils.test_connectivity(dev[0], hapd)
sig = dev[0].request("SIGNAL_POLL").splitlines()
- if "FREQUENCY=5180" not in sig:
- raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
- if "WIDTH=160 MHz" not in sig:
- raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig))
- dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5520")
- hwsim_utils.test_connectivity(dev[1], hapd2)
- sig = dev[1].request("SIGNAL_POLL").splitlines()
if "FREQUENCY=5520" not in sig:
raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig))
if "WIDTH=160 MHz" not in sig:
raise
finally:
dev[0].request("DISCONNECT")
- dev[1].request("DISCONNECT")
if hapd:
hapd.request("DISABLE")
- if hapd2:
- hapd2.request("DISABLE")
subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache()
- dev[1].flush_scan_cache()
def test_ap_vht160_no_dfs_100_plus(dev, apdev):
"""VHT with 160 MHz channel width and no DFS (100 plus)"""