Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/module/stp.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,20 @@ The following table describes per-platform support of individual STP features:
| Operating system | STP | MSTP | RSTP | Per-VLAN<br>RSTP | Enable<br>per port |
| ------------------ |:---:|:---:|:---:|:---:|:---:|
| Arista EOS[^EOS] | ✅ | ✅ | ✅ | ✅ | ✅ |
| Cisco IOL L2^[IOLL2] | ✅ | ✅ | ✅ | ✅ | ✅ |
| Aruba AOS-CX[^AOSCX] | ❗ | ✅ | ❌ | ✅ | ✅ |
| Cumulus Linux 4.x[^CL] | ✅ | ❌ | ✅ | ❌ | ✅ |
| Cumulus 5.x (NVUE)[^CL] | ✅ | ❌ | ✅ | ❌ | ✅ |
| Dell OS10[^OS10] | ✅ | ✅ | ✅ | ❗ | ✅ |
| FRR[^FRR] | ✅ | ❌ | ❌ | ❌ | ❌ |


[^EOS]: MSTP is enabled by default
[^AOSCX]: MSTP is enabled by default; STP is stated as not supported, but it is configured as MSTP (see tip below).
[^CL]: STP is enabled by default
[^OS10]: PVRST is enabled by default, but will require custom VLAN templates as Netlab uses virtual networks (which don't support STP)
[^FRR]: STP is disabled by default; STP is not supported on VLAN trunks as FRR sends BPDUs tagged, you could use Cumulus instead
[^IOLL2]: Per Vlan RSTP is enabled by default. STP,RSTP are emulated with MSTP.

```{tip}
MSTP/RSTP ports fall back to regular STP upon receiving a plain STP BPDU.
Expand Down
65 changes: 65 additions & 0 deletions netsim/ansible/templates/stp/ios.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
{% if stp.enable == False %}
no spanning-tree vlan 1-4094
{% else %}

{% set proto_map = { 'stp': 'mst', 'rstp': 'mst', 'pvrst': 'rapid-pvst', 'mstp': 'mst' } %}
{% set mode = proto_map[stp.protocol] %}

{# options are stp rstp, rapid-pvst or mstp (default if not set) #}

spanning-tree mode {{ mode }}


{% if stp.port.type is defined and stp.port.type == 'auto' %}
spanning-tree portfast default
{% endif %}

{% if 'priority' in stp %}
{% if stp.protocol != 'pvrst' %}
spanning-tree mst 0 priority {{ stp.priority }}
{% endif %}
{% endif %}

{# Check for per-VLAN enable and priority; implies Rapid-PVST #}
{% if vlans is defined and stp.protocol == 'pvrst' %}
{% for vname,vdata in vlans.items() %}
{% if not vdata.stp.enable|default(True) %}
no spanning-tree vlan {{ vdata.id }}
{% elif vdata.stp.priority is defined %}
spanning-tree vlan {{ vdata.id }} priority {{ vdata.stp.priority }}
{% elif stp.priority is defined %}
spanning-tree vlan {{ vdata.id }} priority {{ stp.priority }}
{% endif %}
{% endfor +%}
{% endif %}

{% for ifdata in interfaces if 'stp' in ifdata %}
{% if ifdata.vlan.trunk_id is defined or ifdata.vlan.access_id is defined %}
interface {{ ifdata.ifname }}
{% if not ifdata.stp.enable|default(True) %}
! Disable STP on this interface, i.e. dont receive or send BPDUs
spanning-tree bpdufilter enable
{% elif 'port_priority' in ifdata.stp %}
#
# Use 16x port_priority to get the correct 4-bit value on the wire
#
{% if stp.protocol == 'pvrst' %}
spanning-tree port-priority {{ ifdata.stp.port_priority * 16 }}
{% else %}
spanning-tree mst 0 port-priority {{ ifdata.stp.port_priority * 16 }}
{% endif %}
{% endif %}
{% endif %}
{% if ifdata.stp.port_type is defined %}
{% set _ptype = ifdata.stp.port_type %}
{% if _ptype == 'network' or _ptype == 'normal'%}
no spanning-tree portfast
{% elif _ptype == 'edge' %}
spanning-tree portfast
{% if ifdata.vlan.trunk_id is defined%}
spanning-tree portfast trunk
{% endif %}
{% endif %} {# _ptype #}
{% endif %} {# ifdata.stp.port.type#}
{% endfor %}
{% endif %} {# stp.enable #}
4 changes: 4 additions & 0 deletions netsim/devices/ioll2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ features:
native_routed: True
mixed_trunk: False
subif_name: "{ifname}.{subif_index}"
stp:
supported_protocols: [ stp, rstp, mstp, pvrst ]
enable_per_port: True
port_type: True
clab:
group_vars:
netlab_device_type: ioll2
Expand Down