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.
This commit is contained in:
Andrew Zaborowski 2017-08-23 18:18:50 +02:00 committed by Denis Kenzior
parent b66d55c52c
commit d3cf79ed12
2 changed files with 25 additions and 5 deletions

View File

@ -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')

View File

@ -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):