Skip to contentSkip to conversation

station: Add RoamScanning property to debug interface

PATCH New James Prestwood 1 participant 3 messages Aug 13, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/3 station: Add RoamScanning property to debug interface

This lets the test environment know if IWD is attempting a roam prior to the roaming state being set.

---
 src/station.c | 35 ++++++++++++++++++++++++++++++++++-
 1 file changed, 34 insertions(+), 1 deletion(-)
src/station.c +34 -1
index 408ae887..a1885cfa 100644
@@ -114,6 +114,7 @@ struct station {
 	bool ap_directed_roaming : 1;
 	bool scanning : 1;
 	bool autoconnect : 1;
+	bool roam_scanning : 1;
 };
 
 struct anqp_entry {
@@ -1842,8 +1843,15 @@ static void station_roam_scan_triggered(int err, void *user_data)
 
 	/*
 	 * Do not update the Scanning property as we won't be updating the
-	 * list of networks.
+	 * list of networks. But if in developer mode update the RoamScanning
+	 * property for autotesting.
 	 */
+	station->roam_scanning = true;
+
+	if (iwd_is_developer_mode())
+		l_dbus_property_changed(dbus_get_bus(),
+				netdev_get_path(station->netdev),
+				IWD_STATION_DEBUG_INTERFACE, "RoamScanning");
 }
 
 static bool station_roam_scan_notify(int err, struct l_queue *bss_list,
@@ -1968,6 +1976,12 @@ static void station_roam_scan_destroy(void *userdata)
 	struct station *station = userdata;
 
 	station->roam_scan_id = 0;
+	station->roam_scanning = false;
+
+	if (iwd_is_developer_mode())
+		l_dbus_property_changed(dbus_get_bus(),
+				netdev_get_path(station->netdev),
+				IWD_STATION_DEBUG_INTERFACE, "RoamScanning");
 }
 
 static int station_roam_scan(struct station *station,
@@ -3978,6 +3992,22 @@ static struct l_dbus_message *station_property_set_autoconnect(
 	return l_dbus_message_new_method_return(message);
 }
 
+static bool station_property_get_roam_scanning(struct l_dbus *dbus,
+					struct l_dbus_message *message,
+					struct l_dbus_message_builder *builder,
+					void *user_data)
+{
+	struct station *station = user_data;
+	bool scanning;
+
+	scanning = station->roam_scanning;
+
+	l_dbus_message_builder_append_basic(builder, 'b', &scanning);
+
+	return true;
+}
+
+
 static void station_setup_debug_interface(
 					struct l_dbus_interface *interface)
 {
@@ -3994,6 +4024,9 @@ static void station_setup_debug_interface(
 	l_dbus_interface_property(interface, "AutoConnect", 0, "b",
 					station_property_get_autoconnect,
 					station_property_set_autoconnect);
+	l_dbus_interface_property(interface, "RoamScanning", 0, "b",
+					station_property_get_roam_scanning,
+					NULL);
 }
 
 static void ap_roam_frame_event(const struct mmpdu_header *hdr,
Signature · 1 line
2.31.1
#1 lore raw

PATCH 2/3 auto-t: iwd.py: add roam_scanning property

---
 autotests/util/iwd.py | 11 +++++++++++
 1 file changed, 11 insertions(+)
autotests/util/iwd.py +11 -0
index cee1b99d..18840cd6 100755
@@ -242,6 +242,10 @@ class StationDebug(IWDDBusAbstract):
     def autoconnect(self):
         return self._properties['AutoConnect']
 
+    @property
+    def roam_scanning(self):
+        return self._properties['RoamScanning']
+
     def scan(self, frequencies):
         frequencies = dbus.Array([dbus.UInt16(f) for f in frequencies])
         self._iface.Scan(frequencies)
@@ -389,6 +393,13 @@ class Device(IWDDBusAbstract):
         self._station_debug._prop_proxy.Set(IWD_STATION_DEBUG_INTERFACE,
                                             'AutoConnect', value)
 
+    @property
+    def roam_scanning(self):
+        if not self._station_debug:
+            self._station_debug = StationDebug(self._object_path)
+
+        return self._station_debug.roam_scanning
+
     def scan(self):
         '''Schedule a network scan.
 
Signature · 1 line
2.31.1
#2 lore raw

PATCH 3/3 auto-t: speed up testRoamRetry

In reply to James Prestwood

This test took quite a while to execute (~2 minutes on my machine) because there was simply no other way to test this scenario but waiting. Now RoamScanning is a property so that can be used to avoid sleeping. Additionally the default RoamRetryInterval was being used which is 60 seconds. Instead main.conf can set this to 5 seconds and really cut down on the time to wait.

Part of a comment was also removed due to being incorrect. Even with neighbor reports IWD still must scan, its just that the scan is more limited and, in theory, faster.

---
 autotests/testRoamRetry/fast_retry_test.py | 15 ++++++++++++---
 autotests/testRoamRetry/main.conf          |  2 ++
 autotests/testRoamRetry/stop_retry_test.py |  2 +-
 3 files changed, 15 insertions(+), 4 deletions(-)
 create mode 100644 autotests/testRoamRetry/main.conf
autotests/testRoamRetry/fast_retry_test.py +12 -3
index d6324c31..fccd42bb 100644
@@ -82,7 +82,11 @@ class Test(unittest.TestCase):
         # schedule another attempt for 60 seconds later
         rule0.signal = -8000
 
-        wd.wait(20)
+        condition = 'obj.roam_scanning == True'
+        wd.wait_for_object_condition(device, condition)
+
+        condition = 'obj.roam_scanning == False'
+        wd.wait_for_object_condition(device, condition)
 
         self.assertEqual(device.state, iwd.DeviceState.connected)
         self.assertTrue(bss_hostapd[0].list_sta())
@@ -99,11 +103,16 @@ class Test(unittest.TestCase):
         wd.wait(1)
 
         # Assert low signal for BSS 0, check that iwd starts transition to BSS 1
-        # in less than 10 seconds. Because of the neighbor report a scan should
-        # not be necessary.
+        # in less than 10 seconds.
         rule0.signal = -8000
         rule1.signal = -2000
 
+        condition = 'obj.roam_scanning == True'
+        wd.wait_for_object_condition(device, condition)
+
+        condition = 'obj.roam_scanning == False'
+        wd.wait_for_object_condition(device, condition)
+
         condition = 'obj.state == DeviceState.roaming'
         wd.wait_for_object_condition(device, condition, max_wait=10)
 
autotests/testRoamRetry/main.conf new file +2 -0
new file mode 100644
index 00000000..f0d1c0f4
@@ -0,0 +1,2 @@
+[General]
+RoamRetryInterval=5
autotests/testRoamRetry/stop_retry_test.py +1 -1
index be9776a5..3bf166d8 100644
@@ -99,7 +99,7 @@ class Test(unittest.TestCase):
 
         condition = 'obj.state == DeviceState.roaming'
         self.assertRaises(TimeoutError, wd.wait_for_object_condition, device,
-                          condition, max_wait=70)
+                          condition, max_wait=10)
 
         device.disconnect()
 
Signature · 1 line
2.31.1