Roll back last whitespace fix

netbox
Daniel Ankers 2024-07-05 15:10:31 +01:00
parent 30fe75a9ed
commit 02b05dd0f1
1 changed files with 35 additions and 35 deletions

View File

@ -112,91 +112,91 @@ chassis {
{%- endmacro %} {%- endmacro %}
{%- macro interfaceconfig(interface,rack = None) -%} {% macro interfaceconfig(interface,rack = None) -%}
{%- if not ('-' in interface.name) or interface.description or interface.lag or interface.ip_addresses.count() or interface.connected_endpoints or interface.mode or interface.tagged_vlans.all() or interface.untagged_vlan %} {% if not ('-' in interface.name) or interface.description or interface.lag or interface.ip_addresses.count() or interface.connected_endpoints or interface.mode or interface.tagged_vlans.all() or interface.untagged_vlan %}
{{ interface.name }} { {{ interface.name }} {
{%- if interface.description %} {% if interface.description %}
description "{{ interface.description }}"; description "{{ interface.description }}";
{%- endif %} {% endif %}
{%- if interface.mtu and not interface.lag %} {% if interface.mtu and not interface.lag %}
mtu {{ interface.mtu }}; mtu {{ interface.mtu }};
{%- endif %} {% endif %}
{%- if interface.device.role.name in ['Provide Core'] %} {% if interface.device.role.name in ['Provide Core'] %}
flexible-vlan-tagging; flexible-vlan-tagging;
native-vlan-id 1; native-vlan-id 1;
encapsulation flexible-ethernet-services; encapsulation flexible-ethernet-services;
{%- endif %} {% endif %}
{%- if interface.lag %} {% if interface.lag %}
ether-options { ether-options {
802.3ad {{ interface.lag.name }}; 802.3ad {{ interface.lag.name }};
} }
{%- endif %} {% endif %}
{%- if interface.name.startswith('ae') %} {% if interface.name.startswith('ae') %}
{%- if interface.custom_field_data['esi_lag'] %} {% if interface.custom_field_data['esi_lag'] %}
esi { esi {
auto-derive { auto-derive {
lacp; lacp;
} }
all-active; all-active;
} }
{%- endif %} {% endif %}
aggregated-ether-options { aggregated-ether-options {
lacp { lacp {
periodic fast; periodic fast;
{%- if interface.custom_field_data['system_id'] %} {% if interface.custom_field_data['system_id'] %}
system-id {{ interface.custom_field_data['system_id'] }}; system-id {{ interface.custom_field_data['system_id'] }};
{%- elif interface.custom_field_data['esi_lag'] %} {% elif interface.custom_field_data['esi_lag'] %}
system-id 00:00:{{ '%02d' % rack|int }}:{% if interface.name[2:]|int < 99 %}{{ '%02d' % interface.name[2:]|int }}{% else %}{{ '%02x' % interface.name[2:]|int }}{% endif %}:00:01; system-id 00:00:{{ '%02d' % rack|int }}:{% if interface.name[2:]|int < 99 %}{{ '%02d' % interface.name[2:]|int }}{% else %}{{ '%02x' % interface.name[2:]|int }}{% endif %}:00:01;
{%- endif %} {% endif %}
} }
} }
{%- endif %} {% endif %}
{%- if interface.ip_addresses.count() > 0 %} {% if interface.ip_addresses.count() > 0 %}
unit 0 { unit 0 {
{%- if (interface.connected_endpoints) and (interface.connected_endpoints[0].device.role.name == 'Provider Core') %} {% if (interface.connected_endpoints) and (interface.connected_endpoints[0].device.role.name == 'Provider Core') %}
vlan-id 1; vlan-id 1;
{%- endif %} {% endif %}
family inet { family inet {
{% if interface.ip_addresses.first().status == 'reserved' %}inactive: {% endif %}address {{ interface.ip_addresses.first().address }}; {% if interface.ip_addresses.first().status == 'reserved' %}inactive: {% endif %}address {{ interface.ip_addresses.first().address }};
} }
} }
{%- endif %} {% endif %}
{%- if interface.device.role.name in ['Leaf','Spine'] %} {% if interface.device.role.name in ['Leaf','Spine'] %}
{%- if interface.mode != '' %} {% if interface.mode != '' %}
unit 0 { unit 0 {
family ethernet-switching { family ethernet-switching {
{%- if interface.mode=='ACCESS' %} {% if interface.mode=='ACCESS' %}
interface-mode access; interface-mode access;
vlan { vlan {
members {{ interface.untagged_vlan.vid }}; members {{ interface.untagged_vlan.vid }};
} }
{%- elif interface.mode=='TAGGED' %} {% elif interface.mode=='TAGGED' %}
interface-mode trunk; interface-mode trunk;
vlan { vlan {
members [ {% for vlan in interface.tagged_vlans %}{{ vlan.vid }} {% endfor %}]; members [ {% for vlan in interface.tagged_vlans %}{{ vlan.vid }} {% endfor %}];
} }
{%- elif interface.mode=='TAGGED_ALL' %} {% elif interface.mode=='TAGGED_ALL' %}
interface-mode trunk; interface-mode trunk;
vlan { vlan {
members [ all ]; members [ all ];
} }
{%- endif %} {% endif %}
storm-control default; storm-control default;
} }
} }
{%- elif interface.device.role.name in ['Provider Core'] and interface.connected_endpoints %} {% elif interface.device.role.name in ['Provider Core'] and interface.connected_endpoints %}
{%- if interface.connected_endpoints[0].device.role.name in ['Provider Edge'] %} {% if interface.connected_endpoints[0].device.role.name in ['Provider Edge'] %}
{%- for vlan in interface.tagged_vlans %} {% for vlan in interface.tagged_vlans %}
unit {{ vlan.vid }} { unit {{ vlan.vid }} {
encapsulation vlan-vpls; encapsulation vlan-vpls;
vlan-id {{ vlan.vid }}; vlan-id {{ vlan.vid }};
} }
{%- endfor %} {% endfor %}
{%- endif %} {% endif %}
{%- endif %} {% endif %}
{%- endif %} {% endif %}
} }
{%- endif %} {% endif %}
{%- endmacro %} {%- endmacro %}
{% macro interfacesection(device,vlans) %} {% macro interfacesection(device,vlans) %}