diff mbox series

[15/26] auto-t: Support multiple pairwise ciphers in WPA2

Message ID 20221021191307.31492-15-denkenz@gmail.com (mailing list archive)
State New
Headers show
Series [01/26] eapol: More strictly validate key_descriptor_version | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Denis Kenzior Oct. 21, 2022, 7:12 p.m. UTC
---
 autotests/testWPA2/connection_test.py         | 30 +++++++++++++++----
 autotests/testWPA2/failure_test.py            |  4 +--
 autotests/testWPA2/hw.conf                    |  3 +-
 autotests/testWPA2/password_test.py           |  4 +--
 .../testWPA2/{ssidCCMP.conf => ssidWPA2.conf} |  2 +-
 5 files changed, 31 insertions(+), 12 deletions(-)
 rename autotests/testWPA2/{ssidCCMP.conf => ssidWPA2.conf} (83%)
diff mbox series

Patch

diff --git a/autotests/testWPA2/connection_test.py b/autotests/testWPA2/connection_test.py
index bf8831ea81db..2cbdf8e1b788 100644
--- a/autotests/testWPA2/connection_test.py
+++ b/autotests/testWPA2/connection_test.py
@@ -8,20 +8,19 @@  import iwd
 from iwd import IWD
 from iwd import PSKAgent
 from iwd import NetworkType
+from hostapd import HostapdCLI
 import testutil
 
 class Test(unittest.TestCase):
 
-    def test_connection_success(self):
-        wd = IWD()
-
+    def validate_connection_success(self, wd):
         psk_agent = PSKAgent("secret123")
         wd.register_psk_agent(psk_agent)
 
         devices = wd.list_devices(1)
         device = devices[0]
 
-        ordered_network = device.get_ordered_network('ssidCCMP')
+        ordered_network = device.get_ordered_network('ssidWPA2')
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
@@ -43,13 +42,32 @@  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):
+        self.hostapd.set_value('rsn_pairwise', 'GCMP')
+        self.hostapd.reload()
+        self.hostapd.wait_for_event("AP-ENABLED")
+        self.validate_connection_success(self.wd)
+
+    def setUp(self):
+        self.wd = IWD(True)
+
+    def tearDown(self):
+        self.wd.clear_storage()
+        self.wd = None
+
     @classmethod
     def setUpClass(cls):
-        pass
+        cls.hostapd = HostapdCLI(config='ssidWPA2.conf')
 
     @classmethod
     def tearDownClass(cls):
-        IWD.clear_storage()
+        pass
 
 if __name__ == '__main__':
     unittest.main(exit=True)
diff --git a/autotests/testWPA2/failure_test.py b/autotests/testWPA2/failure_test.py
index 605ee5dddc59..61cf6ade87b0 100644
--- a/autotests/testWPA2/failure_test.py
+++ b/autotests/testWPA2/failure_test.py
@@ -13,7 +13,7 @@  import testutil
 class Test(unittest.TestCase):
 
     def test_connection_success(self):
-        wd = IWD()
+        wd = IWD(True)
 
         psk_agent = PSKAgent("InvalidPassword")
         wd.register_psk_agent(psk_agent)
@@ -22,7 +22,7 @@  class Test(unittest.TestCase):
         self.assertIsNotNone(devices)
         device = devices[0]
 
-        ordered_network = device.get_ordered_network('ssidCCMP')
+        ordered_network = device.get_ordered_network('ssidWPA2')
 
         self.assertEqual(ordered_network.type, NetworkType.psk)
 
diff --git a/autotests/testWPA2/hw.conf b/autotests/testWPA2/hw.conf
index fad15b8823a3..51350f989552 100644
--- a/autotests/testWPA2/hw.conf
+++ b/autotests/testWPA2/hw.conf
@@ -1,5 +1,6 @@ 
 [SETUP]
 num_radios=2
+start_iwd=0
 
 [HOSTAPD]
-rad0=ssidCCMP.conf
+rad0=ssidWPA2.conf
diff --git a/autotests/testWPA2/password_test.py b/autotests/testWPA2/password_test.py
index d937d5c04cd8..1dbfce004c2e 100644
--- a/autotests/testWPA2/password_test.py
+++ b/autotests/testWPA2/password_test.py
@@ -13,7 +13,7 @@  import testutil
 class Test(unittest.TestCase):
 
     def test_connection_success(self):
-        wd = IWD()
+        wd = IWD(True)
 
         devices = wd.list_devices(1)
         device = devices[0]
@@ -22,7 +22,7 @@  class Test(unittest.TestCase):
         condition = 'obj.state == DeviceState.disconnected'
         wd.wait_for_object_condition(device, condition)
 
-        ordered_network = device.get_ordered_network("ssidCCMP")
+        ordered_network = device.get_ordered_network("ssidWPA2")
         self.assertEqual(ordered_network.type, NetworkType.psk)
         network = ordered_network.network_object
 
diff --git a/autotests/testWPA2/ssidCCMP.conf b/autotests/testWPA2/ssidWPA2.conf
similarity index 83%
rename from autotests/testWPA2/ssidCCMP.conf
rename to autotests/testWPA2/ssidWPA2.conf
index 074e82283e23..64fd77961f2c 100644
--- a/autotests/testWPA2/ssidCCMP.conf
+++ b/autotests/testWPA2/ssidWPA2.conf
@@ -1,6 +1,6 @@ 
 hw_mode=g
 channel=1
-ssid=ssidCCMP
+ssid=ssidWPA2
 
 wpa=2
 wpa_pairwise=CCMP