summaryrefslogtreecommitdiff
path: root/python/vyos/template.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-12-28 20:05:42 +0100
committerGitHub <noreply@github.com>2021-12-28 20:05:42 +0100
commit961ed0f869979f66cb99492545d686ec380689a9 (patch)
tree8643a31cc75b4c0174f06b202205bada3e4b0a90 /python/vyos/template.py
parent5c5e283f8a964f5bbb3d838d1c0aabdee4e2032b (diff)
parent5e05bfe790035f7d53dede8d76bccb089a186864 (diff)
downloadvyos-1x-961ed0f869979f66cb99492545d686ec380689a9.tar.gz
vyos-1x-961ed0f869979f66cb99492545d686ec380689a9.zip
Merge pull request #1123 from sever-sever/T4111
ipsec: T4111: Fix for swanctl configuration IPV6 peers
Diffstat (limited to 'python/vyos/template.py')
-rw-r--r--python/vyos/template.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py
index b32cafe74..29c6b3882 100644
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -151,6 +151,16 @@ def bracketize_ipv6(address):
return f'[{address}]'
return address
+@register_filter('dot_colon_to_dash')
+def dot_colon_to_dash(text):
+ """ Replace dot and colon to dash for string
+ Example:
+ 192.0.2.1 => 192-0-2-1, 2001:db8::1 => 2001-db8--1
+ """
+ text = text.replace(":", "-")
+ text = text.replace(".", "-")
+ return text
+
@register_filter('netmask_from_cidr')
def netmask_from_cidr(prefix):
""" Take CIDR prefix and convert the prefix length to a "subnet mask".