test-network: add tests for IPv6 routes with reject type

This commit is contained in:
Yu Watanabe 2020-12-03 19:09:55 +09:00
parent 37b9c79e5d
commit 452d86a532
2 changed files with 72 additions and 0 deletions

View File

@ -48,6 +48,18 @@ Destination=202.54.1.3
Type=prohibit
Destination=202.54.1.4
[Route]
Type=blackhole
Destination=2001:1234:5678::2
[Route]
Type=unreachable
Destination=2001:1234:5678::3
[Route]
Type=prohibit
Destination=2001:1234:5678::4
[Route]
Type=local
Destination=149.10.123.1

View File

@ -2216,6 +2216,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
print('### ip -6 route show type blackhole')
output = check_output('ip -6 route show type blackhole')
print(output)
self.assertIn('blackhole 2001:1234:5678::2 dev lo proto static', output)
print('### ip -6 route show type unreachable')
output = check_output('ip -6 route show type unreachable')
print(output)
self.assertIn('unreachable 2001:1234:5678::3 dev lo proto static', output)
print('### ip -6 route show type prohibit')
output = check_output('ip -6 route show type prohibit')
print(output)
self.assertIn('prohibit 2001:1234:5678::4 dev lo proto static', output)
print('### ip route show 192.168.10.1')
output = check_output('ip route show 192.168.10.1')
print(output)
@ -2261,6 +2276,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertEqual(output, '')
print('### ip -6 route show type blackhole')
output = check_output('ip -6 route show type blackhole')
print(output)
self.assertEqual(output, '')
print('### ip -6 route show type unreachable')
output = check_output('ip -6 route show type unreachable')
print(output)
self.assertEqual(output, '')
print('### ip -6 route show type prohibit')
output = check_output('ip -6 route show type prohibit')
print(output)
self.assertEqual(output, '')
remove_unit_from_networkd_path(['25-address-static.network'])
check_output(*networkctl_cmd, 'reload', env=env)
time.sleep(1)
@ -2282,6 +2312,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertRegex(output, 'prohibit 202.54.1.4 proto static')
print('### ip -6 route show type blackhole')
output = check_output('ip -6 route show type blackhole')
print(output)
self.assertIn('blackhole 2001:1234:5678::2 dev lo proto static', output)
print('### ip -6 route show type unreachable')
output = check_output('ip -6 route show type unreachable')
print(output)
self.assertIn('unreachable 2001:1234:5678::3 dev lo proto static', output)
print('### ip -6 route show type prohibit')
output = check_output('ip -6 route show type prohibit')
print(output)
self.assertIn('prohibit 2001:1234:5678::4 dev lo proto static', output)
rc = call("ip link del dummy98")
self.assertEqual(rc, 0)
time.sleep(2)
@ -2302,6 +2347,21 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
print(output)
self.assertEqual(output, '')
print('### ip -6 route show type blackhole')
output = check_output('ip -6 route show type blackhole')
print(output)
self.assertEqual(output, '')
print('### ip -6 route show type unreachable')
output = check_output('ip -6 route show type unreachable')
print(output)
self.assertEqual(output, '')
print('### ip -6 route show type prohibit')
output = check_output('ip -6 route show type prohibit')
print(output)
self.assertEqual(output, '')
@expectedFailureIfRTA_VIAIsNotSupported()
def test_route_via_ipv6(self):
copy_unit_to_networkd_unit_path('25-route-via-ipv6.network', '12-dummy.netdev')