]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tests: add a basic test for wireguard (#10631)
authorEvgeny Vereshchagin <evvers@ya.ru>
Sat, 3 Nov 2018 17:03:43 +0000 (20:03 +0300)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sat, 3 Nov 2018 17:03:43 +0000 (02:03 +0900)
test/test-network/conf/25-wireguard.netdev [new file with mode: 0644]
test/test-network/systemd-networkd-tests.py

diff --git a/test/test-network/conf/25-wireguard.netdev b/test/test-network/conf/25-wireguard.netdev
new file mode 100644 (file)
index 0000000..01c5f2a
--- /dev/null
@@ -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
index ff632740fc289669f275b00327995659ca2fe3f9..16dadd1501cbdb64aa7d383ca66a67198f39277f 100755 (executable)
@@ -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')