From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 13/13] auto-t: add AP test with DHCP server
Date: Tue, 20 Oct 2020 11:02:56 -0700 [thread overview]
Message-ID: <20201020180256.1630120-13-prestwoj@gmail.com> (raw)
In-Reply-To: <20201020180256.1630120-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 6142 bytes --]
---
autotests/testAP-DHCP/TestAP2.ap | 31 ++++++++++
autotests/testAP-DHCP/connection_test.py | 76 ++++++++++++++++++++++++
autotests/testAP-DHCP/failure_test.py | 53 +++++++++++++++++
autotests/testAP-DHCP/hw.conf | 3 +
autotests/testAP-DHCP/main.conf | 5 ++
5 files changed, 168 insertions(+)
create mode 100644 autotests/testAP-DHCP/TestAP2.ap
create mode 100644 autotests/testAP-DHCP/connection_test.py
create mode 100644 autotests/testAP-DHCP/failure_test.py
create mode 100644 autotests/testAP-DHCP/hw.conf
create mode 100644 autotests/testAP-DHCP/main.conf
diff --git a/autotests/testAP-DHCP/TestAP2.ap b/autotests/testAP-DHCP/TestAP2.ap
new file mode 100644
index 00000000..dc1a3579
--- /dev/null
+++ b/autotests/testAP-DHCP/TestAP2.ap
@@ -0,0 +1,31 @@
+[Security]
+Passphrase=Password2
+
+[IPv4]
+#
+# IP address of access point interface. If omitted the current interface IP
+# address will be used. If provided the IP will be changed to this address.
+#
+Address=192.168.1.1
+Netmask=255.255.255.0
+
+#
+# Gateway address for AP. If omitted [IPv4].Address will be used.
+#
+Gateway=192.168.1.1
+
+#
+# Optional list of DNS servers
+#
+DNSList=192.168.1.1,192.168.1.254
+
+#
+# Required IP range
+#
+IPRange=192.168.1.2,192.168.1.100
+
+#
+# Optional lease time. If omitted an infinite lease will be used.
+#
+LeaseTime=10
+
diff --git a/autotests/testAP-DHCP/connection_test.py b/autotests/testAP-DHCP/connection_test.py
new file mode 100644
index 00000000..8a79db6d
--- /dev/null
+++ b/autotests/testAP-DHCP/connection_test.py
@@ -0,0 +1,76 @@
+#! /usr/bin/python3
+
+import unittest
+import sys, os
+
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+import testutil
+
+class Test(unittest.TestCase):
+ def test_connection_success(self):
+
+ os.system('ls /tmp/iwd')
+ os.system('ls /tmp/iwd/ap')
+ wd = IWD(True)
+
+ dev1, dev2 = wd.list_devices(2)
+
+ dev1.start_ap('TestAP2')
+
+ try:
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(dev2, condition)
+ dev2.scan()
+ condition = 'obj.scanning'
+ wd.wait_for_object_condition(dev2, condition)
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(dev2, condition)
+
+ ordered_networks = dev2.get_ordered_networks()
+
+ networks = { n.name: n for n in ordered_networks }
+ 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()
+
+ @classmethod
+ def setUpClass(cls):
+ IWD.copy_to_ap('TestAP2.ap')
+ os.system('ls /tmp/iwd/ap')
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
diff --git a/autotests/testAP-DHCP/failure_test.py b/autotests/testAP-DHCP/failure_test.py
new file mode 100644
index 00000000..494fedda
--- /dev/null
+++ b/autotests/testAP-DHCP/failure_test.py
@@ -0,0 +1,53 @@
+#! /usr/bin/python3
+
+import unittest
+import sys, os
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+import testutil
+
+class Test(unittest.TestCase):
+ def test_connection_failure(self):
+ wd = IWD(True)
+
+ dev1, dev2 = wd.list_devices(2)
+
+ dev1.start_ap('TestAP2')
+
+ try:
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(dev2, condition)
+ dev2.scan()
+ condition = 'obj.scanning'
+ wd.wait_for_object_condition(dev2, condition)
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(dev2, condition)
+
+ ordered_networks = dev2.get_ordered_networks()
+ networks = { n.name: n for n in ordered_networks }
+ self.assertEqual(networks['TestAP2'].type, NetworkType.psk)
+
+ psk_agent = PSKAgent('InvalidPassword')
+ wd.register_psk_agent(psk_agent)
+
+ with self.assertRaises(iwd.FailedEx):
+ networks['TestAP2'].network_object.connect()
+
+ wd.unregister_psk_agent(psk_agent)
+ finally:
+ dev1.stop_ap()
+
+ @classmethod
+ def setUpClass(cls):
+ IWD.copy_to_ap('TestAP2.ap')
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
diff --git a/autotests/testAP-DHCP/hw.conf b/autotests/testAP-DHCP/hw.conf
new file mode 100644
index 00000000..c6553537
--- /dev/null
+++ b/autotests/testAP-DHCP/hw.conf
@@ -0,0 +1,3 @@
+[SETUP]
+num_radios=2
+start_iwd=0
diff --git a/autotests/testAP-DHCP/main.conf b/autotests/testAP-DHCP/main.conf
new file mode 100644
index 00000000..25ebe4ff
--- /dev/null
+++ b/autotests/testAP-DHCP/main.conf
@@ -0,0 +1,5 @@
+[Scan]
+DisableMacAddressRandomization=true
+
+[General]
+EnableNetworkConfiguration=true
--
2.26.2
next prev parent reply other threads:[~2020-10-20 18:02 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-20 18:02 [PATCH 01/13] auto-t: no hostapd instance graceful failure James Prestwood
2020-10-20 18:02 ` [PATCH 02/13] auto-t: add copy_to_ap utility James Prestwood
2020-10-20 18:02 ` [PATCH 03/13] auto-t: simplify copy_to_hotspot James Prestwood
2020-10-20 18:02 ` [PATCH 04/13] storage: allow NULL type on storage_network_ssid_from_path James Prestwood
2020-10-20 18:30 ` Denis Kenzior
2020-10-20 18:02 ` [PATCH 05/13] storage: add storage_get_ap_path James Prestwood
2020-10-20 18:02 ` [PATCH 06/13] ap: refactor AP to use provisioning files James Prestwood
2020-10-20 18:02 ` [PATCH 07/13] doc: update AP docs with new Start() arguments James Prestwood
2020-10-20 18:02 ` [PATCH 08/13] ap: remove 'psk' from Start() James Prestwood
2020-10-20 20:19 ` Andrew Zaborowski
2020-10-20 20:27 ` James Prestwood
2020-10-20 18:02 ` [PATCH 09/13] auto-t: update start_ap() to remove psk argument James Prestwood
2020-10-20 18:02 ` [PATCH 10/13] auto-t: update AP tests with provisioning files James Prestwood
2020-10-20 18:02 ` [PATCH 11/13] build: add ELL dhcp-util.c to build James Prestwood
2020-10-20 18:02 ` [PATCH 12/13] ap: add support for DHCPv4 server James Prestwood
2020-10-20 18:28 ` Denis Kenzior
2020-10-20 18:41 ` James Prestwood
2020-10-20 18:51 ` Denis Kenzior
2020-10-20 20:48 ` Andrew Zaborowski
2020-10-20 21:03 ` Denis Kenzior
2020-10-20 21:41 ` Andrew Zaborowski
2020-10-20 18:02 ` James Prestwood [this message]
2020-10-20 18:32 ` [PATCH 01/13] auto-t: no hostapd instance graceful failure Denis Kenzior
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=20201020180256.1630120-13-prestwoj@gmail.com \
--to=prestwoj@gmail.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 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.