test-network: add a test case for DHCPv4.UseGateway=no
This commit is contained in:
parent
b453122789
commit
0d7bd445d2
|
@ -0,0 +1,9 @@
|
|||
[Match]
|
||||
Name=veth99
|
||||
|
||||
[Network]
|
||||
DHCP=ipv4
|
||||
IPv6AcceptRA=false
|
||||
|
||||
[DHCPv4]
|
||||
UseGateway=no
|
|
@ -2921,6 +2921,7 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
'dhcp-client-ipv4-dhcp-settings.network',
|
||||
'dhcp-client-ipv4-only-ipv6-disabled.network',
|
||||
'dhcp-client-ipv4-only.network',
|
||||
'dhcp-client-ipv4-use-gateway-no.network',
|
||||
'dhcp-client-ipv4-use-routes-no.network',
|
||||
'dhcp-client-ipv6-only.network',
|
||||
'dhcp-client-ipv6-rapid-commit.network',
|
||||
|
@ -3040,6 +3041,19 @@ class NetworkdDHCPClientTests(unittest.TestCase, Utilities):
|
|||
self.assertRegex(output, r'default via 192.168.5.1 proto dhcp src 192.168.5.181 metric 1024')
|
||||
self.assertRegex(output, r'192.168.5.1 proto dhcp scope link src 192.168.5.181 metric 1024')
|
||||
|
||||
def test_dhcp_client_ipv4_use_gateway_no(self):
|
||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv4-use-gateway-no.network')
|
||||
|
||||
start_networkd()
|
||||
self.wait_online(['veth-peer:carrier'])
|
||||
start_dnsmasq(additional_options='--dhcp-option=option:dns-server,192.168.5.6,192.168.5.7', lease_time='2m')
|
||||
self.wait_online(['veth99:routable', 'veth-peer:routable'])
|
||||
|
||||
output = check_output('ip route show dev veth99')
|
||||
print(output)
|
||||
self.assertRegex(output, r'192.168.5.0/24 via 192.168.5.5 proto dhcp src 192.168.5.181 metric 1024')
|
||||
self.assertNotRegex(output, r'default via 192.168.5.1')
|
||||
|
||||
def test_dhcp_client_ipv4_ipv6(self):
|
||||
copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network', 'dhcp-client-ipv6-only.network',
|
||||
'dhcp-client-ipv4-only.network')
|
||||
|
|
Loading…
Reference in a new issue