From dc7d3c5fd4cfba5f467457c248bc722faad2789d Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Fri, 6 Dec 2019 23:29:28 +0900 Subject: [PATCH] test-network: add test case for IPv4 DAD --- .../conf/25-address-dad-veth-peer.network | 9 +++++++++ .../conf/25-address-dad-veth99.network | 8 ++++++++ test/test-network/systemd-networkd-tests.py | 16 ++++++++++++++++ 3 files changed, 33 insertions(+) create mode 100644 test/test-network/conf/25-address-dad-veth-peer.network create mode 100644 test/test-network/conf/25-address-dad-veth99.network diff --git a/test/test-network/conf/25-address-dad-veth-peer.network b/test/test-network/conf/25-address-dad-veth-peer.network new file mode 100644 index 00000000000..2827a751af8 --- /dev/null +++ b/test/test-network/conf/25-address-dad-veth-peer.network @@ -0,0 +1,9 @@ +[Match] +Name=veth-peer + +[Network] +IPv6AcceptRA=no + +[Address] +Address=192.168.100.10/24 +DuplicateAddressDetection=ipv4 diff --git a/test/test-network/conf/25-address-dad-veth99.network b/test/test-network/conf/25-address-dad-veth99.network new file mode 100644 index 00000000000..8e323d8395a --- /dev/null +++ b/test/test-network/conf/25-address-dad-veth99.network @@ -0,0 +1,8 @@ +[Match] +Name=veth99 + +[Network] +IPv6AcceptRA=no + +[Address] +Address=192.168.100.10/24 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index f47463956e7..cab8fb6afc2 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -1479,6 +1479,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): '23-active-slave.network', '24-keep-configuration-static.network', '24-search-domain.network', + '25-address-dad-veth-peer.network', + '25-address-dad-veth99.network', '25-address-link-section.network', '25-address-preferred-lifetime-zero.network', '25-address-static.network', @@ -1581,6 +1583,20 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): print(output) self.assertRegex(output, 'default via 20.20.20.1 proto static') + def test_address_dad(self): + copy_unit_to_networkd_unit_path('25-address-dad-veth99.network', '25-address-dad-veth-peer.network', + '25-veth.netdev') + start_networkd() + self.wait_online(['veth99:routable', 'veth-peer:degraded']) + + output = check_output('ip -4 address show dev veth99') + print(output) + self.assertRegex(output, '192.168.100.10/24') + + output = check_output('ip -4 address show dev veth-peer') + print(output) + self.assertNotRegex(output, '192.168.100.10/24') + def test_configure_without_carrier(self): copy_unit_to_networkd_unit_path('configure-without-carrier.network', '11-dummy.netdev') start_networkd()