summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYu Watanabe <watanabe.yu+github@gmail.com>2021-12-12 05:58:13 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2021-12-25 07:32:06 +0100
commit49ad8da7798248f2b604e937afb2727aa3c89454 (patch)
tree0d40051b95a24d5c477a0de653e10b79130733cc
parentnetwork: vxlan: support to select an address assigned on underlying interface... (diff)
downloadsystemd-49ad8da7798248f2b604e937afb2727aa3c89454.tar.xz
systemd-49ad8da7798248f2b604e937afb2727aa3c89454.zip
test-network: add testcase for vxlan local address auto selection
-rw-r--r--test/test-network/conf/25-vxlan-local-slaac.netdev8
-rw-r--r--test/test-network/conf/25-vxlan-local-slaac.network7
-rw-r--r--test/test-network/conf/25-vxlan-veth99.network10
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py21
4 files changed, 43 insertions, 3 deletions
diff --git a/test/test-network/conf/25-vxlan-local-slaac.netdev b/test/test-network/conf/25-vxlan-local-slaac.netdev
new file mode 100644
index 0000000000..43f5934d2a
--- /dev/null
+++ b/test/test-network/conf/25-vxlan-local-slaac.netdev
@@ -0,0 +1,8 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[NetDev]
+Name=vxlan-slaac
+Kind=vxlan
+
+[VXLAN]
+VNI=4831584
+Local=slaac
diff --git a/test/test-network/conf/25-vxlan-local-slaac.network b/test/test-network/conf/25-vxlan-local-slaac.network
new file mode 100644
index 0000000000..4ea1eae875
--- /dev/null
+++ b/test/test-network/conf/25-vxlan-local-slaac.network
@@ -0,0 +1,7 @@
+# SPDX-License-Identifier: LGPL-2.1-or-later
+[Match]
+Name=vxlan-slaac
+
+[Network]
+IPv6AcceptRA=no
+LinkLocalAddressing=yes
diff --git a/test/test-network/conf/25-vxlan-veth99.network b/test/test-network/conf/25-vxlan-veth99.network
new file mode 100644
index 0000000000..b67b746624
--- /dev/null
+++ b/test/test-network/conf/25-vxlan-veth99.network
@@ -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
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index d3c9fdad01..5613398757 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -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')