test-network: add test cases for global [DHCPv4] ClientIdentifier= setting

This commit is contained in:
Yu Watanabe
2024-12-30 11:18:59 +09:00
parent 7bbe9ad796
commit 5e5fe05896
3 changed files with 20 additions and 2 deletions

View File

@@ -0,0 +1,3 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[DHCPv4]
ClientIdentifier=duid

View File

@@ -0,0 +1,3 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[DHCPv4]
ClientIdentifier=mac

View File

@@ -6742,8 +6742,9 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
self.assertIn('Gateway: 192.168.5.1', output)
self.assertIn('Time Zone: Europe/Berlin', output)
def test_dhcp_server_static_lease(self):
def test_dhcp_server_static_lease_mac_by_network(self):
copy_network_unit('25-veth.netdev', '25-dhcp-client-static-lease.network', '25-dhcp-server-static-lease.network')
copy_networkd_conf_dropin('10-dhcp-client-id-duid.conf')
start_networkd()
self.wait_online('veth99:routable', 'veth-peer:routable')
@@ -6752,7 +6753,18 @@ class NetworkdDHCPServerTests(unittest.TestCase, Utilities):
self.assertIn('Address: 10.1.1.200 (DHCPv4 via 10.1.1.1)', output)
self.assertIn('DHCPv4 Client ID: 12:34:56:78:9a:bc', output)
def test_dhcp_server_static_lease_default_client_id(self):
def test_dhcp_server_static_lease_mac_by_global(self):
copy_network_unit('25-veth.netdev', '25-dhcp-client.network', '25-dhcp-server-static-lease.network')
copy_networkd_conf_dropin('10-dhcp-client-id-mac.conf')
start_networkd()
self.wait_online('veth99:routable', 'veth-peer:routable')
output = networkctl_status('veth99')
print(output)
self.assertIn('Address: 10.1.1.200 (DHCPv4 via 10.1.1.1)', output)
self.assertIn('DHCPv4 Client ID: 12:34:56:78:9a:bc', output)
def test_dhcp_server_static_lease_duid(self):
copy_network_unit('25-veth.netdev', '25-dhcp-client.network', '25-dhcp-server-static-lease.network')
start_networkd()
self.wait_online('veth99:routable', 'veth-peer:routable')