fabric: only add enabled ports to bridge

This commit is contained in:
Timotej Lazar 2023-12-11 20:31:44 +01:00
parent b2e42bfb30
commit 950cd41c33

View file

@ -1,8 +1,8 @@
{# Note that there must be exactly one VLAN-aware bridge. #}
{% set bridge = interfaces | selectattr('type') | selectattr('type.value', '==', 'bridge') | first %}
{# interfaces (always bonds on Mellanox) that belong to this bridge #}
{% set ports = interfaces | selectattr('bridge') | selectattr('bridge.name', '==', bridge.name) %}
{# allowed VLANs can be specified on the bridge, any of its ports, or #}
{# 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_vlan_ids = my_vlans | map(attribute='vid') | sort -%}