Skip to content

Commit

Permalink
Check if stp.port_type is explicitly set, leave it default otherwise
Browse files Browse the repository at this point in the history
  • Loading branch information
jbemmel committed Dec 16, 2024
1 parent bffee6f commit 936d54e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion netsim/ansible/templates/stp/cumulus.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ iface {{ ifdata.ifname }}
# Newer versions 5.x support mstpctl-port-vlan-priority <vlan id>={{ ifdata.stp.port_priority }}
#
{% endif %}
{% set port_type = ifdata.stp.port_type|default("normal") %}
{% if ifdata.stp.port_type is defined %}
{% set port_type = ifdata.stp.port_type %}
mstpctl-portadminedge {{ 'yes' if port_type=='edge' else 'no' }}
mstpctl-portautoedge {{ 'yes' if port_type in ['normal','auto'] else 'no' }}
{% endif %}
{% endfor %}
CONFIG

Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/stp/cumulus_nvue.j2
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,11 @@
'{{ ifdata.vlan.access_id|default(1) }}':
priority: {{ ifdata.stp.port_priority * 16 }}
{% endif %}
{% set port_type = ifdata.stp.port_type|default("normal") %}
{% if ifdata.stp.port_type is defined %}
{% set port_type = ifdata.stp.port_type %}
admin-edge: {{ 'on' if port_type=='edge' else 'off' }}
auto-edge: {{ 'on' if port_type in ['normal','auto'] else 'off' }}
{% endif %}
{% elif ifdata.vlan.trunk_id is defined %}
{% for id in ifdata.vlan.trunk_id %}
{% if loop.first %}
Expand Down
4 changes: 3 additions & 1 deletion netsim/ansible/templates/stp/eos.j2
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,7 @@ interface {{ ifdata.ifname }}
#
{% endif %}
{% endif %}
spanning-tree portfast {{ ifdata.stp.port_type|default('normal') }}
{% if ifdata.stp.port_type is defined %}
spanning-tree portfast {{ ifdata.stp.port_type }}
{% endif %}
{% endfor %}

0 comments on commit 936d54e

Please sign in to comment.