def test_ap_vht160(dev, apdev): """VHT with 160 MHz channel width (1)""" try: hapd = None params = { "ssid": "vht", "country_code": "FI", "hw_mode": "a", "channel": "36", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "2", "vht_oper_centr_freq_seg0_idx": "50", 'ieee80211d': '1', 'ieee80211h': '1' } hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) if "DFS-CAC-START" not in ev: raise Exception("Unexpected DFS event") state = hapd.get_status_field("state") if state != "DFS": if state == "DISABLED" and not os.path.exists("dfs"): # Not all systems have recent enough CRDA version and # wireless-regdb changes to support 160 MHz and DFS. For now, # do not report failures for this test case. raise HwsimSkip("CRDA or wireless-regdb did not support 160 MHz") raise Exception("Unexpected interface state: " + state) logger.info("Waiting for CAC to complete") ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed") if "freq=5180" not in ev: raise Exception("Unexpected DFS freq result") ev = hapd.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out") state = hapd.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state") dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180") hwsim_utils.test_connectivity(dev[0], hapd) sig = dev[0].request("SIGNAL_POLL").splitlines() if "FREQUENCY=5180" not in sig: raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) if "WIDTH=160 MHz" not in sig: raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) 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
def test_ap_acs_vht160_dfs(dev, apdev, params): """Automatic channel selection 160 MHz, HT scan, and DFS [long]""" if not params['long']: raise HwsimSkip( "Skip test case with long duration due to --long not specified") try: hapd = None force_prev_ap_on_5g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params['hw_mode'] = 'a' params['channel'] = '0' params['ht_capab'] = '[HT40+]' params['country_code'] = 'US' params['ieee80211ac'] = '1' params['vht_oper_chwidth'] = '2' params['ieee80211d'] = '1' params['ieee80211h'] = '1' params['acs_num_scans'] = '1' hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) wait_acs(hapd, return_after_acs=True) wait_dfs_event(hapd, "DFS-CAC-START", 5) ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed") ev = hapd.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out") state = hapd.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state") freq = int(hapd.get_status_field("freq")) if freq not in [5180, 5500]: raise Exception("Unexpected frequency: %d" % freq) dev[0].connect("test-acs", psk="12345678", scan_freq=str(freq)) dev[0].wait_regdom(country_ie=True) finally: if hapd: hapd.request("DISABLE") dev[0].request("DISCONNECT") dev[0].request("ABORT_SCAN") dev[0].wait_event(["CTRL-EVENT-DISCONNECTED"], timeout=0.5) hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00']) dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5) dev[0].flush_scan_cache()
def test_ap_acs_dfs(dev, apdev): """Automatic channel selection, HT scan, and DFS""" try: hapd = None force_prev_ap_on_5g(apdev[0]) params = hostapd.wpa2_params(ssid="test-acs", passphrase="12345678") params['hw_mode'] = 'a' params['channel'] = '0' params['ht_capab'] = '[HT40+]' params['country_code'] = 'US' params['ieee80211d'] = '1' params['ieee80211h'] = '1' params['acs_num_scans'] = '1' params['chanlist'] = '52 56 60 64' hapd = hostapd.add_ap(apdev[0], params, wait_enabled=False) wait_acs(hapd, return_after_acs=True) wait_dfs_event(hapd, "DFS-CAC-START", 5) ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed") ev = hapd.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out") state = hapd.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state") freq = int(hapd.get_status_field("freq")) if freq not in [5260, 5280, 5300, 5320]: raise Exception("Unexpected frequency: %d" % freq) dev[0].connect("test-acs", psk="12345678", scan_freq=str(freq)) dev[0].wait_regdom(country_ie=True) finally: if hapd: hapd.request("DISABLE") dev[0].disconnect_and_stop_scan() hostapd.cmd_execute(apdev[0], ['iw', 'reg', 'set', '00']) dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5) dev[0].flush_scan_cache()
def test_ap_vht160b(dev, apdev): """VHT with 160 MHz channel width (2)""" try: hapd = None params = { "ssid": "vht", "country_code": "FI", "hw_mode": "a", "channel": "104", "ht_capab": "[HT40-]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "2", "vht_oper_centr_freq_seg0_idx": "114", 'ieee80211d': '1', 'ieee80211h': '1' } hapd = hostapd.add_ap(apdev[1], params, wait_enabled=False) ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) if "DFS-CAC-START" not in ev: raise Exception("Unexpected DFS event(2)") state = hapd.get_status_field("state") if state != "DFS": if state == "DISABLED" and not os.path.exists("dfs"): # Not all systems have recent enough CRDA version and # wireless-regdb changes to support 160 MHz and DFS. For now, # do not report failures for this test case. raise HwsimSkip( "CRDA or wireless-regdb did not support 160 MHz") raise Exception("Unexpected interface state: " + state) logger.info("Waiting for CAC to complete") ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed(2)") if "freq=5520" not in ev: raise Exception("Unexpected DFS freq result(2)") ev = hapd.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out(2)") state = hapd.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state(2)") freq = hapd.get_status_field("freq") if freq != "5520": raise Exception("Unexpected frequency(2)") dev[0].connect("vht", key_mgmt="NONE", scan_freq="5520") dev[0].wait_regdom(country_ie=True) hwsim_utils.test_connectivity(dev[0], hapd) sig = dev[0].request("SIGNAL_POLL").splitlines() if "FREQUENCY=5520" not in sig: raise Exception("Unexpected SIGNAL_POLL value(1): " + str(sig)) if "WIDTH=160 MHz" not in sig: raise Exception("Unexpected SIGNAL_POLL value(2): " + str(sig)) except Exception as 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: if hapd: hapd.request("DISABLE") dev[0].disconnect_and_stop_scan() subprocess.call(['iw', 'reg', 'set', '00']) dev[0].wait_event(["CTRL-EVENT-REGDOM-CHANGE"], timeout=0.5) dev[0].flush_scan_cache()
def test_ap_vht160(dev, apdev): """VHT with 160 MHz channel width""" try: params = { "ssid": "vht", "country_code": "FI", "hw_mode": "a", "channel": "36", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "2", "vht_oper_centr_freq_seg0_idx": "50", 'ieee80211d': '1', 'ieee80211h': '1' } hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) if "DFS-CAC-START" not in ev: raise Exception("Unexpected DFS event") state = hapd.get_status_field("state") if state != "DFS": if state == "DISABLED" and not os.path.exists("dfs"): # Not all systems have recent enough CRDA version and # wireless-regdb changes to support 160 MHz and DFS. For now, # do not report failures for this test case. return "skip" raise Exception("Unexpected interface state: " + state) params = { "ssid": "vht2", "country_code": "FI", "hw_mode": "a", "channel": "100", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "2", "vht_oper_centr_freq_seg0_idx": "114", 'ieee80211d': '1', 'ieee80211h': '1' } hapd2 = hostapd.add_ap(apdev[1]['ifname'], params, wait_enabled=False) ev = wait_dfs_event(hapd2, "DFS-CAC-START", 5) if "DFS-CAC-START" not in ev: raise Exception("Unexpected DFS event(2)") state = hapd2.get_status_field("state") if state != "DFS": raise Exception("Unexpected interface state(2): " + state) logger.info("Waiting for CAC to complete") ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed") if "freq=5180" not in ev: raise Exception("Unexpected DFS freq result") ev = hapd.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out") state = hapd.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state") ev = wait_dfs_event(hapd2, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed(2)") if "freq=5500" not in ev: raise Exception("Unexpected DFS freq result(2)") ev = hapd2.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out(2)") state = hapd2.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state(2)") freq = hapd2.get_status_field("freq") if freq != "5500": raise Exception("Unexpected frequency(2)") dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180") hwsim_utils.test_connectivity(dev[0], hapd) dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5500") hwsim_utils.test_connectivity(dev[1], hapd2) except Exception, e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not vht_supported(): logger.info( "80/160 MHz channel not supported in regulatory information" ) return "skip" raise
def test_ap_vht160(dev, apdev): """VHT with 160 MHz channel width""" try: params = { "ssid": "vht", "country_code": "FI", "hw_mode": "a", "channel": "36", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "2", "vht_oper_centr_freq_seg0_idx": "50", 'ieee80211d': '1', 'ieee80211h': '1' } hapd = hostapd.add_ap(apdev[0]['ifname'], params, wait_enabled=False) ev = wait_dfs_event(hapd, "DFS-CAC-START", 5) if "DFS-CAC-START" not in ev: raise Exception("Unexpected DFS event") state = hapd.get_status_field("state") if state != "DFS": if state == "DISABLED" and not os.path.exists("dfs"): # Not all systems have recent enough CRDA version and # wireless-regdb changes to support 160 MHz and DFS. For now, # do not report failures for this test case. return "skip" raise Exception("Unexpected interface state: " + state) params = { "ssid": "vht2", "country_code": "FI", "hw_mode": "a", "channel": "100", "ht_capab": "[HT40+]", "ieee80211n": "1", "ieee80211ac": "1", "vht_oper_chwidth": "2", "vht_oper_centr_freq_seg0_idx": "114", 'ieee80211d': '1', 'ieee80211h': '1' } hapd2 = hostapd.add_ap(apdev[1]['ifname'], params, wait_enabled=False) ev = wait_dfs_event(hapd2, "DFS-CAC-START", 5) if "DFS-CAC-START" not in ev: raise Exception("Unexpected DFS event(2)") state = hapd2.get_status_field("state") if state != "DFS": raise Exception("Unexpected interface state(2): " + state) logger.info("Waiting for CAC to complete") ev = wait_dfs_event(hapd, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed") if "freq=5180" not in ev: raise Exception("Unexpected DFS freq result") ev = hapd.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out") state = hapd.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state") ev = wait_dfs_event(hapd2, "DFS-CAC-COMPLETED", 70) if "success=1" not in ev: raise Exception("CAC failed(2)") if "freq=5500" not in ev: raise Exception("Unexpected DFS freq result(2)") ev = hapd2.wait_event(["AP-ENABLED"], timeout=5) if not ev: raise Exception("AP setup timed out(2)") state = hapd2.get_status_field("state") if state != "ENABLED": raise Exception("Unexpected interface state(2)") freq = hapd2.get_status_field("freq") if freq != "5500": raise Exception("Unexpected frequency(2)") dev[0].connect("vht", key_mgmt="NONE", scan_freq="5180") hwsim_utils.test_connectivity(dev[0].ifname, apdev[0]['ifname']) dev[1].connect("vht2", key_mgmt="NONE", scan_freq="5500") hwsim_utils.test_connectivity(dev[1].ifname, apdev[1]['ifname']) except Exception, e: if isinstance(e, Exception) and str(e) == "AP startup failed": if not vht_supported(): logger.info("80/160 MHz channel not supported in regulatory information") return "skip" raise