fabric: sort bridge VLANs by ID

Instead of barfing on unsortable dicts.
This commit is contained in:
Timotej Lazar 2023-12-29 13:51:38 +01:00
parent 6fd5432b69
commit be398e54fe

View file

@ -3,7 +3,7 @@
{# interfaces that belong to this bridge #}
{% set ports = interfaces | selectattr('enabled') | selectattr('bridge') | selectattr('bridge.name', '==', bridge.name) %}
{# allowed VLANs can be specified on the bridge, any of its ports, or all VLANs in NetBox #}
{% set my_vlans = bridge.tagged_vlans or (ports | iface_vlans | flatten | sort | unique) or vlans %}
{% set my_vlans = bridge.tagged_vlans or (ports | iface_vlans | flatten | sort(attribute='vid') | unique) or vlans %}
{% set my_vlan_ids = my_vlans | map(attribute='vid') | sort -%}
auto {{ bridge.name }}