summaryrefslogtreecommitdiff
path: root/python/vyos/template.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-14 19:23:59 +0200
committerGitHub <noreply@github.com>2022-07-14 19:23:59 +0200
commit9810898b2a16c9f2fce1810c8c2f6b62095d4aba (patch)
tree3aa5d89cec1edab0636cf48ddee721daae516a03 /python/vyos/template.py
parent02104b8cb194ac4034ff60663523620bc3eaf01e (diff)
parent9ec0b176311e66ceb37018ced80673cfea1ad3b0 (diff)
downloadvyos-1x-9810898b2a16c9f2fce1810c8c2f6b62095d4aba.tar.gz
vyos-1x-9810898b2a16c9f2fce1810c8c2f6b62095d4aba.zip
Merge pull request #1412 from sever-sever/T4532-eq
netflow: T4532: Fix flow-accounting server IPv6 bug
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 f9e754357..88271125c 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".