summaryrefslogtreecommitdiff
path: root/python/vyos/template.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/template.py')
-rw-r--r--python/vyos/template.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py
index 2bad6df06..0e79994f5 100644
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -616,6 +616,15 @@ def nft_nested_group(out_list, includes, groups, key):
add_includes(name)
return out_list
+@register_filter('range_to_regex')
+def range_to_regex(num_range):
+ from vyos.range_regex import range_to_regex
+ if '-' not in num_range:
+ return num_range
+
+ regex = range_to_regex(num_range)
+ return f'({regex})'
+
@register_test('vyos_defined')
def vyos_defined(value, test_value=None, var_type=None):
"""