Browse Source

tests: VHT with 160 MHz channel width

Since this requires a recent CRDA version and updated wireless-regdb, do
not report failures yet (i.e., indicate that the test case was skipped
if AP startup fails).

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Jouni Malinen 10 years ago
parent
commit
6259fd814b
1 changed files with 99 additions and 0 deletions
  1. 99 0
      tests/hwsim/test_ap_vht.py

+ 99 - 0
tests/hwsim/test_ap_vht.py

@@ -7,10 +7,12 @@
 
 import logging
 logger = logging.getLogger()
+import os
 import subprocess, time
 
 import hwsim_utils
 import hostapd
+from test_dfs import wait_dfs_event
 
 def vht_supported():
     cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE)
@@ -125,3 +127,100 @@ def test_ap_vht_capab_not_supported(dev, apdev):
                 raise Exception("Unexpected SET failure")
     finally:
         subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+
+def test_ap_vht160(dev, apdev):
+    """VHT with 160 MHz channel width"""
+    try:
+        params = { "ssid": "vht",
+                   "country_code": "FI",
+                   "hw_mode": "a",
+                   "channel": "36",
+                   "ht_capab": "[HT40+]",
+                   "ieee80211n": "1",
+                   "ieee80211ac": "1",
+                   "vht_oper_chwidth": "2",
+                   "vht_oper_centr_freq_seg0_idx": "50",
+                   'ieee80211d': '1',
+                   'ieee80211h': '1' }
+        hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False)
+
+        ev = wait_dfs_event(hapd, "DFS-CAC-START", 5)
+        if "DFS-CAC-START" not in ev:
+            raise Exception("Unexpected DFS event")
+
+        state = hapd.get_status_field("state")
+        if state != "DFS":
+            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.
+                return "skip"
+            raise Exception("Unexpected interface state: " + state)
+
+        params = { "ssid": "vht2",
+                   "country_code": "FI",
+                   "hw_mode": "a",
+                   "channel": "100",
+                   "ht_capab": "[HT40+]",
+                   "ieee80211n": "1",
+                   "ieee80211ac": "1",
+                   "vht_oper_chwidth": "2",
+                   "vht_oper_centr_freq_seg0_idx": "114",
+                   'ieee80211d': '1',
+                   'ieee80211h': '1' }
+        hapd2 = hostapd.add_ap(apdev[1]['ifname'], params, wait_enabled=False)
+
+        ev = wait_dfs_event(hapd2, "DFS-CAC-START", 5)
+        if "DFS-CAC-START" not in ev:
+            raise Exception("Unexpected DFS event(2)")
+
+        state = hapd2.get_status_field("state")
+        if state != "DFS":
+            raise Exception("Unexpected interface state(2): " + 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=5500" not in ev:
+            raise Exception("Unexpected DFS freq result(2)")
+
+        ev = hapd2.wait_event(["AP-ENABLED"], timeout=5)
+        if not ev:
+            raise Exception("AP setup timed out(2)")
+
+        state = hapd2.get_status_field("state")
+        if state != "ENABLED":
+            raise Exception("Unexpected interface state(2)")
+
+        freq = hapd2.get_status_field("freq")
+        if freq != "5500":
+            raise Exception("Unexpected frequency(2)")
+
+        dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+        hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname'])
+        dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5500")
+        hwsim_utils.test_connectivity(dev[1].ifname, apdev[1]['ifname'])
+    except Exception, e:
+        if isinstance(e, Exception) and str(e) == "AP startup failed":
+            if not vht_supported():
+                logger.info("80/160 MHz channel not supported in regulatory information")
+                return "skip"
+        raise
+    finally:
+        subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])