def test_ap_acs_5ghz(dev, apdev):
"""Automatic channel selection on 5 GHz"""
try:
+ hapd = None
params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
params['hw_mode'] = 'a'
params['channel'] = '0'
dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_acs_5ghz_40mhz(dev, apdev):
"""Automatic channel selection on 5 GHz for 40 MHz channel"""
try:
+ hapd = None
params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
params['hw_mode'] = 'a'
params['channel'] = '0'
dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_acs_vht(dev, apdev):
"""Automatic channel selection for VHT"""
try:
+ hapd = None
params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678")
params['hw_mode'] = 'a'
params['channel'] = '0'
dev[0].connect("test-acs", psk="12345678", scan_freq=freq)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
"""HT40 co-ex scan on 5 GHz with matching pri/sec channel"""
clear_scan_cache(apdev[0]['ifname'])
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "test-ht40",
"hw_mode": "a",
"channel": "36",
"country_code": "US",
"ht_capab": "[HT40+]"}
- hostapd.add_ap(apdev[1]['ifname'], params)
+ hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
params = { "ssid": "test-ht40",
"hw_mode": "a",
dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_ht40_5ghz_switch(dev, apdev):
"""HT40 co-ex scan on 5 GHz switching pri/sec channel"""
clear_scan_cache(apdev[0]['ifname'])
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "test-ht40",
"hw_mode": "a",
"channel": "36",
"country_code": "US",
"ht_capab": "[HT40+]"}
- hostapd.add_ap(apdev[1]['ifname'], params)
+ hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
params = { "ssid": "test-ht40",
"hw_mode": "a",
dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
def test_ap_ht40_5ghz_switch2(dev, apdev):
"""HT40 co-ex scan on 5 GHz switching pri/sec channel (2)"""
clear_scan_cache(apdev[0]['ifname'])
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "test-ht40",
"hw_mode": "a",
"channel": "36",
"country_code": "US",
"ht_capab": "[HT40+]"}
- hostapd.add_ap(apdev[1]['ifname'], params)
+ hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
id = dev[0].add_network()
dev[0].set_network(id, "mode", "2")
dev[0].connect("test-ht40", key_mgmt="NONE", scan_freq=freq)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_obss_scan(dev, apdev):
"""Overlapping BSS scan request"""
def test_olbc_5ghz(dev, apdev):
"""OLBC detection on 5 GHz"""
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "test-olbc",
"country_code": "FI",
"hw_mode": "a",
"channel": "36",
"ieee80211n": "0",
"wmm_enabled": "0" }
- hostapd.add_ap(apdev[1]['ifname'], params)
+ hapd2 = hostapd.add_ap(apdev[1]['ifname'], params)
time.sleep(0.5)
status = hapd.get_status()
if status['olbc_ht'] != '1':
raise Exception("Missing OLBC information")
finally:
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
def test_ap_require_ht(dev, apdev):
if not csa_supported(dev[0]):
return "skip"
try:
+ hapd = None
params = { "ssid": "ht",
"country_code": "US",
"hw_mode": "a",
raise Exception("Unexpected STA disconnection during CSA")
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_ht40_csa2(dev, apdev):
"""HT with 40 MHz channel width and CSA"""
if not csa_supported(dev[0]):
return "skip"
try:
+ hapd = None
params = { "ssid": "ht",
"country_code": "US",
"hw_mode": "a",
raise Exception("Unexpected STA disconnection during CSA")
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_ht40_csa3(dev, apdev):
"""HT with 40 MHz channel width and CSA"""
if not csa_supported(dev[0]):
return "skip"
try:
+ hapd = None
params = { "ssid": "ht",
"country_code": "US",
"hw_mode": "a",
raise Exception("Unexpected STA disconnection during CSA")
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_country(dev, apdev):
"""WPA2-PSK AP setting country code and using 5 GHz band"""
try:
+ hapd = None
bssid = apdev[0]['bssid']
ssid = "test-wpa2-psk"
passphrase = 'qwertyuiop'
dev[0].connect(ssid, psk=passphrase, scan_freq="5180")
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_acl_accept(dev, apdev):
"""MAC ACL accept list"""
params["local_pwr_constraint"] = "3"
params['spectrum_mgmt_required'] = "1"
try:
- hostapd.add_ap(apdev[0]['ifname'], params)
+ hapd = None
+ hapd = hostapd.add_ap(apdev[0]['ifname'], params)
dev[0].connect(ssid, key_mgmt="NONE", scan_freq="5180")
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_max_listen_interval(dev, apdev):
"""Open AP with maximum listen interval limit"""
def test_ap_vht80(dev, apdev):
"""VHT with 80 MHz channel width"""
try:
+ hapd = None
params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
return "skip"
raise
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_vht80_params(dev, apdev):
"""VHT with 80 MHz channel width and number of optional features enabled"""
try:
+ hapd = None
params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
return "skip"
raise
finally:
+ dev[0].request("DISCONNECT")
+ dev[1].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
+ dev[1].flush_scan_cache()
def test_ap_vht_20(devs, apdevs):
"""VHT and 20 MHz channel"""
dev = devs[0]
ap = apdevs[0]
try:
+ hapd = None
params = { "ssid": "test-vht20",
"country_code": "DE",
"hw_mode": "a",
dev.connect("test-vht20", scan_freq="5180", key_mgmt="NONE")
hwsim_utils.test_connectivity(dev, hapd)
finally:
+ dev.request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev.flush_scan_cache()
def test_ap_vht_capab_not_supported(dev, apdev):
"""VHT configuration with driver not supporting all vht_capab entries"""
def test_ap_vht160(dev, apdev):
"""VHT with 160 MHz channel width"""
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "vht",
"country_code": "FI",
"hw_mode": "a",
return "skip"
raise
finally:
+ dev[0].request("DISCONNECT")
+ dev[1].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
+ dev[1].flush_scan_cache()
def test_ap_vht80plus80(dev, apdev):
"""VHT with 80+80 MHz channel width"""
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "vht",
"country_code": "US",
"hw_mode": "a",
return "skip"
raise
finally:
+ dev[0].request("DISCONNECT")
+ dev[1].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
+ dev[1].flush_scan_cache()
def test_ap_vht80_csa(dev, apdev):
"""VHT with 80 MHz channel width and CSA"""
if not csa_supported(dev[0]):
return "skip"
try:
+ hapd = None
params = { "ssid": "vht",
"country_code": "US",
"hw_mode": "a",
return "skip"
raise
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_wps_conf_5ghz(dev, apdev):
"""WPS PBC provisioning with configured AP on 5 GHz band"""
try:
+ hapd = None
ssid = "test-wps-conf"
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
if 'wpsDeviceName' not in sta or sta['wpsDeviceName'] != "Device A":
raise Exception("Device name not available in STA command")
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_wps_conf_chan14(dev, apdev):
"""WPS PBC provisioning with configured AP on channel 14"""
try:
+ hapd = None
ssid = "test-wps-conf"
params = { "ssid": ssid, "eap_server": "1", "wps_state": "2",
"wpa_passphrase": "12345678", "wpa": "2",
if 'wpsDeviceName' not in sta or sta['wpsDeviceName'] != "Device A":
raise Exception("Device name not available in STA command")
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_ap_wps_twice(dev, apdev):
"""WPS provisioning with twice to change passphrase"""
time.sleep(1)
hwsim_utils.test_connectivity(dev[0], hapd)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_dfs_radar(dev, apdev):
"""DFS CAC functionality with radar detected"""
try:
+ hapd2 = None
hapd = start_dfs_ap(apdev[0])
if hapd is None:
if not os.path.exists("dfs"):
wait_dfs_event(hapd2, None, 5)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_dfs_radar_on_non_dfs_channel(dev, apdev):
"""DFS radar detection test code on non-DFS channel"""
raise Exception("Unexpected DFS event")
dev[0].connect("dfs", key_mgmt="NONE")
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht80(dev, apdev):
"""DFS chanlist when radar is detected and VHT80 configured"""
if hapd.get_status_field('vht_oper_centr_freq_seg0_idx') != "42":
raise Exception("Unexpected seg0 idx")
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_dfs_radar_chanlist_vht20(dev, apdev):
"""DFS chanlist when radar is detected and VHT40 configured"""
raise Exception("Unexpected DFS event")
dev[0].connect("dfs", key_mgmt="NONE")
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
raise Exception("Association with the AP timed out")
check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_nfc_wps_handover_chan14(dev, apdev):
"""Connect to WPS AP with NFC connection handover on channel 14"""
raise Exception("Association with the AP timed out")
check_wpa2_connection(dev[0], apdev[0], hapd, ssid)
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
subprocess.call(['sudo', 'iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()
def test_nfc_wps_handover_with_pw_token_set(dev, apdev):
"""Connect to WPS AP with NFC connection handover (wps_nfc_* set)"""
remove_group(dev[0], dev[1])
finally:
set_country("00")
+ dev[1].flush_scan_cache()
def test_p2p_channel_5ghz_no_vht(dev):
"""P2P group formation with 5 GHz preference when VHT channels are disallowed"""
finally:
set_country("00")
dev[0].request("P2P_SET disallow_freq ")
+ dev[1].flush_scan_cache()
def test_p2p_channel_random_social(dev):
"""P2P group formation with 5 GHz preference but all 5 GHz channels disabled"""
finally:
set_country("00")
dev[0].request("P2P_SET disallow_freq ")
+ dev[1].flush_scan_cache()
def test_p2p_channel_random(dev):
"""P2P group formation with 5 GHz preference but all 5 GHz channels and all social channels disabled"""
finally:
set_country("00")
dev[0].request("P2P_SET disallow_freq ")
+ dev[1].flush_scan_cache()
def test_p2p_channel_random_social_with_op_class_change(dev, apdev, params):
"""P2P group formation using random social channel with oper class change needed"""
dev[0].request("P2P_SET disallow_freq ")
dev[0].request("SET p2p_oper_reg_class 0")
dev[0].request("SET p2p_oper_channel 0")
+ dev[1].flush_scan_cache()
def test_p2p_channel_avoid(dev):
"""P2P and avoid frequencies driver event"""
finally:
set_country("00")
dev[0].request("DRIVER_EVENT AVOID_FREQUENCIES")
+ dev[1].flush_scan_cache()
def test_autogo_following_bss(dev, apdev):
"""P2P autonomous GO operate on the same channel as station interface"""
raise Exception("GO not selected according to go_intent")
hwsim_utils.test_connectivity(wpas, hapd)
+ wpas.request("DISCONNECT")
+ hapd.request("DISABLE")
+ subprocess.call(['iw', 'reg', 'set', '00'])
+ wpas.flush_scan_cache()
+
def test_go_pref_chan_bss_on_diff_chan(dev, apdev):
"""P2P channel selection: Station on different channel than GO configured pref channel"""
def test_wnm_bss_tm(dev, apdev):
"""WNM BSS Transition Management"""
try:
+ hapd = None
+ hapd2 = None
params = { "ssid": "test-wnm",
"country_code": "FI",
"ieee80211d": "1",
if ev is not None:
raise Exception("Unexpected reassociation");
finally:
+ dev[0].request("DISCONNECT")
+ if hapd:
+ hapd.request("DISABLE")
+ if hapd2:
+ hapd2.request("DISABLE")
subprocess.call(['iw', 'reg', 'set', '00'])
+ dev[0].flush_scan_cache()