{%- set floor_distros = [ 'd1.floor', 'd2.floor', 'd3.floor', 'd4.floor', 'd5.floor', 'd6.floor', ] %} {% set ae10_networks = [] %} {# networks via roof #} {% set ae11_networks = [] %} {# networks via ring #} {% for key, switchname in v.tree['d1.ring'].items() %} {# some switches might not have networks. For instance wifi or "utskutt-distro" #} {% if switchname in v.distro_networks %} {% do ae11_networks.append(v.distro_networks[switchname]) %} {% endif %} {% if "distro-utskutt" in objects["public/switches"].switches[switchname].tags %} {% if switchname in v.tree %} {% for key, switchname2 in v.tree[switchname].items() %} {% do ae11_networks.append(v.distro_networks[switchname2]) %} {% endfor %} {% endif %} {% endif %} {% endfor %} {% for distro in floor_distros %} {% if v.tree[distro] %} {% for key, switchname in v.tree[distro].items() %} {% do ae10_networks.append(v.distro_networks[switchname]) %} {% endfor %} {% endif %} {% endfor %} {# NAT stuff gulvet #} routing-instances { NAT-LAN { {% for distro in floor_distros %} {% if v.tree[distro] %} {% for key, switchname in v.tree[distro].items() %} {% if "nat" in objects["public/switches"].switches[switchname].tags %} {% set network = v.distro_networks[switchname] %} interface ae10.{{ network.vlan }}; {% endif %} {% endfor %} {% endif %} {% endfor %} {# NAT stuff ringen #} {% if v.tree['d1.ring'] %} {% for key, switchname in v.tree['d1.ring'].items() %} {% set network = v.distro_networks[switchname] %} {% if "nat" in objects["public/switches"].switches[switchname].tags %} interface ae11.{{ network.vlan }}; {% endif %} {% endfor %} {% endif %} } } {# Roof / Floor stuff #} interfaces { ae10 { {% for network in ae10_networks %} unit {{ network.vlan }} { description "C: {{ network.name }} - VLAN {{ network.vlan }}"; no-traps; vlan-tags outer {{ network.vlan }}; family inet { no-redirects; address {{ network.gw4 }}/{{ network.subnet4|cidr }}; } family inet6 { address {{ network.gw6 }}/{{ network.subnet6|cidr }}; } } {% endfor %} } } protocols { router-advertisement { {% for network in ae10_networks %} interface ae10.{{ network.vlan }} { max-advertisement-interval 30; managed-configuration; other-stateful-configuration; } {% endfor %} } } forwarding-options { dhcp-relay { dhcpv6 { group all-networks { {% for network in ae10_networks %} interface ae10.{{ network.vlan }}; {% endfor %} } } group all-networks { {% for network in ae10_networks %} interface ae10.{{ network.vlan }}; {% endfor %} } } } {# Ring stuff #} {% if v.tree['d1.ring'] %} interfaces { ae11 { {% for network in ae11_networks %} unit {{ network.vlan }} { description "C: {{ network.name }} - VLAN {{ network.vlan }}"; no-traps; vlan-tags outer {{ network.vlan }}; family inet { no-redirects; address {{ network.gw4 }}/{{ network.subnet4|cidr }}; } family inet6 { address {{ network.gw6 }}/{{ network.subnet6|cidr }}; } } {% endfor %} } } protocols { router-advertisement { {% for network in ae11_networks %} interface ae11.{{ network.vlan }} { max-advertisement-interval 30; managed-configuration; other-stateful-configuration; } {% endfor %} } } forwarding-options { dhcp-relay { dhcpv6 { group all-networks { {% for network in ae11_networks %} interface ae11.{{ network.vlan }}; {% endfor %} } } group all-networks { {% for network in ae11_networks %} interface ae11.{{ network.vlan }}; {% endfor %} } } } {% endif %}