aboutsummaryrefslogtreecommitdiffstats
path: root/examples/tg23/templates/magic.conf
blob: de71dc23c9ae822b6aa8bd72a70c06f690d8fd3a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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 %}