eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit f456ac49dc506a7208d33f736d21eec1525a8388
parent 576d8ad123d7008bb463e4d11b288b0a761a021b
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Sat, 20 Apr 2019 22:29:04 +0200

autotests: Use hostapd_map in place of wiphy_map

In the tests that only want to iterate over the hostapd interfaces,
simplify the pattern of walking through the whole wiphy_map tree by
instead using the hostapd_map variable which is already filtered to only
contain hostapd interfaces.

Diffstat:
Mautotests/testAPRoam/connection_test.py | 7++-----
Mautotests/testBSSBlacklist/all_blacklisted_test.py | 8++------
Mautotests/testBSSBlacklist/bad_pass_test.py | 8++------
Mautotests/testBSSBlacklist/connection_test.py | 8++------
Mautotests/testBSSBlacklist/temp_blacklist_test.py | 8++------
Mautotests/testEAP-TTLS-MSCHAP/connection_test.py | 2+-
Mautotests/testFT-8021x-roam/test.py | 9+++------
Mautotests/testFT-PSK-roam/test.py | 9+++------
Mautotests/testFT-SAE-roam/test.py | 9+++------
Mautotests/testHT-VHT/test.py | 37+++++++++++++------------------------
Mautotests/testOWE/timeout_test.py | 17++++++-----------
Mautotests/testPreauth-roam/test.py | 9+++------
Mautotests/testSAE/connection_test.py | 2+-
Mautotests/testSAE/group_20_connection_test.py | 2+-
Mautotests/testSAQuery-spoofing/connection_test.py | 21+++++++--------------
Mautotests/testSAQuery/connection_test.py | 12++----------
16 files changed, 53 insertions(+), 115 deletions(-)

diff --git 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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': - non_ht_hostapd = HostapdCLI(intf) - - for path in hwsim.radios: - radio = hwsim.radios[path] - if radio.name == wname: - non_ht_radio = radio + for intf in hostapd_map.values(): + for path in hwsim.radios: + radio = hwsim.radios[path] + if radio.name == intf.wiphy.name: + break - elif intf.config and intf.config == 'ht.conf': + 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) - - 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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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()