mirror of
https://github.com/systemd/systemd.git
synced 2025-01-11 09:18:07 +03:00
test-network: add testcase for automatic tunnel local address selection
This commit is contained in:
parent
2be25d7557
commit
da7d684825
@ -0,0 +1,9 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[NetDev]
|
||||||
|
Name=ip6tnl-slaac
|
||||||
|
Kind=ip6tnl
|
||||||
|
|
||||||
|
[Tunnel]
|
||||||
|
Mode=ip6ip6
|
||||||
|
Local=slaac
|
||||||
|
Remote=2001:473:fece:cafe::5179
|
10
test/test-network/conf/25-ip6tnl-tunnel-local-slaac.network
Normal file
10
test/test-network/conf/25-ip6tnl-tunnel-local-slaac.network
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[Match]
|
||||||
|
Name=ip6tnl-slaac
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=no
|
||||||
|
LinkLocalAddressing=yes
|
||||||
|
|
||||||
|
[Route]
|
||||||
|
Destination=0.0.0.0/0
|
10
test/test-network/conf/ip6tnl-slaac.network
Normal file
10
test/test-network/conf/ip6tnl-slaac.network
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||||
|
[Match]
|
||||||
|
Name=veth99
|
||||||
|
|
||||||
|
[Network]
|
||||||
|
IPv6AcceptRA=yes
|
||||||
|
Tunnel=ip6tnl-slaac
|
||||||
|
|
||||||
|
[IPv6AcceptRA]
|
||||||
|
PrefixAllowList=2002:da8:1::/64
|
@ -895,6 +895,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
|||||||
'ip6gretun97',
|
'ip6gretun97',
|
||||||
'ip6gretun98',
|
'ip6gretun98',
|
||||||
'ip6gretun99',
|
'ip6gretun99',
|
||||||
|
'ip6tnl-slaac',
|
||||||
'ip6tnl97',
|
'ip6tnl97',
|
||||||
'ip6tnl98',
|
'ip6tnl98',
|
||||||
'ip6tnl99',
|
'ip6tnl99',
|
||||||
@ -981,6 +982,8 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
|||||||
'25-ip6gre-tunnel.netdev',
|
'25-ip6gre-tunnel.netdev',
|
||||||
'25-ip6tnl-tunnel-any-any.netdev',
|
'25-ip6tnl-tunnel-any-any.netdev',
|
||||||
'25-ip6tnl-tunnel-local-any.netdev',
|
'25-ip6tnl-tunnel-local-any.netdev',
|
||||||
|
'25-ip6tnl-tunnel-local-slaac.netdev',
|
||||||
|
'25-ip6tnl-tunnel-local-slaac.network',
|
||||||
'25-ip6tnl-tunnel-remote-any.netdev',
|
'25-ip6tnl-tunnel-remote-any.netdev',
|
||||||
'25-ip6tnl-tunnel.netdev',
|
'25-ip6tnl-tunnel.netdev',
|
||||||
'25-ipip-tunnel-any-any.netdev',
|
'25-ipip-tunnel-any-any.netdev',
|
||||||
@ -1039,8 +1042,10 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
|||||||
'gretun.network',
|
'gretun.network',
|
||||||
'ip6gretap.network',
|
'ip6gretap.network',
|
||||||
'ip6gretun.network',
|
'ip6gretun.network',
|
||||||
|
'ip6tnl-slaac.network',
|
||||||
'ip6tnl.network',
|
'ip6tnl.network',
|
||||||
'ipip.network',
|
'ipip.network',
|
||||||
|
'ipv6-prefix.network',
|
||||||
'ipvlan.network',
|
'ipvlan.network',
|
||||||
'ipvtap.network',
|
'ipvtap.network',
|
||||||
'isatap.network',
|
'isatap.network',
|
||||||
@ -1659,19 +1664,33 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
|
|||||||
copy_unit_to_networkd_unit_path('12-dummy.netdev', 'ip6tnl.network',
|
copy_unit_to_networkd_unit_path('12-dummy.netdev', 'ip6tnl.network',
|
||||||
'25-ip6tnl-tunnel.netdev', '25-tunnel.network',
|
'25-ip6tnl-tunnel.netdev', '25-tunnel.network',
|
||||||
'25-ip6tnl-tunnel-local-any.netdev', '25-tunnel-local-any.network',
|
'25-ip6tnl-tunnel-local-any.netdev', '25-tunnel-local-any.network',
|
||||||
'25-ip6tnl-tunnel-remote-any.netdev', '25-tunnel-remote-any.network')
|
'25-ip6tnl-tunnel-remote-any.netdev', '25-tunnel-remote-any.network',
|
||||||
|
'25-veth.netdev', 'ip6tnl-slaac.network', 'ipv6-prefix.network',
|
||||||
|
'25-ip6tnl-tunnel-local-slaac.netdev', '25-ip6tnl-tunnel-local-slaac.network')
|
||||||
start_networkd()
|
start_networkd()
|
||||||
self.wait_online(['ip6tnl99:routable', 'ip6tnl98:routable', 'ip6tnl97:routable', 'dummy98:degraded'])
|
self.wait_online(['ip6tnl99:routable', 'ip6tnl98:routable', 'ip6tnl97:routable', 'ip6tnl-slaac:degraded',
|
||||||
|
'dummy98:degraded', 'veth99:routable', 'veth-peer:degraded'])
|
||||||
|
|
||||||
output = check_output('ip -d link show ip6tnl99')
|
output = check_output('ip -d link show ip6tnl99')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98')
|
self.assertIn('ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2a00:ffde:4567:edde::4987 dev dummy98', output)
|
||||||
output = check_output('ip -d link show ip6tnl98')
|
output = check_output('ip -d link show ip6tnl98')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local (any|::) dev dummy98')
|
self.assertRegex(output, 'ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local (any|::) dev dummy98')
|
||||||
output = check_output('ip -d link show ip6tnl97')
|
output = check_output('ip -d link show ip6tnl97')
|
||||||
print(output)
|
print(output)
|
||||||
self.assertRegex(output, 'ip6tnl ip6ip6 remote (any|::) local 2a00:ffde:4567:edde::4987 dev dummy98')
|
self.assertRegex(output, 'ip6tnl ip6ip6 remote (any|::) local 2a00:ffde:4567:edde::4987 dev dummy98')
|
||||||
|
output = check_output('ip -d link show ip6tnl-slaac')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('ip6tnl ip6ip6 remote 2001:473:fece:cafe::5179 local 2002:da8:1:0:1034:56ff:fe78:9abc dev veth99', output)
|
||||||
|
|
||||||
|
output = check_output('ip -6 address show veth99')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('inet6 2002:da8:1:0:1034:56ff:fe78:9abc/64 scope global dynamic', output)
|
||||||
|
|
||||||
|
output = check_output('ip -4 route show default')
|
||||||
|
print(output)
|
||||||
|
self.assertIn('default dev ip6tnl-slaac proto static', output)
|
||||||
|
|
||||||
def test_sit_tunnel(self):
|
def test_sit_tunnel(self):
|
||||||
copy_unit_to_networkd_unit_path('12-dummy.netdev', 'sit.network',
|
copy_unit_to_networkd_unit_path('12-dummy.netdev', 'sit.network',
|
||||||
|
Loading…
Reference in New Issue
Block a user