mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-11 05:17:44 +03:00
test-network: add testcase for #1850
This commit is contained in:
parent
4912ab7774
commit
af3b1498c6
@ -0,0 +1,13 @@
|
||||
[Match]
|
||||
Name=veth99
|
||||
|
||||
[Network]
|
||||
DHCP=ipv4
|
||||
|
||||
[Route]
|
||||
Gateway=192.168.0.1
|
||||
Destination=10.0.0.0/8
|
||||
|
||||
[Route]
|
||||
Gateway=192.168.0.1
|
||||
Destination=192.168.100.0/24
|
@ -1491,6 +1491,7 @@ class NetworkdNetworkDHCPClientTests(unittest.TestCase, Utilities):
|
||||
'25-vrf.network',
|
||||
'dhcp-client-anonymize.network',
|
||||
'dhcp-client-critical-connection.network',
|
||||
'dhcp-client-gateway-onlink-implicit.network',
|
||||
'dhcp-client-ipv4-dhcp-settings.network',
|
||||
'dhcp-client-ipv4-only-ipv6-disabled.network',
|
||||
'dhcp-client-ipv4-only.network',
|
||||
@ -1776,6 +1777,26 @@ class NetworkdNetworkDHCPClientTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertRegex(output, 'State: routable \(configured\)')
|
||||
|
||||
def test_dhcp_client_gateway_onlink_implicit(self):
|
||||
self.copy_unit_to_networkd_unit_path('25-veth.netdev', 'dhcp-server-veth-peer.network',
|
||||
'dhcp-client-gateway-onlink-implicit.network')
|
||||
self.start_networkd()
|
||||
|
||||
self.assertTrue(self.link_exits('veth99'))
|
||||
|
||||
self.start_dnsmasq()
|
||||
|
||||
output = subprocess.check_output(['networkctl', 'status', 'veth99']).rstrip().decode('utf-8')
|
||||
print(output)
|
||||
self.assertRegex(output, '192.168.5')
|
||||
|
||||
output = subprocess.check_output(['ip', 'route', 'list', 'dev', 'veth99', '10.0.0.0/8']).rstrip().decode('utf-8')
|
||||
print(output)
|
||||
self.assertRegex(output, 'onlink')
|
||||
output = subprocess.check_output(['ip', 'route', 'list', 'dev', 'veth99', '192.168.100.0/24']).rstrip().decode('utf-8')
|
||||
print(output)
|
||||
self.assertRegex(output, 'onlink')
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main(testRunner=unittest.TextTestRunner(stream=sys.stdout,
|
||||
verbosity=3))
|
||||
|
Loading…
Reference in New Issue
Block a user