def test_rssi_based_assoc_rej_good_rssi(dev, apdev): """RSSI-based association rejection: STA with RSSI above the threshold connects""" check_set_tx_power(dev, apdev) try: run_rssi_based_assoc_rej_good_rssi(dev, apdev) finally: reset_rx_rssi(dev[0])
def test_rssi_based_assoc_rej_timeout(dev, apdev, params): """RSSI-based association rejection: no assoc request during retry timeout""" check_set_tx_power(dev, apdev) try: run_rssi_based_assoc_rej_timeout(dev, apdev, params) finally: reset_rx_rssi(dev[0]) dev[0].request("SCAN_INTERVAL 5")
def test_rssi_based_assoc_rssi_change(dev, apdev): """RSSI-based association rejection: connect after improving RSSI""" check_set_tx_power(dev, apdev) try: ap_params = {'ssid': "test-RSSI-ar-to", 'rssi_reject_assoc_rssi': '-45', 'rssi_reject_assoc_timeout': '60'} logger.info("Set APs RSSI rejection threshold to -45 dBm, retry timeout: 60") hapd = hostapd.add_ap(apdev[0], ap_params) run_rssi_based_assoc_rssi_change(dev, hapd) finally: reset_rx_rssi(dev[0]) reset_rx_rssi(hapd) dev[0].request("SCAN_INTERVAL 5")
def check_set_tx_power(dev, apdev): hapd = hostapd.add_ap(apdev[0], {'ssid': 'check_tx_power'}) set_rx_rssi(hapd, -50) dev[0].scan(freq=2412) ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 2) res = dev[0].request("SCAN_RESULTS") if '-50' not in res: raise HwsimSkip('set_rx_rssi not supported') reset_rx_rssi(hapd) dev[0].scan(freq=2412) ev = dev[0].wait_event(["CTRL-EVENT-SCAN-RESULTS"], 2) res = dev[0].request("SCAN_RESULTS") if '-30' not in res: raise HwsimSkip('set_rx_rssi not supported')