From d3cf79ed122c901d26471e03750371466c7351e9 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Wed, 23 Aug 2017 18:18:50 +0200 Subject: [PATCH] autotests: Restore AP beacons after timeout in testFT-PSK-roam In the beacon loss test try to simulate a periodic communication problem because we don't support roaming if the AP goes away completely. 2 seconds seems to be enough to consistently trigger the beacon_loss event without triggering a disconnect by the linux kernel or hiding the AP from the roam scan. Also set the RSSI for that AP lower so that it is not reselected by iwd. --- autotests/testFT-PSK-roam/test.py | 19 +++++++++++++++---- autotests/util/hwsim.py | 11 ++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/autotests/testFT-PSK-roam/test.py b/autotests/testFT-PSK-roam/test.py index 1c7d79e0..60e1594d 100644 --- a/autotests/testFT-PSK-roam/test.py +++ b/autotests/testFT-PSK-roam/test.py @@ -76,7 +76,12 @@ class Test(unittest.TestCase): 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 + # 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' @@ -157,11 +162,15 @@ class Test(unittest.TestCase): 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 - os.system('ifconfig "' + self.bss_hostapd[0].ifname + '" down') + # Check that iwd starts transition to BSS 1 in less than 20 seconds + # from a beacon loss event + rule0.drop = True + rule0.signal = -3000 + wd.wait(2) + rule0.drop = False condition = 'obj.state == DeviceState.roaming' - wd.wait_for_object_condition(device, condition, 10) + wd.wait_for_object_condition(device, condition, 20) # Check that iwd is on BSS 1 once out of roaming state and doesn't # go through 'disconnected', 'autoconnect', 'connecting' in between @@ -177,6 +186,8 @@ class Test(unittest.TestCase): (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') diff --git a/autotests/util/hwsim.py b/autotests/util/hwsim.py index de861a6e..f2ea8a68 100755 --- a/autotests/util/hwsim.py +++ b/autotests/util/hwsim.py @@ -103,6 +103,14 @@ class Rule(HwsimDBusAbstract): self._prop_proxy.Set(self._iface_name, 'SignalStrength', dbus.Int16(value)) + @property + def drop(self): + return bool(self._properties['Drop']) + + @drop.setter + def drop(self, value): + self._prop_proxy.Set(self._iface_name, 'Drop', dbus.Boolean(value)) + def remove(self): self._iface.Remove(reply_handler=self._success, error_handler=self._failure) @@ -117,7 +125,8 @@ class Rule(HwsimDBusAbstract): str(self.bidirectional) + '\n' + \ prefix + '\tPriority:\t' + str(self.priority) + '\n' +\ prefix + '\tFrequency:\t' + str(self.frequency) + '\n' + \ - prefix + '\tApply rssi:\t' + str(self.signal) + '\n' + prefix + '\tApply rssi:\t' + str(self.signal) + '\n' + \ + prefix + '\tApply drop:\t' + str(self.drop) + '\n' class RuleSet(collections.Mapping): def __init__(self, hwsim, objects):