Only configure relevant VLANs on any switch

main
Daniel Ankers 2024-01-19 16:50:24 +00:00
parent 4bdd303dff
commit e38c09bc09
1 changed files with 2 additions and 1 deletions

View File

@ -302,7 +302,8 @@ routing-options {
{% macro vlanssection(vlans,device) %}
vlans {
{% for vlan in vlans %}
{# This next line selects all of the VLANs which are configured on this device #}
{% for vlan in vlans if (device['interfaces']|selectattr('untagged_vlan.vid','equalto',vlan)|list|count or interfaces|map(attribute='tagged_vlans')|sum(start=[])|selectattr('vid','equalto',vlan)|list|count) or device['interfaces']|selectattr('name', 'equalto', 'irb.'+vlan['vid']|string)|list|count %}
vl{{ vlan['vid'] }} {
{% if vlan['name'] != '' %}
description "{{ vlan['name'] }}";