diff --git a/autotests/testAPRoam/connection_test.py b/autotests/testAPRoam/connection_test.py index 9e90b7fd..292754c9 100644 --- a/autotests/testAPRoam/connection_test.py +++ b/autotests/testAPRoam/connection_test.py @@ -19,26 +19,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - bss_hostapd = [None, None, None] - bss_radio = [None, None, None] - - 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: - bss_idx = 1 - elif intf.config and '3' in intf.config: - bss_idx = 2 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - bss_hostapd[bss_idx] = HostapdCLI(intf) - bss_radio[bss_idx] = radio + bss_hostapd = [ HostapdCLI(config='ssid1.conf'), + HostapdCLI(config='ssid2.conf'), + HostapdCLI(config='ssid3.conf') ] + bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1'), + hwsim.get_radio('rad2') ] wd = IWD() diff --git a/autotests/testBSSBlacklist/all_blacklisted_test.py b/autotests/testBSSBlacklist/all_blacklisted_test.py index 61635eca..78239309 100644 --- a/autotests/testBSSBlacklist/all_blacklisted_test.py +++ b/autotests/testBSSBlacklist/all_blacklisted_test.py @@ -21,26 +21,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - bss_radio = [None, None, None] - bss_hostapd = [None, None, None] - - 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: - bss_idx = 1 - elif intf.config and '3' in intf.config: - bss_idx = 2 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - bss_radio[bss_idx] = radio - bss_hostapd[bss_idx] = HostapdCLI(intf) + bss_hostapd = [ HostapdCLI(config='ssid1.conf'), + HostapdCLI(config='ssid2.conf'), + HostapdCLI(config='ssid3.conf') ] + bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1'), + hwsim.get_radio('rad2') ] rule0 = hwsim.rules.create() rule0.source = bss_radio[0].addresses[0] diff --git a/autotests/testBSSBlacklist/bad_pass_test.py b/autotests/testBSSBlacklist/bad_pass_test.py index f31549c3..3de47719 100644 --- a/autotests/testBSSBlacklist/bad_pass_test.py +++ b/autotests/testBSSBlacklist/bad_pass_test.py @@ -21,26 +21,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - bss_radio = [None, None, None] - bss_hostapd = [None, None, None] - - 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: - bss_idx = 1 - elif intf.config and '3' in intf.config: - bss_idx = 2 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - bss_radio[bss_idx] = radio - bss_hostapd[bss_idx] = HostapdCLI(intf) + bss_hostapd = [ HostapdCLI(config='ssid1.conf'), + HostapdCLI(config='ssid2.conf'), + HostapdCLI(config='ssid3.conf') ] + bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1'), + hwsim.get_radio('rad2') ] rule0 = hwsim.rules.create() rule0.source = bss_radio[0].addresses[0] diff --git a/autotests/testBSSBlacklist/connection_test.py b/autotests/testBSSBlacklist/connection_test.py index 9ed19d25..f192eb68 100644 --- a/autotests/testBSSBlacklist/connection_test.py +++ b/autotests/testBSSBlacklist/connection_test.py @@ -21,26 +21,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - bss_radio = [None, None, None] - bss_hostapd = [None, None, None] - - 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: - bss_idx = 1 - elif intf.config and '3' in intf.config: - bss_idx = 2 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - bss_radio[bss_idx] = radio - bss_hostapd[bss_idx] = HostapdCLI(intf) + bss_hostapd = [ HostapdCLI(config='ssid1.conf'), + HostapdCLI(config='ssid2.conf'), + HostapdCLI(config='ssid3.conf') ] + bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1'), + hwsim.get_radio('rad2') ] rule0 = hwsim.rules.create() rule0.source = bss_radio[0].addresses[0] diff --git a/autotests/testBSSBlacklist/temp_blacklist_test.py b/autotests/testBSSBlacklist/temp_blacklist_test.py index 1ed19ac6..f43f807c 100644 --- a/autotests/testBSSBlacklist/temp_blacklist_test.py +++ b/autotests/testBSSBlacklist/temp_blacklist_test.py @@ -21,26 +21,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - bss_radio = [None, None, None] - bss_hostapd = [None, None, None] - - 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: - bss_idx = 1 - elif intf.config and '3' in intf.config: - bss_idx = 2 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - bss_radio[bss_idx] = radio - bss_hostapd[bss_idx] = HostapdCLI(intf) + bss_hostapd = [ HostapdCLI(config='ssid1.conf'), + HostapdCLI(config='ssid2.conf'), + HostapdCLI(config='ssid3.conf') ] + bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1'), + hwsim.get_radio('rad2') ] rule0 = hwsim.rules.create() rule0.source = bss_radio[0].addresses[0] diff --git a/autotests/testFT-8021x-roam/test.py b/autotests/testFT-8021x-roam/test.py index 6d61b16e..0e6f733e 100644 --- a/autotests/testFT-8021x-roam/test.py +++ b/autotests/testFT-8021x-roam/test.py @@ -192,23 +192,10 @@ class Test(unittest.TestCase): hwsim = Hwsim() - cls.bss_hostapd = [None, None] - cls.bss_radio = [None, None] - 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: - bss_idx = 1 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - cls.bss_hostapd[bss_idx] = HostapdCLI(intf) - cls.bss_radio[bss_idx] = radio + cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'), + HostapdCLI(config='ft-eap-ccmp-2.conf') ] + cls.bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1') ] # Set interface addresses to those expected by hostapd config files os.system('ifconfig "' + cls.bss_hostapd[0].ifname + diff --git a/autotests/testFT-FILS-SHA256/test.py b/autotests/testFT-FILS-SHA256/test.py index 09f4bd06..7b800f1c 100644 --- a/autotests/testFT-FILS-SHA256/test.py +++ b/autotests/testFT-FILS-SHA256/test.py @@ -147,23 +147,10 @@ class Test(unittest.TestCase): hwsim = Hwsim() - cls.bss_hostapd = [None, None] - cls.bss_radio = [None, None] - 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: - bss_idx = 1 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - cls.bss_hostapd[bss_idx] = HostapdCLI(intf) - cls.bss_radio[bss_idx] = radio + cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'), + HostapdCLI(config='ft-eap-ccmp-2.conf') ] + cls.bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1') ] # Set interface addresses to those expected by hostapd config files os.system('ifconfig "' + cls.bss_hostapd[0].ifname + diff --git a/autotests/testFT-FILS-SHA384/test.py b/autotests/testFT-FILS-SHA384/test.py index 09f4bd06..7b800f1c 100644 --- a/autotests/testFT-FILS-SHA384/test.py +++ b/autotests/testFT-FILS-SHA384/test.py @@ -147,23 +147,10 @@ class Test(unittest.TestCase): hwsim = Hwsim() - cls.bss_hostapd = [None, None] - cls.bss_radio = [None, None] - 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: - bss_idx = 1 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - cls.bss_hostapd[bss_idx] = HostapdCLI(intf) - cls.bss_radio[bss_idx] = radio + cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'), + HostapdCLI(config='ft-eap-ccmp-2.conf') ] + cls.bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1') ] # Set interface addresses to those expected by hostapd config files os.system('ifconfig "' + cls.bss_hostapd[0].ifname + diff --git a/autotests/testFT-PSK-over-DS/test.py b/autotests/testFT-PSK-over-DS/test.py index 0afadfe1..f3dd088c 100644 --- a/autotests/testFT-PSK-over-DS/test.py +++ b/autotests/testFT-PSK-over-DS/test.py @@ -120,23 +120,10 @@ class Test(unittest.TestCase): def setUpClass(cls): hwsim = Hwsim() - cls.bss_hostapd = [None, None] - cls.bss_radio = [None, None] - 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: - bss_idx = 1 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - cls.bss_hostapd[bss_idx] = HostapdCLI(intf) - cls.bss_radio[bss_idx] = radio + cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), + HostapdCLI(config='ft-psk-ccmp-2.conf') ] + cls.bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1') ] # Set interface addresses to those expected by hostapd config files os.system('ifconfig "' + cls.bss_hostapd[0].ifname + diff --git a/autotests/testFT-PSK-roam/test.py b/autotests/testFT-PSK-roam/test.py index 91fc7805..2443593d 100644 --- a/autotests/testFT-PSK-roam/test.py +++ b/autotests/testFT-PSK-roam/test.py @@ -201,23 +201,10 @@ class Test(unittest.TestCase): def setUpClass(cls): hwsim = Hwsim() - cls.bss_hostapd = [None, None] - cls.bss_radio = [None, None] - 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: - bss_idx = 1 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - cls.bss_hostapd[bss_idx] = HostapdCLI(intf) - cls.bss_radio[bss_idx] = radio + cls.bss_hostapd = [ HostapdCLI(config='ft-psk-ccmp-1.conf'), + HostapdCLI(config='ft-psk-ccmp-2.conf') ] + cls.bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1') ] # Set interface addresses to those expected by hostapd config files os.system('ifconfig "' + cls.bss_hostapd[0].ifname + diff --git a/autotests/testFT-SAE-roam/test.py b/autotests/testFT-SAE-roam/test.py index c8414b68..9c2b3ee1 100644 --- a/autotests/testFT-SAE-roam/test.py +++ b/autotests/testFT-SAE-roam/test.py @@ -151,25 +151,12 @@ class Test(unittest.TestCase): def setUpClass(cls): hwsim = Hwsim() - cls.bss_hostapd = [None, None, None] - cls.bss_radio = [None, None, None] - 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: - bss_idx = 1 - elif intf.config and '3' in intf.config: - bss_idx = 2 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - cls.bss_hostapd[bss_idx] = HostapdCLI(intf) - cls.bss_radio[bss_idx] = radio + cls.bss_hostapd = [ HostapdCLI(config='ft-sae-1.conf'), + HostapdCLI(config='ft-sae-2.conf'), + HostapdCLI(config='ft-psk-3.conf') ] + cls.bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1'), + hwsim.get_radio('rad2') ] # Set interface addresses to those expected by hostapd config files os.system('ifconfig "' + cls.bss_hostapd[0].ifname + diff --git a/autotests/testHT-VHT/test.py b/autotests/testHT-VHT/test.py index ddab8311..0129d8a0 100644 --- a/autotests/testHT-VHT/test.py +++ b/autotests/testHT-VHT/test.py @@ -50,29 +50,12 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - non_ht_hostapd = None - ht_hostapd = None - non_ht_radio = None - ht_radio = None - vht_radio = None - - 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) - non_ht_radio = radio - elif intf.config == 'ht.conf': - ht_hostapd = HostapdCLI(intf) - ht_radio = radio - elif intf.config == 'vht.conf': - vht_hostapd = HostapdCLI(intf) - vht_radio = radio - else: - continue + non_ht_hostapd = HostapdCLI(config='non-ht-vht.conf') + ht_hostapd = HostapdCLI(config='ht.conf') + vht_hostapd = HostapdCLI(config='vht.conf') + non_ht_radio = hwsim.get_radio('rad0') + ht_radio = hwsim.get_radio('rad1') + vht_radio = hwsim.get_radio('rad2') self.assertIsNotNone(non_ht_hostapd) self.assertIsNotNone(ht_hostapd) diff --git a/autotests/testOWE/timeout_test.py b/autotests/testOWE/timeout_test.py index 1581c22d..d02432e9 100644 --- a/autotests/testOWE/timeout_test.py +++ b/autotests/testOWE/timeout_test.py @@ -17,13 +17,7 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - bss_radio = None - - 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 + bss_radio = hwsim.get_radio('rad0') self.assertIsNotNone(bss_radio) diff --git a/autotests/testPreauth-roam/test.py b/autotests/testPreauth-roam/test.py index 1d91448a..06babcea 100644 --- a/autotests/testPreauth-roam/test.py +++ b/autotests/testPreauth-roam/test.py @@ -16,23 +16,10 @@ class Test(unittest.TestCase): def test_preauth_success(self): hwsim = Hwsim() - bss_hostapd = [None, None] - bss_radio = [None, None] - 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: - bss_idx = 1 - else: - continue - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == intf.wiphy.name: - break - - bss_hostapd[bss_idx] = HostapdCLI(intf) - bss_radio[bss_idx] = radio + bss_hostapd = [ HostapdCLI(config='eaptls-preauth-1.conf'), + HostapdCLI(config='eaptls-preauth-2.conf') ] + bss_radio = [ hwsim.get_radio('rad0'), + hwsim.get_radio('rad1') ] rule0 = hwsim.rules.create() rule0.source = bss_radio[0].addresses[0] diff --git a/autotests/testSAQuery-spoofing/connection_test.py b/autotests/testSAQuery-spoofing/connection_test.py index dc3277ef..e9d31c15 100644 --- a/autotests/testSAQuery-spoofing/connection_test.py +++ b/autotests/testSAQuery-spoofing/connection_test.py @@ -18,12 +18,8 @@ class Test(unittest.TestCase): def test_connection_success(self): hwsim = Hwsim() - 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 + hostapd = HostapdCLI(config='ssidCCMP.conf') + radio = hwsim.get_radio('rad0') wd = IWD()