summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2023-03-10 11:21:33 +0200
committerGitHub <noreply@github.com>2023-03-10 11:21:33 +0200
commita3b16a483140bff9d0085351adabcb2e793cfe2b (patch)
treeeae91a0dccc98b26eb48de8440c0d34dc2d1dc9b /python
parent9e79f8a38be18383f12c06913d23e63b2b2e2ae3 (diff)
parent36fea4cb4956ac396f20c785f6ff710c00e2ad8f (diff)
downloadvyos-1x-a3b16a483140bff9d0085351adabcb2e793cfe2b.tar.gz
vyos-1x-a3b16a483140bff9d0085351adabcb2e793cfe2b.zip
Merge pull request #1859 from sever-sever/T5033-eq
T5033: Ability to generate muliple keys from a file or link
Diffstat (limited to 'python')
-rw-r--r--python/vyos/template.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/python/vyos/template.py b/python/vyos/template.py
index 88271125c..4778bf1c8 100644
--- a/python/vyos/template.py
+++ b/python/vyos/template.py
@@ -1,4 +1,4 @@
-# Copyright 2019-2020 VyOS maintainers and contributors <maintainers@vyos.io>
+# Copyright 2019-2023 VyOS maintainers and contributors <maintainers@vyos.io>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
@@ -161,6 +161,16 @@ def dot_colon_to_dash(text):
text = text.replace(".", "-")
return text
+@register_filter('generate_uuid4')
+def generate_uuid4(text):
+ """ Generate random unique ID
+ Example:
+ % uuid4()
+ UUID('958ddf6a-ef14-4e81-8cfb-afb12456d1c5')
+ """
+ from uuid import uuid4
+ return uuid4()
+
@register_filter('netmask_from_cidr')
def netmask_from_cidr(prefix):
""" Take CIDR prefix and convert the prefix length to a "subnet mask".