mirror of
https://github.com/systemd/systemd
synced 2024-09-06 08:46:19 +00:00
test-network: add a test case for IPv4 route with IPv6 gateway
This commit is contained in:
parent
6dd5398137
commit
297f9d86fe
|
@ -15,7 +15,6 @@ Destination=2001:1234:5:8fff:ff:ff:ff:ff/128
|
|||
Destination=2001:1234:5:9fff:ff:ff:ff:ff/128
|
||||
|
||||
[Route]
|
||||
Destination=::/0
|
||||
Gateway=2001:1234:5:8fff:ff:ff:ff:ff
|
||||
|
||||
[Route]
|
||||
|
|
14
test/test-network/conf/25-route-via-ipv6.network
Normal file
14
test/test-network/conf/25-route-via-ipv6.network
Normal file
|
@ -0,0 +1,14 @@
|
|||
[Match]
|
||||
Name=dummy98
|
||||
|
||||
[Network]
|
||||
IPv6AcceptRA=no
|
||||
Address=2001:1234:5:8f63::1/128
|
||||
Address=149.10.124.58/28
|
||||
|
||||
[Route]
|
||||
Destination=2001:1234:5:8fff:ff:ff:ff:ff/128
|
||||
|
||||
[Route]
|
||||
Destination=149.10.124.66
|
||||
Gateway=2001:1234:5:8fff:ff:ff:ff:ff
|
|
@ -146,6 +146,20 @@ def expectedFailureIfNexthopIsNotAvailable():
|
|||
|
||||
return f
|
||||
|
||||
def expectedFailureIfRTA_VIAIsNotSupported():
|
||||
def f(func):
|
||||
call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL)
|
||||
call('ip link set up dev dummy98', stderr=subprocess.DEVNULL)
|
||||
call('ip route add 2001:1234:5:8fff:ff:ff:ff:fe/128 dev dummy98', stderr=subprocess.DEVNULL)
|
||||
rc = call('ip route add 10.10.10.10 via inet6 2001:1234:5:8fff:ff:ff:ff:fe dev dummy98', stderr=subprocess.DEVNULL)
|
||||
call('ip link del dummy98', stderr=subprocess.DEVNULL)
|
||||
if rc == 0:
|
||||
return func
|
||||
else:
|
||||
return unittest.expectedFailure(func)
|
||||
|
||||
return f
|
||||
|
||||
def expectedFailureIfAlternativeNameIsNotAvailable():
|
||||
def f(func):
|
||||
call('ip link add dummy98 type dummy', stderr=subprocess.DEVNULL)
|
||||
|
@ -1760,6 +1774,7 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
|||
'25-prefix-route-without-vrf.network',
|
||||
'25-route-ipv6-src.network',
|
||||
'25-route-static.network',
|
||||
'25-route-via-ipv6.network',
|
||||
'25-route-vrf.network',
|
||||
'25-gateway-static.network',
|
||||
'25-gateway-next-static.network',
|
||||
|
@ -2198,6 +2213,27 @@ class NetworkdNetworkTests(unittest.TestCase, Utilities):
|
|||
self.assertRegex(output, 'via 2001:1234:5:8fff:ff:ff:ff:ff dev dummy98')
|
||||
self.assertRegex(output, 'via 2001:1234:5:9fff:ff:ff:ff:ff dev dummy98')
|
||||
|
||||
@expectedFailureIfRTA_VIAIsNotSupported()
|
||||
def test_route_via_ipv6(self):
|
||||
copy_unit_to_networkd_unit_path('25-route-via-ipv6.network', '12-dummy.netdev')
|
||||
start_networkd()
|
||||
self.wait_online(['dummy98:routable'])
|
||||
|
||||
output = check_output(*networkctl_cmd, '-n', '0', 'status', 'dummy98', env=env)
|
||||
print(output)
|
||||
|
||||
print('### ip -6 route show dev dummy98')
|
||||
output = check_output('ip -6 route show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, '2001:1234:5:8fff:ff:ff:ff:ff proto static')
|
||||
self.assertRegex(output, '2001:1234:5:8f63::1 proto kernel')
|
||||
|
||||
print('### ip -4 route show dev dummy98')
|
||||
output = check_output('ip -4 route show dev dummy98')
|
||||
print(output)
|
||||
self.assertRegex(output, '149.10.124.48/28 proto kernel scope link src 149.10.124.58')
|
||||
self.assertRegex(output, '149.10.124.66 via inet6 2001:1234:5:8fff:ff:ff:ff:ff proto static')
|
||||
|
||||
@expectedFailureIfModuleIsNotAvailable('vrf')
|
||||
def test_route_vrf(self):
|
||||
copy_unit_to_networkd_unit_path('25-route-vrf.network', '12-dummy.netdev',
|
||||
|
|
Loading…
Reference in a new issue