aboutsummaryrefslogtreecommitdiffstats
path: root/templating/templates
diff options
context:
space:
mode:
authorKristian Lyngstol <kly@kly.no>2016-11-07 21:47:37 +0100
committerKristian Lyngstol <kly@kly.no>2016-11-07 21:47:37 +0100
commitc9bdd40a9f90c9f5205ba058d6bc5ab1443dfee4 (patch)
tree50927cb5610df6fb1f0d6162efae91f2feac6d60 /templating/templates
parentf0ba03a2319f1c2ac9346494dc03696684722d4e (diff)
Templating: Add variable-support and provide demo
This SHOULD resolve everything needed for FAP from a templating perspective.
Diffstat (limited to 'templating/templates')
-rw-r--r--templating/templates/switch.txt19
1 files changed, 19 insertions, 0 deletions
diff --git a/templating/templates/switch.txt b/templating/templates/switch.txt
new file mode 100644
index 0000000..0fd9754
--- /dev/null
+++ b/templating/templates/switch.txt
@@ -0,0 +1,19 @@
+{#
+ This can be used through GET /templating/switch.txt?switch=e41-2
+
+ It is provided as a simple demo of how to combine "GET parameters" with
+ templating.
+
+ #}
+{% set sw = options["switch"] %}
+{% set s = objects["public/switches"].switches[sw] %}
+{% if s %}
+{% set mg = objects["read/switches-management"].switches[sw] %}
+
+Switch {{ sw }} has management ip {{ mg.mgmt_v4_addr }}
+
+It is assoicated with distro {{ s.distro_name }}
+{% else %}
+Switch not found
+{% endif %}
+