|
{%- macro interface_description(interface, interface_context) %}
|
|
description "{% if interface.label %}{{ interface.label|replace('"','\\"') or "-" }}: {% endif %}{{ interface.description|replace('"','\\"') or "-" }}{% if interface.connected_endpoint %} ({{ interface.connected_endpoint.name|replace('"','\\"')|replace('.voneus.net','') }}{% if interface.connected_endpoint.device.name %} @ {{ interface.connected_endpoint.device.name|replace('.voneus.net','')|replace('"','\\"') }}{% endif %}){% endif %}{% if interface.cable %} via [{{ interface.cable.label.split("/")[-1] }}]{% endif %}{% if interface.link_peer %} to [{{ interface.link_peer.label or interface.link_peer.name }}{% if interface.link_peer.device %} @ {{ interface.link_peer.device.name.split("/")[-1]|replace('"','\\"')|replace('.voneus.net','') }}]{% endif %}{% endif %}"
|
|
{%- endmacro %}
|
|
|
|
{%- macro interface_common(interface, interface_context, mtu=True) %}
|
|
{%- if mtu and interface.mtu %}
|
|
mtu {{ interface.mtu }};
|
|
{%- endif %}
|
|
{%- endmacro %}
|
|
|
|
{%- macro interface_addresses(device, interface, interface_context, mtu=False) %}
|
|
family inet {
|
|
{%- if mtu and interface.mtu %}
|
|
mtu {{ interface.mtu }};
|
|
{%- endif %}
|
|
{%- for address in interface|get_addresses %}{% if address|ipv4 %}
|
|
address {{ address.address }}{% if address.address == device.primary_ip4.address %}{
|
|
primary;
|
|
preferred;
|
|
}{% endif %}
|
|
{%- endif %}{%- endfor %}
|
|
}
|
|
family inet6 {
|
|
{%- if mtu and interface.mtu %}
|
|
mtu {{ interface.mtu }};
|
|
{%- endif %}
|
|
{%- for address in interface|get_addresses %}{% if address|ipv6 %}
|
|
address {{ address.address }}{% if address.address == device.primary_ip6.address %}{
|
|
primary;
|
|
preferred;
|
|
}{% endif %}
|
|
{%- endif %}{%- endfor %}
|
|
}
|
|
{%- set tags = interface.tags|tags_to_map %}
|
|
{%- if 'core-isis-link' in tags %}
|
|
family iso;
|
|
family mpls;
|
|
{%- elif 'isis-loopback' in tags %}
|
|
family iso {
|
|
address {{ device.primary_ip4.address|ipv4_to_iso }};
|
|
}
|
|
{%- endif %}
|
|
{%- endmacro %}
|