network/roles/fabric/templates/ports.conf.j2

8 lines
578 B
Plaintext
Raw Normal View History

2023-12-18 10:22:14 +00:00
# https://docs.nvidia.com/networking-ethernet-software/cumulus-linux/Layer-1-and-Switch-Ports/Interface-Configuration-and-Management/Switch-Port-Attributes/#breakout-ports
{% for interface in interfaces | selectattr('name', 'match', '^swp[0-9]+(s0)?$') %}
{# get '1' from 'swp1' and '2' from 'swp2s0' #}
{% set port = interface.name | regex_replace('^swp([0-9]+).*$', '\\1') %}
{% set count = interfaces | selectattr('name', 'match', '^swp'+port+'(s[0-9])*$') | length %}
{{ port }}={% if interface.enabled or count > 1 %}{{ count }}x{% else %}disabled{% endif +%}
2023-12-18 10:22:14 +00:00
{% endfor %}