mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-25 17:59:25 +01:00
auto-t: add DPP tests to check extra settings are applied
In order to test that extra settings are applied prior to connecting two tests were added for hidden networks as well as one testing if there is already an existing profile after DPP. The reason hidden networks were used was due to the requirement of the "Hidden" settings in the profile. If this setting doesn't get sync'ed to disk the connection will fail.
This commit is contained in:
parent
8f5109c439
commit
0f1d9685e7
2
autotests/testDPP/existingProfile.psk
Normal file
2
autotests/testDPP/existingProfile.psk
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=IncorrectPassphrase
|
@ -1,5 +1,5 @@
|
|||||||
[SETUP]
|
[SETUP]
|
||||||
num_radios=4
|
num_radios=5
|
||||||
start_iwd=0
|
start_iwd=0
|
||||||
hwsim_medium=yes
|
hwsim_medium=yes
|
||||||
|
|
||||||
@ -8,6 +8,7 @@ rad0=wpas.conf
|
|||||||
|
|
||||||
[HOSTAPD]
|
[HOSTAPD]
|
||||||
rad1=hostapd.conf
|
rad1=hostapd.conf
|
||||||
|
rad2=ssidHidden.conf
|
||||||
|
|
||||||
[NameSpaces]
|
[NameSpaces]
|
||||||
ns0=rad2
|
ns0=rad3
|
||||||
|
@ -26,11 +26,11 @@ class Test(unittest.TestCase):
|
|||||||
self.wpas.dpp_stop_listen()
|
self.wpas.dpp_stop_listen()
|
||||||
self.wpas.dpp_configurator_remove()
|
self.wpas.dpp_configurator_remove()
|
||||||
|
|
||||||
def start_iwd_pkex_configurator(self, device, agent=False):
|
def start_iwd_pkex_configurator(self, device, agent=False, profile='ssidCCMP.psk'):
|
||||||
self.hapd.reload()
|
self.hapd.reload()
|
||||||
self.hapd.wait_for_event('AP-ENABLED')
|
self.hapd.wait_for_event('AP-ENABLED')
|
||||||
|
|
||||||
IWD.copy_to_storage('ssidCCMP.psk')
|
IWD.copy_to_storage(profile)
|
||||||
device.autoconnect = True
|
device.autoconnect = True
|
||||||
|
|
||||||
condition = 'obj.state == DeviceState.connected'
|
condition = 'obj.state == DeviceState.connected'
|
||||||
@ -186,6 +186,71 @@ class Test(unittest.TestCase):
|
|||||||
|
|
||||||
self.agent = None
|
self.agent = None
|
||||||
|
|
||||||
|
def test_existing_network(self):
|
||||||
|
self.hapd.reload()
|
||||||
|
self.hapd.wait_for_event('AP-ENABLED')
|
||||||
|
IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidCCMP.psk")
|
||||||
|
|
||||||
|
# Scan first so a network object exists, and its a known network
|
||||||
|
self.device[1].scan()
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
|
||||||
|
|
||||||
|
self.start_iwd_pkex_configurator(self.device[0])
|
||||||
|
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
self.device[1].autoconnect = False
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
|
|
||||||
|
# Check additional settings were carried over
|
||||||
|
with open('/tmp/ns0/ssidCCMP.psk', 'r') as f:
|
||||||
|
settings = f.read()
|
||||||
|
|
||||||
|
self.assertIn("SendHostname=true", settings)
|
||||||
|
|
||||||
|
def test_existing_hidden_network(self):
|
||||||
|
self.hapd_hidden.reload()
|
||||||
|
self.hapd_hidden.wait_for_event('AP-ENABLED')
|
||||||
|
IWD.copy_to_storage("existingProfile.psk", "/tmp/ns0/", "ssidHidden.psk")
|
||||||
|
|
||||||
|
# Scan first so a network object exists, and its a known network
|
||||||
|
self.device[1].scan()
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == True')
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], 'obj.scanning == False')
|
||||||
|
|
||||||
|
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
|
||||||
|
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
self.device[1].autoconnect = False
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
|
|
||||||
|
# Check additional settings were carried over
|
||||||
|
with open('/tmp/ns0/ssidHidden.psk', 'r') as f:
|
||||||
|
settings = f.read()
|
||||||
|
|
||||||
|
self.assertIn("Hidden=true", settings)
|
||||||
|
|
||||||
|
def test_hidden_network(self):
|
||||||
|
self.hapd_hidden.reload()
|
||||||
|
self.hapd_hidden.wait_for_event('AP-ENABLED')
|
||||||
|
self.start_iwd_pkex_configurator(self.device[0], profile='ssidHidden.psk')
|
||||||
|
|
||||||
|
self.device[1].dpp_pkex_enroll('secret123', identifier="test")
|
||||||
|
self.device[1].autoconnect = False
|
||||||
|
|
||||||
|
condition = 'obj.state == DeviceState.connected'
|
||||||
|
self.wd.wait_for_object_condition(self.device[1], condition)
|
||||||
|
|
||||||
|
# Check additional settings were carried over
|
||||||
|
with open('/tmp/ns0/ssidHidden.psk', 'r') as f:
|
||||||
|
settings = f.read()
|
||||||
|
|
||||||
|
self.assertIn("Hidden=true", settings)
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
ns0 = ctx.get_namespace('ns0')
|
ns0 = ctx.get_namespace('ns0')
|
||||||
self.wpas = Wpas('wpas.conf')
|
self.wpas = Wpas('wpas.conf')
|
||||||
@ -197,6 +262,8 @@ class Test(unittest.TestCase):
|
|||||||
self.device.append(self.wd_ns0.list_devices(1)[0])
|
self.device.append(self.wd_ns0.list_devices(1)[0])
|
||||||
self.hapd = HostapdCLI('hostapd.conf')
|
self.hapd = HostapdCLI('hostapd.conf')
|
||||||
self.hapd.disable()
|
self.hapd.disable()
|
||||||
|
self.hapd_hidden = HostapdCLI('ssidHidden.conf')
|
||||||
|
self.hapd_hidden.disable()
|
||||||
self.hwsim = Hwsim()
|
self.hwsim = Hwsim()
|
||||||
|
|
||||||
self.rule_xchg_resp = self.hwsim.rules.create()
|
self.rule_xchg_resp = self.hwsim.rules.create()
|
||||||
@ -240,6 +307,7 @@ class Test(unittest.TestCase):
|
|||||||
self.hapd = None
|
self.hapd = None
|
||||||
self.rule_xchg_resp = None
|
self.rule_xchg_resp = None
|
||||||
IWD.clear_storage()
|
IWD.clear_storage()
|
||||||
|
IWD.clear_storage('/tmp/ns0')
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
|
9
autotests/testDPP/ssidHidden.conf
Normal file
9
autotests/testDPP/ssidHidden.conf
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=6
|
||||||
|
ssid=ssidHidden
|
||||||
|
|
||||||
|
wpa=1
|
||||||
|
wpa_pairwise=TKIP
|
||||||
|
wpa_passphrase=secret123
|
||||||
|
|
||||||
|
ignore_broadcast_ssid=1
|
5
autotests/testDPP/ssidHidden.psk
Normal file
5
autotests/testDPP/ssidHidden.psk
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[Security]
|
||||||
|
Passphrase=secret123
|
||||||
|
|
||||||
|
[Settings]
|
||||||
|
Hidden=true
|
Loading…
Reference in New Issue
Block a user