1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-10 01:17:44 +03:00

test-network: add a testcase for DHCP static lease

This commit is contained in:
borna-blazevic 2021-05-27 14:50:19 +09:00 committed by Yu Watanabe
parent c517a49bf7
commit ffaece68bc
3 changed files with 37 additions and 0 deletions

View File

@ -0,0 +1,9 @@
[Match]
Name=veth99
[Network]
IPv6AcceptRA=no
DHCP=ipv4
[DHCPv4]
ClientIdentifier=mac

View File

@ -0,0 +1,17 @@
[Match]
Name=veth-peer
[Network]
IPv6AcceptRA=no
Address=10.1.1.1/24
DHCPServer=yes
[DHCPServer]
PoolOffset=0
PoolSize=20
EmitDNS=yes
DNS=9.9.9.9
[DHCPServerStaticLease]
MACAddress=12:34:56:78:9a:bc
Address=10.1.1.3

View File

@ -3673,8 +3673,10 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
units = [
'25-veth.netdev',
'dhcp-client.network',
'dhcp-client-static-lease.network',
'dhcp-client-timezone-router.network',
'dhcp-server.network',
'dhcp-server-static-lease.network',
'dhcp-server-timezone-router.network']
def setUp(self):
@ -3709,6 +3711,15 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
self.assertRegex(output, '192.168.5.*')
self.assertRegex(output, 'Europe/Berlin')
def test_dhcp_server_static_lease(self):
copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-client-static-lease.network', 'dhcp-server-static-lease.network')
start_networkd()
self.wait_online(['veth99:routable', 'veth-peer:routable'])
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'veth99', env=env)
print(output)
self.assertIn('10.1.1.3 (DHCP4 via 10.1.1.1)', output)
class NetworkdDHCPServerRelayAgentTests(unittest.TestCase, Utilities):
links = [
'client',