mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-11-26 02:19:26 +01:00
auto-t: interoperability of IWD/AP with MFP options
This patch combines the work done by Rahul to test the interoperability of permutations of MFP options in IWD/AP into a single autotest.
This commit is contained in:
parent
4471e7805c
commit
46717cae08
2
autotests/testMFP-Options/IWD-MFP0/iwd.conf
Normal file
2
autotests/testMFP-Options/IWD-MFP0/iwd.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
ManagementFrameProtection=0
|
2
autotests/testMFP-Options/IWD-MFP1/iwd.conf
Normal file
2
autotests/testMFP-Options/IWD-MFP1/iwd.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
ManagementFrameProtection=1
|
2
autotests/testMFP-Options/IWD-MFP2/iwd.conf
Normal file
2
autotests/testMFP-Options/IWD-MFP2/iwd.conf
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
[General]
|
||||||
|
ManagementFrameProtection=2
|
109
autotests/testMFP-Options/connection_test.py
Normal file
109
autotests/testMFP-Options/connection_test.py
Normal file
@ -0,0 +1,109 @@
|
|||||||
|
#!/usr/bin/python3
|
||||||
|
|
||||||
|
import unittest
|
||||||
|
import sys
|
||||||
|
|
||||||
|
sys.path.append('../util')
|
||||||
|
import iwd
|
||||||
|
from iwd import IWD
|
||||||
|
from iwd import PSKAgent
|
||||||
|
from iwd import NetworkType
|
||||||
|
|
||||||
|
class TestMFP(unittest.TestCase):
|
||||||
|
'''
|
||||||
|
The bellow test cases excesise the following MFP option setting scenarios:
|
||||||
|
|
||||||
|
IWD_MFP: AP_MFP: Result:
|
||||||
|
0 0 No MFP, connection succeeds
|
||||||
|
0 1 No MFP, connection succeeds
|
||||||
|
0 2 Not capable error
|
||||||
|
1 0 No MFP, connection succeeds
|
||||||
|
1 1 MFP enabled, connection succeeds
|
||||||
|
1 2 MFP enabled, connection succeeds
|
||||||
|
2 0 Not capable error
|
||||||
|
2 1 MFP enabled, connection succeeds
|
||||||
|
2 2 MFP enabled, connection succeeds
|
||||||
|
|
||||||
|
where:
|
||||||
|
0 - MFP is disabled
|
||||||
|
1 - MFP is optional
|
||||||
|
2 - MFP is required
|
||||||
|
'''
|
||||||
|
|
||||||
|
def check_mfp_connection(self, wd, device, ssid, throws_exception):
|
||||||
|
ordered_networks = device.get_ordered_networks()
|
||||||
|
ordered_network = None
|
||||||
|
|
||||||
|
for o_n in ordered_networks:
|
||||||
|
if o_n.name == ssid:
|
||||||
|
ordered_network = o_n
|
||||||
|
break
|
||||||
|
|
||||||
|
self.assertEqual(ordered_network.name, ssid)
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
if throws_exception:
|
||||||
|
with self.assertRaises(iwd.NotSupportedEx):
|
||||||
|
ordered_network.network_object.connect()
|
||||||
|
return
|
||||||
|
else:
|
||||||
|
ordered_network.network_object.connect()
|
||||||
|
|
||||||
|
condition = 'obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
device.disconnect()
|
||||||
|
|
||||||
|
condition = 'not obj.connected'
|
||||||
|
wd.wait_for_object_condition(ordered_network.network_object, condition)
|
||||||
|
|
||||||
|
def stage_iwd(self, config_dir):
|
||||||
|
|
||||||
|
wd = IWD(True, config_dir)
|
||||||
|
|
||||||
|
psk_agent = PSKAgent("secret123")
|
||||||
|
wd.register_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
devices = wd.list_devices();
|
||||||
|
self.assertIsNotNone(devices)
|
||||||
|
device = devices[0]
|
||||||
|
|
||||||
|
condition = 'not obj.scanning'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
device.scan()
|
||||||
|
|
||||||
|
condition = 'not obj.scanning'
|
||||||
|
wd.wait_for_object_condition(device, condition)
|
||||||
|
|
||||||
|
if config_dir == '/tmp/IWD-MFP2':
|
||||||
|
self.check_mfp_connection(wd, device, 'ssidMFP0', True)
|
||||||
|
else:
|
||||||
|
self.check_mfp_connection(wd, device, 'ssidMFP0', False)
|
||||||
|
|
||||||
|
self.check_mfp_connection(wd, device, 'ssidMFP1', False)
|
||||||
|
|
||||||
|
if config_dir == '/tmp/IWD-MFP0':
|
||||||
|
self.check_mfp_connection(wd, device, 'ssidMFP2', True)
|
||||||
|
else:
|
||||||
|
self.check_mfp_connection(wd, device, 'ssidMFP2', False)
|
||||||
|
|
||||||
|
wd.unregister_psk_agent(psk_agent)
|
||||||
|
|
||||||
|
del wd
|
||||||
|
|
||||||
|
IWD.clear_storage()
|
||||||
|
|
||||||
|
def test_iwd_mfp0(self):
|
||||||
|
self.stage_iwd('/tmp/IWD-MFP0')
|
||||||
|
|
||||||
|
def test_iwd_mfp1(self):
|
||||||
|
self.stage_iwd('/tmp/IWD-MFP1')
|
||||||
|
|
||||||
|
def test_iwd_mfp2(self):
|
||||||
|
self.stage_iwd('/tmp/IWD-MFP2')
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
unittest.main(exit=True)
|
10
autotests/testMFP-Options/hw.conf
Normal file
10
autotests/testMFP-Options/hw.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
[SETUP]
|
||||||
|
num_radios=4
|
||||||
|
start_iwd=0
|
||||||
|
max_test_exec_interval_sec=50
|
||||||
|
tmpfs_extra_stuff=IWD-MFP0:IWD-MFP1:IWD-MFP2
|
||||||
|
|
||||||
|
[HOSTAPD]
|
||||||
|
rad0=ssidMFP0.conf
|
||||||
|
rad1=ssidMFP1.conf
|
||||||
|
rad2=ssidMFP2.conf
|
10
autotests/testMFP-Options/ssidMFP0.conf
Normal file
10
autotests/testMFP-Options/ssidMFP0.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidMFP0
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
wpa_passphrase=secret123
|
||||||
|
|
||||||
|
ieee80211w=0
|
||||||
|
wpa_key_mgmt=WPA-PSK-SHA256
|
10
autotests/testMFP-Options/ssidMFP1.conf
Normal file
10
autotests/testMFP-Options/ssidMFP1.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidMFP1
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
wpa_passphrase=secret123
|
||||||
|
|
||||||
|
ieee80211w=1
|
||||||
|
wpa_key_mgmt=WPA-PSK-SHA256
|
10
autotests/testMFP-Options/ssidMFP2.conf
Normal file
10
autotests/testMFP-Options/ssidMFP2.conf
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
hw_mode=g
|
||||||
|
channel=1
|
||||||
|
ssid=ssidMFP2
|
||||||
|
|
||||||
|
wpa=2
|
||||||
|
wpa_pairwise=CCMP
|
||||||
|
wpa_passphrase=secret123
|
||||||
|
|
||||||
|
ieee80211w=2
|
||||||
|
wpa_key_mgmt=WPA-PSK-SHA256
|
Loading…
Reference in New Issue
Block a user