diff --git a/juniper-macros.j2 b/juniper-macros.j2 index 67ef287..adc6b33 100644 --- a/juniper-macros.j2 +++ b/juniper-macros.j2 @@ -85,6 +85,11 @@ chassis { {% if interface.mtu and not interface.lag %} mtu {{ interface.mtu }}; {% endif %} +{% if interface.tags.filter(name__in=['vpls-core','vpls-edge']).count() %} + flexible-vlan-tagging; + native-vlan-id 1; + encapsulation flexible-ethernet-services; +{% endif %} {% if interface.lag %} ether-options { 802.3ad {{ interface.lag.name }}; @@ -112,11 +117,15 @@ chassis { {% endif %} {% if interface.ip_addresses.count() > 0 %} unit 0 { +{% if interface.tags.filter(name__in=['vpls-core']).count() %} + vlan-id 1; +{% endif %} family inet { {% if interface.ip_addresses.first().status == 'reserved' %}inactive: {% endif %}address {{ interface.ip_addresses.first().address }}; } } {% endif %} +{% if device.role.name in ['Leaf','Spine'] %} {% if interface.mode != '' %} unit 0 { family ethernet-switching { @@ -139,6 +148,15 @@ chassis { storm-control default; } } +{% elif device.role.name in ['Provider Core'] %} +{% if interface.tags.filter(name__in=['vpls-edge']).count() %} +{% for vlan in interface.tagged_vlans %} + unit {{ vlan.vid }} { + encapsulation vlan-vpls; + vlan-id {{ vlan.vid }}; + } +{% endfor %} +{% endif %} {% endif %} } {%- endmacro %}