From 4b6297e832b9bd793d38e1bf981cc502a991550a Mon Sep 17 00:00:00 2001 From: Daniel Ankers Date: Mon, 22 Jan 2024 11:35:56 +0000 Subject: [PATCH] VLANs section and AE interfaces should be sorted alphabetically by name --- juniper-macros.j2 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/juniper-macros.j2 b/juniper-macros.j2 index cc5cf6a..a65702e 100644 --- a/juniper-macros.j2 +++ b/juniper-macros.j2 @@ -147,7 +147,7 @@ interfaces { {% for interface in device['interfaces'] if interface['name'].startswith('et-') %} {{ interfaceconfig(interface) }} {% endfor %} -{% for interface in device['interfaces'] if interface['name'].startswith('ae') %} +{% for interface in device['interfaces']|sort(attribute='name') if interface['name'].startswith('ae') %} {{ interfaceconfig(interface,device['rack']['name'][5:]) }} {% endfor %} {% for interface in device['interfaces'] if interface['name']=='em0' %} @@ -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|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 %} +{% for vlan in vlans|sort(attribute='name') 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'] }}";