diff --git a/autotests/testAPRoam/connection_test.py b/autotests/testAPRoam/connection_test.py index 02f57f38..9e90b7fd 100644 --- a/autotests/testAPRoam/connection_test.py +++ b/autotests/testAPRoam/connection_test.py @@ -12,7 +12,6 @@ from iwd import NetworkType from hostapd import HostapdCLI from hostapd import hostapd_map -from wiphy import wiphy_map from hwsim import Hwsim class Test(unittest.TestCase): @@ -23,9 +22,7 @@ class Test(unittest.TestCase): bss_hostapd = [None, None, None] bss_radio = [None, None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -37,7 +34,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break bss_hostapd[bss_idx] = HostapdCLI(intf) diff --git a/autotests/testBSSBlacklist/all_blacklisted_test.py b/autotests/testBSSBlacklist/all_blacklisted_test.py index 1dcdecf1..9e721d1a 100644 --- a/autotests/testBSSBlacklist/all_blacklisted_test.py +++ b/autotests/testBSSBlacklist/all_blacklisted_test.py @@ -12,7 +12,6 @@ from iwd import NetworkType from hostapd import HostapdCLI from hostapd import hostapd_map -from wiphy import wiphy_map from hwsim import Hwsim import time @@ -25,10 +24,7 @@ class Test(unittest.TestCase): bss_radio = [None, None, None] bss_hostapd = [None, None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -40,7 +36,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break bss_radio[bss_idx] = radio diff --git a/autotests/testBSSBlacklist/bad_pass_test.py b/autotests/testBSSBlacklist/bad_pass_test.py index fa4399a0..c1452cb6 100644 --- a/autotests/testBSSBlacklist/bad_pass_test.py +++ b/autotests/testBSSBlacklist/bad_pass_test.py @@ -12,7 +12,6 @@ from iwd import NetworkType from hostapd import HostapdCLI from hostapd import hostapd_map -from wiphy import wiphy_map from hwsim import Hwsim import time @@ -25,10 +24,7 @@ class Test(unittest.TestCase): bss_radio = [None, None, None] bss_hostapd = [None, None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -40,7 +36,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break bss_radio[bss_idx] = radio diff --git a/autotests/testBSSBlacklist/connection_test.py b/autotests/testBSSBlacklist/connection_test.py index 761f057a..ef350a2a 100644 --- a/autotests/testBSSBlacklist/connection_test.py +++ b/autotests/testBSSBlacklist/connection_test.py @@ -12,7 +12,6 @@ from iwd import NetworkType from hostapd import HostapdCLI from hostapd import hostapd_map -from wiphy import wiphy_map from hwsim import Hwsim import time @@ -25,10 +24,7 @@ class Test(unittest.TestCase): bss_radio = [None, None, None] bss_hostapd = [None, None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -40,7 +36,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break bss_radio[bss_idx] = radio diff --git a/autotests/testBSSBlacklist/temp_blacklist_test.py b/autotests/testBSSBlacklist/temp_blacklist_test.py index 51e33b77..82a1af51 100644 --- a/autotests/testBSSBlacklist/temp_blacklist_test.py +++ b/autotests/testBSSBlacklist/temp_blacklist_test.py @@ -12,7 +12,6 @@ from iwd import NetworkType from hostapd import HostapdCLI from hostapd import hostapd_map -from wiphy import wiphy_map from hwsim import Hwsim import time @@ -25,10 +24,7 @@ class Test(unittest.TestCase): bss_radio = [None, None, None] bss_hostapd = [None, None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -40,7 +36,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break bss_radio[bss_idx] = radio diff --git a/autotests/testEAP-TTLS-MSCHAP/connection_test.py b/autotests/testEAP-TTLS-MSCHAP/connection_test.py index ff2b9feb..269f6131 100644 --- a/autotests/testEAP-TTLS-MSCHAP/connection_test.py +++ b/autotests/testEAP-TTLS-MSCHAP/connection_test.py @@ -18,7 +18,7 @@ class Test(unittest.TestCase): def test_connection_success(self): hostapd = None - for hostapd_if in list(hostapd_map.values()): + for hostapd_if in hostapd_map.values(): hpd = HostapdCLI(hostapd_if) if hpd.get_config_value('ssid') == 'ssidEAP-TTLS-MSCHAP': hostapd = hpd diff --git a/autotests/testFT-8021x-roam/test.py b/autotests/testFT-8021x-roam/test.py index 20d88bc6..6d61b16e 100644 --- a/autotests/testFT-8021x-roam/test.py +++ b/autotests/testFT-8021x-roam/test.py @@ -8,8 +8,7 @@ import iwd from iwd import IWD from iwd import NetworkType from hwsim import Hwsim -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map import testutil class Test(unittest.TestCase): @@ -195,9 +194,7 @@ class Test(unittest.TestCase): cls.bss_hostapd = [None, None] cls.bss_radio = [None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -207,7 +204,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break cls.bss_hostapd[bss_idx] = HostapdCLI(intf) diff --git a/autotests/testFT-PSK-roam/test.py b/autotests/testFT-PSK-roam/test.py index 5224a042..91fc7805 100644 --- a/autotests/testFT-PSK-roam/test.py +++ b/autotests/testFT-PSK-roam/test.py @@ -9,8 +9,7 @@ from iwd import IWD from iwd import PSKAgent from iwd import NetworkType from hwsim import Hwsim -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map import testutil class Test(unittest.TestCase): @@ -204,9 +203,7 @@ class Test(unittest.TestCase): cls.bss_hostapd = [None, None] cls.bss_radio = [None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -216,7 +213,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break cls.bss_hostapd[bss_idx] = HostapdCLI(intf) diff --git a/autotests/testFT-SAE-roam/test.py b/autotests/testFT-SAE-roam/test.py index 3174e076..c8414b68 100644 --- a/autotests/testFT-SAE-roam/test.py +++ b/autotests/testFT-SAE-roam/test.py @@ -9,8 +9,7 @@ from iwd import IWD from iwd import PSKAgent from iwd import NetworkType from hwsim import Hwsim -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map import testutil class Test(unittest.TestCase): @@ -154,9 +153,7 @@ class Test(unittest.TestCase): cls.bss_hostapd = [None, None, None] cls.bss_radio = [None, None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -168,7 +165,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break cls.bss_hostapd[bss_idx] = HostapdCLI(intf) diff --git a/autotests/testHT-VHT/test.py b/autotests/testHT-VHT/test.py index 0e49d61e..ddab8311 100644 --- a/autotests/testHT-VHT/test.py +++ b/autotests/testHT-VHT/test.py @@ -9,8 +9,7 @@ from iwd import IWD from iwd import PSKAgent from iwd import NetworkType from hwsim import Hwsim -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map import testutil from time import sleep @@ -57,31 +56,21 @@ class Test(unittest.TestCase): ht_radio = None vht_radio = None - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - if intf.config and intf.config == 'non-ht-vht.conf': + for intf in hostapd_map.values(): + for path in hwsim.radios: + radio = hwsim.radios[path] + if radio.name == intf.wiphy.name: + break + + if intf.config == 'non-ht-vht.conf': non_ht_hostapd = HostapdCLI(intf) - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == wname: - non_ht_radio = radio - - elif intf.config and intf.config == 'ht.conf': + non_ht_radio = radio + elif intf.config == 'ht.conf': ht_hostapd = HostapdCLI(intf) - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == wname: - ht_radio = radio - elif intf.config and intf.config == 'vht.conf': + ht_radio = radio + elif intf.config == 'vht.conf': vht_hostapd = HostapdCLI(intf) - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == wname: - vht_radio = radio + vht_radio = radio else: continue diff --git a/autotests/testOWE/timeout_test.py b/autotests/testOWE/timeout_test.py index 9834c499..1581c22d 100644 --- a/autotests/testOWE/timeout_test.py +++ b/autotests/testOWE/timeout_test.py @@ -9,7 +9,7 @@ from iwd import IWD from iwd import NetworkType import testutil -from wiphy import wiphy_map +import hostapd from hwsim import Hwsim class Test(unittest.TestCase): @@ -19,16 +19,11 @@ class Test(unittest.TestCase): bss_radio = None - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - if intf.config == 'ssidOWE.conf': - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == wname: - bss_radio = radio - else: - continue + intf = list(hostapd.hostapd_map.values())[0] + for path in hwsim.radios: + radio = hwsim.radios[path] + if radio.name == intf.wiphy.name: + bss_radio = radio self.assertIsNotNone(bss_radio) diff --git a/autotests/testPreauth-roam/test.py b/autotests/testPreauth-roam/test.py index ca295544..1d91448a 100644 --- a/autotests/testPreauth-roam/test.py +++ b/autotests/testPreauth-roam/test.py @@ -9,8 +9,7 @@ from iwd import IWD from iwd import PSKAgent from iwd import NetworkType from hwsim import Hwsim -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map import testutil class Test(unittest.TestCase): @@ -19,9 +18,7 @@ class Test(unittest.TestCase): bss_hostapd = [None, None] bss_radio = [None, None] - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] + for intf in hostapd_map.values(): if intf.config and '1' in intf.config: bss_idx = 0 elif intf.config and '2' in intf.config: @@ -31,7 +28,7 @@ class Test(unittest.TestCase): for path in hwsim.radios: radio = hwsim.radios[path] - if radio.name == wname: + if radio.name == intf.wiphy.name: break bss_hostapd[bss_idx] = HostapdCLI(intf) diff --git a/autotests/testSAE/connection_test.py b/autotests/testSAE/connection_test.py index b55b2904..8959e712 100644 --- a/autotests/testSAE/connection_test.py +++ b/autotests/testSAE/connection_test.py @@ -16,7 +16,7 @@ class Test(unittest.TestCase): def validate_connection(self, wd): hostapd_if = None - for hostapd in list(hostapd_map.values()): + for hostapd in hostapd_map.values(): if hostapd.config == 'ssidSAE.conf': hostapd_if = hostapd.name diff --git a/autotests/testSAE/group_20_connection_test.py b/autotests/testSAE/group_20_connection_test.py index 351261be..9c6cd61d 100644 --- a/autotests/testSAE/group_20_connection_test.py +++ b/autotests/testSAE/group_20_connection_test.py @@ -16,7 +16,7 @@ class Test(unittest.TestCase): def validate_connection(self, wd): hostapd_if = None - for hostapd in list(hostapd_map.values()): + for hostapd in hostapd_map.values(): if hostapd.config == 'ssidSAE-20.conf': hostapd_if = hostapd.name diff --git a/autotests/testSAQuery-spoofing/connection_test.py b/autotests/testSAQuery-spoofing/connection_test.py index 506a11ca..dc3277ef 100644 --- a/autotests/testSAQuery-spoofing/connection_test.py +++ b/autotests/testSAQuery-spoofing/connection_test.py @@ -9,8 +9,7 @@ from iwd import IWD from iwd import PSKAgent from iwd import NetworkType from hwsim import Hwsim -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map from time import sleep @@ -19,18 +18,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - hostapd = None - radio = None - - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - if intf.use == 'hostapd': - hostapd = HostapdCLI(intf) - for path in hwsim.radios: - if hwsim.radios[path].name == wname: - radio = hwsim.radios[path] - break + intf = list(hostapd_map.values())[0] + hostapd = HostapdCLI(intf) + for path in hwsim.radios: + radio = hwsim.radios[path] + if radio.name == intf.wiphy.name: + break wd = IWD() diff --git a/autotests/testSAQuery/connection_test.py b/autotests/testSAQuery/connection_test.py index 695deac7..13c45ee9 100644 --- a/autotests/testSAQuery/connection_test.py +++ b/autotests/testSAQuery/connection_test.py @@ -8,20 +8,12 @@ import iwd from iwd import IWD from iwd import PSKAgent from iwd import NetworkType -from hostapd import HostapdCLI -from wiphy import wiphy_map +from hostapd import HostapdCLI, hostapd_map class Test(unittest.TestCase): def test_connection_success(self): - hostapd = None - - for wname in wiphy_map: - wiphy = wiphy_map[wname] - intf = list(wiphy.values())[0] - if intf.use == 'hostapd': - hostapd = HostapdCLI(intf) - break + hostapd = HostapdCLI(list(hostapd_map.values())[0]) wd = IWD()