]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
tests: Wi-Fi generation indication for HT and VHT
authorJouni Malinen <jouni@codeaurora.org>
Thu, 14 Feb 2019 20:36:40 +0000 (22:36 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 15 Feb 2019 00:09:41 +0000 (02:09 +0200)
Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
tests/hwsim/test_ap_ht.py
tests/hwsim/test_ap_vht.py

index e6f6502f46596dd775827cda2af169e32cdfaa90..1df9a9de4bf17c62e4912490815d59f84d00b11d 100644 (file)
@@ -11,6 +11,7 @@ logger = logging.getLogger()
 import struct
 
 import hostapd
+from wpasupplicant import WpaSupplicant
 from utils import HwsimSkip, alloc_fail, parse_ie
 import hwsim_utils
 from test_ap_csa import csa_supported
@@ -72,6 +73,33 @@ def test_ap_ht40_scan(dev, apdev):
     sta = hapd.get_sta(dev[0].own_addr())
     logger.info("hostapd STA: " + str(sta))
 
+def test_ap_ht_wifi_generation(dev, apdev):
+    """HT and wifi_generation"""
+    clear_scan_cache(apdev[0])
+    params = { "ssid": "test-ht",
+               "channel": "6" }
+    hapd = hostapd.add_ap(apdev[0], params)
+
+    dev[0].connect("test-ht", key_mgmt="NONE", scan_freq="2437")
+    status = dev[0].get_status()
+    if 'wifi_generation' not in status:
+        # For now, assume this is because of missing kernel support
+        raise HwsimSkip("Association Request IE reporting not supported")
+        #raise Exception("Missing wifi_generation information")
+    if status['wifi_generation'] != "4":
+        raise Exception("Unexpected wifi_generation value: " + status['wifi_generation'])
+
+    wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+    wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
+    wpas.connect("test-ht", key_mgmt="NONE", scan_freq="2437")
+    status = wpas.get_status()
+    if 'wifi_generation' not in status:
+        # For now, assume this is because of missing kernel support
+        raise HwsimSkip("Association Request IE reporting not supported")
+        #raise Exception("Missing wifi_generation information (connect)")
+    if status['wifi_generation'] != "4":
+        raise Exception("Unexpected wifi_generation value (connect): " + status['wifi_generation'])
+
 @remote_compatible
 def test_ap_ht40_scan_conflict(dev, apdev):
     """HT40 co-ex scan conflict"""
index d1fc0e8307232726d4b0c8686f8b93fde1f5ffdf..df4be9b5b27ed507f16bb417fc9ca8de7667673d 100644 (file)
@@ -12,6 +12,7 @@ import subprocess, time
 
 import hwsim_utils
 import hostapd
+from wpasupplicant import WpaSupplicant
 from utils import *
 from test_dfs import wait_dfs_event
 from test_ap_csa import csa_supported
@@ -86,6 +87,53 @@ def test_ap_vht80(dev, apdev):
         subprocess.call(['iw', 'reg', 'set', '00'])
         dev[0].flush_scan_cache()
 
+def test_ap_vht_wifi_generation(dev, apdev):
+    """VHT and wifi_generation"""
+    try:
+        hapd = None
+        params = { "ssid": "vht",
+                   "country_code": "FI",
+                   "hw_mode": "a",
+                   "channel": "36",
+                   "ht_capab": "[HT40+]",
+                   "ieee80211n": "1",
+                   "ieee80211ac": "1",
+                   "vht_oper_chwidth": "1",
+                   "vht_oper_centr_freq_seg0_idx": "42" }
+        hapd = hostapd.add_ap(apdev[0], params)
+        bssid = apdev[0]['bssid']
+
+        dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180")
+        status = dev[0].get_status()
+        if 'wifi_generation' not in status:
+            # For now, assume this is because of missing kernel support
+            raise HwsimSkip("Association Request IE reporting not supported")
+            #raise Exception("Missing wifi_generation information")
+        if status['wifi_generation'] != "5":
+            raise Exception("Unexpected wifi_generation value: " + status['wifi_generation'])
+
+        wpas = WpaSupplicant(global_iface='/tmp/wpas-wlan5')
+        wpas.interface_add("wlan5", drv_params="force_connect_cmd=1")
+        wpas.connect("vht", key_mgmt="NONE", scan_freq="5180")
+        status = wpas.get_status()
+        if 'wifi_generation' not in status:
+            # For now, assume this is because of missing kernel support
+            raise HwsimSkip("Association Request IE reporting not supported")
+            #raise Exception("Missing wifi_generation information (connect)")
+        if status['wifi_generation'] != "5":
+            raise Exception("Unexpected wifi_generation value (connect): " + status['wifi_generation'])
+    except Exception as e:
+        if isinstance(e, Exception) and str(e) == "AP startup failed":
+            if not vht_supported():
+                raise HwsimSkip("80 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 vht80_test(apdev, dev, channel, ht_capab):
     clear_scan_cache(apdev)
     try: