Skip to content

Commit a54df67

Browse files
authored
Dell OS10: Fix trunk STP port priority (#1533)
1 parent b1181b8 commit a54df67

File tree

3 files changed

+29
-11
lines changed

3 files changed

+29
-11
lines changed

Diff for: netsim/ansible/templates/stp/dellos10.j2

+17-8
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,45 @@ spanning-tree mode {{ mode }}
1010
spanning-tree rstp force-version stp
1111
{% endif %}
1212

13-
{% if 'priority' in stp %}
13+
{% if 'priority' in stp %}
1414
spanning-tree rstp priority {{ stp.priority }}
15-
{% endif %}
15+
{% endif %}
1616

1717
{# Check for per-VLAN enable and priority; implies Rapid-PVST #}
18-
{% if vlans is defined %}
18+
{% if vlans is defined %}
1919
{% for vname,vdata in vlans.items() if 'stp' in vdata %}
2020
{% if not vdata.stp.enable|default(True) %}
2121
spanning-tree vlan {{ vdata.id }} disable
2222
{% elif 'priority' in vdata.stp %}
2323
spanning-tree vlan {{ vdata.id }} priority {{ vdata.stp.priority }}
2424
{% endif %}
2525
{% endfor +%}
26-
{% endif %}
26+
{% endif %}
2727

28-
{% for ifdata in interfaces if 'stp' in ifdata %}
29-
{% if ifdata.vlan.trunk_id is defined or ifdata.vlan.access_id is defined %}
28+
{% for ifdata in interfaces if 'stp' in ifdata or ifdata.vlan.trunk|default({})|dict2items|map(attribute='value')|selectattr('stp','defined') %}
3029
interface {{ ifdata.ifname }}
30+
{% if 'stp' in ifdata %}
3131
{% if not ifdata.stp.enable|default(True) %}
3232
spanning-tree disable
3333
{% elif 'port_priority' in ifdata.stp %}
3434
#
3535
# Use 16x port_priority to get the correct 4-bit value on the wire
3636
#
3737
{% if stp.protocol=='pvrst' %}
38-
spanning-tree vlan {{ ifdata.vlan.trunk_id|default(ifdata.vlan.access_id) }} priority {{ ifdata.stp.port_priority * 16 }}
38+
spanning-tree vlan {{ ifdata.vlan.access_id|default(1) }} priority {{ ifdata.stp.port_priority * 16 }}
3939
{% else %}
4040
spanning-tree rstp priority {{ ifdata.stp.port_priority * 16 }}
4141
{% endif %}
4242
{% endif %}
43+
{% else %}
44+
{# Trunk port(s) with STP attributes #}
45+
{% for id in ifdata.vlan.trunk_id %}
46+
{% for vname,vdata in vlans.items() if vdata.id==id %}
47+
{% if vname in ifdata.vlan.trunk and ifdata.vlan.trunk[vname].stp.port_priority is defined %}
48+
spanning-tree vlan {{ id }} priority {{ ifdata.vlan.trunk[vname].stp.port_priority * 16 }}
49+
{% endif %}
50+
{% endfor %}
51+
{% endfor %}
4352
{% endif %}
44-
{% endfor %}
53+
{% endfor %}
4554
{% endif %}

Diff for: tests/integration/stp/03-vlan-multi-link.yml

+8-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ message: |
88
For FRR, use ```docker exec -it clab-stp-s1 /usr/sbin/brctl showstp vlan1000``` to verify
99
Cumulus: ```docker exec -it clab-stp-s1 /sbin/brctl showstp bridge```
1010
cEOS: ```docker exec -it clab-stp-s2 Cli -c "show spanning-tree"```
11-
Dell OS10: ```sshpass -padmin ssh admin@clab-stp-s1 "show spanning-tree vlan 1000"```
11+
Dell OS10: ```netlab exec "s*" show spanning-tree vlan 1000```
1212
1313
Sample cEOS output:
1414
user@host:~/Projects/netlab/tests/integration/stp$ docker exec -it clab-stp-s1 Cli -c "show spanning-tree"
@@ -47,6 +47,13 @@ message: |
4747
Et2 designated forwarding 20000 32.2 P2p
4848
Et3 designated forwarding 20000 16.3 P2p <-- configured '1' => *16
4949
50+
# Dell OS10 can't run STP on virtual networks -> use custom template
51+
defaults.devices.dellos10:
52+
features.vlan.svi_interface_name: vlan{vlan}
53+
54+
# Per-VLAN port priority requires PVRST
55+
stp.protocol: pvrst
56+
5057
groups:
5158
_auto_create: True
5259
switches:

Diff for: tests/integration/stp/03b-vlan-multi-link-no-stp.yml

+4-2
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@ vlans:
3030

3131
links: # Dual link between s1/s2
3232
- s1:
33-
# stp.port_priority: 1 # S1 uses this link to send to S2, unless it is down
33+
vlan.trunk:
34+
red:
35+
stp.port_priority: 1 # S1 uses this link to send to S2, unless it is down
3436
s2:
3537
vlan.trunk: [ untagged, red ] # Must be a trunk allowing packets on VLAN 1 for this topology to work on Cumulus
3638
vlan.native: untagged
3739
- s1:
38-
# stp.port_priority: 2
40+
stp.port_priority: 2
3941
s2:
4042
vlan.trunk: [ untagged, red ]
4143
vlan.native: untagged

0 commit comments

Comments
 (0)