* Re: [PATCH v2] auto-t: Test Agent ops
2020-05-14 16:20 [PATCH v2] auto-t: Test Agent ops Tim Kourt
@ 2020-05-14 16:19 ` Denis Kenzior
0 siblings, 0 replies; 2+ messages in thread
From: Denis Kenzior @ 2020-05-14 16:19 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 592 bytes --]
Hi Tim,
On 5/14/20 11:20 AM, Tim Kourt wrote:
> ---
> autotests/testAgent/agent_test.py | 100 ++++++++++++++++++++++++++++++++++++++
> autotests/testAgent/hw.conf | 7 +++
> autotests/testAgent/ssid1.conf | 7 +++
> autotests/testAgent/ssid2.conf | 7 +++
> 4 files changed, 121 insertions(+)
> create mode 100644 autotests/testAgent/agent_test.py
> create mode 100644 autotests/testAgent/hw.conf
> create mode 100644 autotests/testAgent/ssid1.conf
> create mode 100644 autotests/testAgent/ssid2.conf
>
Applied, thanks.
Regards,
-Denis
^ permalink raw reply [flat|nested] 2+ messages in thread
* [PATCH v2] auto-t: Test Agent ops
@ 2020-05-14 16:20 Tim Kourt
2020-05-14 16:19 ` Denis Kenzior
0 siblings, 1 reply; 2+ messages in thread
From: Tim Kourt @ 2020-05-14 16:20 UTC (permalink / raw)
To: iwd
[-- Attachment #1: Type: text/plain, Size: 4108 bytes --]
---
autotests/testAgent/agent_test.py | 100 ++++++++++++++++++++++++++++++++++++++
autotests/testAgent/hw.conf | 7 +++
autotests/testAgent/ssid1.conf | 7 +++
autotests/testAgent/ssid2.conf | 7 +++
4 files changed, 121 insertions(+)
create mode 100644 autotests/testAgent/agent_test.py
create mode 100644 autotests/testAgent/hw.conf
create mode 100644 autotests/testAgent/ssid1.conf
create mode 100644 autotests/testAgent/ssid2.conf
diff --git a/autotests/testAgent/agent_test.py b/autotests/testAgent/agent_test.py
new file mode 100644
index 00000000..80d2ce83
--- /dev/null
+++ b/autotests/testAgent/agent_test.py
@@ -0,0 +1,100 @@
+#!/usr/bin/python3
+
+import unittest
+import sys
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+import testutil
+import subprocess
+
+class Test(unittest.TestCase):
+
+ def check_connection(self, wd, ssid):
+
+ device = wd.list_devices(1)[0]
+ ordered_network = device.get_ordered_network(ssid, scan_if_needed=True)
+
+ ordered_network.network_object.connect()
+
+ condition = 'obj.state == DeviceState.connected'
+ wd.wait_for_object_condition(device, condition)
+
+ condition = 'obj.connected_network is not None'
+ wd.wait_for_object_condition(device, condition)
+
+ testutil.test_iface_operstate(device.name)
+ device.disconnect()
+
+ condition = 'obj.state == DeviceState.disconnected'
+ wd.wait_for_object_condition(device, condition)
+
+ def test_connection_with_no_agent(self):
+
+ wd = IWD()
+
+ with self.assertRaises(iwd.NoAgentEx):
+ self.check_connection(wd, 'ssid1')
+
+ IWD.clear_storage()
+
+ def test_connection_with_own_agent(self):
+
+ wd = IWD()
+
+ psk_agent = PSKAgent("secret_ssid1")
+ wd.register_psk_agent(psk_agent)
+
+ self.check_connection(wd, 'ssid1')
+
+ wd.unregister_psk_agent(psk_agent)
+
+ IWD.clear_storage()
+
+ def test_connection_with_other_agent(self):
+ wd = IWD()
+
+ iwctl = subprocess.Popen(['iwctl', '-P', 'secret_ssid2'])
+ # Let iwctl to start and register its agent.
+ wd.wait(2)
+
+ self.check_connection(wd, 'ssid2')
+
+ iwctl.terminate()
+ iwctl.communicate()
+
+ IWD.clear_storage()
+
+ def test_connection_use_own_agent_from_multiple_registered(self):
+
+ wd = IWD()
+
+ iwctl = subprocess.Popen(['iwctl', '-P', 'secret_ssid2'])
+ # Let iwctl to start and register its agent.
+ wd.wait(2)
+
+ psk_agent = PSKAgent("secret_ssid1")
+ wd.register_psk_agent(psk_agent)
+
+ self.check_connection(wd, 'ssid1')
+
+ wd.unregister_psk_agent(psk_agent)
+
+ iwctl.terminate()
+ iwctl.communicate()
+
+ IWD.clear_storage()
+
+ @classmethod
+ def setUpClass(cls):
+ pass
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
diff --git a/autotests/testAgent/hw.conf b/autotests/testAgent/hw.conf
new file mode 100644
index 00000000..53249c9c
--- /dev/null
+++ b/autotests/testAgent/hw.conf
@@ -0,0 +1,7 @@
+[SETUP]
+num_radios=3
+max_test_exec_interval_sec=40
+
+[HOSTAPD]
+rad0=ssid1.conf
+rad1=ssid2.conf
diff --git a/autotests/testAgent/ssid1.conf b/autotests/testAgent/ssid1.conf
new file mode 100644
index 00000000..2416d53a
--- /dev/null
+++ b/autotests/testAgent/ssid1.conf
@@ -0,0 +1,7 @@
+hw_mode=g
+channel=1
+ssid=ssid1
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret_ssid1
diff --git a/autotests/testAgent/ssid2.conf b/autotests/testAgent/ssid2.conf
new file mode 100644
index 00000000..69b4f000
--- /dev/null
+++ b/autotests/testAgent/ssid2.conf
@@ -0,0 +1,7 @@
+hw_mode=g
+channel=1
+ssid=ssid2
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret_ssid2
--
2.13.6
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-05-14 16:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-14 16:20 [PATCH v2] auto-t: Test Agent ops Tim Kourt
2020-05-14 16:19 ` Denis Kenzior
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.