diff options
author | Kristian Lyngstol <kristian@bohemians.org> | 2016-11-08 11:38:17 +0100 |
---|---|---|
committer | Kristian Lyngstol <kristian@bohemians.org> | 2016-11-08 11:38:17 +0100 |
commit | f9e79c6d8e7484e00e493d1b3436d5c6bc05be3e (patch) | |
tree | 0caf4e7ef5bc3a69b2bd2078231879bd0631ec4b /web | |
parent | d8f2953b4b3cd86865d266b70f765cd200f9dcf6 (diff) |
Move templating URLs around
Fixes #143
Fixes #141
Diffstat (limited to 'web')
-rw-r--r-- | web/templates/switch.txt | 19 | ||||
-rw-r--r-- | web/templates/switches.txt | 7 |
2 files changed, 26 insertions, 0 deletions
diff --git a/web/templates/switch.txt b/web/templates/switch.txt new file mode 100644 index 0000000..0fd9754 --- /dev/null +++ b/web/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 %} + diff --git a/web/templates/switches.txt b/web/templates/switches.txt new file mode 100644 index 0000000..0cc203b --- /dev/null +++ b/web/templates/switches.txt @@ -0,0 +1,7 @@ +{% for switch in objects["public/switches"].switches %} + {% set mg = objects["read/switches-management"].switches[switch] %} + {% set s = objects["public/switches"].switches[switch] %} + {% if mg.subnet4 -%} + {{ switch }} {{mg.subnet4 }} {{ mg.subnet6 }} {{ mg.mgmt_v4_addr }} {{ mg.mgmt_v6_addr }} {{ mg.traffic_vlan }} {{ s.distro_name }} + {% endif %} +{% endfor %} |