summaryrefslogtreecommitdiffstats
path: root/test/test-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-02-16 21:47:55 +0100
committerLuca Boccassi <bluca@debian.org>2024-02-17 12:48:25 +0100
commitab06b74fd38f2af8be35fe51c975711ac448ab54 (patch)
treeab9a1a6d3e164e54a3d76ff58fe910e169cd3ed1 /test/test-network
parentnetwork: do not request DHCP addresses configured on checking prefix delegation (diff)
downloadsystemd-ab06b74fd38f2af8be35fe51c975711ac448ab54.tar.xz
systemd-ab06b74fd38f2af8be35fe51c975711ac448ab54.zip
test-network: split test_dhcp6pd() into small pieces
Diffstat (limited to 'test/test-network')
-rw-r--r--test/test-network/conf/25-dhcp6pd-upstream-no-address.network21
-rw-r--r--test/test-network/conf/25-dhcp6pd-upstream.network2
-rw-r--r--test/test-network/conf/25-dhcp6pd-upstream.network.d/with-address.conf6
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py73
4 files changed, 58 insertions, 44 deletions
diff --git a/test/test-network/conf/25-dhcp6pd-upstream-no-address.network b/test/test-network/conf/25-dhcp6pd-upstream-no-address.network
new file mode 100644
index 0000000000..01f0e9e6d5
--- /dev/null
+++ b/test/test-network/conf/25-dhcp6pd-upstream-no-address.network
@@ -0,0 +1,21 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=veth99
+
+[Network]
+IPv6PrivacyExtensions=yes
+IPv6AcceptRA=no
+DHCP=ipv6
+DHCPPrefixDelegation=yes
+
+[DHCPv6]
+WithoutRA=solicit
+UseAddress=no
+
+[DHCPPrefixDelegation]
+UplinkInterface=:self
+SubnetId=10
+Announce=no
+Token=eui64
+Token=::1a:2b:3c:4d
+Assign=no
diff --git a/test/test-network/conf/25-dhcp6pd-upstream.network b/test/test-network/conf/25-dhcp6pd-upstream.network
index 01f0e9e6d5..4b8cd7d324 100644
--- a/test/test-network/conf/25-dhcp6pd-upstream.network
+++ b/test/test-network/conf/25-dhcp6pd-upstream.network
@@ -10,7 +10,6 @@ DHCPPrefixDelegation=yes
[DHCPv6]
WithoutRA=solicit
-UseAddress=no
[DHCPPrefixDelegation]
UplinkInterface=:self
@@ -18,4 +17,3 @@ SubnetId=10
Announce=no
Token=eui64
Token=::1a:2b:3c:4d
-Assign=no
diff --git a/test/test-network/conf/25-dhcp6pd-upstream.network.d/with-address.conf b/test/test-network/conf/25-dhcp6pd-upstream.network.d/with-address.conf
deleted file mode 100644
index 451475509d..0000000000
--- a/test/test-network/conf/25-dhcp6pd-upstream.network.d/with-address.conf
+++ /dev/null
@@ -1,6 +0,0 @@
-# SPDX-License-Identifier: LGPL-2.1-or-later
-[DHCPv6]
-UseAddress=yes
-
-[DHCPPrefixDelegation]
-Assign=yes
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 661ac8ec7a..9c83291f63 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -6567,63 +6567,64 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
def tearDown(self):
tear_down_common()
- def test_dhcp6pd(self):
- def get_dhcp6_prefix(link):
- description = get_link_description(link)
+ def check_dhcp6_prefix(self, link):
+ description = get_link_description(link)
- self.assertIn('DHCPv6Client', description.keys())
- self.assertIn('Prefixes', description['DHCPv6Client'])
+ self.assertIn('DHCPv6Client', description.keys())
+ self.assertIn('Prefixes', description['DHCPv6Client'])
- prefixInfo = description['DHCPv6Client']['Prefixes']
+ prefixInfo = description['DHCPv6Client']['Prefixes']
- return prefixInfo
+ self.assertEqual(len(prefixInfo), 1)
- copy_network_unit('25-veth.netdev', '25-dhcp6pd-server.network', '25-dhcp6pd-upstream.network',
- '25-veth-downstream-veth97.netdev', '25-dhcp-pd-downstream-veth97.network', '25-dhcp-pd-downstream-veth97-peer.network',
- '25-veth-downstream-veth98.netdev', '25-dhcp-pd-downstream-veth98.network', '25-dhcp-pd-downstream-veth98-peer.network',
- '11-dummy.netdev', '25-dhcp-pd-downstream-test1.network',
- '25-dhcp-pd-downstream-dummy97.network',
- '12-dummy.netdev', '25-dhcp-pd-downstream-dummy98.network',
- '13-dummy.netdev', '25-dhcp-pd-downstream-dummy99.network',
- copy_dropins=False)
+ self.assertIn('Prefix', prefixInfo[0].keys())
+ self.assertIn('PrefixLength', prefixInfo[0].keys())
+ self.assertIn('PreferredLifetimeUSec', prefixInfo[0].keys())
+ self.assertIn('ValidLifetimeUSec', prefixInfo[0].keys())
- self.setup_nftset('addr6', 'ipv6_addr')
- self.setup_nftset('network6', 'ipv6_addr', 'flags interval;')
- self.setup_nftset('ifindex', 'iface_index')
+ self.assertEqual(prefixInfo[0]['Prefix'][0:6], [63, 254, 5, 1, 255, 255])
+ self.assertEqual(prefixInfo[0]['PrefixLength'], 56)
+ self.assertGreater(prefixInfo[0]['PreferredLifetimeUSec'], 0)
+ self.assertGreater(prefixInfo[0]['ValidLifetimeUSec'], 0)
+
+ def test_dhcp6pd_no_address(self):
+ # For issue #29979.
+ copy_network_unit('25-veth.netdev', '25-dhcp6pd-server.network', '25-dhcp6pd-upstream-no-address.network')
start_networkd()
self.wait_online('veth-peer:routable')
start_isc_dhcpd(conf_file='isc-dhcpd-dhcp6pd.conf', ipv='-6')
self.wait_online('veth99:degraded')
- # First, test UseAddress=no and Assign=no (issue #29979).
- # Note, due to the bug #29701, this test must be done at first.
print('### ip -6 address show dev veth99 scope global')
output = check_output('ip -6 address show dev veth99 scope global')
print(output)
self.assertNotIn('inet6 3ffe:501:ffff', output)
- # Check DBus assigned prefix information to veth99
- prefixInfo = get_dhcp6_prefix('veth99')
-
- self.assertEqual(len(prefixInfo), 1)
- prefixInfo = prefixInfo[0]
+ self.check_dhcp6_prefix('veth99')
- self.assertIn('Prefix', prefixInfo.keys())
- self.assertIn('PrefixLength', prefixInfo.keys())
- self.assertIn('PreferredLifetimeUSec', prefixInfo.keys())
- self.assertIn('ValidLifetimeUSec', prefixInfo.keys())
-
- self.assertEqual(prefixInfo['Prefix'][0:6], [63, 254, 5, 1, 255, 255])
- self.assertEqual(prefixInfo['PrefixLength'], 56)
- self.assertGreater(prefixInfo['PreferredLifetimeUSec'], 0)
- self.assertGreater(prefixInfo['ValidLifetimeUSec'], 0)
+ def test_dhcp6pd(self):
+ copy_network_unit('25-veth.netdev', '25-dhcp6pd-server.network', '25-dhcp6pd-upstream.network',
+ '25-veth-downstream-veth97.netdev', '25-dhcp-pd-downstream-veth97.network', '25-dhcp-pd-downstream-veth97-peer.network',
+ '25-veth-downstream-veth98.netdev', '25-dhcp-pd-downstream-veth98.network', '25-dhcp-pd-downstream-veth98-peer.network',
+ '11-dummy.netdev', '25-dhcp-pd-downstream-test1.network',
+ '25-dhcp-pd-downstream-dummy97.network',
+ '12-dummy.netdev', '25-dhcp-pd-downstream-dummy98.network',
+ '13-dummy.netdev', '25-dhcp-pd-downstream-dummy99.network')
- copy_network_unit('25-dhcp6pd-upstream.network.d/with-address.conf')
- networkctl_reload()
+ start_networkd()
+ self.wait_online('veth-peer:routable')
+ start_isc_dhcpd(conf_file='isc-dhcpd-dhcp6pd.conf', ipv='-6')
self.wait_online('veth99:routable', 'test1:routable', 'dummy98:routable', 'dummy99:degraded',
'veth97:routable', 'veth97-peer:routable', 'veth98:routable', 'veth98-peer:routable')
+ self.setup_nftset('addr6', 'ipv6_addr')
+ self.setup_nftset('network6', 'ipv6_addr', 'flags interval;')
+ self.setup_nftset('ifindex', 'iface_index')
+
+ # Check DBus assigned prefix information to veth99
+ self.check_dhcp6_prefix('veth99')
+
print('### ip -6 address show dev veth-peer scope global')
output = check_output('ip -6 address show dev veth-peer scope global')
print(output)