{# Include API info #} {# used mainly for edge/distro #} {% set switch = objects["public/switches"].switches[switch_name] %} {% set switches2 = objects["public/switches"]["switches"] %} {% set switch_tags = objects["public/switches"].switches[switch_name].tags %} {% set switch_management = objects["read/switches-management"].switches[switch_name] %} {% set switch_management_network = objects["read/networks"].networks[switch_management.mgmt_vlan] %} {% set switches = objects["read/switches-management"]["switches"] %} {% set states = objects["public/switch-state"]["switches"] %} {% set distro_networks = objects["read/networks"]["networks"] %} {% set port = switches[switch_name].distro_phy_port %} {% set tree = objects["public/distro-tree"]["distro-tree-phy"] %} {% set device_tree = objects["public/distro-tree"]["distro-tree-sys"] %} {% set network = distro_networks[switch_name] %} {# Some functions that helps us create interfaces #} {% macro create_interface_vc(port) -%} {{ port.split("-")[1].split("/")[0] }} {%- endmacro %} {% macro create_interface_ge0(port) -%} {{ port.split("/")[2] | replace('.0', '')}} {%- endmacro %} {% macro create_interface_ge1(port) -%} {{ create_interface_ge0(port) | int + 1}} {%- endmacro %} {% macro create_interface_ae(port) -%} {{ create_interface_ge0(port) | int + 100}} {%- endmacro %} {# Static Vars #} {% set root_pw= '' %} {% set tech_pw = '' %} {% set snmp_community = '' %} {% set nameservers = [ '2a06:5841:f:d::101', '2a06:5841:f:e::132', ] %} {% set tacplusserver = "" %} {% set tacplus_secret = ''%} {% set uplink_ns = namespace(uplink_ports=[], all_ports=[]) %} {# Uplink porter: Vi reserverer i utgangspunktet alle siste 4 1g porter og 10g porter til uplink. EX4300-48MP er unntak ettersom det er trengsel på multirate porter. #} {%- set uplink_ns.active = [] %} {%- set uplink_ns.unused = [] %} {% if "ex4300-48mp" in switch_tags %} {% if "10g-uplink" in switch_tags and "10g-copper" in switch_tags %} {%- set uplink_ns.uplink_ports = ['mge-0/0/46','mge-0/0/47'] %} {%- set uplink_ns.all_ports = ['mge-0/0/46','mge-0/0/47'] %} {# litt mangel på porter her, så bare mulig med 2 stk uplink #} {%- if "1-uplink" in switch_tags %} {%- set uplink_ns.uplink_ports = ['mge-0/0/46'] %} {%- endif %} {%- else %} {%- set uplink_ns.uplink_ports = ['xe-0/2/0','xe-0/2/1'] %} {%- set uplink_ns.all_ports = ['xe-0/2/0','xe-0/2/1' ] %} {# støtter bare 2 uplinks her og, burde holde #} {%- if "1-uplink" in switch_tags %} {%- set uplink_ns.uplink_ports = ['xe-0/2/0'] %} {%- endif %} {%- endif %} {%- elif "10g-uplink" in switch_tags %} {%- set uplink_ns.uplink_ports = ['xe-0/1/0','xe-0/1/1'] %} {%- set uplink_ns.all_ports = ['xe-0/1/0','xe-0/1/1','xe-0/1/2', 'xe-0/1/3'] %} {%- if "1-uplink" in switch_tags %} {%- set uplink_ns.uplink_ports = ['xe-0/1/1'] %} {%- elif "2-uplinks" in switch_tags %} {%- set uplink_ns.uplink_ports = ['xe-0/1/0','xe-0/1/1'] %} {%- elif "3-uplinks" in switch_tags %} {%- set uplink_ns.uplink_ports = ['xe-0/1/0','xe-0/1/1','xe-0/1/2'] %} {%- elif "4-uplinks" in switch_tags %} {%- set uplink_ns.uplink_ports = ['xe-0/1/0','xe-0/1/1','xe-0/1/2', 'xe-0/1/3'] %} {%- endif %} {%- elif switch_name == "e1.roof" or switch_name == "e2.roof" %} {%- set uplink_ns.uplink_ports = ['ge-0/1/0'] %} {%- set uplink_ns.all_ports = ['ge-0/1/0','ge-0/1/1','ge-0/1/2','ge-0/1/3'] %} {%- else %} {%- set uplink_ns.uplink_ports = ['ge-0/0/44','ge-0/0/45'] %} {%- set uplink_ns.all_ports = ['ge-0/0/44','ge-0/0/45','ge-0/0/46','ge-0/0/47'] %} {%- if "1-uplink" in switch_tags %} {%- set uplink_ns.uplink_ports = ['ge-0/0/44'] %} {%- elif "2-uplinks" in switch_tags %} {%- set uplink_ns.uplink_ports = ['ge-0/0/44','ge-0/0/45'] %} {%- elif "3-uplinks" in switch_tags %} {%- set uplink_ns.uplink_ports = ['ge-0/0/44','ge-0/0/45','ge-0/0/46'] %} {%- elif "4-uplinks" in switch_tags %} {%- set uplink_ns.uplink_ports = uplink_ns.all_ports %} {%- endif %} {%- endif %} {# MAPS with info we're missing from gondul API#} {% set distrodata = { 'd1.floor' : {'if1':'et-0/2/0', 'if2':'et-1/2/0', 'uplink_device':'d1.roof', 'remote_phy1':'et-0/0/49', 'remote_phy2':'et-1/0/49', 'remote_ae':'ae18'}, 'd2.floor' : {'if1':'xe-0/1/0', 'if2':'xe-1/1/0', 'uplink_device':'d1.roof', 'remote_phy1':'xe-0/0/1', 'remote_phy2':'xe-1/0/1', 'remote_ae':'ae10'}, 'd3.floor' : {'if1':'xe-0/1/0', 'if2':'xe-1/1/0', 'uplink_device':'d1.roof', 'remote_phy1':'xe-0/0/2', 'remote_phy2':'xe-1/0/2', 'remote_ae':'ae11'}, 'd4.floor' : {'if1':'xe-0/1/0', 'if2':'xe-1/1/0', 'uplink_device':'d1.roof', 'remote_phy1':'xe-0/0/3', 'remote_phy2':'xe-1/0/3', 'remote_ae':'ae12'}, 'd5.floor' : {'if1':'xe-0/1/0', 'if2':'xe-1/1/0', 'uplink_device':'d1.roof', 'remote_phy1':'xe-0/0/4', 'remote_phy2':'xe-1/0/4', 'remote_ae':'ae13'}, 'd6.floor' : {'if1':'xe-0/1/0', 'if2':'xe-1/1/0', 'uplink_device':'d1.roof', 'remote_phy1':'xe-0/0/5', 'remote_phy2':'xe-1/0/5', 'remote_ae':'ae14'}, 'd1.ring' : {'if1':'et-4/0/24', 'if2':'et-5/1/0', 'uplink_device':'r1.tele', 'remote_phy1':'et-4/0/1', 'remote_phy2':'et-5/0/1', 'remote_ae':'ae11'}, 'd1.bird' : {'if1':'xe-0/1/0', 'if2':'xe-0/1/1', 'uplink_device':'d1.ring', 'remote_phy1':'xe-4/0/2', 'remote_phy2':'xe-4/0/3', 'remote_ae':'ae100'}, 'd1.sponsor' : {'if1':'xe-0/1/0', 'if2':'xe-0/1/1', 'uplink_device':'d1.ring', 'remote_phy1':'xe-5/2/0', 'remote_phy2':'xe-5/2/1', 'remote_ae':'ae102'}, 'd1.resepsjon' : {'if1':'xe-0/1/0', 'if2':'xe-0/1/1', 'uplink_device':'d1.ring', 'remote_phy1':'xe-4/0/6', 'remote_phy2':'xe-4/0/7', 'remote_ae':'ae103'}, } %} {% set vc_config = { 'd1.floor' : [{'sn':'', 're':true}, {'sn':'', 're':true}, {'sn':'', 're':false}], 'd2.floor' : [{'sn':'', 're':true}, {'sn':'', 're':true}, {'sn':'', 're':false}], 'd3.floor' : [{'sn':'', 're':true}, {'sn':'', 're':true}, {'sn':'', 're':false}], 'd4.floor' : [{'sn':'', 're':true}, {'sn':'', 're':true}, {'sn':'', 're':false}], 'd5.floor' : [{'sn':'', 're':true}, {'sn':'', 're':true}, {'sn':'', 're':false}], 'd6.floor' : [{'sn':'', 're':true}, {'sn':'', 're':true}, {'sn':'', 're':false}], 'd1.ring' : [{'sn':'', 'loc':'south'}, {'sn':'', 'loc':'log', 're':true}, {'sn':'', 'loc':'swing'}, {'sn':'', 'loc':'north', }, {'sn':'', 'loc':'noc','re':true}, {'sn':'', 'loc':'tele'}], } %} {% set ustkutt_distro_ae = { 'd1.bird' : "ae100", 'd1.north' : "ae101", 'd1.sponsor' : 'ae102', 'd1.resepsjon' : 'ae103' } %}