tests: Wi-Fi generation indication for HT and VHT

Signed-off-by: Jouni Malinen <jouni@codeaurora.org>
This commit is contained in:
Jouni Malinen 2019-02-14 22:36:40 +02:00 committed by Jouni Malinen
parent 3f8ceff54c
commit 810dcfb667
2 changed files with 76 additions and 0 deletions

View file

@ -11,6 +11,7 @@ logger = logging.getLogger()
import struct import struct
import hostapd import hostapd
from wpasupplicant import WpaSupplicant
from utils import HwsimSkip, alloc_fail, parse_ie from utils import HwsimSkip, alloc_fail, parse_ie
import hwsim_utils import hwsim_utils
from test_ap_csa import csa_supported 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()) sta = hapd.get_sta(dev[0].own_addr())
logger.info("hostapd STA: " + str(sta)) 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 @remote_compatible
def test_ap_ht40_scan_conflict(dev, apdev): def test_ap_ht40_scan_conflict(dev, apdev):
"""HT40 co-ex scan conflict""" """HT40 co-ex scan conflict"""

View file

@ -12,6 +12,7 @@ import subprocess, time
import hwsim_utils import hwsim_utils
import hostapd import hostapd
from wpasupplicant import WpaSupplicant
from utils import * from utils import *
from test_dfs import wait_dfs_event from test_dfs import wait_dfs_event
from test_ap_csa import csa_supported from test_ap_csa import csa_supported
@ -86,6 +87,53 @@ def test_ap_vht80(dev, apdev):
subprocess.call(['iw', 'reg', 'set', '00']) subprocess.call(['iw', 'reg', 'set', '00'])
dev[0].flush_scan_cache() 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): def vht80_test(apdev, dev, channel, ht_capab):
clear_scan_cache(apdev) clear_scan_cache(apdev)
try: try: