mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2025-02-16 15:20:42 +01:00
auto-t: add a few more DPP tests
This adds 3 more tests: - Channel switch during authentication - Scan after configuring - Retransmit auth frames
This commit is contained in:
parent
692d137a21
commit
7a3d4dabb1
@ -7,58 +7,105 @@ sys.path.append('../util')
|
|||||||
from iwd import IWD
|
from iwd import IWD
|
||||||
from wpas import Wpas
|
from wpas import Wpas
|
||||||
from hostapd import HostapdCLI
|
from hostapd import HostapdCLI
|
||||||
|
from hwsim import Hwsim
|
||||||
|
|
||||||
class Test(unittest.TestCase):
|
class Test(unittest.TestCase):
|
||||||
|
|
||||||
def test_iwd_as_enrollee(self):
|
def test_iwd_as_enrollee(self):
|
||||||
wpas = Wpas('wpas.conf')
|
self.device.autoconnect = True
|
||||||
|
self.hapd.reload()
|
||||||
|
|
||||||
wd = IWD(True)
|
uri = self.device.dpp_start_enrollee()
|
||||||
|
|
||||||
devices = wd.list_devices(1)
|
self.wpas.dpp_configurator_create(uri)
|
||||||
device = devices[0]
|
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
|
||||||
device.autoconnect = True
|
|
||||||
|
|
||||||
uri = device.dpp_start_enrollee()
|
|
||||||
|
|
||||||
wpas.dpp_configurator_create(uri)
|
|
||||||
wpas.dpp_configurator_start('ssidCCMP', 'secret123')
|
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
device.disconnect()
|
def test_iwd_as_enrollee_channel_switch(self):
|
||||||
device.dpp_stop()
|
self.device.autoconnect = True
|
||||||
|
self.hapd.reload()
|
||||||
|
|
||||||
del wpas
|
uri = self.device.dpp_start_enrollee()
|
||||||
|
|
||||||
|
self.wpas.dpp_configurator_create(uri)
|
||||||
|
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123', freq=2462)
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
|
def test_iwd_as_enrollee_scan_after(self):
|
||||||
|
uri = self.device.dpp_start_enrollee()
|
||||||
|
|
||||||
|
self.wpas.dpp_configurator_create(uri)
|
||||||
|
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
|
||||||
|
|
||||||
|
self.hapd.reload()
|
||||||
|
|
||||||
|
with self.assertRaises(Exception):
|
||||||
|
self.device.get_ordered_network('ssidCCMP', scan_if_needed=False)
|
||||||
|
|
||||||
|
self.hapd.wait_for_event('AP-ENABLED')
|
||||||
|
|
||||||
|
self.device.autoconnect = True
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
|
def test_iwd_as_enrollee_no_ack(self):
|
||||||
|
self.rule0.enabled = True
|
||||||
|
self.device.autoconnect = True
|
||||||
|
self.hapd.reload()
|
||||||
|
|
||||||
|
uri = self.device.dpp_start_enrollee()
|
||||||
|
|
||||||
|
self.wpas.dpp_configurator_create(uri)
|
||||||
|
self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
def test_iwd_as_configurator(self):
|
def test_iwd_as_configurator(self):
|
||||||
|
self.device.autoconnect = True
|
||||||
IWD.copy_to_storage('ssidCCMP.psk')
|
IWD.copy_to_storage('ssidCCMP.psk')
|
||||||
|
|
||||||
wpas = Wpas('wpas.conf')
|
self.hapd.reload()
|
||||||
hapd = HostapdCLI('hostapd.conf')
|
|
||||||
|
|
||||||
wd = IWD(True)
|
|
||||||
|
|
||||||
devices = wd.list_devices(1)
|
|
||||||
device = devices[0]
|
|
||||||
device.autoconnect = True
|
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
wd.wait_for_object_condition(device, condition)
|
self.wd.wait_for_object_condition(self.device, condition)
|
||||||
|
|
||||||
uri = device.dpp_start_configurator()
|
uri = self.device.dpp_start_configurator()
|
||||||
|
|
||||||
wpas.dpp_enrollee_start(uri)
|
self.wpas.dpp_enrollee_start(uri)
|
||||||
|
|
||||||
hapd.wait_for_event('AP-STA-CONNECTED 42:00:00:00:00:00')
|
self.hapd.wait_for_event('AP-STA-CONNECTED 42:00:00:00:00:00')
|
||||||
|
|
||||||
device.disconnect()
|
def setUp(self):
|
||||||
device.dpp_stop()
|
self.wd = IWD(True)
|
||||||
|
self.device = self.wd.list_devices(1)[0]
|
||||||
|
self.wpas = Wpas('wpas.conf')
|
||||||
|
self.hapd = HostapdCLI('hostapd.conf')
|
||||||
|
self.hapd.disable()
|
||||||
|
self.hwsim = Hwsim()
|
||||||
|
|
||||||
del wpas
|
self.rule0 = self.hwsim.rules.create()
|
||||||
|
self.rule0.prefix = 'd0'
|
||||||
|
self.rule0.match_offset = 24
|
||||||
|
self.rule0.match = '04 09 50 6f 9a 1a 01 01'
|
||||||
|
self.rule0.match_times = 1
|
||||||
|
self.rule0.drop = True
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
|
print("calling Disconnect()")
|
||||||
|
self.device.disconnect()
|
||||||
|
self.device.dpp_stop()
|
||||||
|
self.wpas.dpp_configurator_remove()
|
||||||
|
|
||||||
|
self.wd = None
|
||||||
|
self.device = None
|
||||||
|
self.wpas = None
|
||||||
|
self.hapd = None
|
||||||
|
self.rule0 = None
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
[SETUP]
|
[SETUP]
|
||||||
num_radios=3
|
num_radios=3
|
||||||
start_iwd=0
|
start_iwd=0
|
||||||
|
hwsim_medium=yes
|
||||||
|
|
||||||
[WPA_SUPPLICANT]
|
[WPA_SUPPLICANT]
|
||||||
rad0=wpas.conf
|
rad0=wpas.conf
|
||||||
|
Loading…
x
Reference in New Issue
Block a user