From 7a3bc5a8e52acbaf68cad61aa96b5f7093adc005 Mon Sep 17 00:00:00 2001 From: Evgeny Vereshchagin Date: Sat, 3 Nov 2018 20:03:43 +0300 Subject: tests: add a basic test for wireguard (#10631) --- test/test-network/conf/25-wireguard.netdev | 15 +++++++++++++++ test/test-network/systemd-networkd-tests.py | 16 ++++++++++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 test/test-network/conf/25-wireguard.netdev (limited to 'test') 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') -- cgit v1.2.3