aboutsummaryrefslogtreecommitdiffstats
path: root/examples/tg23/templates/magic.conf
diff options
context:
space:
mode:
Diffstat (limited to 'examples/tg23/templates/magic.conf')
-rw-r--r--examples/tg23/templates/magic.conf39
1 files changed, 39 insertions, 0 deletions
diff --git a/examples/tg23/templates/magic.conf b/examples/tg23/templates/magic.conf
new file mode 100644
index 0000000..de71dc2
--- /dev/null
+++ b/examples/tg23/templates/magic.conf
@@ -0,0 +1,39 @@
+{# HOWTO #}
+{# Manual query parameters: ?switch=e1-1 #}
+
+{# If there is no manual switch option we just assume it's fap.
+ The FAP query looks like this: "?a=d1.ring:ge-1/0/2.0:mgmt+irb.666".
+ agentDistro and agentPort is functions from template.py. And splits out
+ d1.ring and ge-1/0/2.0.
+ The distro-tree API endpoint has a overview of what switch is connected to what
+ distro on each port. #}
+
+{% if options["a"] %}
+ {% set distro = options["a"] | agentDistro %}
+ {% set port = options["a"] | agentPort %}
+ {% set switch_name = objects["public/distro-tree"]['distro-tree-phy'][distro][port] %}
+{% elif options["switch"] %}
+ {% set switch_name = options["switch"] %}
+{% else %}
+Unsupported option. Please use "?switch=e1-1" if this is done manually.
+{% endif %}
+
+
+{# Change this if statement to do if edge, elif distro etc before tg20 #}
+{# tagging edge switches was never done during TG19 #}
+{% if switch_name is defined %}
+ {% import "vars.conf" as v with context %}
+ {% if switch_name == "d1.roof" %}
+ {% include "dist-roof.conf" %}
+ {% elif switch_name == "r1.tele" %}
+ {% include "core.conf" %}
+ {% elif switch_name == "r1.stand" %}
+ {% include "r1.stand.conf" %}
+ {% elif ("distro" in v.switch_tags or "distro-utskutt" in v.switch_tags) and "els-software" in v.switch_tags %}
+ {% include "juniper-distro-els.conf" %}
+ {% elif "distro" in v.switch_tags or "distro-utskutt" in v.switch_tags %}
+ {% include "juniper-distro-non-els.conf" %}
+ {% else %}
+ {% include "edge.conf" %}
+ {% endif %}
+{% endif %} \ No newline at end of file