From d386a9ace839ed7551c4de52177997df3728592d Mon Sep 17 00:00:00 2001 From: Jouni Malinen Date: Thu, 17 Dec 2015 19:26:40 +0200 Subject: [PATCH] tests: TDLS with VHT 80, 80+80, and 160 This adds more coverage for TDLS testing for a case where the direct link should use various VHT channel bandwidths. Signed-off-by: Jouni Malinen --- tests/hwsim/test_ap_tdls.py | 144 ++++++++++++++++++++++++++++++++++++ 1 file changed, 144 insertions(+) diff --git a/tests/hwsim/test_ap_tdls.py b/tests/hwsim/test_ap_tdls.py index bcfa3cce7..fedfaefc4 100644 --- a/tests/hwsim/test_ap_tdls.py +++ b/tests/hwsim/test_ap_tdls.py @@ -15,6 +15,7 @@ from hostapd import Hostapd import hostapd from utils import HwsimSkip, skip_with_fips from wlantest import Wlantest +from test_ap_vht import vht_supported def start_ap_wpa2_psk(ifname): params = hostapd.wpa2_params(ssid="test-wpa2-psk", passphrase="12345678") @@ -378,6 +379,149 @@ def test_ap_open_tdls_vht(dev, apdev): dev[0].flush_scan_cache() dev[1].flush_scan_cache() +def test_ap_open_tdls_vht80(dev, apdev): + """Open AP and two stations using TDLS with VHT 80""" + params = { "ssid": "test-open", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_capab": "", + "vht_oper_chwidth": "1", + "vht_oper_centr_freq_seg0_idx": "42" } + try: + hapd = None + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + wlantest_setup() + connect_2sta_open(dev, hapd, scan_freq="5180") + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "WIDTH=80 MHz" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + setup_tdls(dev[0], dev[1], apdev[0]) + for i in range(10): + check_connectivity(dev[0], dev[1], hapd) + for i in range(2): + cmd = subprocess.Popen(['iw', dev[0].ifname, 'station', 'dump'], + stdout=subprocess.PIPE) + res = cmd.stdout.read() + cmd.stdout.close() + logger.info("Station dump on dev[%d]:\n%s" % (i, res)) + 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") + dev[1].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() + dev[1].flush_scan_cache() + +def test_ap_open_tdls_vht80plus80(dev, apdev): + """Open AP and two stations using TDLS with VHT 80+80""" + params = { "ssid": "test-open", + "country_code": "US", + "hw_mode": "a", + "channel": "36", + "ht_capab": "[HT40+]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_capab": "", + "vht_oper_chwidth": "3", + "vht_oper_centr_freq_seg0_idx": "42", + "vht_oper_centr_freq_seg1_idx": "155" } + try: + hapd = None + hapd = hostapd.add_ap(apdev[0]['ifname'], params) + wlantest_setup() + connect_2sta_open(dev, hapd, scan_freq="5180") + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "FREQUENCY=5180" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) + if "WIDTH=80+80 MHz" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + if "CENTER_FRQ1=5210" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(3): " + str(sig)) + if "CENTER_FRQ2=5775" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(4): " + str(sig)) + setup_tdls(dev[0], dev[1], apdev[0]) + for i in range(10): + check_connectivity(dev[0], dev[1], hapd) + for i in range(2): + cmd = subprocess.Popen(['iw', dev[0].ifname, 'station', 'dump'], + stdout=subprocess.PIPE) + res = cmd.stdout.read() + cmd.stdout.close() + logger.info("Station dump on dev[%d]:\n%s" % (i, res)) + 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") + dev[1].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() + dev[1].flush_scan_cache() + +def test_ap_open_tdls_vht160(dev, apdev): + """Open AP and two stations using TDLS with VHT 160""" + params = { "ssid": "test-open", + "country_code": "ZA", + "hw_mode": "a", + "channel": "104", + "ht_capab": "[HT40-]", + "ieee80211n": "1", + "ieee80211ac": "1", + "vht_oper_chwidth": "2", + "vht_oper_centr_freq_seg0_idx": "114" } + try: + hapd = None + hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) + ev = hapd.wait_event(["AP-ENABLED"], timeout=2) + if not ev: + cmd = subprocess.Popen(["iw", "reg", "get"], stdout=subprocess.PIPE) + reg = cmd.stdout.readlines() + for r in reg: + if "5490" in r and "DFS" in r: + raise HwsimSkip("ZA regulatory rule did not have DFS requirement removed") + raise Exception("AP setup timed out") + wlantest_setup() + connect_2sta_open(dev, hapd, scan_freq="5520") + sig = dev[0].request("SIGNAL_POLL").splitlines() + if "WIDTH=160 MHz" not in sig: + raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) + setup_tdls(dev[0], dev[1], apdev[0]) + for i in range(10): + check_connectivity(dev[0], dev[1], hapd) + for i in range(2): + cmd = subprocess.Popen(['iw', dev[0].ifname, 'station', 'dump'], + stdout=subprocess.PIPE) + res = cmd.stdout.read() + cmd.stdout.close() + logger.info("Station dump on dev[%d]:\n%s" % (i, res)) + 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") + dev[1].request("DISCONNECT") + if hapd: + hapd.request("DISABLE") + subprocess.call(['iw', 'reg', 'set', '00']) + dev[0].flush_scan_cache() + dev[1].flush_scan_cache() + def test_tdls_chan_switch(dev, apdev): """Open AP and two stations using TDLS""" flags = int(dev[0].get_driver_status_field('capa.flags'), 16)