From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 10/10] auto-t: add test for delayed ANQP response
Date: Tue, 02 Jun 2020 10:30:21 -0700 [thread overview]
Message-ID: <20200602173021.20085-11-prestwoj@gmail.com> (raw)
In-Reply-To: <20200602173021.20085-1-prestwoj@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 3021 bytes --]
---
autotests/testHotspot/anqp_delay_test.py | 83 ++++++++++++++++++++++++
1 file changed, 83 insertions(+)
create mode 100644 autotests/testHotspot/anqp_delay_test.py
diff --git a/autotests/testHotspot/anqp_delay_test.py b/autotests/testHotspot/anqp_delay_test.py
new file mode 100644
index 00000000..161b1a8e
--- /dev/null
+++ b/autotests/testHotspot/anqp_delay_test.py
@@ -0,0 +1,83 @@
+#!/usr/bin/python3
+
+import unittest
+import sys
+import os
+
+sys.path.append('../util')
+import iwd
+from iwd import IWD
+from iwd import PSKAgent
+from iwd import NetworkType
+from hostapd import HostapdCLI
+from hwsim import Hwsim
+import testutil
+from time import sleep
+
+class Test(unittest.TestCase):
+
+ def test_connection_success(self):
+ hwsim = Hwsim()
+
+ bss_radio = hwsim.get_radio('rad0')
+ rule0 = hwsim.rules.create()
+ rule0.source = bss_radio.addresses[0]
+ rule0.bidirectional = True
+ # Force the case where ANQP does not finish before Connect() comes in
+ rule0.delay = 100
+
+ wd = IWD(True, '/tmp')
+
+ hapd = HostapdCLI(config='ssidHotspot.conf')
+
+ psk_agent = PSKAgent('abc', ('domain\\user', 'testpasswd'))
+ wd.register_psk_agent(psk_agent)
+
+ devices = wd.list_devices(1)
+ device = devices[0]
+
+ # We are dependent on a periodic scan here. We want to wait for this
+ # because this is the first opportunity IWD has to do ANQP. Once ANQP
+ # has been done once the network is set up and we cannot simulate the
+ # 'Connect() before ANQP' race condition anymore.
+ condition = 'obj.scanning'
+ wd.wait_for_object_condition(device, condition)
+
+ condition = 'not obj.scanning'
+ wd.wait_for_object_condition(device, condition)
+
+ ordered_network = device.get_ordered_network('Hotspot')
+
+ self.assertEqual(ordered_network.type, NetworkType.eap)
+
+ condition = 'not obj.connected'
+ wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+ ordered_network.network_object.connect()
+
+ condition = 'obj.connected'
+ wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+ testutil.test_iface_operstate()
+ testutil.test_ifaces_connected(device.name, hapd.ifname)
+
+ device.disconnect()
+
+ condition = 'not obj.connected'
+ wd.wait_for_object_condition(ordered_network.network_object, condition)
+
+ wd.unregister_psk_agent(psk_agent)
+
+ @classmethod
+ def setUpClass(cls):
+ IWD.copy_to_hotspot('example.conf')
+ conf = '[General]\nDisableANQP=0\n'
+ os.system('echo "%s" > /tmp/main.conf' % conf)
+
+ @classmethod
+ def tearDownClass(cls):
+ IWD.clear_storage()
+ os.remove('/tmp/main.conf')
+
+if __name__ == '__main__':
+ unittest.main(exit=True)
--
2.21.1
prev parent reply other threads:[~2020-06-02 17:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-02 17:30 [PATCH 00/10] ANQP Refactor to use frame-xchg James Prestwood
2020-06-02 17:30 ` [PATCH 01/10] frame-xchg: fix bug when starting new xchg from callback James Prestwood
2020-06-02 17:30 ` [PATCH 02/10] frame-xchg: Fix frame_watch_remove_by_handler for group 0 James Prestwood
2020-06-02 17:30 ` [PATCH 03/10] frame-xchg: Use frame_watch_group_match in frame_watch_group_get James Prestwood
2020-06-02 17:30 ` [PATCH 04/10] anqp: refactor to use frame-xchg James Prestwood
2020-06-02 17:30 ` [PATCH 05/10] station: add ANQP state watch API James Prestwood
2020-06-02 17:30 ` [PATCH 06/10] network: delay connect if ANQP has not completed James Prestwood
2020-06-02 17:30 ` [PATCH 07/10] hwsim: add new 'Delay' property to Rules James Prestwood
2020-06-08 20:15 ` Denis Kenzior
2020-06-02 17:30 ` [PATCH 08/10] doc: document new 'Delay' property for hwsim Rules James Prestwood
2020-06-02 17:30 ` [PATCH 09/10] auto-t: add 'Delay' property to hwsim python module James Prestwood
2020-06-02 17:30 ` James Prestwood [this message]
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=20200602173021.20085-11-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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox