1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-25 01:34:28 +03:00

test-network: add test case for IPv4 DAD

This commit is contained in:
Yu Watanabe 2019-12-06 23:29:28 +09:00
parent 051e77cac1
commit dc7d3c5fd4
3 changed files with 33 additions and 0 deletions

View File

@ -0,0 +1,9 @@
[Match]
Name=veth-peer
[Network]
IPv6AcceptRA=no
[Address]
Address=192.168.100.10/24
DuplicateAddressDetection=ipv4

View File

@ -0,0 +1,8 @@
[Match]
Name=veth99
[Network]
IPv6AcceptRA=no
[Address]
Address=192.168.100.10/24

View File

@ -1479,6 +1479,8 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'23-active-slave.network', '23-active-slave.network',
'24-keep-configuration-static.network', '24-keep-configuration-static.network',
'24-search-domain.network', '24-search-domain.network',
'25-address-dad-veth-peer.network',
'25-address-dad-veth99.network',
'25-address-link-section.network', '25-address-link-section.network',
'25-address-preferred-lifetime-zero.network', '25-address-preferred-lifetime-zero.network',
'25-address-static.network', '25-address-static.network',
@ -1581,6 +1583,20 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output) print(output)
self.assertRegex(output, 'default via 20.20.20.1 proto static') 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): def test_configure_without_carrier(self):
copy_unit_to_networkd_unit_path('configure-without-carrier.network', '11-dummy.netdev') copy_unit_to_networkd_unit_path('configure-without-carrier.network', '11-dummy.netdev')
start_networkd() start_networkd()