3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-12-23 14:22:36 +01:00

auto-t: Update tests to use hostapd.default()

This commit is contained in:
James Prestwood 2023-08-29 07:39:55 -07:00 committed by Denis Kenzior
parent df4d0eef5c
commit 927e27b8b5
21 changed files with 46 additions and 119 deletions

View File

@ -47,11 +47,6 @@ class Test(unittest.TestCase):
# Normal success case
def test_owe_transition(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_owe2.disable()
self.hapd_open2.disable()
@ -59,15 +54,8 @@ class Test(unittest.TestCase):
# Normal success case
def test_owe_transition_multi_network(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_open2.set_value('vendor_elements', 'dd17506f9a1c02000000f1000c6f77652d68696464656e2d32')
self.hapd_open2.set_value('ssid', 'transition-2')
self.hapd_open2.reload()
self.hapd_owe2.set_value('vendor_elements', 'dd17506f9a1c02000000f0000c7472616e736974696f6e2d32')
self.hapd_owe2.set_value('ssid', 'owe-hidden-2')
self.hapd_owe2.reload()
@ -75,11 +63,6 @@ class Test(unittest.TestCase):
# Two pairs of open/OWE BSS's (OWE BSS's have different SSIDs) */
def test_owe_transition_multi_bss(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_open2.set_value('vendor_elements', 'dd17506f9a1c02000000f3000c6f77652d68696464656e2d32')
self.hapd_open2.set_value('ssid', 'transition')
self.hapd_open2.reload()
@ -91,11 +74,6 @@ class Test(unittest.TestCase):
# Two pairs of open/OWE BSS's (OWE BSS's have same SSID) */
def test_owe_transition_multi_bss_same_ssid(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_open2.set_value('vendor_elements', 'dd15506f9a1c02000000f3000a6f77652d68696464656e')
self.hapd_open2.set_value('ssid', 'transition')
self.hapd_open2.reload()
@ -107,11 +85,6 @@ class Test(unittest.TestCase):
# Normal success autoconnect case
def test_owe_transition_autoconnect(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_owe2.disable()
self.hapd_open2.disable()
@ -124,8 +97,6 @@ class Test(unittest.TestCase):
def test_owe_transition_invalid_open_bssid(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000ff000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_owe2.disable()
self.hapd_open2.disable()
@ -135,8 +106,6 @@ class Test(unittest.TestCase):
# OWE BSS has invalid BSSID in OWE transition element
# Expected connection to Open BSS
def test_owe_transition_invalid_owe_bssid(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000ff000a7472616e736974696f6e')
self.hapd_owe.reload()
@ -148,8 +117,6 @@ class Test(unittest.TestCase):
# No OWE hidden network exists
# Expected connection to Open BSS
def test_owe_transition_no_hidden_found(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.disable()
self.hapd_owe2.disable()
@ -160,11 +127,6 @@ class Test(unittest.TestCase):
# Directly connect to valid OWE hidden network
# Expected connection failure
def test_owe_transition_connect_hidden_valid(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_owe2.disable()
self.hapd_open2.disable()
@ -189,7 +151,6 @@ class Test(unittest.TestCase):
def test_owe_transition_band_info(self):
self.hapd_open.set_value('vendor_elements', 'dd17506f9a1c02000000f1000a6f77652d68696464656e5103')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.set_value('channel', '3')
self.hapd_owe.reload()
@ -201,7 +162,6 @@ class Test(unittest.TestCase):
def test_owe_transition_wrong_band_info(self):
self.hapd_open.set_value('vendor_elements', 'dd17506f9a1c02000000f1000a6f77652d68696464656e5102')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.set_value('channel', '3')
self.hapd_owe.reload()
@ -212,11 +172,6 @@ class Test(unittest.TestCase):
# OWE Transition pair + additional open network with the same SSID
def test_owe_transition_extra_open(self):
self.hapd_open.set_value('vendor_elements', 'dd15506f9a1c02000000f1000a6f77652d68696464656e')
self.hapd_open.reload()
self.hapd_owe.set_value('vendor_elements', 'dd15506f9a1c02000000f0000a7472616e736974696f6e')
self.hapd_owe.reload()
self.hapd_open2.set_value('ssid', 'transition')
self.hapd_open2.reload()
@ -235,17 +190,19 @@ class Test(unittest.TestCase):
def setUp(self):
self.wd = IWD(True)
self.hapd_owe = HostapdCLI(config='ssidOWE.conf')
self.hapd_owe.default()
self.hapd_open = HostapdCLI(config='ssidOpen.conf')
self.hapd_open.default()
self.hapd_owe2 = HostapdCLI(config='ssidOWE-2.conf')
self.hapd_owe2.default()
self.hapd_open2 = HostapdCLI(config='ssidOpen-2.conf')
self.hapd_open2.default()
self.hwsim = Hwsim()
def tearDown(self):
IWD.clear_storage()
self.hapd_owe.set_value('channel', '1')
self.wd = None
self.hapd_open = None
self.hapd_owe = None

View File

@ -7,3 +7,5 @@ ieee80211w=1
wpa=2
wpa_key_mgmt=OWE
rsn_pairwise=CCMP
vendor_elements=dd17506f9a1c02000000f0000c7472616e736974696f6e2d32

View File

@ -7,6 +7,7 @@ ieee80211w=1
wpa=2
wpa_key_mgmt=OWE
rsn_pairwise=CCMP
vendor_elements=dd15506f9a1c02000000f0000a7472616e736974696f6e
# You would conventionally use these options but hostapd does not include an
# IE for the OWE network, hence vendor_elements must be used directly

View File

@ -1,3 +1,4 @@
channel=1
ssid=transition-2
bssid=02:00:00:00:f2:00
vendor_elements=dd17506f9a1c02000000f1000c6f77652d68696464656e2d32

View File

@ -1,6 +1,7 @@
channel=1
ssid=transition
bssid=02:00:00:00:f0:00
vendor_elements=dd15506f9a1c02000000f1000a6f77652d68696464656e
# You would conventionally use these options but hostapd does not include an
# IE for the OWE network, hence vendor_elements must be used directly

View File

@ -93,32 +93,16 @@ class Test(unittest.TestCase):
def test_ft_psk(self):
wd = IWD(True)
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[0].set_value('ft_over_ds', '0')
self.bss_hostapd[0].set_value('ocv', '1')
self.bss_hostapd[0].reload()
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[1].set_value('ft_over_ds', '0')
self.bss_hostapd[0].set_value('ocv', '1')
self.bss_hostapd[1].reload()
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
self.validate_connection(wd)
def test_ft_psk_over_ds(self):
wd = IWD(True)
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[0].set_value('ft_over_ds', '1')
self.bss_hostapd[0].set_value('ocv', '1')
self.bss_hostapd[0].reload()
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[1].set_value('ft_over_ds', '1')
self.bss_hostapd[1].set_value('ocv', '1')
self.bss_hostapd[1].reload()
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
@ -128,12 +112,10 @@ class Test(unittest.TestCase):
wd = IWD(True)
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'WPA-PSK')
self.bss_hostapd[0].set_value('ft_over_ds', '0')
self.bss_hostapd[0].reload()
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'WPA-PSK')
self.bss_hostapd[1].set_value('ft_over_ds', '0')
self.bss_hostapd[1].reload()
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
@ -142,18 +124,6 @@ class Test(unittest.TestCase):
def test_roam_packet_loss(self):
wd = IWD(True)
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[0].set_value('ft_over_ds', '0')
self.bss_hostapd[0].set_value('ocv', '1')
self.bss_hostapd[0].reload()
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[1].set_value('ft_over_ds', '0')
self.bss_hostapd[0].set_value('ocv', '1')
self.bss_hostapd[1].reload()
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
self.validate_connection(wd, pkt_loss=True)
def tearDown(self):
@ -166,6 +136,9 @@ class Test(unittest.TestCase):
self.rule1.enabled = False
self.rule2.enabled = False
for hapd in self.bss_hostapd:
hapd.default()
@classmethod
def setUpClass(cls):
hwsim = Hwsim()

View File

@ -44,16 +44,6 @@ class Test(unittest.TestCase):
# FT-over-Air failure, should stay connected
def test_ft_over_air_failure(self):
self.bss_hostapd[0].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[0].set_value('ft_over_ds', '0')
self.bss_hostapd[0].reload()
self.bss_hostapd[0].wait_for_event("AP-ENABLED")
self.bss_hostapd[1].set_value('wpa_key_mgmt', 'FT-PSK')
self.bss_hostapd[1].set_value('ft_over_ds', '0')
self.bss_hostapd[1].reload()
self.bss_hostapd[1].wait_for_event("AP-ENABLED")
wd = IWD(True)
device = wd.list_devices(1)[0]
@ -86,6 +76,9 @@ class Test(unittest.TestCase):
self.rule1.enabled = False
self.rule2.enabled = False
for hapd in self.bss_hostapd:
hapd.default()
@classmethod
def setUpClass(cls):
hwsim = Hwsim()

View File

@ -37,3 +37,4 @@ ft_over_ds=0
ap_table_expiration_time=36000
ap_table_max_size=10
rrm_neighbor_report=1
ocv=1

View File

@ -37,3 +37,4 @@ ft_over_ds=0
ap_table_expiration_time=36000
ap_table_max_size=10
rrm_neighbor_report=1
ocv=1

View File

@ -37,3 +37,4 @@ ft_over_ds=0
ap_table_expiration_time=36000
ap_table_max_size=10
rrm_neighbor_report=1
ocv=1

View File

@ -55,14 +55,13 @@ class Test(unittest.TestCase):
wd.clear_storage()
def test_SAE(self):
self.hostapd.set_value('sae_pwe', '0');
self.hostapd.set_value('sae_groups', '19');
self.hostapd.reload()
self.hostapd.wait_for_event("AP-ENABLED")
wd = IWD(True)
self.validate_connection(wd)
wd.clear_storage()
def setUp(self):
self.hostapd.default()
@classmethod
def setUpClass(cls):
cls.hostapd = HostapdCLI(config='ssidSAE-Clogging.conf')

View File

@ -8,3 +8,5 @@ wpa_pairwise=CCMP
sae_password=secret123|mac=ff:ff:ff:ff:ff:ff
sae_anti_clogging_threshold=2
ieee80211w=2
sae_pwe=0
sae_groups=19

View File

@ -35,9 +35,6 @@ class Test(unittest.TestCase):
wd.wait_for_object_condition(ordered_network.network_object, condition)
def test_SAE(self):
self.hostapd.set_value('sae_pwe', '0')
self.hostapd.set_value('sae_groups', '19')
self.hostapd.reload()
self.hostapd.wait_for_event("AP-ENABLED")
wd = IWD(True)
@ -51,6 +48,9 @@ class Test(unittest.TestCase):
wd = IWD(True)
self.validate_connection(wd)
def setUp(self):
self.hostapd.default()
@classmethod
def setUpClass(cls):
cls.hostapd = HostapdCLI(config='ssidSAE.conf')

View File

@ -45,16 +45,10 @@ class Test(unittest.TestCase):
wd.unregister_psk_agent(psk_agent)
def test_SAE(self):
self.hostapd.set_value('sae_pwe', '0')
self.hostapd.set_value('sae_groups', '19')
self.hostapd.set_value('vendor_elements', '')
self.hostapd.reload()
self.hostapd.wait_for_event("AP-ENABLED")
self.validate_connection(self.wd)
def test_SAE_force_group_19(self):
self.hostapd.set_value('sae_pwe', '0')
self.hostapd.set_value('sae_groups', '19')
# Vendor data from APs which require group 19 be used first
# TODO: (for all tests) verify the expected group was used
self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
@ -63,7 +57,6 @@ class Test(unittest.TestCase):
self.validate_connection(self.wd)
def test_SAE_Group20(self):
self.hostapd.set_value('sae_pwe', '0')
self.hostapd.set_value('sae_groups', '20')
self.hostapd.set_value('vendor_elements', '')
self.hostapd.reload()
@ -72,7 +65,6 @@ class Test(unittest.TestCase):
def test_SAE_H2E(self):
self.hostapd.set_value('sae_pwe', '1')
self.hostapd.set_value('sae_groups', '19')
self.hostapd.set_value('vendor_elements', '')
self.hostapd.reload()
self.hostapd.wait_for_event("AP-ENABLED")
@ -87,6 +79,7 @@ class Test(unittest.TestCase):
self.validate_connection(self.wd)
def setUp(self):
self.hostapd.default()
self.wd = IWD(True)
def tearDown(self):

View File

@ -37,13 +37,16 @@ class Test(unittest.TestCase):
self.validate_connection(wd, 'InvalidSecret')
def test_no_supported_groups(self):
hostapd = HostapdCLI(config='ssidSAE.conf')
hostapd.set_value('sae_groups', '1')
hostapd.reload()
self.hostapd.set_value('sae_groups', '1')
self.hostapd.reload()
wd = IWD(True)
self.validate_connection(wd, 'secret123')
def setUp(self):
self.hostapd = HostapdCLI(config='ssidSAE.conf')
self.hostapd.default()
@classmethod
def setUpClass(cls):
pass

View File

@ -8,3 +8,4 @@ wpa_pairwise=CCMP
sae_password=secret123|mac=ff:ff:ff:ff:ff:ff
sae_groups=19
ieee80211w=2
sae_pwe=0

View File

@ -40,10 +40,8 @@ class Test(unittest.TestCase):
# needed because the hwsim rule only matches once and must be matched
# on the first commit, not during group negotiation.
#
hostapd = HostapdCLI(config='ssidSAE.conf')
hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
hostapd.set_value('sae_groups', '19')
hostapd.reload()
self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
self.hostapd.reload()
hwsim = Hwsim()
bss_radio = hwsim.get_radio('rad0')
@ -64,10 +62,8 @@ class Test(unittest.TestCase):
rule0.remove()
def test_sta_confirm_not_acked(self):
hostapd = HostapdCLI(config='ssidSAE.conf')
hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
hostapd.set_value('sae_groups', '19')
hostapd.reload()
self.hostapd.set_value('vendor_elements', 'dd0cf4f5e8050500000000000000')
self.hostapd.reload()
hwsim = Hwsim()
bss_radio = hwsim.get_radio('rad0')
@ -87,6 +83,10 @@ class Test(unittest.TestCase):
rule0.remove()
def setUp(self):
self.hostapd = HostapdCLI(config='ssidSAE.conf')
self.hostapd.default()
@classmethod
def setUpClass(cls):
pass

View File

@ -43,9 +43,6 @@ class Test(unittest.TestCase):
wd.unregister_psk_agent(psk_agent)
def test_ccmp(self):
self.hostapd.set_value('rsn_pairwise', 'CCMP')
self.hostapd.reload()
self.hostapd.wait_for_event("AP-ENABLED")
self.validate_connection_success(self.wd)
def test_gcmp(self):
@ -67,6 +64,7 @@ class Test(unittest.TestCase):
self.validate_connection_success(self.wd)
def setUp(self):
self.hostapd.default()
self.wd = IWD(True)
def tearDown(self):

View File

@ -5,3 +5,4 @@ ssid=ssidWPA2
wpa=2
wpa_pairwise=CCMP
wpa_passphrase=secret123
rsn_pairwise=CCMP

View File

@ -39,9 +39,6 @@ class Test(unittest.TestCase):
wd.unregister_psk_agent(psk_agent)
def test_cmac(self):
self.hostapd.set_value('group_mgmt_cipher', 'AES-128-CMAC')
self.hostapd.reload()
self.hostapd.wait_for_event("AP-ENABLED")
self.validate_connection_success(self.wd)
def test_gmac(self):
@ -63,6 +60,7 @@ class Test(unittest.TestCase):
self.validate_connection_success(self.wd)
def setUp(self):
self.hostapd.default()
self.wd = IWD(True)
def tearDown(self):

View File

@ -8,3 +8,4 @@ wpa_passphrase=secret123
ieee80211w=2
wpa_key_mgmt=WPA-PSK-SHA256
group_mgmt_cipher=AES-128-CMAC