Spanning Tree Commands

show spanning-tree

show spanning-tree
import requests
import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
 "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)

{
    "ins_api":	{
        "type":	"cli_show",
        "version":	"1.2",
        "sid":	"eoc",
        "outputs":	{
            "output":	{
                "input": "show spanning-tree",
                "msg":	"Success",
                "code":	"200",
                "body":	{
                    "TABLE_tree":	{
                        "ROW_tree":	{
                            "tree_id":	"2",
                            "tree_tree_type":	"vlan",
                            "tree_protocol":	"rstp",
                            "port_count":	"2",
                            "bridge_mac":	"0026.51c7.fcc1",
                            "bridge_priority":	"32770",
                            "tree_designated_root":	"0026.51c7.fcc1",
                            "tree_designated_root_priority":	"32770",
                            "stp_active":	"enabled",
                            "root_path_cost":	"0",
                            "root_port_if_index":	"",
                            "root_port_priority":	"0",
                            "root_port_number":	"0",
                            "topology_change":	"false",
                            "topology_change_detected":	"false",
                            "topology_change_count":	"3",
                            "topology_change_time_since_last":	"35116",
                            "tc_initiator_if_index":	"Ethernet9/20",
                            "bridge_forward_delay":	"15",
                            "bridge_max_age":	"20",
                            "bridge_hello_time":	"2",
                            "max_age":	"20",
                            "hello_time":	"2",
                            "forward_delay":	"15",
                            "hold_time":	"1",
                            "hello_timer":	"0",
                            "topology_change_timer":	"0",
                            "tcn_timer":	"0",
                            "aging_timer":	"0",
                            "disabled":	"0",
                            "blocking":	"0",
                            "listening":	"0",
                            "learning":	"0",
                            "forwarding":	"2",
                            "invalid":	"0",
                            "TABLE_port":	{
                                "ROW_port":	[{
                                        "if_index":	"Ethernet9/2",
                                        "port_info_tree_id":	"2",
                                        "state":	"forwarding",
                                        "role":	"designated",
                                        "port_priority":	"128",
                                        "port_number":	"1154",
                                        "port_protocol":	"rstp",
                                        "port_tree_type":	"vlan",
                                        "path_cost":	"2",
                                        "port_designated_root":	"0026.51c7.fcc1",
                                        "port_designated_root_priority":	"32770",
                                        "designated_cost":	"0",
                                        "designated_bridge":	"0026.51c7.fcc1",
                                        "designated_bridge_priority":	"32770",
                                        "designated_port":	"33922",
                                        "tc_acknowledge":	"false",
                                        "forward_transition_count":	"1",
                                        "self_looped":	"false",
                                        "inconsistency":	"0",
                                        "bpdus_in":	"0",
                                        "bpdus_out":	"18084",
                                        "port_fast":	"default1",
                                        "link_type":	"auto",
                                        "port_guard":	"default1",
                                        "bpdu_guard":	"default1",
                                        "bpdu_filter":	"default1",
                                        "oper_portfast":	"false",
                                        "oper_p2p":	"true",
                                        "oper_loopguard":	"false",
                                        "oper_bpduguard":	"false",
                                        "oper_bpdufilter":	"false",
                                        "int_bpdufilter":	"false",
                                        "oper_networkport":	"false",
                                        "forward_delay_timer":	"0",
                                        "hold_timer":	"0",
                                        "message_age":	"0",
                                        "peer":	"rstp",
                                        "dispute":	"false",
                                        "pvstsim_inc_timer":	"0"
                                    }, {
                                        "if_index":	"Ethernet9/20",
                                        "port_info_tree_id":	"2",
                                        "state":	"forwarding",
                                        "role":	"designated",
                                        "port_priority":	"128",
                                        "port_number":	"1172",
                                        "port_protocol":	"rstp",
                                        "port_tree_type":	"vlan",
                                        "path_cost":	"4",
                                        "port_designated_root":	"0026.51c7.fcc1",
                                        "port_designated_root_priority":	"32770",
                                        "designated_cost":	"0",
                                        "designated_bridge":	"0026.51c7.fcc1",
                                        "designated_bridge_priority":	"32770",
                                        "designated_port":	"33940",
                                        "tc_acknowledge":	"false",
                                        "forward_transition_count":	"1",
                                        "self_looped":	"false",
                                        "inconsistency":	"0",
                                        "bpdus_in":	"2",
                                        "bpdus_out":	"17560",
                                        "port_fast":	"default1",
                                        "link_type":	"auto",
                                        "port_guard":	"default1",
                                        "bpdu_guard":	"default1",
                                        "bpdu_filter":	"default1",
                                        "oper_portfast":	"false",
                                        "oper_p2p":	"true",
                                        "oper_loopguard":	"false",
                                        "oper_bpduguard":	"false",
                                        "oper_bpdufilter":	"false",
                                        "int_bpdufilter":	"false",
                                        "oper_networkport":	"false",
                                        "forward_delay_timer":	"0",
                                        "hold_timer":	"0",
                                        "message_age":	"0",
                                        "peer":	"rstp",
                                        "dispute":	"false",
                                        "pvstsim_inc_timer":	"0"
                                    }]
                            }
                        }
                    }
                }
            }
        }
    }
}

To display information about the Spanning Tree Protocol (STP), use the show spanning-tree command.

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).

CLI Output

switch# **show spanning-tree**

VLAN0002
  Spanning tree enabled protocol rstp
  Root ID    Priority    32770
             Address     0026.51c7.fcc1
             This bridge is the root
             Hello Time  2  sec  Max Age 20 sec  Forward Delay 15 sec

Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 0026.51c7.fcc1 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Interface Role Sts Cost Prio.Nbr Type


Po22 Desg FWD 2 128.4117 P2p Eth9/2 Desg FWD 2 128.1154 P2p

show spanning-tree vlan 2

show spanning-tree vlan 2
import requests
import json

"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'

myheaders={'content-type':'application/json'}
payload={
 "ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree vlan 2",
  "output_format": "json"
}

response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)

{
    "ins_api":	{
        "type":	"cli_show",
        "version":	"1.2",
        "sid":	"eoc",
        "outputs":	{
            "output":	{
                "input": "show spanning-tree vlan 2",
                "msg":	"Success",
                "code":	"200",
                "body":	{
                    "TABLE_tree":	{
                        "ROW_tree":	{
                            "tree_id":	"2",
                            "tree_tree_type":	"vlan",
                            "tree_protocol":	"rstp",
                            "port_count":	"2",
                            "bridge_mac":	"0026.51c7.fcc1",
                            "bridge_priority":	"32770",
                            "tree_designated_root":	"0026.51c7.fcc1",
                            "tree_designated_root_priority":	"32770",
                            "stp_active":	"enabled",
                            "root_path_cost":	"0",
                            "root_port_if_index":	"",
                            "root_port_priority":	"0",
                            "root_port_number":	"0",
                            "topology_change":	"false",
                            "topology_change_detected":	"false",
                            "topology_change_count":	"3",
                            "topology_change_time_since_last":	"35116",
                            "tc_initiator_if_index":	"Ethernet9/20",
                            "bridge_forward_delay":	"15",
                            "bridge_max_age":	"20",
                            "bridge_hello_time":	"2",
                            "max_age":	"20",
                            "hello_time":	"2",
                            "forward_delay":	"15",
                            "hold_time":	"1",
                            "hello_timer":	"0",
                            "topology_change_timer":	"0",
                            "tcn_timer":	"0",
                            "aging_timer":	"0",
                            "disabled":	"0",
                            "blocking":	"0",
                            "listening":	"0",
                            "learning":	"0",
                            "forwarding":	"2",
                            "invalid":	"0",
                            "TABLE_port":	{
                                "ROW_port":	[{
                                        "if_index":	"Ethernet9/2",
                                        "port_info_tree_id":	"2",
                                        "state":	"forwarding",
                                        "role":	"designated",
                                        "port_priority":	"128",
                                        "port_number":	"1154",
                                        "port_protocol":	"rstp",
                                        "port_tree_type":	"vlan",
                                        "path_cost":	"2",
                                        "port_designated_root":	"0026.51c7.fcc1",
                                        "port_designated_root_priority":	"32770",
                                        "designated_cost":	"0",
                                        "designated_bridge":	"0026.51c7.fcc1",
                                        "designated_bridge_priority":	"32770",
                                        "designated_port":	"33922",
                                        "tc_acknowledge":	"false",
                                        "forward_transition_count":	"1",
                                        "self_looped":	"false",
                                        "inconsistency":	"0",
                                        "bpdus_in":	"0",
                                        "bpdus_out":	"18084",
                                        "port_fast":	"default1",
                                        "link_type":	"auto",
                                        "port_guard":	"default1",
                                        "bpdu_guard":	"default1",
                                        "bpdu_filter":	"default1",
                                        "oper_portfast":	"false",
                                        "oper_p2p":	"true",
                                        "oper_loopguard":	"false",
                                        "oper_bpduguard":	"false",
                                        "oper_bpdufilter":	"false",
                                        "int_bpdufilter":	"false",
                                        "oper_networkport":	"false",
                                        "forward_delay_timer":	"0",
                                        "hold_timer":	"0",
                                        "message_age":	"0",
                                        "peer":	"rstp",
                                        "dispute":	"false",
                                        "pvstsim_inc_timer":	"0"
                                    }, {
                                        "if_index":	"Ethernet9/20",
                                        "port_info_tree_id":	"2",
                                        "state":	"forwarding",
                                        "role":	"designated",
                                        "port_priority":	"128",
                                        "port_number":	"1172",
                                        "port_protocol":	"rstp",
                                        "port_tree_type":	"vlan",
                                        "path_cost":	"4",
                                        "port_designated_root":	"0026.51c7.fcc1",
                                        "port_designated_root_priority":	"32770",
                                        "designated_cost":	"0",
                                        "designated_bridge":	"0026.51c7.fcc1",
                                        "designated_bridge_priority":	"32770",
                                        "designated_port":	"33940",
                                        "tc_acknowledge":	"false",
                                        "forward_transition_count":	"1",
                                        "self_looped":	"false",
                                        "inconsistency":	"0",
                                        "bpdus_in":	"2",
                                        "bpdus_out":	"17560",
                                        "port_fast":	"default1",
                                        "link_type":	"auto",
                                        "port_guard":	"default1",
                                        "bpdu_guard":	"default1",
                                        "bpdu_filter":	"default1",
                                        "oper_portfast":	"false",
                                        "oper_p2p":	"true",
                                        "oper_loopguard":	"false",
                                        "oper_bpduguard":	"false",
                                        "oper_bpdufilter":	"false",
                                        "int_bpdufilter":	"false",
                                        "oper_networkport":	"false",
                                        "forward_delay_timer":	"0",
                                        "hold_timer":	"0",
                                        "message_age":	"0",
                                        "peer":	"rstp",
                                        "dispute":	"false",
                                        "pvstsim_inc_timer":	"0"
                                    }]
                            }
                        }
                    }
                }
            }
        }
    }
}

To display STP information for specified VLANs, use the show spanning-tree vlan command.

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.2(1).

CLI Output

switch# **show spanning-tree vlan 2**

VLAN0002
  Spanning tree enabled protocol rstp
  Root ID    Priority    32770
             Address     0026.51c7.fcc1
             This bridge is the root
             Hello Time  2  sec  Max Age 20 sec  Forward Delay 15 sec

Bridge ID Priority 32770 (priority 32768 sys-id-ext 2) Address 0026.51c7.fcc1 Hello Time 2 sec Max Age 20 sec Forward Delay 15 sec

Interface Role Sts Cost Prio.Nbr Type


Po22 Desg FWD 2 128.4117 P2p Eth9/2 Desg FWD 2 128.1154 P2p

show spanning-tree vlan 400 summary

show spanning-tree vlan 400 summary
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree vlan 400 summary",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "stp-mode": "rapid-pvst", 
  "stp_tree_root_info": 400, 
  "total_tree_type": [
    "vlan", 
    "vlan"
  ], 
  "bridge_mac": "002a.6a5c.06c1", 
  "bridge_priority": 33168, 
  "tree_designated_root": "0023.04ee.be64", 
  "tree_designated_root_priority": 33168, 
  "stp_global_info": 0, 
  "pcost_method": 1, 
  "oper_pcost_method": 1, 
  "port_fast": "default1", 
  "bpdu_guard": "default1", 
  "bpdu_filter": "default1", 
  "oper_loopguard": "false", 
  "bridge_assurance": 1, 
  "networkport_default": 0, 
  "simulate_pvst": "true", 
  "max-hops": 20, 
  "peer_switch_cfg": 0, 
  "oper_peer_switch": 0, 
  "stp_l2gstp_domain_id": 0, 
  "stp_lite": 1, 
  "TABLE_tree": {
    "ROW_tree": {
      "stp_tree_summary": 400
    }
  }, 
  "disabled": 0, 
  "blocking": 0, 
  "listening": 0, 
  "learning": 0, 
  "forwarding": 2, 
  "invalid": 0, 
  "port_count": 2
}
switch# show spanning-tree vlan 400 summary | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:stp" xmlns:nf="urn:ietf:param
s:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <spanning-tree>
    <__XML__OPT_Cmd_show_stp_vlan_vlan>
     <summary>
      <__XML__OPT_Cmd_show_stp_vlan_summary___readonly__>
       <__readonly__>
        <stp-mode>rapid-pvst</stp-mode>
        <stp_tree_root_info>400</stp_tree_root_info>
        <total_tree_type>vlan</total_tree_type>
        <bridge_mac>002a.6a5c.06c1</bridge_mac>
        <bridge_priority>33168</bridge_priority>
        <tree_designated_root>0023.04ee.be64</tree_designated_root>
        <tree_designated_root_priority>33168</tree_designated_root_priority>
        <stp_global_info>0</stp_global_info>
        <pcost_method>1</pcost_method>
        <oper_pcost_method>1</oper_pcost_method>
        <port_fast>default1</port_fast>
        <bpdu_guard>default1</bpdu_guard>
        <bpdu_filter>default1</bpdu_filter>
        <oper_loopguard>false</oper_loopguard>
        <bridge_assurance>1</bridge_assurance>
        <networkport_default>0</networkport_default>
        <simulate_pvst>true</simulate_pvst>
        <max-hops>20</max-hops>
        <peer_switch_cfg>0</peer_switch_cfg>
        <oper_peer_switch>0</oper_peer_switch>
        <stp_l2gstp_domain_id>0</stp_l2gstp_domain_id>
        <stp_lite>1</stp_lite>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>400</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>2</forwarding>
        <invalid>0</invalid>
        <port_count>2</port_count>
       </__readonly__>
      </__XML__OPT_Cmd_show_stp_vlan_summary___readonly__>
     </summary>
    </__XML__OPT_Cmd_show_stp_vlan_vlan>
   </spanning-tree>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).

CLI Output

switch# **show spanning-tree vlan 400 summary**

switch# show spanning-tree vlan 400 summary
Switch is in rapid-pvst mode 
Root bridge for VLAN0400 is 33168.0023.04ee.be64.
Port Type Default                        is disable
Edge Port [PortFast] BPDU Guard Default  is disabled
Edge Port [PortFast] BPDU Filter Default is disabled
Bridge Assurance                         is enabled
Loopguard Default                        is disabled
Pathcost method used                     is short
STP-Lite                                 is enabled

Name Blocking Listening Learning Forwarding STP Active


VLAN0400 0 0 0 2 2

show spanning-tree summary

show spanning-tree summary
 
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree summary",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "stp-mode": "rapid-pvst", 
  "stp_root_bmp_info": 0, 
  "total_tree_type": [
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan", 
    "vlan"
  ], 
  "tree_root_bmp": "none", 
  "stp_l2gstp_bmp_info": null, 
  "stp_l2gstp_bmp": "none", 
  "stp_global_info": 0, 
  "pcost_method": 1, 
  "oper_pcost_method": 1, 
  "port_fast": "default1", 
  "bpdu_guard": "default1", 
  "bpdu_filter": "default1", 
  "oper_loopguard": "false", 
  "bridge_assurance": 1, 
  "networkport_default": 0, 
  "simulate_pvst": "true", 
  "max-hops": 20, 
  "peer_switch_cfg": 0, 
  "oper_peer_switch": 0, 
  "stp_l2gstp_domain_id": 0, 
  "stp_lite": 1, 
  "TABLE_tree": [
    {
      "ROW_tree": {
        "stp_tree_summary": 1
      }
    }, 
    {
      "ROW_tree": {
        "stp_tree_summary": 400
      }
    }, 
    {
      "ROW_tree": {
        "stp_tree_summary": 401
      }
    }, 
    {
      "ROW_tree": {
        "stp_tree_summary": 402
      }
    }, 
    {
      "ROW_tree": {
        "stp_tree_summary": 500
      }
    }, 
    {
      "ROW_tree": {
        "stp_tree_summary": 501
      }
    }, 
    {
      "ROW_tree": {
        "stp_tree_summary": 502
      }
    }
  ], 
  "disabled": [
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0"
  ], 
  "blocking": [
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0"
  ], 
  "listening": [
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0"
  ], 
  "learning": [
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0"
  ], 
  "forwarding": [
    "1", 
    "2", 
    "1", 
    "1", 
    "2", 
    "1", 
    "1", 
    "9"
  ], 
  "invalid": [
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0", 
    "0"
  ], 
  "port_count": [
    "1", 
    "2", 
    "1", 
    "1", 
    "2", 
    "1", 
    "1", 
    "9"
  ], 
  "stp_summary_totals": 7
}
switch# show spanning-tree summary | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:stp" xmlns:nf="urn:ietf:param
s:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <spanning-tree>
    <__XML__OPT_Cmd_show_stp_vlan_vlan>
     <summary>
      <__XML__OPT_Cmd_show_stp_vlan_summary___readonly__>
       <__readonly__>
        <stp-mode>rapid-pvst</stp-mode>
        <stp_root_bmp_info>0</stp_root_bmp_info>
        <total_tree_type>vlan</total_tree_type>
        <tree_root_bmp>none</tree_root_bmp>
        <stp_l2gstp_bmp_info></stp_l2gstp_bmp_info>
        <total_tree_type>vlan</total_tree_type>
        <stp_l2gstp_bmp>none</stp_l2gstp_bmp>
        <stp_global_info>0</stp_global_info>
        <pcost_method>1</pcost_method>
        <oper_pcost_method>1</oper_pcost_method>
        <port_fast>default1</port_fast>
        <bpdu_guard>default1</bpdu_guard>
        <bpdu_filter>default1</bpdu_filter>
        <oper_loopguard>false</oper_loopguard>
        <bridge_assurance>1</bridge_assurance>
        <networkport_default>0</networkport_default>
        <simulate_pvst>true</simulate_pvst>
        <max-hops>20</max-hops>
        <peer_switch_cfg>0</peer_switch_cfg>
        <oper_peer_switch>0</oper_peer_switch>
        <stp_l2gstp_domain_id>0</stp_l2gstp_domain_id>
        <stp_lite>1</stp_lite>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>1</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>1</forwarding>
        <invalid>0</invalid>
        <port_count>1</port_count>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>400</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>2</forwarding>
        <invalid>0</invalid>
        <port_count>2</port_count>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>401</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>1</forwarding>
        <invalid>0</invalid>
        <port_count>1</port_count>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>402</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>1</forwarding>
        <invalid>0</invalid>
        <port_count>1</port_count>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>500</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>2</forwarding>
        <invalid>0</invalid>
        <port_count>2</port_count>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>501</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>1</forwarding>
        <invalid>0</invalid>
        <port_count>1</port_count>
        <TABLE_tree>
         <ROW_tree>
          <stp_tree_summary>502</stp_tree_summary>
         </ROW_tree>
        </TABLE_tree>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>1</forwarding>
        <invalid>0</invalid>
        <port_count>1</port_count>
        <stp_summary_totals>7</stp_summary_totals>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>9</forwarding>
        <invalid>0</invalid>
        <port_count>9</port_count>
       </__readonly__>
      </__XML__OPT_Cmd_show_stp_vlan_summary___readonly__>
     </summary>
    </__XML__OPT_Cmd_show_stp_vlan_vlan>
   </spanning-tree>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).  

CLI Output

switch# **show spanning-tree summary**

switch# show spanning-tree summary
Switch is in rapid-pvst mode 
Root bridge for: none
Port Type Default                        is disable
Edge Port [PortFast] BPDU Guard Default  is disabled
Edge Port [PortFast] BPDU Filter Default is disabled
Bridge Assurance                         is enabled
Loopguard Default                        is disabled
Pathcost method used                     is short
STP-Lite                                 is enabled

Name Blocking Listening Learning Forwarding STP Active


VLAN0001 0 0 0 1 1 VLAN0400 0 0 0 2 2 VLAN0401 0 0 0 1 1 VLAN0402 0 0 0 1 1 VLAN0500 0 0 0 2 2 VLAN0501 0 0 0 1 1 VLAN0502 0 0 0 1 1


7 vlans 0 0 0 9 9

show spanning-tree summary totals

show spanning-tree summary totals
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree summary totals",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "stp-mode": "rapid-pvst", 
  "stp_root_bmp_info": 0, 
  "total_tree_type": [
    "vlan", 
    "vlan", 
    "vlan"
  ], 
  "tree_root_bmp": "none", 
  "stp_l2gstp_bmp_info": null, 
  "stp_l2gstp_bmp": "none", 
  "stp_global_info": 0, 
  "pcost_method": 1, 
  "oper_pcost_method": 1, 
  "port_fast": "default1", 
  "bpdu_guard": "default1", 
  "bpdu_filter": "default1", 
  "oper_loopguard": "false", 
  "bridge_assurance": 1, 
  "networkport_default": 0, 
  "simulate_pvst": "true", 
  "max-hops": 20, 
  "peer_switch_cfg": 0, 
  "oper_peer_switch": 0, 
  "stp_l2gstp_domain_id": 0, 
  "stp_lite": 1, 
  "stp_summary_totals": 7, 
  "disabled": 0, 
  "blocking": 0, 
  "listening": 0, 
  "learning": 0, 
  "forwarding": 9, 
  "invalid": 0, 
  "port_count": 9
}
switch# show spanning-tree summary totals | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:stp" xmlns:nf="urn:ietf:param
s:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <spanning-tree>
    <summary>
     <totals>
      <__XML__OPT_Cmd_show_stp_vlan_summary_totals___readonly__>
       <__readonly__>
        <stp-mode>rapid-pvst</stp-mode>
        <stp_root_bmp_info>0</stp_root_bmp_info>
        <total_tree_type>vlan</total_tree_type>
        <tree_root_bmp>none</tree_root_bmp>
        <stp_l2gstp_bmp_info></stp_l2gstp_bmp_info>
        <total_tree_type>vlan</total_tree_type>
        <stp_l2gstp_bmp>none</stp_l2gstp_bmp>
        <stp_global_info>0</stp_global_info>
        <pcost_method>1</pcost_method>
        <oper_pcost_method>1</oper_pcost_method>
        <port_fast>default1</port_fast>
        <bpdu_guard>default1</bpdu_guard>
        <bpdu_filter>default1</bpdu_filter>
        <oper_loopguard>false</oper_loopguard>
        <bridge_assurance>1</bridge_assurance>
        <networkport_default>0</networkport_default>
        <simulate_pvst>true</simulate_pvst>
        <max-hops>20</max-hops>
        <peer_switch_cfg>0</peer_switch_cfg>
        <oper_peer_switch>0</oper_peer_switch>
        <stp_l2gstp_domain_id>0</stp_l2gstp_domain_id>
        <stp_lite>1</stp_lite>
        <stp_summary_totals>7</stp_summary_totals>
        <total_tree_type>vlan</total_tree_type>
        <disabled>0</disabled>
        <blocking>0</blocking>
        <listening>0</listening>
        <learning>0</learning>
        <forwarding>9</forwarding>
        <invalid>0</invalid>
        <port_count>9</port_count>
       </__readonly__>
      </__XML__OPT_Cmd_show_stp_vlan_summary_totals___readonly__>
     </totals>
    </summary>
   </spanning-tree>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1).

CLI Output

switch# **show spanning-tree summary totals**

switch# show spanning-tree summary totals
Switch is in rapid-pvst mode 
Root bridge for: none
Port Type Default                        is disable
Edge Port [PortFast] BPDU Guard Default  is disabled
Edge Port [PortFast] BPDU Filter Default is disabled
Bridge Assurance                         is enabled
Loopguard Default                        is disabled
Pathcost method used                     is short
STP-Lite                                 is enabled

Name Blocking Listening Learning Forwarding STP Active


7 vlans 0 0 0 9 9

show spanning-tree mst 0 interface port-channel 22

show spanning-tree mst 0 interface port-channel 22
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree mst 0 interface port-channel 22",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "TABLE_port": {
    "ROW_port": {
      "if_index": "port-channel22", 
      "port_info_tree_id": 0, 
      "state": "forwarding", 
      "role": "designated", 
      "port_priority": 128, 
      "port_number": 4117, 
      "port_protocol": "mstp", 
      "port_tree_type": "mst", 
      "path_cost": 100, 
      "port_designated_root": "002a.6a5c.06c1", 
      "port_designated_root_priority": 32768, 
      "designated_cost": 0, 
      "designated_bridge": "002a.6a5c.06c1", 
      "designated_bridge_priority": 32768, 
      "designated_port": 36885, 
      "tc_acknowledge": "false", 
      "forward_transition_count": 1, 
      "self_looped": "false", 
      "inconsistency": 0, 
      "bpdus_in": 944, 
      "bpdus_out": 744, 
      "port_fast": "default1", 
      "link_type": "auto", 
      "port_guard": "default1", 
      "bpdu_guard": "default1", 
      "bpdu_filter": "default1", 
      "oper_portfast": "false", 
      "oper_p2p": "true", 
      "oper_loopguard": "false", 
      "oper_bpduguard": "false", 
      "oper_bpdufilter": "false", 
      "int_bpdufilter": "false", 
      "oper_networkport": "false", 
      "forward_delay_timer": 0, 
      "hold_timer": 0, 
      "message_age": 0, 
      "peer": "stp", 
      "dispute": "false", 
      "pvstsim_inc_timer": 0, 
      "boundary": "true", 
      "simulate_pvst_cfg": "def_enabled", 
      "simulate_pvst": "true", 
      "prestd": "false", 
      "designated_ist_master": "002a.6a5c.06c1", 
      "designated_ist_master_priority": 32768, 
      "designated_ist_cost": 0, 
      "vlan-map": null
    }
  }
}
switch# show spanning-tree mst 0 interface port-channel 22 | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:stp" xmlns:nf="urn:ietf:param
s:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <spanning-tree>
    <mst>
     <__XML__OPT_Cmd_show_stp_mst_mst-id>
      <interface>
       <__XML__INTF_interface-id>
        <__XML__PARAM_value>
         <__XML__INTF_output>port-channel22</__XML__INTF_output>
        </__XML__PARAM_value>
        <__XML__OPT_Cmd_show_stp_mst_interface___readonly___1>
         <__readonly__>
          <TABLE_port>
           <ROW_port>
            <if_index>port-channel22</if_index>
            <port_info_tree_id>0</port_info_tree_id>
            <state>forwarding</state>
            <role>designated</role>
            <port_priority>128</port_priority>
            <port_number>4117</port_number>
            <port_protocol>mstp</port_protocol>
            <port_tree_type>mst</port_tree_type>
            <path_cost>100</path_cost>
            <port_designated_root>002a.6a5c.06c1</port_designated_root>
            <port_designated_root_priority>32768</port_designated_root_priority>
            <designated_cost>0</designated_cost>
            <designated_bridge>002a.6a5c.06c1</designated_bridge>
            <designated_bridge_priority>32768</designated_bridge_priority>
            <designated_port>36885</designated_port>
            <tc_acknowledge>false</tc_acknowledge>
            <forward_transition_count>1</forward_transition_count>
            <self_looped>false</self_looped>
            <inconsistency>0</inconsistency>
            <bpdus_in>848</bpdus_in>
            <bpdus_out>660</bpdus_out>
            <port_fast>default1</port_fast>
            <link_type>auto</link_type>
            <port_guard>default1</port_guard>
            <bpdu_guard>default1</bpdu_guard>
            <bpdu_filter>default1</bpdu_filter>
            <oper_portfast>false</oper_portfast>
            <oper_p2p>true</oper_p2p>
            <oper_loopguard>false</oper_loopguard>
            <oper_bpduguard>false</oper_bpduguard>
            <oper_bpdufilter>false</oper_bpdufilter>
            <int_bpdufilter>false</int_bpdufilter>
            <oper_networkport>false</oper_networkport>
            <forward_delay_timer>0</forward_delay_timer>
            <hold_timer>0</hold_timer>
            <message_age>0</message_age>
            <peer>stp</peer>
            <dispute>false</dispute>
            <pvstsim_inc_timer>0</pvstsim_inc_timer>
            <boundary>true</boundary>
            <simulate_pvst_cfg>def_enabled</simulate_pvst_cfg>
            <simulate_pvst>true</simulate_pvst>
            <prestd>false</prestd>
            <designated_ist_master>002a.6a5c.06c1</designated_ist_master>
            <designated_ist_master_priority>32768</designated_ist_master_priorit
y>
            <designated_ist_cost>0</designated_ist_cost>
            <vlan-map></vlan-map>
           </ROW_port>
          </TABLE_port>
         </__readonly__>
        </__XML__OPT_Cmd_show_stp_mst_interface___readonly___1>
       </__XML__INTF_interface-id>
      </interface>
     </__XML__OPT_Cmd_show_stp_mst_mst-id>
    </mst>
   </spanning-tree>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1). 

CLI Output

switch# **show spanning-tree mst 0 interface port-channel 22**

switch# show spanning-tree mst 0 interface port-channel 22
Po22 of MST0 is designated forwarding 
Port Type: normal         (default)           port guard : none        (default)
Link type: point-to-point (auto)              bpdu filter: disable     (default)
Boundary : boundary       (PVST)              bpdu guard : disable     (default)
Bpdus sent 478, received 636

Instance Role Sts Cost Prio.Nbr Vlans mapped


0 Desg FWD 100 128.4117 1-4094

show spanning-tree mst configuration

show spanning-tree mst configuration
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree mst configuration",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "stp-mode": "mst", 
  "name": null, 
  "rev-id": 0, 
  "Instance_to_vlan_map": {
    "mst_id": 0, 
    "vlan_bit_map": "1-4094"
  }
}
switch# show spanning-tree mst configuration | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:stp" xmlns:nf="urn:ietf:param
s:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <spanning-tree>
    <mst>
     <configuration>
      <__XML__OPT_Cmd_show_stp_mst_configuration___readonly__>
       <__readonly__>
        <stp-mode>mst</stp-mode>
        <name></name>
        <rev-id>0</rev-id>
        <Instance_to_vlan_map>
         <mst_id>0</mst_id>
         <vlan_bit_map>1-4094</vlan_bit_map>
        </Instance_to_vlan_map>
       </__readonly__>
      </__XML__OPT_Cmd_show_stp_mst_configuration___readonly__>
     </configuration>
    </mst>
   </spanning-tree>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1). 
CLI Output

switch# show spanning-tree mst configuration

switch# show spanning-tree mst configuration
Name      []
Revision  0     Instances configured 1
Instance  Vlans mapped
--------  ---------------------------------------------------------------------
0         1-4094

show spanning-tree mst configuration digest

show spanning-tree mst configuration digest
import requests
import json
 
"""
Modify these please
"""
url='http://<IP_Address>/ins'
switchuser='<User_ID>'
switchpassword='<Password>'
 
myheaders={'content-type':'application/json'}
payload={
"ins_api":{
  "version": "1.0",
  "type": "cli_show",
  "chunk": "0",
  "sid": "1",
  "input": "show spanning-tree mst configuration digest",
  "output_format": "json"
}
 
response = requests.post(url,data=json.dumps(payload), headers=myheaders,auth=(switchuser,switchpassword)).json()
output = json.dumps(response, indent=4, sort_keys=True)
{
  "stp-mode": "mst", 
  "name": null, 
  "rev-id": 0, 
  "digest": "ac36177f50283cd4b83821d8ab26de62", 
  "prestd-digest": "bb3b6c15ef8d089bb55ed10d24df44de"
}
switch# show spanning-tree mst configuration digest | xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<nf:rpc-reply xmlns="http://www.cisco.com/nxos:1.0:stp" xmlns:nf="urn:ietf:param
s:xml:ns:netconf:base:1.0">
 <nf:data>
  <show>
   <spanning-tree>
    <mst>
     <configuration>
      <digest>
       <__XML__OPT_Cmd_show_stp_mst_configuration_digest___readonly__>
        <__readonly__>
         <stp-mode>mst</stp-mode>
         <name></name>
         <rev-id>0</rev-id>
         <digest>ac36177f50283cd4b83821d8ab26de62</digest>
         <prestd-digest>bb3b6c15ef8d089bb55ed10d24df44de</prestd-digest>
        </__readonly__>
       </__XML__OPT_Cmd_show_stp_mst_configuration_digest___readonly__>
      </digest>
     </configuration>
    </mst>
   </spanning-tree>
  </show>
 </nf:data>
</nf:rpc-reply>
]]>]]>

For command descriptions, see the Cisco Nexus 7000 Series Switches Command References.

  Note: This sample output is generated for Cisco Nexus 7000 Series NX-OS Release 8.3(1). 

CLI Output

switch# **show spanning-tree mst configuration digest**

switch# show spanning-tree mst configuration digest
Name      []
Revision  0     Instances configured 1
Digest          0xac36177f50283cd4b83821d8ab26de62
Pre-std Digest  0xbb3b6c15ef8d089bb55ed10d24df44de