summaryrefslogtreecommitdiffstats
path: root/test/test-network
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2024-03-12 10:41:38 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2024-03-18 14:33:14 +0100
commit93126bb0fa07f71c0cbb9e120a3c8323e3604100 (patch)
treecb1ff5a1988a4dc692c55120f705d8f05211a51b /test/test-network
parentnetwork/address: acquire address from DHCP server lease file (diff)
downloadsystemd-93126bb0fa07f71c0cbb9e120a3c8323e3604100.tar.xz
systemd-93126bb0fa07f71c0cbb9e120a3c8323e3604100.zip
test-network: extend test case for DHCP server with null server address
Diffstat (limited to 'test/test-network')
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index 1bf79d974c..866c548fbe 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -5771,6 +5771,28 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
output = networkctl_status('veth-peer')
self.assertIn(f'Offered DHCP leases: {client_address}', output)
+ # Check if the same addresses are used even if the service is restarted.
+ restart_networkd()
+ self.wait_online('veth99:routable', 'veth-peer:routable')
+
+ output = check_output('ip -4 address show dev veth-peer')
+ print(output)
+ self.assertIn(f'{server_address}', output)
+
+ output = check_output('ip -4 address show dev veth99')
+ print(output)
+ self.assertIn(f'{client_address}', output)
+
+ output = networkctl_status('veth99')
+ print(output)
+ self.assertRegex(output, rf'Address: {client_address} \(DHCP4 via {server_address}\)')
+ self.assertIn(f'Gateway: {server_address}', output)
+ self.assertIn(f'DNS: {server_address}', output)
+ self.assertIn(f'NTP: {server_address}', output)
+
+ output = networkctl_status('veth-peer')
+ self.assertIn(f'Offered DHCP leases: {client_address}', output)
+
def test_dhcp_server_with_uplink(self):
copy_network_unit('25-veth.netdev', '25-dhcp-client.network', '25-dhcp-server-downstream.network',
'12-dummy.netdev', '25-dhcp-server-uplink.network')