Wireless Daemon for Linux
 help / color / mirror / Atom feed
* [PATCH 1/7] auto-t: iwd.py: add DPP properties
@ 2022-06-30 18:03 James Prestwood
  2022-06-30 18:03 ` [PATCH 2/7] auto-t: add client test to testKnownNetworks James Prestwood
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

---
 autotests/util/iwd.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/autotests/util/iwd.py b/autotests/util/iwd.py
index 5591d7e1..df310a32 100755
--- a/autotests/util/iwd.py
+++ b/autotests/util/iwd.py
@@ -294,6 +294,18 @@ class DeviceProvisioning(IWDDBusAbstract):
     def stop(self):
         self._iface.Stop()
 
+    @property
+    def uri(self):
+        return self._properties['URI']
+
+    @property
+    def started(self):
+        return self._properties['Started']
+
+    @property
+    def role(self):
+        return self._properties['Role']
+
 class Device(IWDDBusAbstract):
     '''
         Class represents a network device object: net.connman.iwd.Device
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/7] auto-t: add client test to testKnownNetworks
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
@ 2022-06-30 18:03 ` James Prestwood
  2022-06-30 18:03 ` [PATCH 3/7] auto-t: add client test to testEAP-WPS James Prestwood
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Tests iwctl functionality with known-networks command
---
 .../testKnownNetworks/known_network_test.py   | 23 +++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/autotests/testKnownNetworks/known_network_test.py b/autotests/testKnownNetworks/known_network_test.py
index 2bdcc955..a383e5ff 100644
--- a/autotests/testKnownNetworks/known_network_test.py
+++ b/autotests/testKnownNetworks/known_network_test.py
@@ -2,10 +2,11 @@
 
 import unittest
 import sys
+import subprocess
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
+from config import ctx
 
 class Test(unittest.TestCase):
 
@@ -70,8 +71,26 @@ class Test(unittest.TestCase):
 
         self.list_removal_and_addition(wd)
 
+    def test_client_known_networks(self):
+        networks = ['Hotspot Network', 'ssidOpen', 'ssidTKIP', 'ssidEAP-TLS']
+        wd = IWD(True)
+
+        iwctl = ctx.start_process(['iwctl', 'known-networks', 'list'], check=True)
+
+        for n in networks:
+            self.assertIn(n, iwctl.out)
+
+        for n in networks:
+            ctx.start_process(['iwctl', 'known-networks', n, 'show'], check=True)
+
+        networks.remove('ssidOpen')
+        ctx.start_process(['iwctl', 'known-networks', 'ssidOpen', 'forget'], check=True)
+
+        with self.assertRaises(subprocess.CalledProcessError):
+            ctx.start_process(['iwctl', 'known-networks', 'ssidOpen', 'show'], check=True)
+
     @classmethod
-    def setUpClass(cls):
+    def setUp(self):
         IWD.copy_to_storage('known_networks/ssidOpen.open')
         IWD.copy_to_storage('known_networks/ssidTKIP.psk')
         IWD.copy_to_storage('known_networks/ssidEAP-TLS.8021x')
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/7] auto-t: add client test to testEAP-WPS
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
  2022-06-30 18:03 ` [PATCH 2/7] auto-t: add client test to testKnownNetworks James Prestwood
@ 2022-06-30 18:03 ` James Prestwood
  2022-06-30 18:03 ` [PATCH 4/7] auto-t: add client test to testAdHoc James Prestwood
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Tests iwctl functionality with wsc commands
---
 autotests/testEAP-WPS/four_digit_pin_test.py | 16 +++++++++++-----
 autotests/testEAP-WPS/push_button_test.py    | 17 ++++++++++++-----
 2 files changed, 23 insertions(+), 10 deletions(-)

diff --git a/autotests/testEAP-WPS/four_digit_pin_test.py b/autotests/testEAP-WPS/four_digit_pin_test.py
index 7bdb57cb..d30492fb 100644
--- a/autotests/testEAP-WPS/four_digit_pin_test.py
+++ b/autotests/testEAP-WPS/four_digit_pin_test.py
@@ -4,22 +4,23 @@ import unittest
 import sys
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
-from iwd import DeviceState
-
 from hostapd import HostapdCLI
+from config import ctx
 
 class Test(unittest.TestCase):
 
-    def four_digit_pin_success(self, wd):
+    def four_digit_pin_success(self, wd, client=False):
 
         devices = wd.list_devices(1)
         device = devices[0]
         pin = '1234'
         self.hostapd.wps_pin(pin)
 
-        device.wps_start_pin(pin)
+        if not client:
+            device.wps_start_pin(pin)
+        else:
+            ctx.start_process(['iwctl', 'wsc', device.name, 'start-user-pin', pin], check=True)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -36,6 +37,11 @@ class Test(unittest.TestCase):
 
         self.four_digit_pin_success(wd)
 
+    def test_client_four_digit_pin(self):
+        wd = IWD(True)
+
+        self.four_digit_pin_success(wd, client=True)
+
     @classmethod
     def setUpClass(cls):
         cls.hostapd = HostapdCLI(config='ssidWPS.conf')
diff --git a/autotests/testEAP-WPS/push_button_test.py b/autotests/testEAP-WPS/push_button_test.py
index 08463f15..e2b4c2b2 100644
--- a/autotests/testEAP-WPS/push_button_test.py
+++ b/autotests/testEAP-WPS/push_button_test.py
@@ -4,20 +4,22 @@ import unittest
 import sys
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
-from iwd import DeviceState
-
 from hostapd import HostapdCLI
+from config import ctx
+
 class Test(unittest.TestCase):
 
-    def push_button_success(self, wd):
+    def push_button_success(self, wd, client=False):
         self.hostapd.wps_push_button()
 
         devices = wd.list_devices(1)
         device = devices[0]
 
-        device.wps_push_button()
+        if not client:
+            device.wps_push_button()
+        else:
+            ctx.start_process(['iwctl', 'wsc', device.name, 'push-button'], check=True)
 
         condition = 'obj.state == DeviceState.connected'
         wd.wait_for_object_condition(device, condition)
@@ -34,6 +36,11 @@ class Test(unittest.TestCase):
 
         self.push_button_success(wd)
 
+    def test_client_push_button(self):
+        wd = IWD(True)
+
+        self.push_button_success(wd, client=True)
+
     @classmethod
     def setUpClass(cls):
         cls.hostapd = HostapdCLI(config='ssidWPS.conf')
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/7] auto-t: add client test to testAdHoc
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
  2022-06-30 18:03 ` [PATCH 2/7] auto-t: add client test to testKnownNetworks James Prestwood
  2022-06-30 18:03 ` [PATCH 3/7] auto-t: add client test to testEAP-WPS James Prestwood
@ 2022-06-30 18:03 ` James Prestwood
  2022-06-30 18:03 ` [PATCH 5/7] auto-t: add client test to testDPP James Prestwood
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Tests iwctl functionality with ad-hoc commands
---
 autotests/testAdHoc/adhoc_test.py | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/autotests/testAdHoc/adhoc_test.py b/autotests/testAdHoc/adhoc_test.py
index 13c0c016..4c5d5023 100644
--- a/autotests/testAdHoc/adhoc_test.py
+++ b/autotests/testAdHoc/adhoc_test.py
@@ -2,16 +2,16 @@
 
 import unittest
 import sys
-import time
 
 sys.path.append('../util')
-import iwd
 from iwd import IWD
+from iwd import AdHocDevice
+from config import ctx
 import testutil
 
 class Test(unittest.TestCase):
 
-    def validate_connection(self, wd):
+    def validate_connection(self, wd, client=False):
         dev1, dev2 = wd.list_devices(2)
 
         self.assertIsNotNone(dev1)
@@ -22,7 +22,14 @@ class Test(unittest.TestCase):
         condition = 'obj.started == True'
         wd.wait_for_object_condition(adhoc1, condition)
 
-        adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
+        if not client:
+            adhoc2 = dev2.start_adhoc("AdHocNetwork", "secret123")
+        else:
+            ctx.start_process(['iwctl', 'device', dev2.name, 'set-property',
+                                'Mode', 'ad-hoc'], check=True)
+            ctx.start_process(['iwctl', 'ad-hoc', dev2.name, 'start',
+                                'AdHocNetwork', 'secret123'], check=True)
+            adhoc2 = AdHocDevice(dev2.device_path)
 
         condition = 'obj.started == True'
         wd.wait_for_object_condition(adhoc1, condition)
@@ -42,6 +49,10 @@ class Test(unittest.TestCase):
 
         self.validate_connection(wd)
 
+    def test_client_adhoc(self):
+        wd = IWD(True)
+        self.validate_connection(wd, client=True)
+
     @classmethod
     def setUpClass(cls):
         pass
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/7] auto-t: add client test to testDPP
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
                   ` (2 preceding siblings ...)
  2022-06-30 18:03 ` [PATCH 4/7] auto-t: add client test to testAdHoc James Prestwood
@ 2022-06-30 18:03 ` James Prestwood
  2022-06-30 18:03 ` [PATCH 6/7] auto-t: refactor testAP to reuse code James Prestwood
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Tests iwctl functionality with dpp commands
---
 autotests/testDPP/connection_test.py | 34 ++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/autotests/testDPP/connection_test.py b/autotests/testDPP/connection_test.py
index 0f9b8f1c..0cab5ff1 100644
--- a/autotests/testDPP/connection_test.py
+++ b/autotests/testDPP/connection_test.py
@@ -5,9 +5,11 @@ import sys
 
 sys.path.append('../util')
 from iwd import IWD
+from iwd import DeviceProvisioning
 from wpas import Wpas
 from hostapd import HostapdCLI
 from hwsim import Hwsim
+from config import ctx
 
 class Test(unittest.TestCase):
     def test_iwd_as_enrollee(self):
@@ -98,6 +100,38 @@ class Test(unittest.TestCase):
 
         self.wpas.wait_for_event('DPP-CONF-RECEIVED', timeout=30)
 
+    def test_client_as_configurator(self):
+        self.hapd.reload()
+        self.hapd.wait_for_event('AP-ENABLED')
+
+        IWD.copy_to_storage('ssidCCMP.psk')
+        self.device.autoconnect = True
+
+        condition = 'obj.state == DeviceState.connected'
+        self.wd.wait_for_object_condition(self.device, condition)
+
+        ctx.start_process(['iwctl', 'dpp', self.device.name, 'start-configurator'], check=True)
+
+        dpp = DeviceProvisioning(self.device.device_path)
+
+        self.wpas.dpp_enrollee_start(dpp.uri)
+
+        self.wpas.wait_for_event('DPP-CONF-RECEIVED', timeout=30)
+
+    def test_client_as_enrollee(self):
+        self.device.autoconnect = True
+        self.hapd.reload()
+
+        ctx.start_process(['iwctl', 'dpp', self.device.name, 'start-enrollee'], check=True)
+
+        dpp = DeviceProvisioning(self.device.device_path)
+
+        self.wpas.dpp_configurator_create(dpp.uri)
+        self.wpas.dpp_configurator_start('ssidCCMP', 'secret123')
+
+        condition = 'obj.state == DeviceState.connected'
+        self.wd.wait_for_object_condition(self.device, condition)
+
     def setUp(self):
         self.wpas = Wpas('wpas.conf')
         self.wd = IWD(True)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 6/7] auto-t: refactor testAP to reuse code
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
                   ` (3 preceding siblings ...)
  2022-06-30 18:03 ` [PATCH 5/7] auto-t: add client test to testDPP James Prestwood
@ 2022-06-30 18:03 ` James Prestwood
  2022-06-30 18:03 ` [PATCH 7/7] auto-t: add client test to testAP James Prestwood
  2022-06-30 18:38 ` [PATCH 1/7] auto-t: iwd.py: add DPP properties Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

All the AP tests were basically doing the same validation. Refactor
this code into validation.py and import that into the tests.
---
 autotests/testAP/connection_test.py  | 74 ++--------------------------
 autotests/testAP/dhcp_config_test.py | 49 ++----------------
 autotests/testAP/dhcp_test.py        | 69 +++++++++-----------------
 autotests/testAP/validation.py       | 71 ++++++++++++++++++++++++++
 4 files changed, 102 insertions(+), 161 deletions(-)
 create mode 100644 autotests/testAP/validation.py

diff --git a/autotests/testAP/connection_test.py b/autotests/testAP/connection_test.py
index 02213947..273c333c 100644
--- a/autotests/testAP/connection_test.py
+++ b/autotests/testAP/connection_test.py
@@ -1,90 +1,24 @@
 #! /usr/bin/python3
 
 import unittest
-import sys, os
 
-import iwd
 from iwd import IWD
-from iwd import PSKAgent
-from iwd import NetworkType
-from hostapd import HostapdCLI
-import testutil
+from validation import validate, client_connect
 
 class Test(unittest.TestCase):
-
-    def client_connect(self, wd, dev):
-        hostapd = HostapdCLI(config='psk-ccmp.conf')
-
-        ordered_network = dev.get_ordered_network('TestAP1')
-
-        self.assertEqual(ordered_network.type, NetworkType.psk)
-
-        psk_agent = PSKAgent('Password1')
-        wd.register_psk_agent(psk_agent)
-
-        ordered_network.network_object.connect()
-
-        condition = 'obj.state == DeviceState.connected'
-        wd.wait_for_object_condition(dev, condition)
-
-        wd.unregister_psk_agent(psk_agent)
-
-        testutil.test_iface_operstate(dev.name)
-        testutil.test_ifaces_connected(hostapd.ifname, dev.name)
-
-        dev.disconnect()
-
-        condition = 'not obj.connected'
-        wd.wait_for_object_condition(ordered_network.network_object, condition)
-
     def test_connection_success(self):
         wd = IWD(True)
 
         dev1, dev2 = wd.list_devices(2)
 
-        self.client_connect(wd, dev1)
+        client_connect(wd, dev1, 'TestAP1')
 
         dev1.start_ap('TestAP2', 'Password2')
 
-        try:
-            networks = {}
-            networks['TestAP1'] = dev2.get_ordered_network('TestAP1', full_scan=True)
-            networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
-
-            self.assertEqual(networks['TestAP1'].type, NetworkType.psk)
-            self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
-
-            psk_agent = PSKAgent('Password2')
-            wd.register_psk_agent(psk_agent)
-
-            try:
-                dev2.disconnect()
-
-                condition = 'not obj.connected'
-                wd.wait_for_object_condition(dev2, condition)
-            except:
-                pass
-
-            networks['TestAP2'].network_object.connect()
-
-            condition = 'obj.state == DeviceState.connected'
-            wd.wait_for_object_condition(dev2, condition)
-
-            testutil.test_iface_operstate(dev2.name)
-            testutil.test_ifaces_connected(dev1.name, dev2.name, group=False)
-
-            wd.unregister_psk_agent(psk_agent)
-
-            dev2.disconnect()
-
-            condition = 'not obj.connected'
-            wd.wait_for_object_condition(networks['TestAP2'].network_object,
-                                         condition)
-        finally:
-            dev1.stop_ap()
+        validate(wd, dev2, dev1, 'TestAP2', 'Password2')
 
         # Finally test dev1 can go to client mode and connect again
-        self.client_connect(wd, dev1)
+        client_connect(wd, dev1, 'TestAP1')
 
     @classmethod
     def setUpClass(cls):
diff --git a/autotests/testAP/dhcp_config_test.py b/autotests/testAP/dhcp_config_test.py
index ac3a95ba..2c75d071 100644
--- a/autotests/testAP/dhcp_config_test.py
+++ b/autotests/testAP/dhcp_config_test.py
@@ -1,14 +1,10 @@
 #! /usr/bin/python3
 
 import unittest
-import sys, os
 
-import iwd
 from iwd import IWD
-from iwd import PSKAgent
-from iwd import NetworkType
 from config import ctx
-import testutil
+from validation import validate
 
 class Test(unittest.TestCase):
     def test_connection_success(self):
@@ -28,47 +24,8 @@ class Test(unittest.TestCase):
 
         dev1.start_ap('APConfig')
 
-        try:
-            networks = {}
-            networks['APConfig'] = dev2.get_ordered_network('APConfig', full_scan=True)
-
-            self.assertEqual(networks['APConfig'].type, NetworkType.psk)
-
-            psk_agent = PSKAgent('password123')
-            wd.register_psk_agent(psk_agent)
-
-            try:
-                dev2.disconnect()
-
-                condition = 'not obj.connected'
-                wd.wait_for_object_condition(dev2, condition)
-            except:
-                pass
-
-            networks['APConfig'].network_object.connect()
-
-            condition = 'obj.state == DeviceState.connected'
-            wd.wait_for_object_condition(dev2, condition)
-
-            testutil.test_iface_operstate(dev2.name)
-            #
-            # TODO: cannot yet check the AP interface IP since its in a
-            #       different namespace.
-            #
-            testutil.test_ip_address_match(dev2.name, "192.168.1.3")
-
-            testutil.test_ip_connected(('192.168.1.3', ctx), ('192.168.1.1', ns0))
-
-            wd.unregister_psk_agent(psk_agent)
-
-            dev2.disconnect()
-
-            condition = 'not obj.connected'
-            wd.wait_for_object_condition(networks['APConfig'].network_object,
-                                         condition)
-
-        finally:
-            dev1.stop_ap()
+        validate(wd, dev2, dev1, 'APConfig', 'password123',
+                    sta_ip_info=('192.168.1.3', ctx), ap_ip_info=('192.168.1.1', ns0))
 
     @classmethod
     def setUpClass(cls):
diff --git a/autotests/testAP/dhcp_test.py b/autotests/testAP/dhcp_test.py
index a8f89eb0..aa50fdb4 100644
--- a/autotests/testAP/dhcp_test.py
+++ b/autotests/testAP/dhcp_test.py
@@ -10,6 +10,8 @@ from iwd import NetworkType
 from config import ctx
 import testutil
 
+from validation import validate
+
 class Test(unittest.TestCase):
     def test_connection_success(self):
         wd = IWD(True, '/tmp/dhcp')
@@ -25,59 +27,36 @@ class Test(unittest.TestCase):
         with self.assertRaises(iwd.AlreadyExistsEx):
             dev4.start_ap('TestAP4', 'Password4')
 
-        try:
-            networks = {}
-            networks['TestAP2'] = dev2.get_ordered_network('TestAP2', full_scan=True)
-
-            self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
-
-            psk_agent = PSKAgent('Password2')
-            wd.register_psk_agent(psk_agent)
-
-            try:
-                dev2.disconnect()
-
-                condition = 'not obj.connected'
-                wd.wait_for_object_condition(dev2, condition)
-            except:
-                pass
+        validate(wd, dev2, dev1, 'TestAP2', 'Password2', ip_checks=False)
 
-            networks['TestAP2'].network_object.connect()
+        network = dev2.get_ordered_network('TestAP2', full_scan=True)
 
-            condition = 'obj.state == DeviceState.connected'
-            wd.wait_for_object_condition(dev2, condition)
-
-            testutil.test_iface_operstate(dev2.name)
-            testutil.test_ifaces_connected(dev1.name, dev2.name, group=False)
-
-            try:
-                testutil.test_ip_address_match(dev1.name, "192.168.80.1")
-                testutil.test_ip_address_match(dev2.name, "192.168.80.2")
-                ip = "192.168.80.1"
-            except:
-                testutil.test_ip_address_match(dev1.name, "192.168.80.17")
-                testutil.test_ip_address_match(dev2.name, "192.168.80.18")
-                ip = "192.168.80.17"
-
-            wd.unregister_psk_agent(psk_agent)
+        try:
+            testutil.test_ip_address_match(dev1.name, "192.168.80.1")
+            testutil.test_ip_address_match(dev2.name, "192.168.80.2")
+            ip = "192.168.80.1"
+        except:
+            testutil.test_ip_address_match(dev1.name, "192.168.80.17")
+            testutil.test_ip_address_match(dev2.name, "192.168.80.18")
+            ip = "192.168.80.17"
 
-            dev2.disconnect()
+        dev2.disconnect()
 
-            condition = 'not obj.connected'
-            wd.wait_for_object_condition(networks['TestAP2'].network_object,
-                                         condition)
+        condition = 'not obj.connected'
+        wd.wait_for_object_condition(network.network_object, condition)
 
-            # This should release the IP */
-            dev1.stop_ap()
+        # This should release the IP */
+        dev1.stop_ap()
 
-            # This should now succeed and the IP should match the old IP dev1
-            # got initially.
-            dev4.start_ap('TestAP4', 'Password4')
+        # This should now succeed and the IP should match the old IP dev1
+        # got initially.
+        dev4.start_ap('TestAP4', 'Password4')
 
-            testutil.test_ip_address_match(dev4.name, ip)
+        testutil.test_ip_address_match(dev4.name, ip)
 
-        finally:
-            dev1.stop_ap()
+        dev1.stop_ap()
+        dev3.stop_ap()
+        dev4.stop_ap()
 
     @classmethod
     def setUpClass(cls):
diff --git a/autotests/testAP/validation.py b/autotests/testAP/validation.py
new file mode 100644
index 00000000..b1b867ef
--- /dev/null
+++ b/autotests/testAP/validation.py
@@ -0,0 +1,71 @@
+from iwd import PSKAgent
+from iwd import NetworkType
+from hostapd import HostapdCLI
+import testutil
+
+def validate(wd, sta_dev, ap_dev, ssid, passphrase,
+                sta_ip_info=None, ap_ip_info=None, ip_checks=True):
+    try:
+        network = sta_dev.get_ordered_network(ssid, full_scan=True)
+
+        if network.type != NetworkType.psk:
+            raise Exception("Network type mismatch")
+
+        psk_agent = PSKAgent(passphrase)
+        wd.register_psk_agent(psk_agent)
+
+        network.network_object.connect()
+
+        condition = 'obj.state == DeviceState.connected'
+        wd.wait_for_object_condition(sta_dev, condition)
+
+        testutil.test_iface_operstate(sta_dev.name)
+
+        # This implies separate namespaces so the iface names won't exist
+        if not sta_ip_info or not ap_ip_info:
+            testutil.test_ifaces_connected(ap_dev.name, sta_dev.name, group=False)
+
+        if not ip_checks:
+            return
+
+        if sta_ip_info:
+            testutil.test_ip_address_match(sta_dev.name, sta_ip_info[0])
+
+        if sta_ip_info and ap_ip_info:
+            testutil.test_ip_connected(sta_ip_info, ap_ip_info)
+
+        wd.unregister_psk_agent(psk_agent)
+
+        sta_dev.disconnect()
+
+        condition = 'not obj.connected'
+        wd.wait_for_object_condition(network.network_object, condition)
+    finally:
+        if ip_checks:
+            ap_dev.stop_ap()
+
+def client_connect(wd, dev, ssid):
+    hostapd = HostapdCLI(config='psk-ccmp.conf')
+
+    ordered_network = dev.get_ordered_network(ssid)
+
+    if ordered_network.type != NetworkType.psk:
+        raise Exception("Network type mismatch")
+
+    psk_agent = PSKAgent('Password1')
+    wd.register_psk_agent(psk_agent)
+
+    ordered_network.network_object.connect()
+
+    condition = 'obj.state == DeviceState.connected'
+    wd.wait_for_object_condition(dev, condition)
+
+    wd.unregister_psk_agent(psk_agent)
+
+    testutil.test_iface_operstate(dev.name)
+    testutil.test_ifaces_connected(hostapd.ifname, dev.name)
+
+    dev.disconnect()
+
+    condition = 'not obj.connected'
+    wd.wait_for_object_condition(ordered_network.network_object, condition)
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 7/7] auto-t: add client test to testAP
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
                   ` (4 preceding siblings ...)
  2022-06-30 18:03 ` [PATCH 6/7] auto-t: refactor testAP to reuse code James Prestwood
@ 2022-06-30 18:03 ` James Prestwood
  2022-06-30 18:38 ` [PATCH 1/7] auto-t: iwd.py: add DPP properties Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: James Prestwood @ 2022-06-30 18:03 UTC (permalink / raw)
  To: iwd; +Cc: James Prestwood

Tests iwctl functionality with ap commands
---
 autotests/testAP/connection_test.py | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/autotests/testAP/connection_test.py b/autotests/testAP/connection_test.py
index 273c333c..dff415e7 100644
--- a/autotests/testAP/connection_test.py
+++ b/autotests/testAP/connection_test.py
@@ -3,6 +3,7 @@
 import unittest
 
 from iwd import IWD
+from config import ctx
 from validation import validate, client_connect
 
 class Test(unittest.TestCase):
@@ -20,6 +21,24 @@ class Test(unittest.TestCase):
         # Finally test dev1 can go to client mode and connect again
         client_connect(wd, dev1, 'TestAP1')
 
+    def test_client_start_ap(self):
+        wd = IWD(True)
+
+        dev1, dev2 = wd.list_devices(2)
+
+        ctx.start_process(['iwctl', 'device', dev1.name, 'set-property', 'Mode', 'ap'], check=True)
+        ctx.start_process(['iwctl', 'ap', dev1.name, 'start', 'TestAP2', 'Password2'], check=True)
+
+        iwctl = ctx.start_process(['iwctl', 'ap', 'list'], check=True)
+
+        self.assertIn(dev1.name, iwctl.out)
+
+        iwctl = ctx.start_process(['iwctl', 'ap', dev1.name, 'show'], check=True)
+
+        self.assertIn('TestAP2', iwctl.out)
+
+        validate(wd, dev2, dev1, 'TestAP2', 'Password2')
+
     @classmethod
     def setUpClass(cls):
         IWD.copy_to_storage('TestAP1.psk')
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/7] auto-t: iwd.py: add DPP properties
  2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
                   ` (5 preceding siblings ...)
  2022-06-30 18:03 ` [PATCH 7/7] auto-t: add client test to testAP James Prestwood
@ 2022-06-30 18:38 ` Denis Kenzior
  6 siblings, 0 replies; 8+ messages in thread
From: Denis Kenzior @ 2022-06-30 18:38 UTC (permalink / raw)
  To: James Prestwood, iwd

Hi James,

On 6/30/22 13:03, James Prestwood wrote:
> ---
>   autotests/util/iwd.py | 12 ++++++++++++
>   1 file changed, 12 insertions(+)
> 

all applied, thanks.

Regards,
-Denis


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-06-30 18:44 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-30 18:03 [PATCH 1/7] auto-t: iwd.py: add DPP properties James Prestwood
2022-06-30 18:03 ` [PATCH 2/7] auto-t: add client test to testKnownNetworks James Prestwood
2022-06-30 18:03 ` [PATCH 3/7] auto-t: add client test to testEAP-WPS James Prestwood
2022-06-30 18:03 ` [PATCH 4/7] auto-t: add client test to testAdHoc James Prestwood
2022-06-30 18:03 ` [PATCH 5/7] auto-t: add client test to testDPP James Prestwood
2022-06-30 18:03 ` [PATCH 6/7] auto-t: refactor testAP to reuse code James Prestwood
2022-06-30 18:03 ` [PATCH 7/7] auto-t: add client test to testAP James Prestwood
2022-06-30 18:38 ` [PATCH 1/7] auto-t: iwd.py: add DPP properties Denis Kenzior

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox