mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-19 02:39:29 +01:00
auto-t: add RRM autotest
This test merely verifies hostapd receieved our measurement reports and verified they were valid. Hostapd does not verify the actual beacon report body. Really, the only way to test this is on an actual network which makes these requests.
This commit is contained in:
parent
1f01819c70
commit
b45242562b
114
autotests/testRRM/connection_test.py
Normal file
114
autotests/testRRM/connection_test.py
Normal file
@ -0,0 +1,114 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import unittest
|
||||
import sys
|
||||
|
||||
sys.path.append('../util')
|
||||
import iwd
|
||||
from iwd import IWD
|
||||
from iwd import PSKAgent
|
||||
from iwd import NetworkType
|
||||
from hostapd import HostapdCLI
|
||||
import testutil
|
||||
|
||||
from time import sleep
|
||||
|
||||
# Table beacon with wildcard BSSID
|
||||
basic_beacon = '51000000000002ffffffffffff020100'
|
||||
# Table beacon with wildcard BSSID and SSID filter
|
||||
beacon_with_ssid = '51000000000002ffffffffffff02010000077373696452524d'
|
||||
# Passive beacon with wildcard BSSID
|
||||
beacon_passive = '510b0000000000ffffffffffff020100'
|
||||
# Active beacon with wildcard BSSID
|
||||
beacon_active = '510b0000000001ffffffffffff020100'
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def test_connection_success(self):
|
||||
hapd = HostapdCLI(config='ssidRRM.conf')
|
||||
wd = IWD()
|
||||
|
||||
psk_agent = PSKAgent("secret123")
|
||||
wd.register_psk_agent(psk_agent)
|
||||
|
||||
devices = wd.list_devices(1)
|
||||
device = devices[0]
|
||||
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
device.scan()
|
||||
|
||||
condition = 'not obj.scanning'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
ordered_network = device.get_ordered_network('ssidRRM')
|
||||
|
||||
self.assertEqual(ordered_network.type, NetworkType.psk)
|
||||
|
||||
condition = 'not obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
||||
ordered_network.network_object.connect()
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
||||
testutil.test_iface_operstate()
|
||||
testutil.test_ifaces_connected()
|
||||
|
||||
hapd.wait_for_event('AP-STA-CONNECTED')
|
||||
|
||||
# This should return both APs
|
||||
hapd.req_beacon(device.address, basic_beacon)
|
||||
|
||||
for e in ['BEACON-RESP-RX', 'BEACON-RESP-RX']:
|
||||
event = hapd.wait_for_event(e)
|
||||
if event:
|
||||
print(event)
|
||||
|
||||
sleep(0.5)
|
||||
|
||||
# This should return just ssidRRM
|
||||
hapd.req_beacon(device.address, beacon_with_ssid)
|
||||
event = hapd.wait_for_event('BEACON-RESP-RX')
|
||||
if event:
|
||||
print(event)
|
||||
|
||||
sleep(0.5)
|
||||
|
||||
# This should passive scan on channel 11, returning otherSSID
|
||||
hapd.req_beacon(device.address, beacon_passive)
|
||||
# TODO: See if we are scanning here (scan not initiated from station)
|
||||
|
||||
event = hapd.wait_for_event('BEACON-RESP-RX')
|
||||
if event:
|
||||
print(event)
|
||||
|
||||
sleep(0.5)
|
||||
|
||||
# This should active scan on channel 11, returning otherSSID
|
||||
hapd.req_beacon(device.address, beacon_active)
|
||||
# TODO: See if we are scanning here (scan not initiated from station)
|
||||
|
||||
event = hapd.wait_for_event('BEACON-RESP-RX')
|
||||
if event:
|
||||
print(event)
|
||||
|
||||
device.disconnect()
|
||||
|
||||
condition = 'not obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
||||
wd.unregister_psk_agent(psk_agent)
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls):
|
||||
IWD.clear_storage()
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(exit=True)
|
8
autotests/testRRM/hw.conf
Normal file
8
autotests/testRRM/hw.conf
Normal file
@ -0,0 +1,8 @@
|
||||
[SETUP]
|
||||
num_radios=3
|
||||
max_test_exec_interval_sec=40
|
||||
reg_domain=US
|
||||
|
||||
[HOSTAPD]
|
||||
rad0=ssidRRM.conf
|
||||
rad1=ssidOther.conf
|
10
autotests/testRRM/ssidOther.conf
Normal file
10
autotests/testRRM/ssidOther.conf
Normal file
@ -0,0 +1,10 @@
|
||||
ctrl_interface=/var/run/hostapd
|
||||
|
||||
hw_mode=g
|
||||
channel=11
|
||||
ssid=ssidOther
|
||||
|
||||
wpa=2
|
||||
wpa_pairwise=CCMP
|
||||
wpa_passphrase=secret123
|
||||
rrm_beacon_report=1
|
13
autotests/testRRM/ssidRRM.conf
Normal file
13
autotests/testRRM/ssidRRM.conf
Normal file
@ -0,0 +1,13 @@
|
||||
ctrl_interface=/var/run/hostapd
|
||||
|
||||
hw_mode=a
|
||||
ssid=ssidRRM
|
||||
|
||||
wpa=2
|
||||
wpa_pairwise=CCMP
|
||||
wpa_passphrase=secret123
|
||||
rrm_beacon_report=1
|
||||
ht_capab=[HT40+]
|
||||
|
||||
ieee80211n=1
|
||||
channel=36
|
Loading…
Reference in New Issue
Block a user