mirror of
https://github.com/systemd/systemd.git
synced 2025-01-10 05:18:17 +03:00
test-network: add a test for OnLink= in [NextHop] section
This commit is contained in:
parent
2ddd52d1e2
commit
e2d9bc5cfd
@ -23,6 +23,11 @@ Family=ipv6
|
||||
Id=4
|
||||
Family=ipv4
|
||||
|
||||
[NextHop]
|
||||
Id=5
|
||||
Gateway=192.168.10.1
|
||||
OnLink=yes
|
||||
|
||||
[NextHop]
|
||||
Gateway=192.168.5.2
|
||||
|
||||
@ -37,3 +42,7 @@ Destination=10.10.10.11
|
||||
[Route]
|
||||
NextHop=2
|
||||
Destination=2001:1234:5:8f62::1
|
||||
|
||||
[Route]
|
||||
NextHop=5
|
||||
Destination=10.10.10.12
|
||||
|
@ -2812,6 +2812,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
self.assertIn('id 2 via 2001:1234:5:8f63::2 dev veth99', output)
|
||||
self.assertIn('id 3 dev veth99', output)
|
||||
self.assertIn('id 4 dev veth99', output)
|
||||
self.assertRegex(output, 'id 5 via 192.168.10.1 dev veth99 .*onlink')
|
||||
self.assertRegex(output, r'id [0-9]* via 192.168.5.2 dev veth99')
|
||||
|
||||
output = check_output('ip route show dev veth99 10.10.10.10')
|
||||
@ -2822,6 +2823,10 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
||||
print(output)
|
||||
self.assertEqual('10.10.10.11 nhid 2 via inet6 2001:1234:5:8f63::2 proto static', output)
|
||||
|
||||
output = check_output('ip route show dev veth99 10.10.10.12')
|
||||
print(output)
|
||||
self.assertEqual('10.10.10.12 nhid 5 via 192.168.10.1 proto static onlink', output)
|
||||
|
||||
output = check_output('ip -6 route show dev veth99 2001:1234:5:8f62::1')
|
||||
print(output)
|
||||
self.assertEqual('2001:1234:5:8f62::1 nhid 2 via 2001:1234:5:8f63::2 proto static metric 1024 pref medium', output)
|
||||
|
Loading…
Reference in New Issue
Block a user