From 9ec0b176311e66ceb37018ced80673cfea1ad3b0 Mon Sep 17 00:00:00 2001 From: Viacheslav Hletenko Date: Thu, 14 Jul 2022 13:39:23 +0000 Subject: netflow: T4532: Fix flow-accounting server IPv6 bug Fix for IPv6 netflow_plugin name When we use IPv6 uacctd.conf doesnt expect coluns in the plugin name. Replace coluns to dash. Place IPv6 address into [] brackets --- python/vyos/template.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'python') 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". -- cgit v1.2.3