test-network: add testcase for vxlan local address auto selection

This commit is contained in:
Yu Watanabe 2021-12-12 13:58:13 +09:00
parent b886649c95
commit 49ad8da779
4 changed files with 43 additions and 3 deletions

View file

@ -0,0 +1,8 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[NetDev]
Name=vxlan-slaac
Kind=vxlan
[VXLAN]
VNI=4831584
Local=slaac

View file

@ -0,0 +1,7 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=vxlan-slaac
[Network]
IPv6AcceptRA=no
LinkLocalAddressing=yes

View file

@ -0,0 +1,10 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
[Match]
Name=veth99
[Network]
IPv6AcceptRA=yes
VXLAN=vxlan-slaac
[IPv6AcceptRA]
PrefixAllowList=2002:da8:1::/64

View file

@ -934,6 +934,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'vtitun98',
'vtitun99',
'vxcan99',
'vxlan-slaac',
'vxlan97',
'vxlan98',
'vxlan99',
@ -1029,6 +1030,9 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'25-vxcan.netdev',
'25-vxlan-independent.netdev',
'25-vxlan-ipv6.netdev',
'25-vxlan-local-slaac.netdev',
'25-vxlan-local-slaac.network',
'25-vxlan-veth99.network',
'25-vxlan.netdev',
'25-wireguard-23-peers.netdev',
'25-wireguard-23-peers.network',
@ -1825,13 +1829,16 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertRegex(output, 'encap fou encap-sport auto encap-dport 55556')
def test_vxlan(self):
copy_unit_to_networkd_unit_path('25-vxlan.netdev', 'vxlan.network',
copy_unit_to_networkd_unit_path('11-dummy.netdev', 'vxlan-test1.network',
'25-vxlan.netdev', 'vxlan.network',
'25-vxlan-ipv6.netdev', 'vxlan-ipv6.network',
'25-vxlan-independent.netdev', 'netdev-link-local-addressing-yes.network',
'11-dummy.netdev', 'vxlan-test1.network')
'25-veth.netdev', '25-vxlan-veth99.network', 'ipv6-prefix.network',
'25-vxlan-local-slaac.netdev', '25-vxlan-local-slaac.network')
start_networkd()
self.wait_online(['test1:degraded', 'vxlan99:degraded', 'vxlan98:degraded', 'vxlan97:degraded'])
self.wait_online(['test1:degraded', 'veth99:routable', 'veth-peer:degraded',
'vxlan99:degraded', 'vxlan98:degraded', 'vxlan97:degraded', 'vxlan-slaac:degraded'])
output = check_output('ip -d link show vxlan99')
print(output)
@ -1864,6 +1871,14 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertIn('00:00:00:00:00:00 dst fe80::27c:16ff:fec0:6c74 via test1 self permanent', output)
self.assertIn('00:00:00:00:00:00 dst fe80::2a2:e4ff:fef9:2269 via test1 self permanent', output)
output = check_output('ip -d link show vxlan-slaac')
print(output)
self.assertIn('vxlan id 4831584 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)
def test_macsec(self):
copy_unit_to_networkd_unit_path('25-macsec.netdev', '25-macsec.network', '25-macsec.key',
'macsec.network', '12-dummy.netdev')