mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-22 04:32:37 +01:00
auto-t: fix testBSSBlacklist
There were a number of fixes here. The waits were changed to wait on the device state instead of the network state and hwsim rules were removed after the test as to not interfere with future tests. One of the rules was setting the signal to -10000 wich was causing the ranking to be zero.
This commit is contained in:
parent
b9cb6134d6
commit
7b933db78a
@ -37,7 +37,7 @@ class Test(unittest.TestCase):
|
||||
rule2 = hwsim.rules.create()
|
||||
rule2.source = bss_radio[2].addresses[0]
|
||||
rule2.bidirectional = True
|
||||
rule2.signal = -10000
|
||||
rule2.signal = -9000
|
||||
|
||||
wd = IWD(True)
|
||||
|
||||
@ -72,17 +72,22 @@ class Test(unittest.TestCase):
|
||||
|
||||
rule0.drop = False
|
||||
rule1.drop = False
|
||||
rule2.drop = False
|
||||
|
||||
# This connect should work
|
||||
ordered_network.network_object.connect()
|
||||
|
||||
condition = 'obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(device, condition)
|
||||
|
||||
self.assertIn(device.address, bss_hostapd[0].list_sta())
|
||||
|
||||
wd.unregister_psk_agent(psk_agent)
|
||||
|
||||
rule0.remove()
|
||||
rule1.remove()
|
||||
rule2.remove()
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
pass
|
||||
|
@ -39,7 +39,7 @@ class Test(unittest.TestCase):
|
||||
rule2.bidirectional = True
|
||||
rule2.signal = -4000
|
||||
|
||||
wd = IWD(True, '/tmp')
|
||||
wd = IWD(True)
|
||||
|
||||
psk_agent = PSKAgent("wrong_password")
|
||||
wd.register_psk_agent(psk_agent)
|
||||
@ -80,6 +80,12 @@ class Test(unittest.TestCase):
|
||||
condition = '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
|
||||
|
@ -10,7 +10,6 @@ from iwd import PSKAgent
|
||||
from iwd import NetworkType
|
||||
|
||||
from hostapd import HostapdCLI
|
||||
|
||||
from hwsim import Hwsim
|
||||
|
||||
import time
|
||||
@ -42,7 +41,7 @@ class Test(unittest.TestCase):
|
||||
rule2.bidirectional = True
|
||||
rule2.signal = -4000
|
||||
|
||||
wd = IWD(True, '/tmp')
|
||||
wd = IWD(True)
|
||||
|
||||
psk_agent = PSKAgent("secret123")
|
||||
wd.register_psk_agent(psk_agent)
|
||||
@ -67,6 +66,8 @@ class Test(unittest.TestCase):
|
||||
condition = 'not obj.connected'
|
||||
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||
|
||||
rule0.drop = True
|
||||
|
||||
ordered_network.network_object.connect(wait=False)
|
||||
|
||||
# Have AP1 drop all packets, should result in a connection timeout
|
||||
@ -140,6 +141,10 @@ class Test(unittest.TestCase):
|
||||
|
||||
wd.unregister_psk_agent(psk_agent)
|
||||
|
||||
rule0.remove()
|
||||
rule1.remove()
|
||||
rule2.remove()
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
IWD.copy_to_storage('main.conf')
|
||||
|
@ -39,7 +39,7 @@ class Test(unittest.TestCase):
|
||||
rule2.bidirectional = True
|
||||
rule2.signal = -2000
|
||||
|
||||
wd = IWD(True, '/tmp')
|
||||
wd = IWD(True)
|
||||
|
||||
psk_agent = PSKAgent("secret123")
|
||||
wd.register_psk_agent(psk_agent)
|
||||
@ -63,6 +63,9 @@ class Test(unittest.TestCase):
|
||||
|
||||
ordered_network.network_object.connect()
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(dev1, condition)
|
||||
|
||||
self.assertIn(dev1.address, bss_hostapd[2].list_sta())
|
||||
|
||||
# dev1 now connected, this should max out the first AP, causing the next
|
||||
@ -85,6 +88,9 @@ class Test(unittest.TestCase):
|
||||
|
||||
ordered_network.network_object.connect()
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(dev2, condition)
|
||||
|
||||
# We should have temporarily blacklisted the first BSS, and connected
|
||||
# to this one.
|
||||
self.assertIn(dev2.address, bss_hostapd[1].list_sta())
|
||||
@ -111,10 +117,17 @@ class Test(unittest.TestCase):
|
||||
|
||||
ordered_network.network_object.connect()
|
||||
|
||||
condition = 'obj.state == DeviceState.connected'
|
||||
wd.wait_for_object_condition(dev2, condition)
|
||||
|
||||
self.assertIn(dev2.address, bss_hostapd[2].list_sta())
|
||||
|
||||
wd.unregister_psk_agent(psk_agent)
|
||||
|
||||
rule0.remove()
|
||||
rule1.remove()
|
||||
rule2.remove()
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
IWD.copy_to_storage('main.conf')
|
||||
|
Loading…
Reference in New Issue
Block a user