summaryrefslogtreecommitdiffstats
path: root/test/test-network/systemd-networkd-tests.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test-network/systemd-networkd-tests.py')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py24
1 files changed, 15 insertions, 9 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index b193f86da9..2689f6024e 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -7713,7 +7713,7 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
self.teardown_nftset('addr6', 'network6', 'ifindex')
- def verify_dhcp4_6rd(self, tunnel_name):
+ def verify_dhcp4_6rd(self, tunnel_name, address_prefix, border_router):
print('### ip -4 address show dev veth-peer scope global')
output = check_output('ip -4 address show dev veth-peer scope global')
print(output)
@@ -7732,7 +7732,7 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
print('### ip -4 address show dev veth99 scope global')
output = check_output('ip -4 address show dev veth99 scope global')
print(output)
- self.assertRegex(output, 'inet 10.100.100.[0-9]*/8 (metric 1024 |)brd 10.255.255.255 scope global dynamic veth99')
+ self.assertRegex(output, fr'inet {address_prefix}[0-9]*/8 (metric 1024 |)brd 10.255.255.255 scope global dynamic veth99')
print('### ip -6 address show dev veth99 scope global')
output = check_output('ip -6 address show dev veth99 scope global')
@@ -7868,8 +7868,8 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
print(f'### ip -d link show dev {tunnel_name}')
output = check_output(f'ip -d link show dev {tunnel_name}')
print(output)
- self.assertIn('link/sit 10.100.100.', output)
- self.assertIn('local 10.100.100.', output)
+ self.assertIn(f'link/sit {address_prefix}', output)
+ self.assertIn(f'local {address_prefix}', output)
self.assertIn('ttl 64', output)
self.assertIn('6rd-prefix 2001:db8::/32', output)
self.assertIn('6rd-relay_prefix 10.0.0.0/8', output)
@@ -7878,7 +7878,7 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
output = check_output(f'ip -6 address show dev {tunnel_name}')
print(output)
self.assertRegex(output, 'inet6 2001:db8:6464:[0-9a-f]+0[23]:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*:[0-9a-f]*/64 (metric 256 |)scope global dynamic')
- self.assertRegex(output, 'inet6 ::10.100.100.[0-9]+/96 scope global')
+ self.assertRegex(output, fr'inet6 ::{address_prefix}[0-9]+/96 scope global')
print(f'### ip -6 route show dev {tunnel_name}')
output = check_output(f'ip -6 route show dev {tunnel_name}')
@@ -7890,7 +7890,7 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
output = check_output('ip -6 route show default')
print(output)
self.assertIn('default', output)
- self.assertIn(f'via ::10.0.0.1 dev {tunnel_name}', output)
+ self.assertIn(f'via ::{border_router} dev {tunnel_name}', output)
def test_dhcp4_6rd(self):
def get_dhcp_6rd_prefix(link):
@@ -7950,13 +7950,19 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
self.wait_online(f'{tunnel_name}:routable')
- self.verify_dhcp4_6rd(tunnel_name)
+ self.verify_dhcp4_6rd(tunnel_name, '10.100.100.1', '10.0.0.1')
# Test case for reconfigure
networkctl_reconfigure('dummy98', 'dummy99')
self.wait_online('dummy98:routable', 'dummy99:degraded')
- self.verify_dhcp4_6rd(tunnel_name)
+ self.verify_dhcp4_6rd(tunnel_name, '10.100.100.1', '10.0.0.1')
+
+ # Change the address range and (border) router, then if check the same tunnel is reused.
+ stop_dnsmasq()
+ start_dnsmasq('--dhcp-option=212,08:20:20:01:0d:b8:00:00:00:00:00:00:00:00:00:00:00:00:0a:00:00:02',
+ ipv4_range='10.100.100.200,10.100.100.250',
+ ipv4_router='10.0.0.2')
print('Wait for the DHCP lease to be renewed/rebind')
time.sleep(120)
@@ -7964,7 +7970,7 @@ class NetworkdDHCPPDTests(unittest.TestCase, Utilities):
self.wait_online('veth99:routable', 'test1:routable', 'dummy97:routable', 'dummy98:routable', 'dummy99:degraded',
'veth97:routable', 'veth97-peer:routable', 'veth98:routable', 'veth98-peer:routable')
- self.verify_dhcp4_6rd(tunnel_name)
+ self.verify_dhcp4_6rd(tunnel_name, '10.100.100.2', '10.0.0.2')
class NetworkdIPv6PrefixTests(unittest.TestCase, Utilities):