def test_ap_vht80_csa(dev, apdev): """VHT with 80 MHz channel width and CSA""" csa_supported(dev[0]) try: hapd = None params = { "ssid": "vht", "country_code": "US", "hw_mode": "a", "channel": "149", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "1", "vht_oper_centr_freq_seg0_idx": "155" } hapd = hostapd.add_ap(apdev[0], params) dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request( "CHAN_SWITCH 5 5180 ht vht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80" ) ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5180" not in ev: raise Exception("Unexpected channel in CSA finished event") time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5745") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5745" not in ev: raise Exception("Unexpected channel in CSA finished event") time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) # This CSA to same channel will fail in kernel, so use this only for # extra code coverage. hapd.request("CHAN_SWITCH 5 5745") hapd.wait_event(["AP-CSA-FINISHED"], timeout=1) 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 test_ap_vht_csa_vht40_disable(dev, apdev): """VHT CSA with VHT40 getting disabled""" csa_supported(dev[0]) try: hapd = None params = { "ssid": "vht", "country_code": "US", "hw_mode": "a", "channel": "149", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_capab": "", "vht_oper_chwidth": "0", "vht_oper_centr_freq_seg0_idx": "0" } hapd = hostapd.add_ap(apdev[0], params) bssid = hapd.own_addr() dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request( "CHAN_SWITCH 5 5200 center_freq1=5210 sec_channel_offset=1 bandwidth=40 ht" ) ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5200" not in ev: raise Exception("Unexpected channel in CSA finished event") ev = dev[0].wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=5) if ev is None: raise Exception("Channel switch event not seen") if "freq=5200" not in ev: raise Exception("Channel mismatch: " + ev) time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) dev[1].connect("vht", key_mgmt="NONE", scan_freq="5200") hwsim_utils.test_connectivity(dev[1], hapd) if dev[1].get_status_field("ieee80211ac") == '1': raise Exception("VHT not disabled as part of channel switch") 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_vht80_csa(dev, apdev): """VHT with 80 MHz channel width and CSA""" csa_supported(dev[0]) try: hapd = None params = {"ssid": "vht", "country_code": "US", "hw_mode": "a", "channel": "149", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "1", "vht_oper_centr_freq_seg0_idx": "155"} hapd = hostapd.add_ap(apdev[0], params) dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5180 ht vht blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5180" not in ev: raise Exception("Unexpected channel in CSA finished event") time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5745") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5745" not in ev: raise Exception("Unexpected channel in CSA finished event") time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) # This CSA to same channel will fail in kernel, so use this only for # extra code coverage. hapd.request("CHAN_SWITCH 5 5745") hapd.wait_event(["AP-CSA-FINISHED"], timeout=1) 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 test_ap_vht_csa_vht40_disable(dev, apdev): """VHT CSA with VHT40 getting disabled""" csa_supported(dev[0]) try: hapd = None params = { "ssid": "vht", "country_code": "US", "hw_mode": "a", "channel": "149", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_capab": "", "vht_oper_chwidth": "0", "vht_oper_centr_freq_seg0_idx": "0" } hapd = hostapd.add_ap(apdev[0], params) bssid = hapd.own_addr() dev[0].connect("vht", key_mgmt="NONE", scan_freq="5745") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5200 center_freq1=5200 bandwidth=40 ht") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5200" not in ev: raise Exception("Unexpected channel in CSA finished event") ev = dev[0].wait_event("CTRL-EVENT-CHANNEL-SWITCH", timeout=5) if ev is None: raise Exception("Channel switch event not seen") if "freq=5200" not in ev: raise Exception("Channel mismatch: " + ev) time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) dev[1].connect("vht", key_mgmt="NONE", scan_freq="5200") hwsim_utils.test_connectivity(dev[1], hapd) if dev[1].get_status_field("ieee80211ac") == '1': raise Exception("VHT not disabled as part of channel switch") 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_ht40_csa(dev, apdev): """HT with 40 MHz channel width and CSA""" csa_supported(dev[0]) try: hapd = None params = { "ssid": "ht", "country_code": "US", "hw_mode": "a", "channel": "36", "ht_capab": "[HT40+]", "ieee80211n": "1" } hapd = hostapd.add_ap(apdev[0]['ifname'], params) dev[0].connect("ht", key_mgmt="NONE", scan_freq="5180") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request( "CHAN_SWITCH 5 5200 ht sec_channel_offset=-1 bandwidth=40") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5200" not in ev: raise Exception("Unexpected channel in CSA finished event") ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) if ev is not None: raise Exception("Unexpected STA disconnection during CSA") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5180 ht sec_channel_offset=1 bandwidth=40") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5180" not in ev: raise Exception("Unexpected channel in CSA finished event") ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) if ev is not None: 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(['iw', 'reg', 'set', '00']) dev[0].flush_scan_cache()
def test_ap_ht40_csa3(dev, apdev): """HT with 40 MHz channel width and CSA""" csa_supported(dev[0]) try: hapd = None params = { "ssid": "ht", "country_code": "US", "hw_mode": "a", "channel": "36", "ht_capab": "[HT40+]", "ieee80211n": "1" } hapd = hostapd.add_ap(apdev[0]['ifname'], params) dev[0].connect("ht", key_mgmt="NONE", scan_freq="5180") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5240 ht sec_channel_offset=-1 bandwidth=40") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5240" not in ev: raise Exception("Unexpected channel in CSA finished event") ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) if ev is not None: raise Exception("Unexpected STA disconnection during CSA") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5180 ht sec_channel_offset=1 bandwidth=40") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5180" not in ev: raise Exception("Unexpected channel in CSA finished event") ev = dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) if ev is not None: 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(['iw', 'reg', 'set', '00']) dev[0].flush_scan_cache()
def test_he80_csa(dev, apdev): """HE with 80 MHz channel width and CSA""" csa_supported(dev[0]) try: hapd = None params = { "ssid": "he", "country_code": "US", "hw_mode": "a", "channel": "149", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "ieee80211ax": "1", "vht_oper_chwidth": "1", "vht_oper_centr_freq_seg0_idx": "155", "he_oper_chwidth": "1", "he_oper_centr_freq_seg0_idx": "155" } hapd = hostapd.add_ap(apdev[0], params) dev[0].connect("he", key_mgmt="NONE", scan_freq="5745") hwsim_utils.test_connectivity(dev[0], hapd) hapd.request( "CHAN_SWITCH 5 5180 ht vht he blocktx center_freq1=5210 sec_channel_offset=1 bandwidth=80" ) ev = hapd.wait_event(["CTRL-EVENT-STARTED-CHANNEL-SWITCH"], timeout=10) if ev is None: raise Exception("Channel switch start event not seen") if "freq=5180" not in ev: raise Exception("Unexpected channel in CS started") ev = hapd.wait_event(["CTRL-EVENT-CHANNEL-SWITCH"], timeout=10) if ev is None: raise Exception("Channel switch completion event not seen") if "freq=5180" not in ev: raise Exception("Unexpected channel in CS completed") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5180" not in ev: raise Exception("Unexpected channel in CSA finished event") time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) hapd.request("CHAN_SWITCH 5 5745") ev = hapd.wait_event(["AP-CSA-FINISHED"], timeout=10) if ev is None: raise Exception("CSA finished event timed out") if "freq=5745" not in ev: raise Exception("Unexpected channel in CSA finished event") time.sleep(0.5) hwsim_utils.test_connectivity(dev[0], hapd) # This CSA to same channel will fail in kernel, so use this only for # extra code coverage. hapd.request("CHAN_SWITCH 5 5745") hapd.wait_event(["AP-CSA-FINISHED"], timeout=1) except Exception as e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not he_supported(): raise HwsimSkip( "80 MHz channel not supported in regulatory information") raise finally: dev[0].request("DISCONNECT") clear_regdom(hapd, dev)