From 4933b97d595e96408796ea5630666f4d22512eaf Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 12 Jun 2019 11:01:32 +0900 Subject: [PATCH] test-network: add more test cases when ipv6 is disabled --- .../conf/25-sysctl-disable-ipv6.network | 12 ++++++++++++ test/test-network/systemd-networkd-tests.py | 15 +++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/test/test-network/conf/25-sysctl-disable-ipv6.network b/test/test-network/conf/25-sysctl-disable-ipv6.network index e52078e0d4c..c4c5fbc1294 100644 --- a/test/test-network/conf/25-sysctl-disable-ipv6.network +++ b/test/test-network/conf/25-sysctl-disable-ipv6.network @@ -4,3 +4,15 @@ Name=dummy98 [Network] IPv6AcceptRA=no Address=10.2.3.4/16 + +# This should be ignored when ipv6 is disabled +Gateway=2607:5300:0203:39ff:ff:ff:ff:ff + +[Address] +# This should be ignored when ipv6 is disabled +Address=2607:5300:0203:3906::/64 + +[Route] +# This should be ignored when ipv6 is disabled +Destination=2607:5300:0203:39ff:ff:ff:ff:ff +Scope=link diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py index ddb2465e1da..f22fdbe5af7 100755 --- a/test/test-network/systemd-networkd-tests.py +++ b/test/test-network/systemd-networkd-tests.py @@ -1579,7 +1579,12 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): output = check_output('ip -6 address show dummy98') print(output) self.assertEqual(output, '') - self.check_operstate('dummy98', 'routable') + output = check_output('ip -4 route show dev dummy98') + print(output) + self.assertEqual(output, '10.2.0.0/16 proto kernel scope link src 10.2.3.4') + output = check_output('ip -6 route show dev dummy98') + print(output) + self.assertEqual(output, '') check_output('ip link del dummy98') @@ -1595,8 +1600,14 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities): self.assertRegex(output, 'inet 10.2.3.4/16 brd 10.2.255.255 scope global dummy98') output = check_output('ip -6 address show dummy98') print(output) + self.assertRegex(output, 'inet6 2607:5300:203:3906::/64 scope global') self.assertRegex(output, 'inet6 .* scope link') - self.check_operstate('dummy98', 'routable') + output = check_output('ip -4 route show dev dummy98') + print(output) + self.assertEqual(output, '10.2.0.0/16 proto kernel scope link src 10.2.3.4') + output = check_output('ip -6 route show dev dummy98') + print(output) + self.assertRegex(output, 'default via 2607:5300:203:39ff:ff:ff:ff:ff proto static') def test_bind_carrier(self): copy_unit_to_networkd_unit_path('25-bind-carrier.network', '11-dummy.netdev') -- 2.47.3