commit 5bf614a7af475e42dfb8c2022b88c3be837b0578
parent e819ee6df62acc3d6743d78785000630a24ec019
Author: James Prestwood <prestwoj@gmail.com>
Date: Thu, 12 Aug 2021 13:21:59 -0700
auto-t: add reassociation test for OWE
The timeout test was also modified to handle the additional
radio.
Diffstat:
6 files changed, 66 insertions(+), 20 deletions(-)
diff --git a/autotests/testOWE/connection_test.py b/autotests/testOWE/connection_test.py
@@ -13,40 +13,59 @@ 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()
+ device.connect_bssid(hapd.bssid)
- condition = 'not obj.scanning'
+ condition = 'obj.state == DeviceState.connected'
wd.wait_for_object_condition(device, condition)
- ordered_network = device.get_ordered_network('ssidOWE')
+ testutil.test_iface_operstate()
+ testutil.test_ifaces_connected(device.name, hapd.ifname)
- self.assertEqual(ordered_network.type, NetworkType.open)
+ 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')
- ordered_network.network_object.connect()
+ 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, hapd.ifname)
+ testutil.test_ifaces_connected(device.name, hapd0.ifname)
- device.disconnect()
+ 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())
- condition = 'not obj.connected'
- wd.wait_for_object_condition(ordered_network.network_object, condition)
+ 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):
diff --git a/autotests/testOWE/hw.conf b/autotests/testOWE/hw.conf
@@ -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
diff --git a/autotests/testOWE/main.conf b/autotests/testOWE/main.conf
@@ -0,0 +1,2 @@
+[Scan]
+DisableMacAddressRandomization=true
diff --git a/autotests/testOWE/ssidOWE.conf b/autotests/testOWE/ssidOWE-1.conf
diff --git a/autotests/testOWE/ssidOWE-2.conf b/autotests/testOWE/ssidOWE-2.conf
@@ -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
diff --git a/autotests/testOWE/timeout_test.py b/autotests/testOWE/timeout_test.py
@@ -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