diff mbox series

[10/15] autotests: In testNetconfig add static IPv6, add comments

Message ID 20220616000231.1966008-10-andrew.zaborowski@intel.com (mailing list archive)
State Accepted, archived
Headers show
Series [01/15] netconfig: Fix address format validation | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
prestwoj/iwd-ci-gitlint success GitLint

Commit Message

Andrew Zaborowski June 16, 2022, 12:02 a.m. UTC
In static_test.py add IPv6.  Add comments on what we're actually testing
since it wasn't very clear.  After the expected ACD conflict detection,
succeed if either the lost address was removed or the client disconnected
from the AP since this seems like a correct action for netconfig to
implement.
---
 autotests/testNetconfig/ssidTKIP.psk   |  7 +++++++
 autotests/testNetconfig/static_test.py | 11 ++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/autotests/testNetconfig/ssidTKIP.psk b/autotests/testNetconfig/ssidTKIP.psk
index eea59cda..72a71ce9 100644
--- a/autotests/testNetconfig/ssidTKIP.psk
+++ b/autotests/testNetconfig/ssidTKIP.psk
@@ -1,7 +1,14 @@ 
 [IPv4]
+# Use a different netmask than DHCP on purpose, but use the same address
+# as DHCP would assign us to produce a conflict and test ACD
 Address=192.168.1.10
 Netmask=255.255.255.128
 Gateway=192.168.1.1
 
+[IPv6]
+# Use a different subnet than DHCP on purpose
+Address=3ffe:501:ffff:200::10/80
+Gateway=3ffe:501:ffff:200::1
+
 [Settings]
 AutoConnect=false
diff --git a/autotests/testNetconfig/static_test.py b/autotests/testNetconfig/static_test.py
index 8d5710c1..a3b294a2 100644
--- a/autotests/testNetconfig/static_test.py
+++ b/autotests/testNetconfig/static_test.py
@@ -16,6 +16,7 @@  import os
 class Test(unittest.TestCase):
 
     def test_connection_success(self):
+        # Use a non-default storage_dir for one of the instances, the default for the other one
         wd = IWD(True, iwd_storage_dir='/tmp/storage')
 
         ns0 = ctx.get_namespace('ns0')
@@ -46,19 +47,27 @@  class Test(unittest.TestCase):
         testutil.test_ifaces_connected()
 
         testutil.test_ip_address_match(dev1.name, '192.168.1.10', 25)
+        testutil.test_ip_address_match(dev1.name, '3ffe:501:ffff:200::10', 80)
 
         ordered_network = dev2.get_ordered_network('ssidTKIP')
 
         condition = 'not obj.connected'
         wd_ns0.wait_for_object_condition(ordered_network.network_object, condition)
 
+        # Connect to the same network from a dynamically configured client.  The
+        # DHCP server doesn't know (even though dev1 announced itself) that
+        # 192.168.1.10 is already in use and if it assigns dev2 the lowest
+        # available address, that's going to be 192.168.1.10.  dev1's ACD
+        # implementation should then stop using this address.
         ordered_network.network_object.connect()
 
         condition = 'obj.state == DeviceState.connected'
         wd_ns0.wait_for_object_condition(dev2, condition)
 
         wd.wait(1)
-        testutil.test_ip_address_match(dev1.name, None)
+        # Check dev1 is now disconnected or without its IPv4 address
+        if dev1.state == iwd.DeviceState.connected:
+            testutil.test_ip_address_match(dev1.name, None)
 
         dev1.disconnect()
         dev2.disconnect()