summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-openvpn.py9
-rw-r--r--src/tests/test_jinja_filters.py12
2 files changed, 12 insertions, 9 deletions
diff --git a/src/conf_mode/interfaces-openvpn.py b/src/conf_mode/interfaces-openvpn.py
index 3ad04610a..b1318b9ee 100755
--- a/src/conf_mode/interfaces-openvpn.py
+++ b/src/conf_mode/interfaces-openvpn.py
@@ -449,15 +449,6 @@ def generate(openvpn):
if 'deleted' in openvpn or 'disable' in openvpn:
return None
- # create config directory on demand
- directories = []
- directories.append(f'{directory}/status')
- directories.append(ccd_dir)
- for onedir in directories:
- if not os.path.exists(onedir):
- os.makedirs(onedir, 0o755)
- chown(onedir, user, group)
-
# Fix file permissons for keys
fix_permissions = []
diff --git a/src/tests/test_jinja_filters.py b/src/tests/test_jinja_filters.py
index 17219802a..acd7a5952 100644
--- a/src/tests/test_jinja_filters.py
+++ b/src/tests/test_jinja_filters.py
@@ -21,6 +21,9 @@ from vyos.template import vyos_address_from_cidr
from vyos.template import vyos_netmask_from_cidr
from vyos.template import vyos_ipv4
from vyos.template import vyos_ipv6
+from vyos.template import vyos_first_host_address
+from vyos.template import vyos_last_host_address
+from vyos.template import vyos_inc_ip
class TestTeamplteHelpers(TestCase):
def setUp(self):
@@ -55,3 +58,12 @@ class TestTeamplteHelpers(TestCase):
self.assertTrue(vyos_ipv6('2001:db8::/32'))
self.assertTrue(vyos_ipv6('2001:db8::/64'))
+ def test_helpers_first_host_address(self):
+ self.assertEqual(vyos_first_host_address('10.0.0.0/24'), '10.0.0.1')
+ self.assertEqual(vyos_first_host_address('10.0.0.128/25'), '10.0.0.129')
+ self.assertEqual(vyos_first_host_address('10.0.0.200/29'), '10.0.0.201')
+
+ self.assertEqual(vyos_first_host_address('2001:db8::/64'), '2001:db8::')
+ self.assertEqual(vyos_first_host_address('2001:db8::/112'), '2001:db8::')
+ self.assertEqual(vyos_first_host_address('2001:db8::10/112'), '2001:db8::10')
+ self.assertEqual(vyos_first_host_address('2001:db8::100/112'), '2001:db8::100')