test-network: add more test cases when ipv6 is disabled

This commit is contained in:
Yu Watanabe 2019-06-12 11:01:32 +09:00
parent b0ab85a2e4
commit 4933b97d59
2 changed files with 25 additions and 2 deletions

View file

@ -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

View file

@ -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')