summaryrefslogtreecommitdiff
path: root/scripts/cli/test_interfaces_wireguard.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-06-24 18:56:36 +0200
committerChristian Poessinger <christian@poessinger.com>2020-06-24 18:56:36 +0200
commitabe6f677ec620c98af7b612569d0d431e05a0bf7 (patch)
treed4e18876d9772fe49893b4de36651fe92c7e395b /scripts/cli/test_interfaces_wireguard.py
parent1dd18ea39de4184a65527ee0255802f3a6fe3953 (diff)
downloadvyos-1x-abe6f677ec620c98af7b612569d0d431e05a0bf7.tar.gz
vyos-1x-abe6f677ec620c98af7b612569d0d431e05a0bf7.zip
wireguard: extend tests with multiple allowed-ips
Diffstat (limited to 'scripts/cli/test_interfaces_wireguard.py')
-rwxr-xr-xscripts/cli/test_interfaces_wireguard.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/scripts/cli/test_interfaces_wireguard.py b/scripts/cli/test_interfaces_wireguard.py
index 159be02f1..0c32a4696 100755
--- a/scripts/cli/test_interfaces_wireguard.py
+++ b/scripts/cli/test_interfaces_wireguard.py
@@ -22,7 +22,7 @@ from base_interfaces_test import BasicInterfaceTest
# Generate WireGuard default keypair
if not os.path.isdir('/config/auth/wireguard/default'):
- os.system('/usr/libexec/vyos/op_mode/wireguard.py --genkey')
+ os.system('sudo /usr/libexec/vyos/op_mode/wireguard.py --genkey')
base_path = ['interfaces', 'wireguard']
@@ -54,7 +54,7 @@ class WireGuardInterfaceTest(unittest.TestCase):
self.session.set(base_path + [intf, 'peer', peer, 'port', '1337'])
# Allow different prefixes to traverse the tunnel
- allowed_ips = ['0.0.0.0/0']
+ allowed_ips = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16']
for ip in allowed_ips:
self.session.set(base_path + [intf, 'peer', peer, 'allowed-ips', ip])
@@ -62,5 +62,7 @@ class WireGuardInterfaceTest(unittest.TestCase):
self.session.set(base_path + [intf, 'peer', peer, 'pubkey', pubkey])
self.session.commit()
+ self.assertTrue(os.path.isdir(f'/sys/class/net/{intf}'))
+
if __name__ == '__main__':
unittest.main()