test-network: add tests for dropping unnecessary nexthops

This commit is contained in:
Yu Watanabe
2021-02-23 18:45:48 +09:00
parent 25b82b6e0e
commit 9947c7bad1
2 changed files with 36 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
[Match]
Name=veth99
[Network]
IPv6AcceptRA=no
Address=2001:1234:5:8f63::1/120
Address=192.168.5.10/24
Gateway=192.168.5.1

View File

@@ -1801,6 +1801,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
'25-neighbor-ipv6.network',
'25-neighbor-ip-dummy.network',
'25-neighbor-ip.network',
'25-nexthop-nothing.network',
'25-nexthop.network',
'25-qdisc-cake.network',
'25-qdisc-clsact-and-htb.network',
@@ -2868,6 +2869,33 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertEqual('blackhole 2001:1234:5:8f62::2 nhid 7 dev lo proto static metric 1024 pref medium', output)
remove_unit_from_networkd_path(['25-nexthop.network'])
copy_unit_to_networkd_unit_path('25-nexthop-nothing.network')
rc = call(*networkctl_cmd, 'reload', env=env)
self.assertEqual(rc, 0)
time.sleep(1)
output = check_output('ip nexthop list dev veth99')
print(output)
self.assertEqual(output, '')
output = check_output('ip nexthop list dev lo')
print(output)
self.assertEqual(output, '')
remove_unit_from_networkd_path(['25-nexthop-nothing.network'])
copy_unit_to_networkd_unit_path('25-nexthop.network')
rc = call(*networkctl_cmd, 'reload', env=env)
self.assertEqual(rc, 0)
time.sleep(1)
rc = call('ip link del veth99')
self.assertEqual(rc, 0)
time.sleep(2)
output = check_output('ip nexthop list dev lo')
print(output)
self.assertEqual(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')