commit 4545f80e58bc941fa40cf2d7d2fd45fb830a9650
parent 3439d098178ffd56a1cc85d5d7c1de73ef9df4a2
Author: James Prestwood <prestwoj@gmail.com>
Date: Mon, 22 Aug 2022 10:01:48 -0700
auto-t: update tests to use set_address/group_neighbors
This reduces the big blocks of copied code with a few function calls.
Diffstat:
8 files changed, 23 insertions(+), 148 deletions(-)
diff --git a/autotests/testFT-8021x-roam/connection_test.py b/autotests/testFT-8021x-roam/connection_test.py
@@ -66,28 +66,10 @@ class Test(unittest.TestCase):
cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'),
HostapdCLI(config='ft-eap-ccmp-2.conf') ]
- # Set interface addresses to those expected by hostapd config files
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + \
- '" address 12:00:00:00:00:01 up')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + \
- '" address 12:00:00:00:00:02 up')
-
- cls.bss_hostapd[0].reload()
- cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
- cls.bss_hostapd[1].reload()
- cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
-
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # FT still works without the neighbor AP table but neighbor reports
- # have to be disabled in the .conf files
- cls.bss_hostapd[0].set_neighbor('12:00:00:00:00:02', 'TestFT',
- '1200000000028f0000005102060603000000')
- cls.bss_hostapd[1].set_neighbor('12:00:00:00:00:01', 'TestFT',
- '1200000000018f0000005101060603000000')
+ cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
+ cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
+
+ HostapdCLI.group_neighbors(*cls.bss_hostapd)
@classmethod
def tearDownClass(cls):
diff --git a/autotests/testFT-FILS/connection_test.py b/autotests/testFT-FILS/connection_test.py
@@ -128,26 +128,10 @@ class Test(unittest.TestCase):
cls.bss_hostapd = [ HostapdCLI(config='ft-eap-ccmp-1.conf'),
HostapdCLI(config='ft-eap-ccmp-2.conf') ]
- # Set interface addresses to those expected by hostapd config files
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up')
-
- cls.bss_hostapd[0].reload()
- cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
- cls.bss_hostapd[1].reload()
- cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
-
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # FT still works without the neighbor AP table but neighbor reports
- # have to be disabled in the .conf files
- cls.bss_hostapd[0].set_neighbor('12:00:00:00:00:02', 'TestFT',
- '1200000000028f0000005102060603000000')
- cls.bss_hostapd[1].set_neighbor('12:00:00:00:00:01', 'TestFT',
- '1200000000018f0000005101060603000000')
+ cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
+ cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
+
+ HostapdCLI.group_neighbors(*cls.bss_hostapd)
@classmethod
def tearDownClass(cls):
diff --git a/autotests/testPSK-roam/connection_test.py b/autotests/testPSK-roam/connection_test.py
@@ -199,26 +199,10 @@ class Test(unittest.TestCase):
cls.rule2.source = rad0.addresses[0]
cls.rule2.signal = -7000
- # Set interface addresses to those expected by hostapd config files
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up')
-
- cls.bss_hostapd[0].reload()
- cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
- cls.bss_hostapd[1].reload()
- cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
-
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # FT still works without the neighbor AP table but neighbor reports
- # have to be disabled in the .conf files
- cls.bss_hostapd[0].set_neighbor('12:00:00:00:00:02', 'TestFT',
- '1200000000028f0000005102060603000000')
- cls.bss_hostapd[1].set_neighbor('12:00:00:00:00:01', 'TestFT',
- '1200000000018f0000005101060603000000')
+ cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
+ cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
+
+ HostapdCLI.group_neighbors(*cls.bss_hostapd)
@classmethod
def tearDownClass(cls):
diff --git a/autotests/testPSK-roam/roam_ap_disconnect_test.py b/autotests/testPSK-roam/roam_ap_disconnect_test.py
@@ -46,10 +46,7 @@ class Test(unittest.TestCase):
self.validate()
def test_ap_disconnect_neighbors(self):
- self.bss_hostapd[0].set_neighbor('12:00:00:00:00:02', 'TestFT',
- '1200000000028f0000005102060603000000')
- self.bss_hostapd[1].set_neighbor('12:00:00:00:00:01', 'TestFT',
- '1200000000018f0000005101060603000000')
+ HostapdCLI.group_neighbors(*self.bss_hostapd)
self.validate()
@@ -85,11 +82,8 @@ class Test(unittest.TestCase):
cls.rule0.signal = -8000
cls.rule0.enabled = True
- # Set interface addresses to those expected by hostapd config files
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[0].ifname + '" addr 12:00:00:00:00:01 up')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" down')
- os.system('ip link set dev "' + cls.bss_hostapd[1].ifname + '" addr 12:00:00:00:00:02 up')
+ cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
+ cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
@classmethod
def tearDownClass(cls):
diff --git a/autotests/testPreauth-roam/connection_test.py b/autotests/testPreauth-roam/connection_test.py
@@ -17,18 +17,7 @@ class Test(unittest.TestCase):
bss0_addr = bss_hostapd[0].bssid
bss1_addr = bss_hostapd[1].bssid
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # Roaming still works without the neighbor AP table but neighbor
- # reports have to be disabled in the .conf files
- bss0_nr = ''.join(bss0_addr.split(':')) + \
- '8f0000005101060603000000'
- bss1_nr = ''.join(bss1_addr.split(':')) + \
- '8f0000005102060603000000'
-
- bss_hostapd[0].set_neighbor(bss1_addr, 'TestPreauth', bss1_nr)
- bss_hostapd[1].set_neighbor(bss0_addr, 'TestPreauth', bss0_nr)
+ HostapdCLI.group_neighbors(*bss_hostapd)
wd = IWD(True)
diff --git a/autotests/testRoamRetry/fast_retry_test.py b/autotests/testRoamRetry/fast_retry_test.py
@@ -36,20 +36,7 @@ class Test(unittest.TestCase):
rule1.bidirectional = True
rule1.enabled = True
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # Roaming still works without the neighbor AP table but neighbor
- # reports have to be disabled in the .conf files
- bss0_nr = ''.join(bss_radio[0].addresses[0].split(':')) + \
- '8f0000005101060603000000'
- bss1_nr = ''.join(bss_radio[1].addresses[0].split(':')) + \
- '8f0000005102060603000000'
-
- bss_hostapd[0].set_neighbor(bss_radio[1].addresses[0], 'TestRoamRetry',
- bss1_nr)
- bss_hostapd[1].set_neighbor(bss_radio[0].addresses[0], 'TestRoamRetry',
- bss0_nr)
+ HostapdCLI.group_neighbors(*bss_hostapd)
# Start in the vicinity of BSS 0, check that iwd connects to BSS 0
rule0.signal = -2000
diff --git a/autotests/testRoamRetry/stop_retry_test.py b/autotests/testRoamRetry/stop_retry_test.py
@@ -35,20 +35,7 @@ class Test(unittest.TestCase):
rule1.bidirectional = True
rule1.enabled = True
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # Roaming still works without the neighbor AP table but neighbor
- # reports have to be disabled in the .conf files
- bss0_nr = ''.join(bss_radio[0].addresses[0].split(':')) + \
- '8f0000005101060603000000'
- bss1_nr = ''.join(bss_radio[1].addresses[0].split(':')) + \
- '8f0000005102060603000000'
-
- bss_hostapd[0].set_neighbor(bss_radio[1].addresses[0], 'TestRoamRetry',
- bss1_nr)
- bss_hostapd[1].set_neighbor(bss_radio[0].addresses[0], 'TestRoamRetry',
- bss0_nr)
+ HostapdCLI.group_neighbors(*bss_hostapd)
# Start in the vicinity of BSS 0, check that iwd connects to BSS 0
rule0.signal = -2000
diff --git a/autotests/testSAE-roam/connection_test.py b/autotests/testSAE-roam/connection_test.py
@@ -120,43 +120,11 @@ class Test(unittest.TestCase):
HostapdCLI(config='ft-sae-2.conf'),
HostapdCLI(config='ft-psk-3.conf') ]
- ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, 'down']).wait()
- ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[0].ifname, \
- 'addr', '12:00:00:00:00:01', 'up']).wait()
- ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, 'down']).wait()
- ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[1].ifname, \
- 'addr', '12:00:00:00:00:02', 'up']).wait()
- ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, 'down']).wait()
- ctx.start_process(['ip', 'link', 'set', 'dev', cls.bss_hostapd[2].ifname, \
- 'addr', '12:00:00:00:00:03', 'up']).wait()
-
- # Set interface addresses to those expected by hostapd config files
- cls.bss_hostapd[0].reload()
- cls.bss_hostapd[0].wait_for_event("AP-ENABLED")
- cls.bss_hostapd[1].reload()
- cls.bss_hostapd[1].wait_for_event("AP-ENABLED")
- cls.bss_hostapd[2].reload()
- cls.bss_hostapd[2].wait_for_event("AP-ENABLED")
-
- # Fill in the neighbor AP tables in both BSSes. By default each
- # instance knows only about current BSS, even inside one hostapd
- # process.
- # FT still works without the neighbor AP table but neighbor reports
- # have to be disabled in the .conf files
- cls.bss_hostapd[0].set_neighbor('12:00:00:00:00:02', 'TestFT',
- '1200000000028f0000005102060603000000')
- cls.bss_hostapd[0].set_neighbor('12:00:00:00:00:03', 'TestFT',
- '1200000000038f0000005102060603000000')
-
- cls.bss_hostapd[1].set_neighbor('12:00:00:00:00:01', 'TestFT',
- '1200000000018f0000005101060603000000')
- cls.bss_hostapd[1].set_neighbor('12:00:00:00:00:03', 'TestFT',
- '1200000000038f0000005101060603000000')
-
- cls.bss_hostapd[2].set_neighbor('12:00:00:00:00:01', 'TestFT',
- '1200000000018f0000005101060603000000')
- cls.bss_hostapd[2].set_neighbor('12:00:00:00:00:02', 'TestFT',
- '1200000000028f0000005101060603000000')
+ cls.bss_hostapd[0].set_address('12:00:00:00:00:01')
+ cls.bss_hostapd[1].set_address('12:00:00:00:00:02')
+ cls.bss_hostapd[2].set_address('12:00:00:00:00:03')
+
+ HostapdCLI.group_neighbors(*cls.bss_hostapd)
IWD.copy_to_storage('TestFT.psk')