Configuring STP
STP provides a loop-free network at the Layer 2 level. Layer 2 LAN ports send and receive STP frames, which are called Bridge Protocol Data Units (BPDUs), at regular intervals. Network devices do not forward these frames but use the frames to construct a loop-free path.
802.1D is the original standard for STP, and many improvements have enhanced the basic loop-free STP. You can create a separate loop-free path for each VLAN, which is named Per VLAN Spanning Tree (PVST+). Additionally, the entire standard was reworked to make the loop-free convergence process faster to keep up with the faster equipment. This STP standard with faster convergence is the 802.1w standard, which is known as Rapid Spanning Tree (RSTP). Now, these faster convergence times are available as you create STP for each VLAN, which is known as Per VLAN Rapid Spanning Tree (Rapid PVST+).
Finally, the 802.1s standard, Multiple Spanning Trees (MST), allows you to map multiple VLANs into a single spanning tree instance. Each instance runs an independent spanning tree topology.
Although the software can interoperate with legacy 802.1D systems, the system runs Rapid PVST+ and MST. Rapid PVST+ is the default STP protocol for Cisco Nexus devices.
Note: Cisco NX-OS uses the extended system ID and MAC address reduction; you cannot disable these features.
In addition, Cisco has created some proprietary features to enhance the spanning tree activities.
For more information about security features, see the Cisco Nexus 9000 Series NX-OS Layer 2 Switching Configuration Guide, Release 7.x.
Configuring STP Settings
NX-API REST supports the following spanning-tree protocol (STP) settings:
spanning-tree mode <stp-mode> | no spanning-tree mode [<stp-mode>]
[no] spanning-tree mst simulate pvst global
[no] spanning-tree port type edge bpduguard default
[no] spanning-tree port type edge bpdufilter default
[no] spanning-tree port type edge edge default
[no] spanning-tree port type edge network default
[no] spanning-tree vlan <vlan-id>
[no] spanning-tree vlan <vlan-id> forward-time <seconds>
[no] spanning-tree vlan <vlan-id> hello-time <seconds>
[no] spanning-tree vlan <vlan-id> max-age <seconds>
[no] spanning-tree vlan <vlan-id> priority <prio>
spanning-tree port type <port-type> | no spanning-tree port [<port-type>]
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Setting STP Mode to MST
Setting STP Mode to MST
POST http://<IP_Address>/api/mo/sys/stp/inst.json
{
"stpInst": {
"attributes": {
"mode": "mst"
}
}
}
{
imdata": []
}
This example sets STP mode to support Multiple Spanning Trees (MST):
When you issue an POST to configure STP, an stpInst object (/sys/stp/inst) is created in the MIT. Under this object, objects are created for each interface included in the spanning tree, and an stpMstEntity object (syst/stp/inst/mstent) is created, which holds the MST configuration.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Setting STP Mode to Rapid PVST
Setting STP Mode to Rapid PVST
POST http://<IP_Address>/api/mo/sys/stp/inst.json
{
"stpInst": {
"attributes": {
"mode": "pvrst"
}
}
}
{
imdata": []
}
This example sets STP mode to support Rapid PVST.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Enabling or Disabling MST Spanning Tree Simulation
Enabling or Disabling MST Spanning Tree Simulation
POST http://<IP_Address>/api/mo/sys/stp/inst/mstent.json
{
"stpMstEntity": {
"attributes": {
"simulate": "enabled"
}
}
}
{
imdata": []
}
This example enables MST spanning tree simulation. To disable MST Spanning Tree simulation, set the "simulate" value to "disabled."
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Setting the Spanning Tree Port Type to extchp-edge
Setting the Spanning Tree Port Type to extchp-edge
POST http://<IP_Address>/api/mo/sys/stp/inst.json
{
"stpInst": {
"attributes": {
"ctrl": "extchp-edge"
}
}
}
{
imdata": []
}
This example changes the spanning tree port type to 'extchp-edge'.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Setting the Spanning Tree Port Type to network
Setting the Spanning Tree Port Type to network
POST http://<IP_Address>/api/mo/sys/stp/inst.json
{
"stpInst": {
"attributes": {
"ctrl": "network"
}
}
}
{
imdata": []
}
This example changes the spanning tree port type to 'network'.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Enabling Additional Settings for the Spanning Tree Port Type
This section uses payload examples to demonstrate how to enable additional settings for the spanning tree port type.
Setting the Spanning Tree Port Type to extchp-bpdu-filter
Setting the Spanning Tree Port Type to extchp-bpdu-filter
POST http://<IP_Address>/api/mo/sys/stp/inst.json
{
"stpInst": {
"attributes": {
"ctrl": "extchp-bpdu-filter"
}
}
}
{
"imdata": []
}
You can provide additional settings for the "ctrl" object to enable additional settings for the spanning tree port type. For example, you can set the value to:
- "extchp-bpdu-guard"
- "extchp-bpdu-filter"
- "" - This specifies a port type of "none"
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Setting the Spanning Tree Port Type to None ("")
Setting the Spanning Tree Port Type to None ("")
{
"stpInst": {
"attributes": {
"ctrl": ""
}
}
}
{
"imdata": []
}
You can provide additional settings for the "ctrl" object to enable additional settings for the spanning tree port type. For example, you can set the value to:
- "extchp-bpdu-guard"
- "extchp-bpdu-filter"
- "" - This specifies a port type of "none"
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Enabling or Disabling Spanning Tree Protocol on a VLAN
Enabling or Disabling Spanning Tree Protocol on a VLAN
POST http://<IP_Address>/api/mo/sys/stp/inst/vlan-33.json
{
"stpVlan": {
"attributes": {
"adminSt": "enabled"
}
}
}
{
imdata": []
}
To enable STP, set the "adminSt" value to "enabled." To disable STP, set the "adminSt" value to "disabled".
This example enables STP on VLAN 33.
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html
Setting an Interface Port Type
Setting an Interface Port Type
POST http://<IP_Address>/api/mo/sys/stp/inst/if-[eth5/1].json
{
"stpIf": {
"attributes": {
"mode": "network"
}
}
}
{
"imdata": []
}
This example sets the interface port type on the eth5/1 interface to 'network'.
By changing the value of the "mode" parameter, you can specify other interface port type values; for example:
- "edge"
- "normal"
- "default"
See the NX-API DME Model Reference for detailed information about classes and attributes described in the payload: https://developer.cisco.com/site/nx-os/docs/nexus-model-reference/
For information about using the payloads, see the Cisco Nexus 9000 Series NX-OS Programmability Guide https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-programming-reference-guides-list.html