3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-22 06:29:23 +01:00

auto-t: add reassociation test for OWE

The timeout test was also modified to handle the additional
radio.
This commit is contained in:
James Prestwood 2021-08-12 13:21:59 -07:00 committed by Denis Kenzior
parent e819ee6df6
commit 5bf614a7af
6 changed files with 70 additions and 24 deletions

View File

@ -13,29 +13,16 @@ import testutil
class Test(unittest.TestCase):
def test_connection_success(self):
hapd = HostapdCLI(config='ssidOWE.conf')
hapd = HostapdCLI(config='ssidOWE-1.conf')
wd = IWD()
devices = wd.list_devices(1)
device = devices[0]
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
device.get_ordered_network('ssidOWE', scan_if_needed=True)
device.scan()
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
ordered_network = device.get_ordered_network('ssidOWE')
self.assertEqual(ordered_network.type, NetworkType.open)
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
ordered_network.network_object.connect()
device.connect_bssid(hapd.bssid)
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
@ -45,8 +32,40 @@ class Test(unittest.TestCase):
device.disconnect()
condition = 'not obj.connected'
wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_reassociate(self):
hapd0 = HostapdCLI(config='ssidOWE-1.conf')
hapd1 = HostapdCLI(config='ssidOWE-2.conf')
wd = IWD()
devices = wd.list_devices(1)
device = devices[0]
device.get_ordered_network('ssidOWE', scan_if_needed=True)
device.connect_bssid(hapd0.bssid)
condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
testutil.test_iface_operstate()
testutil.test_ifaces_connected(device.name, hapd0.ifname)
device.roam(hapd1.bssid)
condition = 'obj.state == DeviceState.roaming'
wd.wait_for_object_condition(device, condition)
from_condition = 'obj.state == DeviceState.roaming'
to_condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_change(device, from_condition, to_condition)
self.assertTrue(hapd1.list_sta())
testutil.test_iface_operstate(device.name)
testutil.test_ifaces_connected(hapd1.ifname, device.name)
self.assertRaises(Exception, testutil.test_ifaces_connected,
(hapd0.ifname, device.name, True, True))
@classmethod
def setUpClass(cls):

View File

@ -1,6 +1,7 @@
[SETUP]
num_radios=3
num_radios=4
[HOSTAPD]
rad0=ssidOWE.conf
rad1=ssidGroup20.conf
rad0=ssidOWE-1.conf
rad1=ssidOWE-2.conf
rad2=ssidGroup20.conf

View File

@ -0,0 +1,2 @@
[Scan]
DisableMacAddressRandomization=true

View File

@ -0,0 +1,8 @@
ctrl_interface=/var/run/hostapd
hw_mode=g
channel=2
ssid=ssidOWE
wpa=2
wpa_key_mgmt=OWE
rsn_pairwise=CCMP
owe_groups=19

View File

@ -17,9 +17,10 @@ class Test(unittest.TestCase):
def test_connection_success(self):
hwsim = Hwsim()
bss_radio = hwsim.get_radio('rad0')
bss_radio0 = hwsim.get_radio('rad0')
bss_radio1 = hwsim.get_radio('rad1')
self.assertIsNotNone(bss_radio)
self.assertIsNotNone(bss_radio0)
wd = IWD()
@ -31,6 +32,9 @@ class Test(unittest.TestCase):
device.scan()
condition = 'obj.scanning'
wd.wait_for_object_condition(device, condition)
condition = 'not obj.scanning'
wd.wait_for_object_condition(device, condition)
@ -42,21 +46,33 @@ class Test(unittest.TestCase):
wd.wait_for_object_condition(ordered_network.network_object, condition)
rule0 = hwsim.rules.create()
rule0.source = bss_radio.addresses[0]
rule0.source = bss_radio0.addresses[0]
rule0.bidirectional = True
rule0.drop = True
rule0.prefix = 'b0'
rule1 = hwsim.rules.create()
rule1.source = bss_radio1.addresses[0]
rule1.bidirectional = True
rule1.drop = True
rule1.prefix = 'b0'
# Test Authenticate (b0) and Association (00) timeouts
with self.assertRaises(iwd.FailedEx):
ordered_network.network_object.connect()
rule0.prefix = '00'
rule1.prefix = '00'
with self.assertRaises(iwd.FailedEx):
ordered_network.network_object.connect()
def tearDown(self):
hwsim = Hwsim()
for rule in list(hwsim.rules.keys()):
del hwsim.rules[rule]
@classmethod
def setUpClass(cls):
pass