test-network: add tests for NextHop= setting in [Route]

This commit is contained in:
Yu Watanabe 2021-02-03 17:19:04 +09:00
parent e918b3c12a
commit cee0f719d8
2 changed files with 24 additions and 0 deletions

View File

@ -25,3 +25,15 @@ Family=ipv4
[NextHop]
Gateway=192.168.5.2
[Route]
NextHop=1
Destination=10.10.10.10
[Route]
NextHop=2
Destination=10.10.10.11
[Route]
NextHop=2
Destination=2001:1234:5:8f62::1

View File

@ -2805,6 +2805,18 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
self.assertIn('id 4 dev veth99', output)
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')
print(output)
self.assertEqual('10.10.10.10 nhid 1 via 192.168.5.1 proto static', output)
output = check_output('ip route show dev veth99 10.10.10.11')
print(output)
self.assertEqual('10.10.10.11 nhid 2 via inet6 2001:1234:5:8f63::2 proto static', 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)
def test_qdisc(self):
copy_unit_to_networkd_unit_path('25-qdisc-clsact-and-htb.network', '12-dummy.netdev',
'25-qdisc-ingress-netem-compat.network', '11-dummy.netdev')