exit: sort prefixes by family values

Because I made some seemingly unrelated changes in NetBox and they all
got flipped‐turned upside down.
This commit is contained in:
Timotej Lazar 2024-04-09 10:47:51 +02:00
parent 000f625988
commit ece3b8a377
2 changed files with 3 additions and 2 deletions

View file

@ -216,7 +216,8 @@ ip prefix-list fabric permit 10.34.0.0/24 ge 32
ipv6 prefix-list fabric permit 2001:1470:fffd:3400::/64 ge 128
{% for vlan in inside_vlans %}
{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', api_filter='vlan_id='~vlan.id, raw_data=true) %}
{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', api_filter='vlan_id='~vlan.id, raw_data=true)
| sort(attribute='family.value') %}
{% for prefix in prefixes %}
{% if prefix.family.value == 4 %}
ip prefix-list office permit {{ prefix.prefix }} ge 24

View file

@ -13,7 +13,7 @@ iface {{ vlan.name }}
# Interfaces.
{% for vlan in bridge_vlans %}
{% set prefixes = query('netbox.netbox.nb_lookup', 'prefixes', api_filter='vlan_id='~vlan.id, raw_data=true)
| map(attribute='prefix') %}
| sort(attribute='family.value') | map(attribute='prefix') %}
auto {{ bridge.name }}.{{ vlan.vid }}
iface {{ bridge.name }}.{{ vlan.vid }}
vrf {% if vlan.role.slug == 'outside' %}outside{% else %}{{ vlan.name }}{% endif +%}