From 91110cf203edb019dfd3eb3a779eac621945b94d Mon Sep 17 00:00:00 2001 From: Daniel Ankers Date: Mon, 22 Jan 2024 11:25:12 +0000 Subject: [PATCH] Order VLANs section by vid --- juniper-macros.j2 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/juniper-macros.j2 b/juniper-macros.j2 index 5c2df57..cc5cf6a 100644 --- a/juniper-macros.j2 +++ b/juniper-macros.j2 @@ -303,7 +303,7 @@ routing-options { {% macro vlanssection(vlans,device) %} 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 %} +{% for vlan in vlans|sort(attribute='vid') 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'] }}";