Skip to contentSkip to conversation

auto-t: hostapd.py: add 'bssid' property

PATCH In review James Prestwood 2 participants 19 messages Aug 12, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/18 auto-t: hostapd.py: add 'bssid' property

This gets the APs BSSID, bypassing the need to use hwsim for obtaining this address.

---
 autotests/util/hostapd.py | 10 ++++++++++
 1 file changed, 10 insertions(+)
autotests/util/hostapd.py +10 -0
index 6031b1dc..f75dbe6b 100644
@@ -234,3 +234,13 @@ class HostapdCLI:
         '''
         cmd = self.cmdline + ['req_beacon', addr, request]
         ctx.start_process(cmd, wait=True)
+
+    @property
+    def bssid(self):
+        cmd = self.cmdline + ['status']
+        status = ctx.start_process(cmd, wait=True, need_out=True).out
+        status = status.split('\n')
+
+        bssid = [x for x in status if x.startswith('bssid')]
+        bssid = bssid[0].split('=')
+        return bssid[1]
Signature · 1 line
2.31.1
#1 lore raw

Hi James,

Quoted 6 lines · James Prestwood

This gets the APs BSSID, bypassing the need to use hwsim for obtaining this address.

---
  autotests/util/hostapd.py | 10 ++++++++++
  1 file changed, 10 insertions(+)

All applied, thanks.

Regards,
-Denis

#2 lore raw

PATCH 2/18 test-runner: start IWD in developer mode

In reply to James Prestwood

This is being done to utilize the Roam() developer method

---
 tools/test-runner | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/test-runner +1 -1
index 75e46444..7e789dd7 100755
@@ -648,7 +648,7 @@ class Namespace:
 			args.extend(['valgrind', '--leak-check=full', '--track-origins=yes',
 					'--log-file=/tmp/valgrind.log.%p'])
 
-		args.extend(['iwd', '-p', iwd_radios])
+		args.extend(['iwd', '-p', iwd_radios, '-E'])
 
 		if self.is_verbose(args[0]):
 			args.append('-d')
Signature · 1 line
2.31.1
#3 lore raw

PATCH 3/18 test-runner: don't fatally exit on bad test configuration

In reply to James Prestwood

If a test has no hw.conf file test-runner was fully exiting and not running any additional tests. This shouldn't happen in practice since all upstreamed tests should run, but if any locally created tests existed like this, it would cause the entire test run to exit early.

Instead raise an exception which bails out of only that test, and allows the rest to continue.

---
 tools/test-runner | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
tools/test-runner +1 -2
index 7e789dd7..939efa51 100755
@@ -1072,8 +1072,7 @@ def pre_test(ctx, test, copied):
 
 	dbg("Starting test %s" % test)
 	if not os.path.exists(test + '/hw.conf'):
-		print("No hw.conf found for %s" % test)
-		exit()
+		raise Exception("No hw.conf found for %s" % test)
 
 	ctx.hw_config = ConfigParser()
 	ctx.hw_config.read(test + '/hw.conf')
Signature · 1 line
2.31.1
#4 lore raw

PATCH 4/18 test-runner: don't run duplicate tests

In reply to James Prestwood

If the user provides duplicate tests in the list only append one of them to the list. This can happen accidentally when using glob matches.

---
 tools/test-runner | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
tools/test-runner +5 -3
index 939efa51..28c7d900 100755
@@ -1013,15 +1013,17 @@ def build_test_list(args):
 				tests = [test_root + '/' + x for x in full_list[i:] \
 							if x.startswith('test')]
 			elif os.path.exists(t):
-				tests.append(t)
+				if t not in tests:
+					tests.append(t)
 			elif os.path.exists(path):
-				tests.append(path)
+				if path not in tests:
+					tests.append(path)
 			else:
 				matches = glob(path)
 				if matches == []:
 					raise Exception("Could not find test %s" % t)
 
-				tests.extend(matches)
+				tests.extend(list(set(matches) - set(tests)))
 
 	return sorted(tests)
 
Signature · 1 line
2.31.1
#5 lore raw

PATCH 5/18 auto-t: testutil.py: add expect_fail flag

In reply to James Prestwood

Several tests tests for connectivity with the expectation that it will fail. This ends up taking 30+ seconds because testutil retries 3 times, each with a 10 second timeout. By passing expect_fail=True this lowers the timeout to zero, and skips any retries.

---
 autotests/util/testutil.py | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
autotests/util/testutil.py +10 -5
index c649b387..ea705bad 100644
@@ -51,7 +51,12 @@ def tx(fromsock, tosock, src, dst):
 
     return (frame, fromsock, tosock, src, dst)
 
-def test_connected(if0=None, if1=None, group=True):
+def test_connected(if0=None, if1=None, group=True, expect_fail=False):
+    if expect_fail:
+        timeout = 0
+    else:
+        timeout = 10
+
     if if0 is None or if1 is None:
         iwd_list = [dev.name for dev in iwd.IWD.get_instance().list_devices()]
 
@@ -82,7 +87,7 @@ def test_connected(if0=None, if1=None, group=True):
             rec.append(False)
 
         while not all(rec):
-            r, w, x = select.select([sock0, sock1], [], [], 10)
+            r, w, x = select.select([sock0, sock1], [], [], timeout)
             if not r:
                 raise Exception('timeout waiting for packets: ' + repr(rec))
 
@@ -110,15 +115,15 @@ def test_connected(if0=None, if1=None, group=True):
         sock0.close()
         sock1.close()
 
-def test_ifaces_connected(if0=None, if1=None, group=True):
+def test_ifaces_connected(if0=None, if1=None, group=True, expect_fail=False):
     retry = 0
     while True:
         try:
-            test_connected(if0, if1, group)
+            test_connected(if0, if1, group, expect_fail)
             break
 
         except Exception as e:
-            if retry < 3:
+            if retry < 3 and not expect_fail:
                 print('retrying connection test: %i' % retry)
                 retry += 1
                 continue
Signature · 1 line
2.31.1
#6 lore raw

PATCH 6/18 auto-t: iwd.py: add connect_bssid() method

In reply to James Prestwood

Python API for ConnectBssid() developer method

---
 autotests/util/iwd.py | 7 +++++++
 1 file changed, 7 insertions(+)
autotests/util/iwd.py +7 -0
index 350e1aca..be072a42 100755
@@ -39,6 +39,7 @@ IWD_P2P_INTERFACE =             'net.connman.iwd.p2p.Device'
 IWD_P2P_PEER_INTERFACE =        'net.connman.iwd.p2p.Peer'
 IWD_P2P_SERVICE_MANAGER_INTERFACE = 'net.connman.iwd.p2p.ServiceManager'
 IWD_P2P_WFD_INTERFACE =         'net.connman.iwd.p2p.Display'
+IWD_STATION_DEBUG_INTERFACE =   'net.connman.iwd.StationDebug'
 
 IWD_AGENT_MANAGER_PATH =        '/net/connman/iwd'
 IWD_TOP_LEVEL_PATH =            '/'
@@ -535,6 +536,12 @@ class Device(IWDDBusAbstract):
     def stop_adhoc(self):
         self._prop_proxy.Set(IWD_DEVICE_INTERFACE, 'Mode', 'station')
 
+    def connect_bssid(self, address):
+        self._station_debug_if = dbus.Interface(self._bus.get_object(IWD_SERVICE,
+                                                self.device_path),
+                                                IWD_STATION_DEBUG_INTERFACE)
+        self._station_debug_if.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', '')))
+
     def __str__(self, prefix = ''):
         return prefix + 'Device: ' + self.device_path + '\n'\
                + prefix + '\tName:\t\t' + self.name + '\n'\
Signature · 1 line
2.31.1
#7 lore raw

PATCH 7/18 auto-t: iwd.py: add roam() method

In reply to James Prestwood

This will use the Roam() developer method to force a roam to a certain BSS. This is particularly useful for any test requiring roams that are not testing IWD's BSS selection logic. Rather than creating hwsim rules, setting low RSSI values, and waiting for the roam logic/scan to happen Roam() can be used to force the roam logic immediately.

---
 autotests/util/iwd.py | 6 ++++++
 1 file changed, 6 insertions(+)
autotests/util/iwd.py +6 -0
index be072a42..1785081f 100755
@@ -542,6 +542,12 @@ class Device(IWDDBusAbstract):
                                                 IWD_STATION_DEBUG_INTERFACE)
         self._station_debug_if.ConnectBssid(dbus.ByteArray.fromhex(address.replace(':', '')))
 
+    def roam(self, address):
+        self._station_debug_if = dbus.Interface(self._bus.get_object(IWD_SERVICE,
+                                                self.device_path),
+                                                IWD_STATION_DEBUG_INTERFACE)
+        self._station_debug_if.Roam(dbus.ByteArray.fromhex(address.replace(':', '')))
+
     def __str__(self, prefix = ''):
         return prefix + 'Device: ' + self.device_path + '\n'\
                + prefix + '\tName:\t\t' + self.name + '\n'\
Signature · 1 line
2.31.1
#8 lore raw

PATCH 8/18 auto-t: add reassociate test to FT-SAE-roam

In reply to James Prestwood

This refactors to test both FT and reassociation.

---
 autotests/testFT-SAE-roam/TestFT.psk         |   5 +
 autotests/testFT-SAE-roam/connection_test.py | 109 ++++++++-----------
 2 files changed, 48 insertions(+), 66 deletions(-)
 create mode 100644 autotests/testFT-SAE-roam/TestFT.psk
autotests/testFT-SAE-roam/TestFT.psk new file +5 -0
new file mode 100644
index 00000000..acadaab9
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=EasilyGuessedPassword
+
+[Settings]
+AutoConnect=False
autotests/testFT-SAE-roam/connection_test.py +43 -66

178 lines not on this page · raw message

Signature · 1 line
2.31.1
#9 lore raw

PATCH 9/18 auto-t: rename testFT-SAE-roam to testSAE-roam

In reply to James Prestwood

Since reassociation is now tested this name fits better

---
 autotests/{testFT-SAE-roam => testSAE-roam}/TestFT.psk         | 0
 autotests/{testFT-SAE-roam => testSAE-roam}/connection_test.py | 0
 autotests/{testFT-SAE-roam => testSAE-roam}/ft-psk-3.conf      | 0
 autotests/{testFT-SAE-roam => testSAE-roam}/ft-sae-1.conf      | 0
 autotests/{testFT-SAE-roam => testSAE-roam}/ft-sae-2.conf      | 0
 autotests/{testFT-SAE-roam => testSAE-roam}/hw.conf            | 0
 autotests/{testFT-SAE-roam => testSAE-roam}/main.conf          | 0
 7 files changed, 0 insertions(+), 0 deletions(-)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/TestFT.psk (100%)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/connection_test.py (100%)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/ft-psk-3.conf (100%)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/ft-sae-1.conf (100%)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/ft-sae-2.conf (100%)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/hw.conf (100%)
 rename autotests/{testFT-SAE-roam => testSAE-roam}/main.conf (100%)
autotests/testSAE-roam/TestFT.psk renamed from autotests/testFT-SAE-roam/TestFT.psk +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/TestFT.psk
rename to autotests/testSAE-roam/TestFT.psk
autotests/testSAE-roam/connection_test.py renamed from autotests/testFT-SAE-roam/connection_test.py +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/connection_test.py
rename to autotests/testSAE-roam/connection_test.py
autotests/testSAE-roam/ft-psk-3.conf renamed from autotests/testFT-SAE-roam/ft-psk-3.conf +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/ft-psk-3.conf
rename to autotests/testSAE-roam/ft-psk-3.conf
autotests/testSAE-roam/ft-sae-1.conf renamed from autotests/testFT-SAE-roam/ft-sae-1.conf +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/ft-sae-1.conf
rename to autotests/testSAE-roam/ft-sae-1.conf
autotests/testSAE-roam/ft-sae-2.conf renamed from autotests/testFT-SAE-roam/ft-sae-2.conf +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/ft-sae-2.conf
rename to autotests/testSAE-roam/ft-sae-2.conf
autotests/testSAE-roam/hw.conf renamed from autotests/testFT-SAE-roam/hw.conf +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/hw.conf
rename to autotests/testSAE-roam/hw.conf
autotests/testSAE-roam/main.conf renamed from autotests/testFT-SAE-roam/main.conf +0 -0
similarity index 100%
rename from autotests/testFT-SAE-roam/main.conf
rename to autotests/testSAE-roam/main.conf
Signature · 1 line
2.31.1
#10 lore raw

PATCH 10/18 auto-t: add reassociation test for OWE

In reply to James Prestwood

The timeout test was also modified to handle the additional radio.

---
 autotests/testOWE/connection_test.py          | 47 +++++++++++++------
 autotests/testOWE/hw.conf                     |  7 +--
 autotests/testOWE/main.conf                   |  2 +
 .../testOWE/{ssidOWE.conf => ssidOWE-1.conf}  |  0
 autotests/testOWE/ssidOWE-2.conf              |  8 ++++
 autotests/testOWE/timeout_test.py             | 22 +++++++--
 6 files changed, 66 insertions(+), 20 deletions(-)
 create mode 100644 autotests/testOWE/main.conf
 rename autotests/testOWE/{ssidOWE.conf => ssidOWE-1.conf} (100%)
 create mode 100644 autotests/testOWE/ssidOWE-2.conf
autotests/testOWE/connection_test.py +33 -14
index ee1036c8..0be09263 100644
@@ -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):
autotests/testOWE/hw.conf +4 -3
index 7f6d938d..fe59f389 100644
@@ -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
autotests/testOWE/main.conf new file +2 -0
new file mode 100644
index 00000000..9452fb6b
@@ -0,0 +1,2 @@
+[Scan]
+DisableMacAddressRandomization=true
autotests/testOWE/ssidOWE-1.conf renamed from autotests/testOWE/ssidOWE.conf +0 -0
similarity index 100%
rename from autotests/testOWE/ssidOWE.conf
rename to autotests/testOWE/ssidOWE-1.conf
autotests/testOWE/ssidOWE-2.conf new file +8 -0
new file mode 100644
index 00000000..d9528a36
@@ -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
autotests/testOWE/timeout_test.py +19 -3
index 39c2d429..d75bc8b9 100644
@@ -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
Signature · 1 line
2.31.1
#11 lore raw

PATCH 11/18 auto-t: update testFT-8021x-roam to use roam() API

In reply to James Prestwood
---
 .../testFT-8021x-roam/connection_test.py      | 56 ++-----------------
 1 file changed, 5 insertions(+), 51 deletions(-)
autotests/testFT-8021x-roam/connection_test.py +5 -51
index aa8eddba..cd6ebbab 100644
@@ -4,56 +4,25 @@ import unittest
 import sys, os
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
 from iwd import NetworkType
-from hwsim import Hwsim
 from hostapd import HostapdCLI
 import testutil
 
 class Test(unittest.TestCase):
     def test_roam_success(self):
-        hwsim = Hwsim()
-
-        rule0 = hwsim.rules.create()
-        rule0.source = self.bss_radio[0].addresses[0]
-        rule0.bidirectional = True
-
-        rule1 = hwsim.rules.create()
-        rule1.source = self.bss_radio[1].addresses[0]
-        rule1.bidirectional = True
-
-        # Check that iwd selects BSS 0 first
-        rule0.signal = -2000
-        rule1.signal = -6900
-
         wd = IWD(True)
 
         device = wd.list_devices(1)[0]
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('TestFT')
+        ordered_network = device.get_ordered_network('TestFT', scan_if_needed=True)
 
         self.assertEqual(ordered_network.type, NetworkType.eap)
-        self.assertEqual(ordered_network.signal_strength, -2000)
-
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
 
         self.assertFalse(self.bss_hostapd[0].list_sta())
         self.assertFalse(self.bss_hostapd[1].list_sta())
 
-        ordered_network.network_object.connect()
+        device.connect_bssid(self.bss_hostapd[0].bssid)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -64,15 +33,9 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[1].ifname, device.name))
+                          (self.bss_hostapd[1].ifname, device.name, True, True))
 
-        # Check that iwd starts transition to BSS 1 in less than 10 seconds.
-        # The 10 seconds is longer than needed to scan on just two channels
-        # but short enough that a full scan on the 2.4 + 5.8 bands supported
-        # by mac80211_hwsim will not finish.  If this times out then, but
-        # device_roam_trigger_cb has happened, it probably means that
-        # Neighbor Reports are broken.
-        rule0.signal = -8000
+        device.roam(self.bss_hostapd[1].bssid)
 
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition)
@@ -88,7 +51,7 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[0].ifname, device.name))
+                          (self.bss_hostapd[0].ifname, device.name, True, True))
 
     def tearDown(self):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
@@ -96,20 +59,12 @@ class Test(unittest.TestCase):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up')
         os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
 
-        hwsim = Hwsim()
-        for rule in list(hwsim.rules.keys()):
-            del hwsim.rules[rule]
-
     @classmethod
     def setUpClass(cls):
         IWD.copy_to_storage('TestFT.8021x')
 
-        hwsim = Hwsim()
-
         cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'),
                             HostapdCLI(config='ft-eap-ccmp-2.conf') ]
-        cls.bss_radio =  [ hwsim.get_radio('rad0'),
-                           hwsim.get_radio('rad1') ]
 
         # Set interface addresses to those expected by hostapd config files
         os.system('ifconfig "' + cls.bss_hostapd[0].ifname +
@@ -136,7 +91,6 @@ class Test(unittest.TestCase):
     def tearDownClass(cls):
         IWD.clear_storage()
         cls.bss_hostapd = None
-        cls.bss_radio = None
 
 if __name__ == '__main__':
     unittest.main(exit=True)
Signature · 1 line
2.31.1
#12 lore raw

PATCH 12/18 auto-t: combine testFT-FILS* tests

In reply to James Prestwood

This combines the SHA256 and SHA384 tests into one, as well as utilizes the new connect_bssid() and roam() APIs for much faster test execution.

---
 autotests/testFT-FILS-SHA256/TestFT.8021x     |  2 +
 .../testFT-FILS-SHA256/connection_test.py     | 85 +++++++++----------
 .../testFT-FILS-SHA384/connection_test.py     |  6 +-
 3 files changed, 44 insertions(+), 49 deletions(-)
autotests/testFT-FILS-SHA256/TestFT.8021x +2 -0
index 6fd3e0e8..3b16769b 100644
@@ -1,5 +1,7 @@
 [Security]
 EAP-Method=PWD
+EAP-Identity=user(a)example.com
+EAP-Password=secret123
 
 [Settings]
 AutoConnect=False
autotests/testFT-FILS-SHA256/connection_test.py +39 -46

161 lines not on this page · raw message

autotests/testFT-FILS-SHA384/connection_test.py +3 -3
index 465b9c98..a7752c98 100644
@@ -69,7 +69,7 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[1].ifname, device.name))
+                          (self.bss_hostapd[1].ifname, device.name, True, True))
 
         device.disconnect()
 
@@ -94,7 +94,7 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[1].ifname, device.name))
+                          (self.bss_hostapd[1].ifname, device.name, True, True))
 
         # Check that iwd starts transition to BSS 1 in less than 10 seconds.
         # The 10 seconds is longer than needed to scan on just two channels
@@ -118,7 +118,7 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[0].ifname, device.name))
+                          (self.bss_hostapd[0].ifname, device.name, True, True))
 
     def tearDown(self):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
Signature · 1 line
2.31.1
#13 lore raw

PATCH 13/18 auto-t: rename testFT-FILS-SHA256 to testFT-FILS

In reply to James Prestwood
---
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/TestFT.8021x       | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/connection_test.py | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/ft-eap-ccmp-1.conf | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/ft-eap-ccmp-2.conf | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/hw.conf            | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/main.conf          | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/pwd.eap_user       | 0
 autotests/{testFT-FILS-SHA256 => testFT-FILS}/radius.conf        | 0
 8 files changed, 0 insertions(+), 0 deletions(-)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/TestFT.8021x (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/connection_test.py (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/ft-eap-ccmp-1.conf (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/ft-eap-ccmp-2.conf (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/hw.conf (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/main.conf (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/pwd.eap_user (100%)
 rename autotests/{testFT-FILS-SHA256 => testFT-FILS}/radius.conf (100%)
autotests/testFT-FILS/TestFT.8021x renamed from autotests/testFT-FILS-SHA256/TestFT.8021x +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/TestFT.8021x
rename to autotests/testFT-FILS/TestFT.8021x
autotests/testFT-FILS/connection_test.py renamed from autotests/testFT-FILS-SHA256/connection_test.py +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/connection_test.py
rename to autotests/testFT-FILS/connection_test.py
autotests/testFT-FILS/ft-eap-ccmp-1.conf renamed from autotests/testFT-FILS-SHA256/ft-eap-ccmp-1.conf +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/ft-eap-ccmp-1.conf
rename to autotests/testFT-FILS/ft-eap-ccmp-1.conf
autotests/testFT-FILS/ft-eap-ccmp-2.conf renamed from autotests/testFT-FILS-SHA256/ft-eap-ccmp-2.conf +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/ft-eap-ccmp-2.conf
rename to autotests/testFT-FILS/ft-eap-ccmp-2.conf
autotests/testFT-FILS/hw.conf renamed from autotests/testFT-FILS-SHA256/hw.conf +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/hw.conf
rename to autotests/testFT-FILS/hw.conf
autotests/testFT-FILS/main.conf renamed from autotests/testFT-FILS-SHA256/main.conf +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/main.conf
rename to autotests/testFT-FILS/main.conf
autotests/testFT-FILS/pwd.eap_user renamed from autotests/testFT-FILS-SHA256/pwd.eap_user +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/pwd.eap_user
rename to autotests/testFT-FILS/pwd.eap_user
autotests/testFT-FILS/radius.conf renamed from autotests/testFT-FILS-SHA256/radius.conf +0 -0
similarity index 100%
rename from autotests/testFT-FILS-SHA256/radius.conf
rename to autotests/testFT-FILS/radius.conf
Signature · 1 line
2.31.1
#14 lore raw

PATCH 14/18 auto-t: remove testFT-FILS-SHA384

In reply to James Prestwood
---
 autotests/testFT-FILS-SHA384/TestFT.8021x     |   5 -
 .../testFT-FILS-SHA384/connection_test.py     | 174 ------------------
 .../testFT-FILS-SHA384/ft-eap-ccmp-1.conf     |  42 -----
 .../testFT-FILS-SHA384/ft-eap-ccmp-2.conf     |  42 -----
 autotests/testFT-FILS-SHA384/hw.conf          |   8 -
 autotests/testFT-FILS-SHA384/main.conf        |   2 -
 autotests/testFT-FILS-SHA384/pwd.eap_user     |   1 -
 autotests/testFT-FILS-SHA384/radius.conf      |  15 --
 8 files changed, 289 deletions(-)
 delete mode 100644 autotests/testFT-FILS-SHA384/TestFT.8021x
 delete mode 100644 autotests/testFT-FILS-SHA384/connection_test.py
 delete mode 100644 autotests/testFT-FILS-SHA384/ft-eap-ccmp-1.conf
 delete mode 100644 autotests/testFT-FILS-SHA384/ft-eap-ccmp-2.conf
 delete mode 100644 autotests/testFT-FILS-SHA384/hw.conf
 delete mode 100644 autotests/testFT-FILS-SHA384/main.conf
 delete mode 100644 autotests/testFT-FILS-SHA384/pwd.eap_user
 delete mode 100644 autotests/testFT-FILS-SHA384/radius.conf
autotests/testFT-FILS-SHA384/TestFT.8021x deleted +0 -5
deleted file mode 100644
index 6fd3e0e8..00000000
@@ -1,5 +0,0 @@
-[Security]
-EAP-Method=PWD
-
-[Settings]
-AutoConnect=False
autotests/testFT-FILS-SHA384/connection_test.py deleted +0 -174

174 lines not on this page · raw message

autotests/testFT-FILS-SHA384/ft-eap-ccmp-1.conf deleted +0 -42

42 lines not on this page · raw message

autotests/testFT-FILS-SHA384/ft-eap-ccmp-2.conf deleted +0 -42

42 lines not on this page · raw message

autotests/testFT-FILS-SHA384/hw.conf deleted +0 -8
deleted file mode 100644
index 322f0862..00000000
@@ -1,8 +0,0 @@
-[SETUP]
-num_radios=3
-start_iwd=0
-
-[HOSTAPD]
-rad0=ft-eap-ccmp-1.conf
-rad1=ft-eap-ccmp-2.conf
-radius_server=radius.conf
autotests/testFT-FILS-SHA384/main.conf deleted +0 -2
deleted file mode 100644
index 9452fb6b..00000000
@@ -1,2 +0,0 @@
-[Scan]
-DisableMacAddressRandomization=true
autotests/testFT-FILS-SHA384/pwd.eap_user deleted +0 -1
deleted file mode 100644
index 69079c24..00000000
@@ -1 +0,0 @@
-"user(a)example.com"	PWD     "secret123"
autotests/testFT-FILS-SHA384/radius.conf deleted +0 -15
deleted file mode 100644
index 4fcfdfff..00000000
@@ -1,15 +0,0 @@
-driver=none
-radius_server_clients=/tmp/certs/radius-clients.text
-radius_server_auth_port=1812
-eap_user_file=/tmp/pwd.eap_user
-eap_server=0
-eap_server_erp=1
-
-erp_send_reauth_start=1
-erp_domain=example.com
-fils_realm=example.com
-disable_pmksa_caching=1
-
-pwd_group=19
-wpa_group_rekey=30
-wpa_ptk_rekey=30
Signature · 1 line
2.31.1
#15 lore raw

PATCH 15/18 auto-t: use connect_bssid/roam APIs in testFT-PSK-roam

In reply to James Prestwood

This also adds FT-over-DS into this test, as well as a reassociation test for good measure.

---
 autotests/testFT-PSK-roam/TestFT.psk         |   5 +
 autotests/testFT-PSK-roam/connection_test.py | 106 +++++++++++--------
 2 files changed, 67 insertions(+), 44 deletions(-)
 create mode 100644 autotests/testFT-PSK-roam/TestFT.psk
autotests/testFT-PSK-roam/TestFT.psk new file +5 -0
new file mode 100644
index 00000000..acadaab9
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=EasilyGuessedPassword
+
+[Settings]
+AutoConnect=False
autotests/testFT-PSK-roam/connection_test.py +62 -44

170 lines not on this page · raw message

Signature · 1 line
2.31.1
#16 lore raw

PATCH 16/18 auto-t: remove FT-over-DS test, and rename testFT-PSK-roam

In reply to James Prestwood
---
 .../testFT-PSK-over-DS/connection_test.py     | 151 ------------------
 .../testFT-PSK-over-DS/ft-psk-ccmp-1.conf     |  41 -----
 .../testFT-PSK-over-DS/ft-psk-ccmp-2.conf     |  41 -----
 autotests/testFT-PSK-roam/hw.conf             |   7 -
 autotests/testFT-PSK-roam/main.conf           |   2 -
 .../TestFT.psk                                |   0
 .../connection_test.py                        |   0
 .../ft-psk-ccmp-1.conf                        |   0
 .../ft-psk-ccmp-2.conf                        |   0
 .../hw.conf                                   |   0
 .../main.conf                                 |   0
 11 files changed, 242 deletions(-)
 delete mode 100644 autotests/testFT-PSK-over-DS/connection_test.py
 delete mode 100644 autotests/testFT-PSK-over-DS/ft-psk-ccmp-1.conf
 delete mode 100644 autotests/testFT-PSK-over-DS/ft-psk-ccmp-2.conf
 delete mode 100644 autotests/testFT-PSK-roam/hw.conf
 delete mode 100644 autotests/testFT-PSK-roam/main.conf
 rename autotests/{testFT-PSK-roam => testPSK-roam}/TestFT.psk (100%)
 rename autotests/{testFT-PSK-roam => testPSK-roam}/connection_test.py (100%)
 rename autotests/{testFT-PSK-roam => testPSK-roam}/ft-psk-ccmp-1.conf (100%)
 rename autotests/{testFT-PSK-roam => testPSK-roam}/ft-psk-ccmp-2.conf (100%)
 rename autotests/{testFT-PSK-over-DS => testPSK-roam}/hw.conf (100%)
 rename autotests/{testFT-PSK-over-DS => testPSK-roam}/main.conf (100%)
autotests/testFT-PSK-over-DS/connection_test.py deleted +0 -151
deleted file mode 100644
index 7be5924f..00000000
@@ -1,151 +0,0 @@
-#! /usr/bin/python3
-
-import unittest
-import sys, os
-
-sys.path.append('../util')
-import iwd
-from iwd import IWD
-from iwd import PSKAgent
-from iwd import NetworkType
-from hwsim import Hwsim
-from hostapd import HostapdCLI
-import testutil
-
-class Test(unittest.TestCase):
-    def test_roam_success(self):
-        hwsim = Hwsim()
-
-        rule0 = hwsim.rules.create()
-        rule0.source = self.bss_radio[0].addresses[0]
-        rule0.bidirectional = True
-
-        rule1 = hwsim.rules.create()
-        rule1.source = self.bss_radio[1].addresses[0]
-        rule1.bidirectional = True
-
-        # Check that iwd selects BSS 0 first
-        rule0.signal = -2000
-        rule1.signal = -6900
-
-        wd = IWD(True)
-
-        psk_agent = PSKAgent("EasilyGuessedPassword")
-        wd.register_psk_agent(psk_agent)
-
-        device = wd.list_devices(1)[0]
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('TestFT')
-
-        self.assertEqual(ordered_network.type, NetworkType.psk)
-        self.assertEqual(ordered_network.signal_strength, -2000)
-
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
-
-        self.assertFalse(self.bss_hostapd[0].list_sta())
-        self.assertFalse(self.bss_hostapd[1].list_sta())
-
-        ordered_network.network_object.connect()
-
-        condition = 'obj.state == DeviceState.connected'
-        wd.wait_for_object_condition(device, condition)
-
-        self.bss_hostapd[0].wait_for_event('AP-STA-CONNECTED %s' % device.address)
-
-        # list_sta actually reports any authenticated stations. Due to the
-        # nature of FT-over-DS IWD should authenticate to all stations with
-        # the same mobility domain. This means both APs should show our station.
-        self.assertTrue(self.bss_hostapd[0].list_sta())
-        self.assertTrue(self.bss_hostapd[1].list_sta())
-
-        wd.unregister_psk_agent(psk_agent)
-
-        testutil.test_iface_operstate(device.name)
-        testutil.test_ifaces_connected(self.bss_hostapd[0].ifname, device.name)
-        self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[1].ifname, device.name))
-
-        # Check that iwd starts transition to BSS 1 in less than 10 seconds.
-        # The 10 seconds is longer than needed to scan on just two channels
-        # but short enough that a full scan on the 2.4 + 5.8 bands supported
-        # by mac80211_hwsim will not finish.  If this times out then, but
-        # device_roam_trigger_cb has happened, it probably means that
-        # Neighbor Reports are broken.
-        rule0.signal = -8000
-
-        condition = 'obj.state == DeviceState.roaming'
-        wd.wait_for_object_condition(device, condition)
-
-        # Check that iwd is on BSS 1 once out of roaming state and doesn't
-        # go through 'disconnected', 'autoconnect', 'connecting' in between
-        from_condition = 'obj.state == DeviceState.roaming'
-        to_condition = 'obj.state == DeviceState.connected'
-        wd.wait_for_object_change(device, from_condition, to_condition)
-
-        self.assertTrue(self.bss_hostapd[1].list_sta())
-
-        testutil.test_iface_operstate(device.name)
-        testutil.test_ifaces_connected(self.bss_hostapd[1].ifname, device.name)
-        self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (self.bss_hostapd[0].ifname, device.name))
-
-    def tearDown(self):
-        os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
-        os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" down')
-        os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" up')
-        os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
-
-        hwsim = Hwsim()
-        for rule in list(hwsim.rules.keys()):
-            del hwsim.rules[rule]
-
-    @classmethod
-    def setUpClass(cls):
-        hwsim = Hwsim()
-
-        cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'),
-                            HostapdCLI(config='ft-psk-ccmp-2.conf') ]
-        cls.bss_radio =  [ hwsim.get_radio('rad0'),
-                           hwsim.get_radio('rad1') ]
-
-        # Set interface addresses to those expected by hostapd config files
-        os.system('ifconfig "' + cls.bss_hostapd[0].ifname +
-                '" down hw ether 12:00:00:00:00:01 up')
-        os.system('ifconfig "' + cls.bss_hostapd[1].ifname +
-                '" down hw ether 12:00:00:00:00:02 up')
-
-        cls.bss_hostapd[0].reload()
-        cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
-        cls.bss_hostapd[1].reload()
-        cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
-
-        # Fill in the neighbor AP tables in both BSSes.  By default each
-        # instance knows only about current BSS, even inside one hostapd
-        # process.
-        # FT still works without the neighbor AP table but neighbor reports
-        # have to be disabled in the .conf files
-        cls.bss_hostapd[0].set_neighbor('12:00:00:00:00:02', 'TestFT',
-                '1200000000028f0000005102060603000000')
-        cls.bss_hostapd[1].set_neighbor('12:00:00:00:00:01', 'TestFT',
-                '1200000000018f0000005101060603000000')
-
-    @classmethod
-    def tearDownClass(cls):
-        IWD.clear_storage()
-        cls.bss_hostapd = None
-        cls.bss_radio = None
-
-if __name__ == '__main__':
-    unittest.main(exit=True)
autotests/testFT-PSK-over-DS/ft-psk-ccmp-1.conf deleted +0 -41

41 lines not on this page · raw message

autotests/testFT-PSK-over-DS/ft-psk-ccmp-2.conf deleted +0 -41

41 lines not on this page · raw message

autotests/testFT-PSK-roam/hw.conf deleted +0 -7
deleted file mode 100644
index 3fc77613..00000000
@@ -1,7 +0,0 @@
-[SETUP]
-num_radios=3
-start_iwd=0
-
-[HOSTAPD]
-rad0=ft-psk-ccmp-1.conf
-rad1=ft-psk-ccmp-2.conf
autotests/testFT-PSK-roam/main.conf deleted +0 -2
deleted file mode 100644
index 9452fb6b..00000000
@@ -1,2 +0,0 @@
-[Scan]
-DisableMacAddressRandomization=true
autotests/testPSK-roam/TestFT.psk renamed from autotests/testFT-PSK-roam/TestFT.psk +0 -0
similarity index 100%
rename from autotests/testFT-PSK-roam/TestFT.psk
rename to autotests/testPSK-roam/TestFT.psk
autotests/testPSK-roam/connection_test.py renamed from autotests/testFT-PSK-roam/connection_test.py +0 -0
similarity index 100%
rename from autotests/testFT-PSK-roam/connection_test.py
rename to autotests/testPSK-roam/connection_test.py
autotests/testPSK-roam/ft-psk-ccmp-1.conf renamed from autotests/testFT-PSK-roam/ft-psk-ccmp-1.conf +0 -0
similarity index 100%
rename from autotests/testFT-PSK-roam/ft-psk-ccmp-1.conf
rename to autotests/testPSK-roam/ft-psk-ccmp-1.conf
autotests/testPSK-roam/ft-psk-ccmp-2.conf renamed from autotests/testFT-PSK-roam/ft-psk-ccmp-2.conf +0 -0
similarity index 100%
rename from autotests/testFT-PSK-roam/ft-psk-ccmp-2.conf
rename to autotests/testPSK-roam/ft-psk-ccmp-2.conf
autotests/testPSK-roam/hw.conf renamed from autotests/testFT-PSK-over-DS/hw.conf +0 -0
similarity index 100%
rename from autotests/testFT-PSK-over-DS/hw.conf
rename to autotests/testPSK-roam/hw.conf
autotests/testPSK-roam/main.conf renamed from autotests/testFT-PSK-over-DS/main.conf +0 -0
similarity index 100%
rename from autotests/testFT-PSK-over-DS/main.conf
rename to autotests/testPSK-roam/main.conf
Signature · 1 line
2.31.1
#17 lore raw

PATCH 17/18 auto-t: update testPreauth-roam to use connect_bssid/roam()

In reply to James Prestwood
---
 autotests/testPreauth-roam/connection_test.py | 53 ++++---------------
 1 file changed, 11 insertions(+), 42 deletions(-)
autotests/testPreauth-roam/connection_test.py +11 -42
index f31b8b0a..545d4cba 100644
@@ -4,69 +4,39 @@ import unittest
 import sys, os
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
-from iwd import PSKAgent
 from iwd import NetworkType
-from hwsim import Hwsim
 from hostapd import HostapdCLI
 import testutil
 
 class Test(unittest.TestCase):
     def test_preauth_success(self):
-        hwsim = Hwsim()
-
         bss_hostapd = [ HostapdCLI(config='eaptls-preauth-1.conf'),
                         HostapdCLI(config='eaptls-preauth-2.conf') ]
-        bss_radio =  [ hwsim.get_radio('rad0'),
-                       hwsim.get_radio('rad1') ]
-
-        rule0 = hwsim.rules.create()
-        rule0.source = bss_radio[0].addresses[0]
-        rule0.bidirectional = True
 
-        rule1 = hwsim.rules.create()
-        rule1.source = bss_radio[1].addresses[0]
-        rule1.bidirectional = True
+        bss0_addr = bss_hostapd[0].bssid
+        bss1_addr = bss_hostapd[1].bssid
 
         # Fill in the neighbor AP tables in both BSSes.  By default each
         # instance knows only about current BSS, even inside one hostapd
         # process.
         # Roaming still works without the neighbor AP table but neighbor
         # reports have to be disabled in the .conf files
-        bss0_nr = ''.join(bss_radio[0].addresses[0].split(':')) + \
+        bss0_nr = ''.join(bss0_addr.split(':')) + \
                 '8f0000005101060603000000'
-        bss1_nr = ''.join(bss_radio[1].addresses[0].split(':')) + \
+        bss1_nr = ''.join(bss1_addr.split(':')) + \
                 '8f0000005102060603000000'
 
-        bss_hostapd[0].set_neighbor(bss_radio[1].addresses[0], 'TestPreauth',
-                bss1_nr)
-        bss_hostapd[1].set_neighbor(bss_radio[0].addresses[0], 'TestPreauth',
-                bss0_nr)
-
-        # Check that iwd selects BSS 0 first
-        rule0.signal = -2500
-        rule1.signal = -6900
+        bss_hostapd[0].set_neighbor(bss1_addr, 'TestPreauth', bss1_nr)
+        bss_hostapd[1].set_neighbor(bss0_addr, 'TestPreauth', bss0_nr)
 
         wd = IWD(True)
 
         device = wd.list_devices(1)[0]
 
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        device.scan()
-
-        condition = 'obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        condition = 'not obj.scanning'
-        wd.wait_for_object_condition(device, condition)
-
-        ordered_network = device.get_ordered_network('TestPreauth')
+        ordered_network = device.get_ordered_network('TestPreauth', scan_if_needed=True)
 
         self.assertEqual(ordered_network.type, NetworkType.eap)
-        self.assertEqual(ordered_network.signal_strength, -2500)
 
         condition = 'not obj.connected'
         wd.wait_for_object_condition(ordered_network.network_object, condition)
@@ -74,7 +44,7 @@ class Test(unittest.TestCase):
         self.assertFalse(bss_hostapd[0].list_sta())
         self.assertFalse(bss_hostapd[1].list_sta())
 
-        ordered_network.network_object.connect()
+        device.connect_bssid(bss0_addr)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -85,10 +55,9 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(bss_hostapd[0].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          bss_hostapd[1].ifname, device.name)
+                          bss_hostapd[1].ifname, device.name, True, True)
 
-        # Check that iwd starts transition to BSS 1 in less than 15 seconds
-        rule0.signal = -8000
+        device.roam(bss1_addr)
 
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition)
@@ -106,7 +75,7 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(bss_hostapd[1].ifname, device.name)
         self.assertRaises(Exception, testutil.test_ifaces_connected,
-                          (bss_hostapd[0].ifname, device.name))
+                          (bss_hostapd[0].ifname, device.name, True, True))
 
         device.disconnect()
 
Signature · 1 line
2.31.1
#18 lore raw

PATCH 18/18 auto-t: use connect_bssid in APRoam

In reply to James Prestwood

In addition the send_bss_transition call was updated to only send a single BSS. By sending two BSS's IWD is left to pick whichever one it wants which makes the test behavior undefined.

---
 autotests/testAPRoam/TestAPRoam.psk     |  2 ++
 autotests/testAPRoam/connection_test.py | 47 ++-----------------------
 2 files changed, 5 insertions(+), 44 deletions(-)
 create mode 100644 autotests/testAPRoam/TestAPRoam.psk
autotests/testAPRoam/TestAPRoam.psk new file +2 -0
new file mode 100644
index 00000000..abafdb66
@@ -0,0 +1,2 @@
+[Security]
+Passphrase=secret123
autotests/testAPRoam/connection_test.py +3 -44

89 lines not on this page · raw message

Signature · 1 line
2.31.1