test-network: add dhcp rapid commit test

This commit is contained in:
Ronan Pigott
2023-10-24 17:57:45 -07:00
parent 808b65a087
commit 2beecc7077

View File

@@ -5553,6 +5553,26 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
print(f"State = {state}")
self.assertEqual(state, 'bound')
@unittest.skipUnless("--dhcp-rapid-commit" in run("dnsmasq --help").stdout, reason="dnsmasq is missing dhcp-rapid-commit support")
def test_dhcp_client_rapid_commit(self):
copy_network_unit('25-veth.netdev', '25-dhcp-server-veth-peer.network', '25-dhcp-client.network')
start_networkd()
self.wait_online(['veth-peer:carrier'])
start_dnsmasq('--dhcp-rapid-commit')
self.wait_online(['veth99:routable', 'veth-peer:routable'])
self.wait_address('veth99', r'inet 192.168.5.[0-9]*/24', ipv='-4')
state = get_dhcp4_client_state('veth99')
print(f"DHCPv4 client state = {state}")
self.assertEqual(state, 'bound')
output = read_dnsmasq_log_file()
self.assertIn('DHCPDISCOVER(veth-peer)', output)
self.assertNotIn('DHCPOFFER(veth-peer)', output)
self.assertNotIn('DHCPREQUEST(veth-peer)', output)
self.assertIn('DHCPACK(veth-peer)', output)
def test_dhcp_client_ipv6_only_mode_without_ipv6_connectivity(self):
copy_network_unit('25-veth.netdev',
'25-dhcp-server-ipv6-only-mode.network',