summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEvgeny Vereshchagin <evvers@ya.ru>2018-11-03 18:03:43 +0100
committerYu Watanabe <watanabe.yu+github@gmail.com>2018-11-03 18:03:43 +0100
commit7a3bc5a8e52acbaf68cad61aa96b5f7093adc005 (patch)
tree855aadc54cd35665205f343ecae7c92eace29c24
parentdocs: Fix a typo in CODING_STYLE.md (#10630) (diff)
downloadsystemd-7a3bc5a8e52acbaf68cad61aa96b5f7093adc005.tar.xz
systemd-7a3bc5a8e52acbaf68cad61aa96b5f7093adc005.zip
tests: add a basic test for wireguard (#10631)
-rw-r--r--test/test-network/conf/25-wireguard.netdev15
-rwxr-xr-xtest/test-network/systemd-networkd-tests.py16
2 files changed, 29 insertions, 2 deletions
diff --git a/test/test-network/conf/25-wireguard.netdev b/test/test-network/conf/25-wireguard.netdev
new file mode 100644
index 0000000000..01c5f2a28d
--- /dev/null
+++ b/test/test-network/conf/25-wireguard.netdev
@@ -0,0 +1,15 @@
+[NetDev]
+Name=wg99
+Kind=wireguard
+
+[WireGuard]
+PrivateKey=EEGlnEPYJV//kbvvIqxKkQwOiS+UENyPncC4bF46ong=
+ListenPort=51820
+FwMark=1234
+
+[WireGuardPeer]
+PublicKey=RDf+LSpeEre7YEIKaxg+wbpsNV7du+ktR99uBEtIiCA=
+AllowedIPs=fd31:bf08:57cb::/48,192.168.26.0/24
+Endpoint=wireguard.example.com:51820
+PresharedKey=IIWIV17wutHv7t4cR6pOT91z6NSz/T8Arh0yaywhw3M=
+PersistentKeepalive=20
diff --git a/test/test-network/systemd-networkd-tests.py b/test/test-network/systemd-networkd-tests.py
index ff632740fc..16dadd1501 100755
--- a/test/test-network/systemd-networkd-tests.py
+++ b/test/test-network/systemd-networkd-tests.py
@@ -145,7 +145,7 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
links =['bridge99', 'bond99', 'bond99', 'vlan99', 'test1', 'macvtap99',
'macvlan99', 'ipvlan99', 'vxlan99', 'veth99', 'vrf99', 'tun99',
'tap99', 'vcan99', 'geneve99', 'dummy98', 'ipiptun99', 'sittun99',
- 'gretap99', 'vtitun99', 'vti6tun99','ip6tnl99', 'gretun99', 'ip6gretap99']
+ 'gretap99', 'vtitun99', 'vti6tun99','ip6tnl99', 'gretun99', 'ip6gretap99', 'wg99']
units = ['25-bridge.netdev', '25-bond.netdev', '21-vlan.netdev', '11-dummy.netdev', '21-vlan.network',
'21-macvtap.netdev', 'macvtap.network', '21-macvlan.netdev', 'macvlan.network', 'vxlan.network',
@@ -154,7 +154,8 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
'25-ip6tnl-tunnel.netdev', '25-ip6gre-tunnel.netdev','25-sit-tunnel.netdev', '25-gre-tunnel.netdev',
'25-gretap-tunnel.netdev', '25-vti-tunnel.netdev', '25-vti6-tunnel.netdev', '12-dummy.netdev',
'gre.network', 'ipip.network', 'ip6gretap.network', 'gretun.network', 'ip6tnl.network', '25-tap.netdev',
- 'vti6.network', 'vti.network', 'gretap.network', 'sit.network', '25-ipip-tunnel-independent.netdev']
+ 'vti6.network', 'vti.network', 'gretap.network', 'sit.network', '25-ipip-tunnel-independent.netdev',
+ '25-wireguard.netdev']
def setUp(self):
self.link_remove(self.links)
@@ -276,6 +277,17 @@ class NetworkdNetDevTests(unittest.TestCase, Utilities):
self.assertTrue(self.link_exits('vcan99'))
+ @expectedFailureIfModuleIsNotAvailable('wireguard')
+ def test_wireguard(self):
+ self.copy_unit_to_networkd_unit_path('25-wireguard.netdev')
+
+ self.start_networkd()
+
+ if shutil.which('wg'):
+ subprocess.call('wg')
+
+ self.assertTrue(self.link_exits('wg99'))
+
def test_geneve(self):
self.copy_unit_to_networkd_unit_path('25-geneve.netdev')