summaryrefslogtreecommitdiff
path: root/test/test-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2022-10-28 04:48:31 +0900
committerLuca Boccassi <luca.boccassi@gmail.com>2022-10-28 12:26:52 +0200
commitee3cbfdbbc1eacac03cdcc6ae3b295d6fbbffc6e (patch)
tree6f8fa7e3ad4ed1374781a3a246337057604521ec /test/test-network
parent60e9a39ac7b9e1c0f48306669eda9f24e2dbda2f (diff)
downloadsystemd-ee3cbfdbbc1eacac03cdcc6ae3b295d6fbbffc6e.tar.gz
test-network: rewrite wait-online address family tests
Fixes #25154.
Diffstat (limited to 'test/test-network')
-rw-r--r--test/test-network/conf/12-dummy-no-address.network (renamed from test/test-network/conf/25-ipv6ra-prefix-client-with-static-ipv4-address.network)5
-rw-r--r--test/test-network/conf/25-dhcp-client-ipv4-ipv6ra-prefix-client-with-delay.network10
-rw-r--r--test/test-network/conf/25-dhcp-server-with-ipv6-prefix.network20
-rw-r--r--test/test-network/conf/25-ipv6-prefix-with-delay.network13
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py56
5 files changed, 32 insertions, 72 deletions
diff --git a/test/test-network/conf/25-ipv6ra-prefix-client-with-static-ipv4-address.network b/test/test-network/conf/12-dummy-no-address.network
index 14c239685e..fef18c2375 100644
--- a/test/test-network/conf/25-ipv6ra-prefix-client-with-static-ipv4-address.network
+++ b/test/test-network/conf/12-dummy-no-address.network
@@ -1,7 +1,6 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
-Name=veth99
+Name=dummy98
[Network]
-IPv6AcceptRA=true
-Address=192.168.5.1/24
+IPv6AcceptRA=no
diff --git a/test/test-network/conf/25-dhcp-client-ipv4-ipv6ra-prefix-client-with-delay.network b/test/test-network/conf/25-dhcp-client-ipv4-ipv6ra-prefix-client-with-delay.network
deleted file mode 100644
index ff5b98a40d..0000000000
--- a/test/test-network/conf/25-dhcp-client-ipv4-ipv6ra-prefix-client-with-delay.network
+++ /dev/null
@@ -1,10 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-[Match]
-Name=veth99
-
-[NetworkEmulator]
-DelaySec=9
-
-[Network]
-DHCP=ipv4
-IPv6AcceptRA=true
diff --git a/test/test-network/conf/25-dhcp-server-with-ipv6-prefix.network b/test/test-network/conf/25-dhcp-server-with-ipv6-prefix.network
deleted file mode 100644
index 13ee90dd5e..0000000000
--- a/test/test-network/conf/25-dhcp-server-with-ipv6-prefix.network
+++ /dev/null
@@ -1,20 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-[Match]
-Name=veth-peer
-
-[Network]
-Address=192.168.5.1/24
-IPv6AcceptRA=no
-DHCPServer=yes
-IPv6SendRA=yes
-
-[IPv6Prefix]
-Prefix=2002:da8:1:0::/64
-
-[DHCPServer]
-DNS=192.168.5.1
-NTP=192.168.5.1
-
-[IPv6SendRA]
-EmitDNS=no
-EmitDomains=no
diff --git a/test/test-network/conf/25-ipv6-prefix-with-delay.network b/test/test-network/conf/25-ipv6-prefix-with-delay.network
deleted file mode 100644
index 4b661fed47..0000000000
--- a/test/test-network/conf/25-ipv6-prefix-with-delay.network
+++ /dev/null
@@ -1,13 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-[Match]
-Name=veth-peer
-
-[NetworkEmulator]
-DelaySec=15
-
-[Network]
-IPv6AcceptRA=no
-IPv6SendRA=yes
-
-[IPv6Prefix]
-Prefix=2002:da8:1:0::/64
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 3b559c8dec..d599c26070 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -3631,32 +3631,6 @@ class NetworkdTCTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'qdisc teql1 31: root')
-class NetworkWaitOnlineTests(unittest.TestCase, Utilities):
-
- def setUp(self):
- setup_common()
-
- def tearDown(self):
- tear_down_common()
-
- @expectedFailureIfModuleIsNotAvailable('sch_netem')
- def test_wait_online_ipv4(self):
- copy_network_unit('25-veth.netdev', '25-dhcp-server-with-ipv6-prefix.network', '25-dhcp-client-ipv4-ipv6ra-prefix-client-with-delay.network')
- start_networkd()
-
- self.wait_online(['veth99:routable'], ipv4=True)
-
- self.wait_address('veth99', r'192.168.5.[0-9]+', ipv='-4', timeout_sec=1)
-
- @expectedFailureIfModuleIsNotAvailable('sch_netem')
- def test_wait_online_ipv6(self):
- copy_network_unit('25-veth.netdev', '25-ipv6-prefix-with-delay.network', '25-ipv6ra-prefix-client-with-static-ipv4-address.network')
- start_networkd()
-
- self.wait_online(['veth99:routable'], ipv6=True)
-
- self.wait_address('veth99', r'2002:da8:1:0:1034:56ff:fe78:9abc', ipv='-6', timeout_sec=1)
-
class NetworkdStateFileTests(unittest.TestCase, Utilities):
def setUp(self):
@@ -3745,6 +3719,36 @@ class NetworkdStateFileTests(unittest.TestCase, Utilities):
self.assertIn('MDNS=yes', output)
self.assertIn('DNSSEC=no', output)
+ def test_address_state(self):
+ copy_network_unit('12-dummy.netdev', '12-dummy-no-address.network')
+ start_networkd()
+
+ self.wait_online(['dummy98:degraded'])
+
+ output = read_link_state_file('dummy98')
+ self.assertIn('IPV4_ADDRESS_STATE=off', output)
+ self.assertIn('IPV6_ADDRESS_STATE=degraded', output)
+
+ # with a routable IPv4 address
+ check_output('ip address add 10.1.2.3/16 dev dummy98')
+ self.wait_online(['dummy98:routable'], ipv4=True)
+ self.wait_online(['dummy98:routable'])
+
+ output = read_link_state_file('dummy98')
+ self.assertIn('IPV4_ADDRESS_STATE=routable', output)
+ self.assertIn('IPV6_ADDRESS_STATE=degraded', output)
+
+ check_output('ip address del 10.1.2.3/16 dev dummy98')
+
+ # with a routable IPv6 address
+ check_output('ip address add 2002:da8:1:0:1034:56ff:fe78:9abc/64 dev dummy98')
+ self.wait_online(['dummy98:routable'], ipv6=True)
+ self.wait_online(['dummy98:routable'])
+
+ output = read_link_state_file('dummy98')
+ self.assertIn('IPV4_ADDRESS_STATE=off', output)
+ self.assertIn('IPV6_ADDRESS_STATE=routable', output)
+
class NetworkdBondTests(unittest.TestCase, Utilities):
def setUp(self):