Skip to content

Commit

Permalink
Fix ethertype assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
mraerino committed Sep 22, 2024
1 parent 531a5d8 commit dc130a0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ubiquiti-edge-router.j2
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
{% set device = dcim.Device.objects.get(pk=device_id) %}
{% endif %}

{%- set ether_types = [y[0] for x in dcim.InterfaceTypeChoices.CHOICES for y in x[1] if x[0].startswith('Ethernet')] %}
{# cursed pipeline to get all possible ethernet-like type #}
{%- set ether_types = dcim.InterfaceTypeChoices.CHOICES |
selectattr(0, "in", ["Ethernet (fixed)", "Ethernet (modular)", "Ethernet (backplane)"]) |
map(attribute=1) | sum(start=[]) | map(attribute=0) | list
%}

{%- for intf in device.interfaces.all() %}

Expand Down

0 comments on commit dc130a0

Please sign in to comment.