diff --git a/tests/hwsim/test_ap_ht.py b/tests/hwsim/test_ap_ht.py index e6f6502f4..1df9a9de4 100644 --- a/tests/hwsim/test_ap_ht.py +++ b/tests/hwsim/test_ap_ht.py @@ -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""" diff --git a/tests/hwsim/test_ap_vht.py b/tests/hwsim/test_ap_vht.py index d1fc0e830..df4be9b5b 100644 --- a/tests/hwsim/test_ap_vht.py +++ b/tests/hwsim/test_ap_vht.py @@ -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: