From: Yu Watanabe Date: Tue, 23 Feb 2021 09:45:48 +0000 (+0900) Subject: test-network: add tests for dropping unnecessary nexthops X-Git-Tag: v248-rc3~129^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F18589%2Fhead;p=thirdparty%2Fsystemd.git test-network: add tests for dropping unnecessary nexthops --- diff --git a/test/test-network/conf/25-nexthop-nothing.network b/test/test-network/conf/25-nexthop-nothing.network new file mode 100644 index 00000000000..fdaf32d5340 --- /dev/null +++ b/test/test-network/conf/25-nexthop-nothing.network @@ -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 diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index 6c17b204a11..70285d2a895 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -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')