From c65b2ec317417778b8533ddeef869b68cb73bd10 Mon Sep 17 00:00:00 2001 From: Andrew Zaborowski Date: Thu, 16 Jun 2022 02:02:26 +0200 Subject: [PATCH] auto-t: In testNetconfig add static IPv6, add comments 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 --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()