All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
@ 2021-08-12 20:14 ` Denis Kenzior
  2021-08-12 20:21 ` [PATCH 02/18] test-runner: start IWD in developer mode James Prestwood
                   ` (16 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: Denis Kenzior @ 2021-08-12 20:14 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 288 bytes --]

Hi James,

On 8/12/21 3:21 PM, James Prestwood wrote:
> 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

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property
@ 2021-08-12 20:21 James Prestwood
  2021-08-12 20:14 ` Denis Kenzior
                   ` (17 more replies)
  0 siblings, 18 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 836 bytes --]

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(+)

diff --git a/autotests/util/hostapd.py b/autotests/util/hostapd.py
index 6031b1dc..f75dbe6b 100644
--- a/autotests/util/hostapd.py
+++ b/autotests/util/hostapd.py
@@ -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]
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 02/18] test-runner: start IWD in developer mode
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
  2021-08-12 20:14 ` Denis Kenzior
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 03/18] test-runner: don't fatally exit on bad test configuration James Prestwood
                   ` (15 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 598 bytes --]

This is being done to utilize the Roam() developer method
---
 tools/test-runner | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/test-runner b/tools/test-runner
index 75e46444..7e789dd7 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -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')
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 03/18] test-runner: don't fatally exit on bad test configuration
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
  2021-08-12 20:14 ` Denis Kenzior
  2021-08-12 20:21 ` [PATCH 02/18] test-runner: start IWD in developer mode James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 04/18] test-runner: don't run duplicate tests James Prestwood
                   ` (14 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 934 bytes --]

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(-)

diff --git a/tools/test-runner b/tools/test-runner
index 7e789dd7..939efa51 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -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')
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 04/18] test-runner: don't run duplicate tests
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (2 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 03/18] test-runner: don't fatally exit on bad test configuration James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 05/18] auto-t: testutil.py: add expect_fail flag James Prestwood
                   ` (13 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 965 bytes --]

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(-)

diff --git a/tools/test-runner b/tools/test-runner
index 939efa51..28c7d900 100755
--- a/tools/test-runner
+++ b/tools/test-runner
@@ -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)
 
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 05/18] auto-t: testutil.py: add expect_fail flag
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (3 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 04/18] test-runner: don't run duplicate tests James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 06/18] auto-t: iwd.py: add connect_bssid() method James Prestwood
                   ` (12 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2047 bytes --]

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(-)

diff --git a/autotests/util/testutil.py b/autotests/util/testutil.py
index c649b387..ea705bad 100644
--- a/autotests/util/testutil.py
+++ b/autotests/util/testutil.py
@@ -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
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 06/18] auto-t: iwd.py: add connect_bssid() method
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (4 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 05/18] auto-t: testutil.py: add expect_fail flag James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 07/18] auto-t: iwd.py: add roam() method James Prestwood
                   ` (11 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1419 bytes --]

Python API for ConnectBssid() developer method
---
 autotests/util/iwd.py | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 350e1aca..be072a42 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -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'\
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 07/18] auto-t: iwd.py: add roam() method
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (5 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 06/18] auto-t: iwd.py: add connect_bssid() method James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 08/18] auto-t: add reassociate test to FT-SAE-roam James Prestwood
                   ` (10 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 1337 bytes --]

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(+)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index be072a42..1785081f 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -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'\
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 08/18] auto-t: add reassociate test to FT-SAE-roam
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (6 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 07/18] auto-t: iwd.py: add roam() method James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 09/18] auto-t: rename testFT-SAE-roam to testSAE-roam James Prestwood
                   ` (9 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 8201 bytes --]

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

diff --git a/autotests/testFT-SAE-roam/TestFT.psk b/autotests/testFT-SAE-roam/TestFT.psk
new file mode 100644
index 00000000..acadaab9
--- /dev/null
+++ b/autotests/testFT-SAE-roam/TestFT.psk
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=EasilyGuessedPassword
+
+[Settings]
+AutoConnect=False
diff --git a/autotests/testFT-SAE-roam/connection_test.py b/autotests/testFT-SAE-roam/connection_test.py
index bea42856..da7413f9 100644
--- a/autotests/testFT-SAE-roam/connection_test.py
+++ b/autotests/testFT-SAE-roam/connection_test.py
@@ -8,37 +8,12 @@ import iwd
 from iwd import IWD
 from iwd import PSKAgent
 from iwd import NetworkType
-from hwsim import Hwsim
 from hostapd import HostapdCLI
 import testutil
 from config import ctx
 
 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
-
-        rule2 = hwsim.rules.create()
-        rule2.source = self.bss_radio[2].addresses[0]
-        rule2.bidirectional = True
-
-        # Check that iwd selects BSS 0 first
-        rule0.signal = -2000
-        rule1.signal = -6900
-        rule2.signal = -7200
-
-        wd = IWD(True)
-
-        psk_agent = PSKAgent("EasilyGuessedPassword")
-        wd.register_psk_agent(psk_agent)
-
+    def validate_connection(self, wd, ft=True):
         device = wd.list_devices(1)[0]
 
         condition = 'not obj.scanning'
@@ -52,18 +27,10 @@ class Test(unittest.TestCase):
         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()
+        device.connect_bssid(self.bss_hostapd[0].bssid)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -71,20 +38,12 @@ class Test(unittest.TestCase):
         self.assertTrue(self.bss_hostapd[0].list_sta())
         self.assertFalse(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))
+                          (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)
@@ -95,22 +54,17 @@ class Test(unittest.TestCase):
         to_condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_change(device, from_condition, to_condition)
 
-        rule1.signal = -2000
-
-        # wait for IWD's signal levels to recover
-        wd.wait(5)
-
         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))
+                          (self.bss_hostapd[0].ifname, device.name, True, True))
 
-        # test FT-PSK after FT-SAE
-        rule1.signal = -8000
-        rule0.signal = -8000
-        rule2.signal = -1000
+        if not ft:
+                return
+
+        device.roam(self.bss_hostapd[2].bssid)
 
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition)
@@ -124,7 +78,37 @@ class Test(unittest.TestCase):
         testutil.test_iface_operstate(device.name)
         testutil.test_ifaces_connected(self.bss_hostapd[2].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))
+
+    def test_ft_roam_success(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-SAE SAE')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-SAE SAE')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+        self.bss_hostapd[2].set_value('wpa_key_mgmt', 'FT-PSK')
+        self.bss_hostapd[2].reload()
+        self.bss_hostapd[2].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd, True)
+
+    def test_reassociate_roam_success(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'SAE')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'SAE')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+        self.bss_hostapd[2].set_value('wpa_key_mgmt', 'WPA-PSK')
+        self.bss_hostapd[2].reload()
+        self.bss_hostapd[2].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd, False)
 
     def tearDown(self):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
@@ -134,20 +118,11 @@ class Test(unittest.TestCase):
         os.system('ifconfig "' + self.bss_hostapd[1].ifname + '" up')
         os.system('ifconfig "' + self.bss_hostapd[2].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-sae-1.conf'),
                             HostapdCLI(config='ft-sae-2.conf'),
                             HostapdCLI(config='ft-psk-3.conf') ]
-        cls.bss_radio =  [ hwsim.get_radio('rad0'),
-                           hwsim.get_radio('rad1'),
-                           hwsim.get_radio('rad2') ]
 
         ctx.start_process(['ifconfig', cls.bss_hostapd[0].ifname, 'down', 'hw', \
                                 'ether', '12:00:00:00:00:01', 'up'], wait=True)
@@ -184,11 +159,13 @@ class Test(unittest.TestCase):
         cls.bss_hostapd[2].set_neighbor('12:00:00:00:00:02', 'TestFT',
                 '1200000000028f0000005101060603000000')
 
+        IWD.copy_to_storage('TestFT.psk')
+
     @classmethod
     def tearDownClass(cls):
         IWD.clear_storage()
+
         cls.bss_hostapd = None
-        cls.bss_radio = None
 
 if __name__ == '__main__':
     unittest.main(exit=True)
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 09/18] auto-t: rename testFT-SAE-roam to testSAE-roam
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (7 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 08/18] auto-t: add reassociate test to FT-SAE-roam James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:21 ` [PATCH 10/18] auto-t: add reassociation test for OWE James Prestwood
                   ` (8 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 2608 bytes --]

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%)

diff --git a/autotests/testFT-SAE-roam/TestFT.psk b/autotests/testSAE-roam/TestFT.psk
similarity index 100%
rename from autotests/testFT-SAE-roam/TestFT.psk
rename to autotests/testSAE-roam/TestFT.psk
diff --git a/autotests/testFT-SAE-roam/connection_test.py b/autotests/testSAE-roam/connection_test.py
similarity index 100%
rename from autotests/testFT-SAE-roam/connection_test.py
rename to autotests/testSAE-roam/connection_test.py
diff --git a/autotests/testFT-SAE-roam/ft-psk-3.conf b/autotests/testSAE-roam/ft-psk-3.conf
similarity index 100%
rename from autotests/testFT-SAE-roam/ft-psk-3.conf
rename to autotests/testSAE-roam/ft-psk-3.conf
diff --git a/autotests/testFT-SAE-roam/ft-sae-1.conf b/autotests/testSAE-roam/ft-sae-1.conf
similarity index 100%
rename from autotests/testFT-SAE-roam/ft-sae-1.conf
rename to autotests/testSAE-roam/ft-sae-1.conf
diff --git a/autotests/testFT-SAE-roam/ft-sae-2.conf b/autotests/testSAE-roam/ft-sae-2.conf
similarity index 100%
rename from autotests/testFT-SAE-roam/ft-sae-2.conf
rename to autotests/testSAE-roam/ft-sae-2.conf
diff --git a/autotests/testFT-SAE-roam/hw.conf b/autotests/testSAE-roam/hw.conf
similarity index 100%
rename from autotests/testFT-SAE-roam/hw.conf
rename to autotests/testSAE-roam/hw.conf
diff --git a/autotests/testFT-SAE-roam/main.conf b/autotests/testSAE-roam/main.conf
similarity index 100%
rename from autotests/testFT-SAE-roam/main.conf
rename to autotests/testSAE-roam/main.conf
-- 
2.31.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 10/18] auto-t: add reassociation test for OWE
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (8 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 09/18] auto-t: rename testFT-SAE-roam to testSAE-roam James Prestwood
@ 2021-08-12 20:21 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 11/18] auto-t: update testFT-8021x-roam to use roam() API James Prestwood
                   ` (7 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:21 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 6651 bytes --]

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

diff --git a/autotests/testOWE/connection_test.py b/autotests/testOWE/connection_test.py
index ee1036c8..0be09263 100644
--- 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
index 7f6d938d..fe59f389 100644
--- 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
new file mode 100644
index 00000000..9452fb6b
--- /dev/null
+++ 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
similarity index 100%
rename from autotests/testOWE/ssidOWE.conf
rename to autotests/testOWE/ssidOWE-1.conf
diff --git a/autotests/testOWE/ssidOWE-2.conf b/autotests/testOWE/ssidOWE-2.conf
new file mode 100644
index 00000000..d9528a36
--- /dev/null
+++ 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
index 39c2d429..d75bc8b9 100644
--- 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
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 11/18] auto-t: update testFT-8021x-roam to use roam() API
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (9 preceding siblings ...)
  2021-08-12 20:21 ` [PATCH 10/18] auto-t: add reassociation test for OWE James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 12/18] auto-t: combine testFT-FILS* tests James Prestwood
                   ` (6 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 4891 bytes --]

---
 .../testFT-8021x-roam/connection_test.py      | 56 ++-----------------
 1 file changed, 5 insertions(+), 51 deletions(-)

diff --git a/autotests/testFT-8021x-roam/connection_test.py b/autotests/testFT-8021x-roam/connection_test.py
index aa8eddba..cd6ebbab 100644
--- a/autotests/testFT-8021x-roam/connection_test.py
+++ b/autotests/testFT-8021x-roam/connection_test.py
@@ -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)
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 12/18] auto-t: combine testFT-FILS* tests
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (10 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 11/18] auto-t: update testFT-8021x-roam to use roam() API James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 13/18] auto-t: rename testFT-FILS-SHA256 to testFT-FILS James Prestwood
                   ` (5 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 9697 bytes --]

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(-)

diff --git a/autotests/testFT-FILS-SHA256/TestFT.8021x b/autotests/testFT-FILS-SHA256/TestFT.8021x
index 6fd3e0e8..3b16769b 100644
--- a/autotests/testFT-FILS-SHA256/TestFT.8021x
+++ b/autotests/testFT-FILS-SHA256/TestFT.8021x
@@ -1,5 +1,7 @@
 [Security]
 EAP-Method=PWD
+EAP-Identity=user(a)example.com
+EAP-Password=secret123
 
 [Settings]
 AutoConnect=False
diff --git a/autotests/testFT-FILS-SHA256/connection_test.py b/autotests/testFT-FILS-SHA256/connection_test.py
index a1c24578..b136cb7b 100644
--- a/autotests/testFT-FILS-SHA256/connection_test.py
+++ b/autotests/testFT-FILS-SHA256/connection_test.py
@@ -4,41 +4,21 @@ 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('user(a)example.com', ('user(a)example.com',
-                                                                  'secret123'))
-        wd.register_psk_agent(psk_agent)
-
+    def validate_connection(self, wd):
         device = wd.list_devices(1)[0]
 
         condition = 'not obj.scanning'
         wd.wait_for_object_condition(device, condition)
 
+        # Scanning is unavoidable in this case since both FILS-SHA256 and
+        # FILS-SHA384 are tested. Without a new scan the cached scan results
+        # would cause IWD to choose an incorrect AKM for the second test.
         device.scan()
 
         condition = 'obj.scanning'
@@ -50,15 +30,11 @@ class Test(unittest.TestCase):
         ordered_network = device.get_ordered_network('TestFT')
 
         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)
@@ -69,7 +45,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()
 
@@ -80,10 +56,8 @@ class Test(unittest.TestCase):
 
         self.assertEqual(ordered_network.type, NetworkType.eap)
 
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
-
-        ordered_network.network_object.connect()
+        # TODO: verify FILS was actually used on this second connection
+        device.connect_bssid(self.bss_hostapd[0].bssid)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -94,7 +68,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
@@ -102,7 +76,8 @@ class Test(unittest.TestCase):
         # 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
+        #rule0.signal = -8000
+        device.roam(self.bss_hostapd[1].bssid)
 
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition)
@@ -118,7 +93,33 @@ 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 test_fils_ft_roam_sha256(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-EAP FILS-SHA256 FT-FILS-SHA256')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-EAP FILS-SHA256 FT-FILS-SHA256')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd)
+
+    def test_fils_ft_roam_sha384(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-EAP FILS-SHA384 FT-FILS-SHA384')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-EAP FILS-SHA384 FT-FILS-SHA384')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd)
 
     def tearDown(self):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
@@ -126,21 +127,13 @@ 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):
         os.system('ifconfig lo up')
         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 +
@@ -167,7 +160,7 @@ class Test(unittest.TestCase):
     def tearDownClass(cls):
         IWD.clear_storage()
         cls.bss_hostapd = None
-        cls.bss_radio = None
+        #cls.bss_radio = None
 
 if __name__ == '__main__':
     unittest.main(exit=True)
diff --git a/autotests/testFT-FILS-SHA384/connection_test.py b/autotests/testFT-FILS-SHA384/connection_test.py
index 465b9c98..a7752c98 100644
--- a/autotests/testFT-FILS-SHA384/connection_test.py
+++ b/autotests/testFT-FILS-SHA384/connection_test.py
@@ -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')
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 13/18] auto-t: rename testFT-FILS-SHA256 to testFT-FILS
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (11 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 12/18] auto-t: combine testFT-FILS* tests James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 14/18] auto-t: remove testFT-FILS-SHA384 James Prestwood
                   ` (4 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 3020 bytes --]

---
 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%)

diff --git a/autotests/testFT-FILS-SHA256/TestFT.8021x b/autotests/testFT-FILS/TestFT.8021x
similarity index 100%
rename from autotests/testFT-FILS-SHA256/TestFT.8021x
rename to autotests/testFT-FILS/TestFT.8021x
diff --git a/autotests/testFT-FILS-SHA256/connection_test.py b/autotests/testFT-FILS/connection_test.py
similarity index 100%
rename from autotests/testFT-FILS-SHA256/connection_test.py
rename to autotests/testFT-FILS/connection_test.py
diff --git a/autotests/testFT-FILS-SHA256/ft-eap-ccmp-1.conf b/autotests/testFT-FILS/ft-eap-ccmp-1.conf
similarity index 100%
rename from autotests/testFT-FILS-SHA256/ft-eap-ccmp-1.conf
rename to autotests/testFT-FILS/ft-eap-ccmp-1.conf
diff --git a/autotests/testFT-FILS-SHA256/ft-eap-ccmp-2.conf b/autotests/testFT-FILS/ft-eap-ccmp-2.conf
similarity index 100%
rename from autotests/testFT-FILS-SHA256/ft-eap-ccmp-2.conf
rename to autotests/testFT-FILS/ft-eap-ccmp-2.conf
diff --git a/autotests/testFT-FILS-SHA256/hw.conf b/autotests/testFT-FILS/hw.conf
similarity index 100%
rename from autotests/testFT-FILS-SHA256/hw.conf
rename to autotests/testFT-FILS/hw.conf
diff --git a/autotests/testFT-FILS-SHA256/main.conf b/autotests/testFT-FILS/main.conf
similarity index 100%
rename from autotests/testFT-FILS-SHA256/main.conf
rename to autotests/testFT-FILS/main.conf
diff --git a/autotests/testFT-FILS-SHA256/pwd.eap_user b/autotests/testFT-FILS/pwd.eap_user
similarity index 100%
rename from autotests/testFT-FILS-SHA256/pwd.eap_user
rename to autotests/testFT-FILS/pwd.eap_user
diff --git a/autotests/testFT-FILS-SHA256/radius.conf b/autotests/testFT-FILS/radius.conf
similarity index 100%
rename from autotests/testFT-FILS-SHA256/radius.conf
rename to autotests/testFT-FILS/radius.conf
-- 
2.31.1

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 14/18] auto-t: remove testFT-FILS-SHA384
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (12 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 13/18] auto-t: rename testFT-FILS-SHA256 to testFT-FILS James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 15/18] auto-t: use connect_bssid/roam APIs in testFT-PSK-roam James Prestwood
                   ` (3 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 12918 bytes --]

---
 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

diff --git a/autotests/testFT-FILS-SHA384/TestFT.8021x b/autotests/testFT-FILS-SHA384/TestFT.8021x
deleted file mode 100644
index 6fd3e0e8..00000000
--- a/autotests/testFT-FILS-SHA384/TestFT.8021x
+++ /dev/null
@@ -1,5 +0,0 @@
-[Security]
-EAP-Method=PWD
-
-[Settings]
-AutoConnect=False
diff --git a/autotests/testFT-FILS-SHA384/connection_test.py b/autotests/testFT-FILS-SHA384/connection_test.py
deleted file mode 100644
index a7752c98..00000000
--- a/autotests/testFT-FILS-SHA384/connection_test.py
+++ /dev/null
@@ -1,174 +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('user(a)example.com', ('user(a)example.com',
-                                                                  'secret123'))
-        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.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()
-
-        condition = 'obj.state == DeviceState.connected'
-        wd.wait_for_object_condition(device, condition)
-
-        self.assertTrue(self.bss_hostapd[0].list_sta())
-        self.assertFalse(self.bss_hostapd[1].list_sta())
-
-        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, True, True))
-
-        device.disconnect()
-
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
-
-        ordered_network = device.get_ordered_network('TestFT')
-
-        self.assertEqual(ordered_network.type, NetworkType.eap)
-
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
-
-        ordered_network.network_object.connect()
-
-        condition = 'obj.state == DeviceState.connected'
-        wd.wait_for_object_condition(device, condition)
-
-        self.assertTrue(self.bss_hostapd[0].list_sta())
-        self.assertFalse(self.bss_hostapd[1].list_sta())
-
-        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, 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
-
-        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, True, True))
-
-    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):
-        os.system('ifconfig lo up')
-        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 +
-                '" 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)
diff --git a/autotests/testFT-FILS-SHA384/ft-eap-ccmp-1.conf b/autotests/testFT-FILS-SHA384/ft-eap-ccmp-1.conf
deleted file mode 100644
index 61262c69..00000000
--- a/autotests/testFT-FILS-SHA384/ft-eap-ccmp-1.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-hw_mode=g
-channel=1
-ssid=TestFT
-utf8_ssid=1
-ctrl_interface=/var/run/hostapd
-r1_key_holder=000000000001
-nas_identifier=dummy1
-
-wpa=2
-# Can support WPA-EAP and FT-EAP (space separated list) at the same
-# time but we want to force FT
-wpa_key_mgmt=FT-EAP FILS-SHA384 FT-FILS-SHA384
-wpa_pairwise=CCMP
-ieee8021x=1
-
-fils_realm=example.com
-
-wpa_ptk_rekey=30
-wpa_group_rekey=80
-ieee80211w=1
-rsn_preauth=1
-disable_pmksa_caching=1
-# Allow PMK cache to be shared opportunistically among configured interfaces
-# and BSSes (i.e., all configurations within a single hostapd process).
-okc=1
-mobility_domain=1234
-reassociation_deadline=60000
-r0kh=12:00:00:00:00:01 nas1.w1.fi 000102030405060708090a0b0c0d0e0f
-r0kh=12:00:00:00:00:02 nas2.w1.fi 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
-# Push mode only needed for 8021x, not PSK mode since msk already known
-pmk_r1_push=1
-ft_over_ds=0
-ap_table_expiration_time=36000
-ap_table_max_size=10
-rrm_neighbor_report=1
-
-auth_server_addr=127.0.0.1
-auth_server_port=1812
-auth_server_shared_secret=secret
-nas_identifier=nas1.w1.fi
diff --git a/autotests/testFT-FILS-SHA384/ft-eap-ccmp-2.conf b/autotests/testFT-FILS-SHA384/ft-eap-ccmp-2.conf
deleted file mode 100644
index a6bdf641..00000000
--- a/autotests/testFT-FILS-SHA384/ft-eap-ccmp-2.conf
+++ /dev/null
@@ -1,42 +0,0 @@
-hw_mode=g
-channel=2
-ssid=TestFT
-utf8_ssid=1
-ctrl_interface=/var/run/hostapd
-r1_key_holder=000000000002
-nas_identifier=dummy2
-
-wpa=2
-# Can support WPA-EAP and FT-EAP (space separated list) at the same
-# time but we want to force FT
-wpa_key_mgmt=WPA-EAP FT-FILS-SHA384
-wpa_pairwise=CCMP
-ieee8021x=1
-
-fils_realm=example.com
-
-wpa_ptk_rekey=30
-wpa_group_rekey=80
-ieee80211w=1
-rsn_preauth=1
-disable_pmksa_caching=1
-# Allow PMK cache to be shared opportunistically among configured interfaces
-# and BSSes (i.e., all configurations within a single hostapd process).
-okc=1
-mobility_domain=1234
-reassociation_deadline=60000
-r0kh=12:00:00:00:00:01 nas1.w1.fi 000102030405060708090a0b0c0d0e0f
-r0kh=12:00:00:00:00:02 nas2.w1.fi 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
-# Push mode only needed for 8021x, not PSK mode since msk already known
-pmk_r1_push=1
-ft_over_ds=0
-ap_table_expiration_time=36000
-ap_table_max_size=10
-rrm_neighbor_report=1
-
-auth_server_addr=127.0.0.1
-auth_server_port=1812
-auth_server_shared_secret=secret
-nas_identifier=nas2.w1.fi
diff --git a/autotests/testFT-FILS-SHA384/hw.conf b/autotests/testFT-FILS-SHA384/hw.conf
deleted file mode 100644
index 322f0862..00000000
--- a/autotests/testFT-FILS-SHA384/hw.conf
+++ /dev/null
@@ -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
diff --git a/autotests/testFT-FILS-SHA384/main.conf b/autotests/testFT-FILS-SHA384/main.conf
deleted file mode 100644
index 9452fb6b..00000000
--- a/autotests/testFT-FILS-SHA384/main.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[Scan]
-DisableMacAddressRandomization=true
diff --git a/autotests/testFT-FILS-SHA384/pwd.eap_user b/autotests/testFT-FILS-SHA384/pwd.eap_user
deleted file mode 100644
index 69079c24..00000000
--- a/autotests/testFT-FILS-SHA384/pwd.eap_user
+++ /dev/null
@@ -1 +0,0 @@
-"user(a)example.com"	PWD     "secret123"
diff --git a/autotests/testFT-FILS-SHA384/radius.conf b/autotests/testFT-FILS-SHA384/radius.conf
deleted file mode 100644
index 4fcfdfff..00000000
--- a/autotests/testFT-FILS-SHA384/radius.conf
+++ /dev/null
@@ -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
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 15/18] auto-t: use connect_bssid/roam APIs in testFT-PSK-roam
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (13 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 14/18] auto-t: remove testFT-FILS-SHA384 James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 16/18] auto-t: remove FT-over-DS test, and rename testFT-PSK-roam James Prestwood
                   ` (2 subsequent siblings)
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 8222 bytes --]

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

diff --git a/autotests/testFT-PSK-roam/TestFT.psk b/autotests/testFT-PSK-roam/TestFT.psk
new file mode 100644
index 00000000..acadaab9
--- /dev/null
+++ b/autotests/testFT-PSK-roam/TestFT.psk
@@ -0,0 +1,5 @@
+[Security]
+Passphrase=EasilyGuessedPassword
+
+[Settings]
+AutoConnect=False
diff --git a/autotests/testFT-PSK-roam/connection_test.py b/autotests/testFT-PSK-roam/connection_test.py
index 716d83c4..b4ead946 100644
--- a/autotests/testFT-PSK-roam/connection_test.py
+++ b/autotests/testFT-PSK-roam/connection_test.py
@@ -13,31 +13,14 @@ 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 = -2500
-
-        wd = IWD(True)
-
-        psk_agent = PSKAgent("EasilyGuessedPassword")
-        wd.register_psk_agent(psk_agent)
-
+    def validate_connection(self, wd, over_ds=False):
         device = wd.list_devices(1)[0]
 
         condition = 'not obj.scanning'
         wd.wait_for_object_condition(device, condition)
 
+        # Scanning is unavoidable in this case since several hostapd
+        # configurations are tested and changed mid-test
         device.scan()
 
         condition = 'obj.scanning'
@@ -49,7 +32,6 @@ class Test(unittest.TestCase):
         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)
@@ -57,28 +39,27 @@ class Test(unittest.TestCase):
         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)
 
         self.assertTrue(self.bss_hostapd[0].list_sta())
-        self.assertFalse(self.bss_hostapd[1].list_sta())
 
-        wd.unregister_psk_agent(psk_agent)
+        # 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.
+        if over_ds:
+            self.assertTrue(self.bss_hostapd[1].list_sta())
+        else:
+            self.assertFalse(self.bss_hostapd[1].list_sta())
 
         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)
@@ -94,10 +75,9 @@ 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))
 
-        rule0.signal = -2000
-        rule1.signal = -8000
+        device.roam(self.bss_hostapd[0].bssid)
 
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition)
@@ -113,7 +93,52 @@ 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))
+
+    def test_ft_psk(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK')
+        self.bss_hostapd[0].set_value('ft_over_ds', '0')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK')
+        self.bss_hostapd[1].set_value('ft_over_ds', '0')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd)
+
+    def test_ft_psk_over_ds(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK')
+        self.bss_hostapd[0].set_value('ft_over_ds', '1')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK')
+        self.bss_hostapd[1].set_value('ft_over_ds', '1')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd, over_ds=True)
+
+    def test_reassociate_psk(self):
+        wd = IWD(True)
+
+        self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK')
+        self.bss_hostapd[0].set_value('ft_over_ds', '0')
+        self.bss_hostapd[0].reload()
+        self.bss_hostapd[0].wait_for_event("AP-ENABLED")
+
+        self.bss_hostapd[1].set_value('wpa_key_mgmt', 'WPA-PSK')
+        self.bss_hostapd[1].set_value('ft_over_ds', '0')
+        self.bss_hostapd[1].reload()
+        self.bss_hostapd[1].wait_for_event("AP-ENABLED")
+
+        self.validate_connection(wd)
 
     def tearDown(self):
         os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down')
@@ -121,18 +146,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):
-        hwsim = Hwsim()
+        IWD.copy_to_storage('TestFT.psk')
 
         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 +
@@ -159,7 +178,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)
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 16/18] auto-t: remove FT-over-DS test, and rename testFT-PSK-roam
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (14 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 15/18] auto-t: use connect_bssid/roam APIs in testFT-PSK-roam James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 17/18] auto-t: update testPreauth-roam to use connect_bssid/roam() James Prestwood
  2021-08-12 20:22 ` [PATCH 18/18] auto-t: use connect_bssid in APRoam James Prestwood
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 12999 bytes --]

---
 .../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%)

diff --git a/autotests/testFT-PSK-over-DS/connection_test.py b/autotests/testFT-PSK-over-DS/connection_test.py
deleted file mode 100644
index 7be5924f..00000000
--- a/autotests/testFT-PSK-over-DS/connection_test.py
+++ /dev/null
@@ -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)
diff --git a/autotests/testFT-PSK-over-DS/ft-psk-ccmp-1.conf b/autotests/testFT-PSK-over-DS/ft-psk-ccmp-1.conf
deleted file mode 100644
index e75aac74..00000000
--- a/autotests/testFT-PSK-over-DS/ft-psk-ccmp-1.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-hw_mode=g
-channel=1
-ssid=TestFT
-utf8_ssid=1
-ctrl_interface=/var/run/hostapd
-
-r1_key_holder=120000000001
-nas_identifier=dummy1
-
-wpa=2
-# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same
-# time but we want to force FT
-wpa_key_mgmt=FT-PSK
-wpa_pairwise=CCMP
-wpa_passphrase=EasilyGuessedPassword
-wpa_ptk_rekey=30
-wpa_group_rekey=80
-ieee80211w=1
-rsn_preauth=1
-rsn_preauth_interfaces=lo
-disable_pmksa_caching=0
-# Allow PMK cache to be shared opportunistically among configured interfaces
-# and BSSes (i.e., all configurations within a single hostapd process).
-okc=1
-mobility_domain=1234
-reassociation_deadline=60000
-r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f
-r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
-# Push mode only needed for 8021x, not PSK mode since msk already known
-pmk_r1_push=0
-# Allow locally generated FT response so we don't have to configure push/pull
-# between BSSes running as separate hostapd processes as in the test-runner
-# case.  Only works with FT-PSK, otherwise brctl needs to be installed and
-# CONFIG_BRIDGE enabled in the kernel.
-ft_psk_generate_local=1
-ft_over_ds=1
-ap_table_expiration_time=36000
-ap_table_max_size=10
-rrm_neighbor_report=1
diff --git a/autotests/testFT-PSK-over-DS/ft-psk-ccmp-2.conf b/autotests/testFT-PSK-over-DS/ft-psk-ccmp-2.conf
deleted file mode 100644
index e9ee6a70..00000000
--- a/autotests/testFT-PSK-over-DS/ft-psk-ccmp-2.conf
+++ /dev/null
@@ -1,41 +0,0 @@
-hw_mode=g
-channel=2
-ssid=TestFT
-utf8_ssid=1
-ctrl_interface=/var/run/hostapd
-
-r1_key_holder=120000000002
-nas_identifier=dummy2
-
-wpa=2
-# Can support WPA-PSK and FT-PSK (space separated list) and/or EAP at the same
-# time but we want to force FT
-wpa_key_mgmt=FT-PSK
-wpa_pairwise=CCMP
-wpa_passphrase=EasilyGuessedPassword
-wpa_ptk_rekey=30
-wpa_group_rekey=80
-ieee80211w=1
-rsn_preauth=1
-rsn_preauth_interfaces=lo
-disable_pmksa_caching=0
-# Allow PMK cache to be shared opportunistically among configured interfaces
-# and BSSes (i.e., all configurations within a single hostapd process).
-okc=1
-mobility_domain=1234
-reassociation_deadline=60000
-r0kh=12:00:00:00:00:01 dummy1 000102030405060708090a0b0c0d0e0f
-r0kh=12:00:00:00:00:02 dummy2 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:01 00:00:00:00:00:01 000102030405060708090a0b0c0d0e0f
-r1kh=12:00:00:00:00:02 00:00:00:00:00:02 000102030405060708090a0b0c0d0e0f
-# Push mode only needed for 8021x, not PSK mode since msk already known
-pmk_r1_push=0
-# Allow locally generated FT response so we don't have to configure push/pull
-# between BSSes running as separate hostapd processes as in the test-runner
-# case.  Only works with FT-PSK, otherwise brctl needs to be installed and
-# CONFIG_BRIDGE enabled in the kernel.
-ft_psk_generate_local=1
-ft_over_ds=1
-ap_table_expiration_time=36000
-ap_table_max_size=10
-rrm_neighbor_report=1
diff --git a/autotests/testFT-PSK-roam/hw.conf b/autotests/testFT-PSK-roam/hw.conf
deleted file mode 100644
index 3fc77613..00000000
--- a/autotests/testFT-PSK-roam/hw.conf
+++ /dev/null
@@ -1,7 +0,0 @@
-[SETUP]
-num_radios=3
-start_iwd=0
-
-[HOSTAPD]
-rad0=ft-psk-ccmp-1.conf
-rad1=ft-psk-ccmp-2.conf
diff --git a/autotests/testFT-PSK-roam/main.conf b/autotests/testFT-PSK-roam/main.conf
deleted file mode 100644
index 9452fb6b..00000000
--- a/autotests/testFT-PSK-roam/main.conf
+++ /dev/null
@@ -1,2 +0,0 @@
-[Scan]
-DisableMacAddressRandomization=true
diff --git a/autotests/testFT-PSK-roam/TestFT.psk b/autotests/testPSK-roam/TestFT.psk
similarity index 100%
rename from autotests/testFT-PSK-roam/TestFT.psk
rename to autotests/testPSK-roam/TestFT.psk
diff --git a/autotests/testFT-PSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py
similarity index 100%
rename from autotests/testFT-PSK-roam/connection_test.py
rename to autotests/testPSK-roam/connection_test.py
diff --git a/autotests/testFT-PSK-roam/ft-psk-ccmp-1.conf b/autotests/testPSK-roam/ft-psk-ccmp-1.conf
similarity index 100%
rename from autotests/testFT-PSK-roam/ft-psk-ccmp-1.conf
rename to autotests/testPSK-roam/ft-psk-ccmp-1.conf
diff --git a/autotests/testFT-PSK-roam/ft-psk-ccmp-2.conf b/autotests/testPSK-roam/ft-psk-ccmp-2.conf
similarity index 100%
rename from autotests/testFT-PSK-roam/ft-psk-ccmp-2.conf
rename to autotests/testPSK-roam/ft-psk-ccmp-2.conf
diff --git a/autotests/testFT-PSK-over-DS/hw.conf b/autotests/testPSK-roam/hw.conf
similarity index 100%
rename from autotests/testFT-PSK-over-DS/hw.conf
rename to autotests/testPSK-roam/hw.conf
diff --git a/autotests/testFT-PSK-over-DS/main.conf b/autotests/testPSK-roam/main.conf
similarity index 100%
rename from autotests/testFT-PSK-over-DS/main.conf
rename to autotests/testPSK-roam/main.conf
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 17/18] auto-t: update testPreauth-roam to use connect_bssid/roam()
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (15 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 16/18] auto-t: remove FT-over-DS test, and rename testFT-PSK-roam James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  2021-08-12 20:22 ` [PATCH 18/18] auto-t: use connect_bssid in APRoam James Prestwood
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 4746 bytes --]

---
 autotests/testPreauth-roam/connection_test.py | 53 ++++---------------
 1 file changed, 11 insertions(+), 42 deletions(-)

diff --git a/autotests/testPreauth-roam/connection_test.py b/autotests/testPreauth-roam/connection_test.py
index f31b8b0a..545d4cba 100644
--- a/autotests/testPreauth-roam/connection_test.py
+++ b/autotests/testPreauth-roam/connection_test.py
@@ -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()
 
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 18/18] auto-t: use connect_bssid in APRoam
  2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
                   ` (16 preceding siblings ...)
  2021-08-12 20:22 ` [PATCH 17/18] auto-t: update testPreauth-roam to use connect_bssid/roam() James Prestwood
@ 2021-08-12 20:22 ` James Prestwood
  17 siblings, 0 replies; 19+ messages in thread
From: James Prestwood @ 2021-08-12 20:22 UTC (permalink / raw)
  To: iwd

[-- Attachment #1: Type: text/plain, Size: 3982 bytes --]

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

diff --git a/autotests/testAPRoam/TestAPRoam.psk b/autotests/testAPRoam/TestAPRoam.psk
new file mode 100644
index 00000000..abafdb66
--- /dev/null
+++ b/autotests/testAPRoam/TestAPRoam.psk
@@ -0,0 +1,2 @@
+[Security]
+Passphrase=secret123
diff --git a/autotests/testAPRoam/connection_test.py b/autotests/testAPRoam/connection_test.py
index e1ca3e4b..c7037231 100644
--- a/autotests/testAPRoam/connection_test.py
+++ b/autotests/testAPRoam/connection_test.py
@@ -6,56 +6,22 @@ import sys
 sys.path.append('../util')
 import iwd
 from iwd import IWD
-from iwd import PSKAgent
 from iwd import NetworkType
 
 from hostapd import HostapdCLI
-from hwsim import Hwsim
 
 class Test(unittest.TestCase):
 
     def test_connection_success(self):
-        hwsim = Hwsim()
-
         bss_hostapd = [ HostapdCLI(config='ssid1.conf'),
                         HostapdCLI(config='ssid2.conf'),
                         HostapdCLI(config='ssid3.conf') ]
-        bss_radio =  [ hwsim.get_radio('rad0'),
-                       hwsim.get_radio('rad1'),
-                       hwsim.get_radio('rad2') ]
-
-        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
-
-        rule2 = hwsim.rules.create()
-        rule2.source = bss_radio[2].addresses[0]
-        rule2.bidirectional = True
-
-        rule0.signal = -6000
-        rule1.signal = -6900
-        rule2.signal = -8000
 
         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('TestAPRoam')
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
@@ -63,7 +29,7 @@ class Test(unittest.TestCase):
         condition = 'not obj.connected'
         wd.wait_for_object_condition(ordered_network.network_object, condition)
 
-        ordered_network.network_object.connect()
+        device.connect_bssid(bss_hostapd[0].bssid)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -74,8 +40,7 @@ class Test(unittest.TestCase):
         self.assertFalse(bss_hostapd[1].list_sta())
 
         bss_hostapd[0].send_bss_transition(device.address,
-                [(bss_radio[1].addresses[0], '8f0000005102060603000000'),
-                 (bss_radio[2].addresses[0], '8f0000005103060603000000')])
+                [(bss_hostapd[1].bssid, '8f0000005102060603000000')])
 
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition)
@@ -93,15 +58,9 @@ class Test(unittest.TestCase):
         condition = 'not obj.connected'
         wd.wait_for_object_condition(ordered_network.network_object, condition)
 
-        wd.unregister_psk_agent(psk_agent)
-
-        rule0.remove()
-        rule1.remove()
-        rule2.remove()
-
     @classmethod
     def setUpClass(cls):
-        pass
+        IWD.copy_to_storage('TestAPRoam.psk')
 
     @classmethod
     def tearDownClass(cls):
-- 
2.31.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2021-08-12 20:22 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-12 20:21 [PATCH 01/18] auto-t: hostapd.py: add 'bssid' property James Prestwood
2021-08-12 20:14 ` Denis Kenzior
2021-08-12 20:21 ` [PATCH 02/18] test-runner: start IWD in developer mode James Prestwood
2021-08-12 20:21 ` [PATCH 03/18] test-runner: don't fatally exit on bad test configuration James Prestwood
2021-08-12 20:21 ` [PATCH 04/18] test-runner: don't run duplicate tests James Prestwood
2021-08-12 20:21 ` [PATCH 05/18] auto-t: testutil.py: add expect_fail flag James Prestwood
2021-08-12 20:21 ` [PATCH 06/18] auto-t: iwd.py: add connect_bssid() method James Prestwood
2021-08-12 20:21 ` [PATCH 07/18] auto-t: iwd.py: add roam() method James Prestwood
2021-08-12 20:21 ` [PATCH 08/18] auto-t: add reassociate test to FT-SAE-roam James Prestwood
2021-08-12 20:21 ` [PATCH 09/18] auto-t: rename testFT-SAE-roam to testSAE-roam James Prestwood
2021-08-12 20:21 ` [PATCH 10/18] auto-t: add reassociation test for OWE James Prestwood
2021-08-12 20:22 ` [PATCH 11/18] auto-t: update testFT-8021x-roam to use roam() API James Prestwood
2021-08-12 20:22 ` [PATCH 12/18] auto-t: combine testFT-FILS* tests James Prestwood
2021-08-12 20:22 ` [PATCH 13/18] auto-t: rename testFT-FILS-SHA256 to testFT-FILS James Prestwood
2021-08-12 20:22 ` [PATCH 14/18] auto-t: remove testFT-FILS-SHA384 James Prestwood
2021-08-12 20:22 ` [PATCH 15/18] auto-t: use connect_bssid/roam APIs in testFT-PSK-roam James Prestwood
2021-08-12 20:22 ` [PATCH 16/18] auto-t: remove FT-over-DS test, and rename testFT-PSK-roam James Prestwood
2021-08-12 20:22 ` [PATCH 17/18] auto-t: update testPreauth-roam to use connect_bssid/roam() James Prestwood
2021-08-12 20:22 ` [PATCH 18/18] auto-t: use connect_bssid in APRoam James Prestwood

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.