summaryrefslogtreecommitdiff
path: root/src/tests
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-11-01 15:29:37 +0100
committerChristian Poessinger <christian@poessinger.com>2020-11-01 16:41:44 +0100
commiteb1ed5e518a08c488fd05ce9cf63b63a5a25c21a (patch)
tree190e92766967bbb1362a82caa51f87ef8a4a411d /src/tests
parent0bb7a7d32b6182064acf3203050464f22815ef5d (diff)
downloadvyos-1x-eb1ed5e518a08c488fd05ce9cf63b63a5a25c21a.tar.gz
vyos-1x-eb1ed5e518a08c488fd05ce9cf63b63a5a25c21a.zip
openvpn: T2994: re-add ifconfig-pool statement in server config
Re-organize the template code and add addtitional Jinja2 filters for processing the ifconfig-pool statement. This reverts the changes from commit 7e546be9 ("openvpn: T2994: temporary revert to 1.2 crux behavior for client pools").
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/test_jinja_filters.py12
1 files changed, 12 insertions, 0 deletions
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')