From: Tim Kourt <tim.a.kourt@linux.intel.com>
To: iwd@lists.01.org
Subject: [PATCH] auto-t: Test Agent ops
Date: Wed, 13 May 2020 16:20:04 -0700 [thread overview]
Message-ID: <20200513232004.30243-1-tim.a.kourt@linux.intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 4111 bytes --]
---
autotests/testAgent/agent_test.py | 100 ++++++++++++++++++++++++++++++++++++++
autotests/testAgent/hw.conf | 7 +++
autotests/testAgent/ssid1.conf | 7 +++
autotests/testAgent/ssid2.conf | 8 +++
4 files changed, 122 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..e1555c31
--- /dev/null
+++ b/autotests/testAgent/ssid2.conf
@@ -0,0 +1,8 @@
+hw_mode=g
+channel=1
+ssid=ssid2
+
+wpa=1
+wpa_pairwise=TKIP
+wpa_passphrase=secret_ssid2
+
--
2.13.6
reply other threads:[~2020-05-13 23:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200513232004.30243-1-tim.a.kourt@linux.intel.com \
--to=tim.a.kourt@linux.intel.com \
--cc=iwd@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox