Configuring Spanning Tree

This article describes how to configure spanning trees on FlexSwitch.

Topology

topology

First I will ensure I have two interfaces on flexswitch admin up pointing towards the switch on vlan 100

Releated Documents

Using the CLI to Configure a Spanning Tree

In the following example, we create a VLAN (vlan 100).

Note

When a vlan is created, it automatically gets a spanning tree instance.

This CLI configuration example has three steps:

  1. Assign a VLAN to fpPort 1 and fpPort 2.
  2. Assure the ports are UP by forcing them with the no shut command.
  3. Check the status of the spanning trees.

Assign a VLAN to Port fpPort 1 and fpPort 2

Use the commands in the following example to create and assign vlan 100 to the ports and apply the configuration.

fpPort 1

localhost(config)#interface fpPort 1
localhost(config-if-eth-1)#vlan 100
localhost(config-if-eth-1)#apply

Applying Config:
id: 10  object: Vlan   status: APPLIED CONFIG  valid: True delete: False num user cmds: 2
 command               attr      value    model attr    iskey    required    userprov    time provisioned
------------------------------------------------------------------------------------------------------------------
 interface fpPort 1    fpPort    ['1']    IntfList      True     X           X           Wed Jun 28 23:07:46 2017
 vlan 100              vlan      100      VlanId        True     X           X           Wed Jun 28 23:21:07 2017

fpPort 2

localhost(config)#interface fpPort 2
localhost(config-if-eth-2)#vlan 100
localhost(config-if-eth-2)#apply

Applying Config:
id: 27  object: Vlan   status: APPLIED CONFIG  valid: True delete: False num user cmds: 2
 command               attr      value    model attr    iskey    required    userprov    time provisioned
------------------------------------------------------------------------------------------------------------------
 interface fpPort 2    fpPort    ['2']    IntfList      True     X           X           Wed Jun 28 23:22:13 2017
 vlan 100              vlan      100      VlanId        True     X           X           Wed Jun 28 23:22:15 2017

Set the Administrative State of the Ports.

Use the commands in the following examples to assure that ports fpPort 1 and fpPort 2 are in the UP state.

fpPort 1

localhost(config)#interface fpPort 1
localhost(config-if-eth-1)#no shut
localhost(config-if-eth-1)#apply

Applying Config:
id: 40  object: Port   status: APPLIED CONFIG  valid: True delete: False num user cmds: 2
 command               attr        value    model attr    iskey    required    userprov    time provisioned
--------------------------------------------------------------------------------------------------------------------
 interface fpPort 1    fpPort      1        IntfRef       True     X           X           Wed Jun 28 23:33:16 2017
 no shutdown UP        shutdown    UP       AdminState    False                X           Wed Jun 28 23:33:17 2017

fpPort 2

localhost(config)#interface fpPort 2
localhost(config-if-eth-2)#no shut
localhost(config-if-eth-2)#apply
id: 54  object: Port   status: APPLIED CONFIG  valid: True delete: False num user cmds: 2
 command               attr        value    model attr    iskey    required    userprov    time provisioned
--------------------------------------------------------------------------------------------------------------------
 interface fpPort 2    fpPort      2        IntfRef       True     X           X           Wed Jun 28 23:33:25 2017
 no shutdown UP        shutdown    UP       AdminState    False                X           Wed Jun 28 23:33:29 2017

Check the Status of the Spanning Tree and Interfaces

In this step, we verify the statuses of the spanning tree instance and both interfaces (fpPort1 and fpPort2).

Check the Spanning Tree Instance.

Use the command in the following example to see the status of the spanniing tree.

localhost(config)#show spanning_tree brg_vlan 100

Applying Show:
BrgIfIndex: 150994946
Bridge Id: a8:2b:b5:17:b9:01
Bridge Hello time: 2
Bridge TxHold: 6
Bridge Forwarding Delay: 15
Bridge Max Age: 20
Bridge Priority: 32868
Root Bridge Mac: a8:2b:b5:17:b9:01:
Root Bridge Prio: 80:64
Root Cost: 0
Root Port: 0
Max Age: 20
Hello Time: 2
Hold Time: 6
Forwarding Delay: 15
Bridge Vlan: 100
sdk:printStpBridgeInstanceState(100,) result: SUCCESS

The result of the show command executed above shows that the spanning tree instance exists and the FlexSwitch is the root (the Root Bridge Mac attribute matches the MAC address of the FlexSwitch.

Check the Status of fpPort1 and fpPort2

pfPort1 Status

Use the show command in the following example to see the status of fpPort1.

localhost#show spanning_tree interface fpPort 1 brg_vlan 100
Applying Show:
IntfRef fpPort1 of Vlan 100 is Forwarding Enabled True
Port path cost 0, Port priority 128, Port Identifier fpPort1
Designated root has bridge id 80:64:a8:2b:b5:17:b9:01
Designated root has priority 32868 MAC a8:2b:b5:17:b9:01
Designated bridge has bridge id 80:64:a8:2b:b5:17:b9:01
Designated bridge has priority 32868 MAC a8:2b:b5:17:b9:01
Designated port id 32793, designated path cost 0 admin path cost 0
Root Timers: max age 20, forward delay 15, hello 2
Number of transitions to forwarding state: 1
AdminEdge False OperEdge False
Bridge Assurance False Bpdu Guard False
Link Type UNSUPPORTED

pfPort2 Status

Use the show command in the following example to see the status of fpPort1.

localhost#show spanning_tree interface fpPort 2 brg_vlan 100
Applying Show:
IntfRef fpPort2 of Vlan 100 is Forwarding (inconsistant)Enabled True
Port path cost 0, Port priority 128, Port Identifier fpPort2
Designated root has bridge id 80:64:a8:2b:b5:17:b9:01
Designated root has priority 32868 MAC a8:2b:b5:17:b9:01
Designated bridge has bridge id 80:64:a8:2b:b5:17:b9:01
Designated bridge has priority 32868 MAC a8:2b:b5:17:b9:01
Designated port id 32792, designated path cost 0 admin path cost 0
Root Timers: max age 20, forward delay 15, hello 2
Number of transitions to forwarding state: 1
AdminEdge False OperEdge True
Bridge Assurance False Bpdu Guard False
Link Type UNSUPPORTED

More CLI Options

The preceding is a very simple spanning tree example, and spanning trees can be very complex. The following shows options in the CLI that you can use to create a more customized spanning tree by adjusting attributes at the interface and global levels.

Global Level Spanning Tree Options

localhost(config)#spanning_tree brg_vlan 100
localhost(config-stp)#?

--------------------------------------------------------------------------------------------------------------------
 Command                      Description
--------------------------------------------------------------------------------------------------------------------
 context:
   <cr>
   enable            UP/DOWN  Administrative state of STP Bridge default: UP
   forward_delay     0-30  The value that all bridges use for ForwardDelay when this bridge is acting as
                              the root.  Note that 802.1D-1998 specifies that the range for this parameter is
                              related to the value of MaxAge.  The granularity of this timer is specified by
                              802.1D-1998 to be 1 second.  An agent may return a badValue error if a set is
                              attempted to a value that is not a whole number of seconds. default: 15
   hello_time        0-2  The value that all bridges use for HelloTime when this bridge is acting as the
                              root.  The granularity of this timer is specified by 802.1D-1998 to be 1 second.  An
                              agent may return a badValue error if a set is attempted    to a value that is not a
                              whole number of seconds. default: 2
   max_age           0-40  The value that all bridges use for MaxAge when this bridge is acting as the
                              root.  Note that 802.1D-1998 specifies that the range for this parameter is related
                              to the value of HelloTime.  The granularity of this timer is specified by 802.1D-1998
                              to be 1 second.  An agent may return a badValue error if a set is attempted to a
                              value that is not a whole number of seconds. default: 20
   priority          0-65535  The value of the write-able portion of the Bridge ID i.e. the first two
                              octets of the 8 octet long Bridge ID.  The other last 6 octets of the Bridge ID are
                              given by the value of Address. On bridges supporting IEEE 802.1t or IEEE 802.1w
                              permissible values are 0-61440 in steps of 4096.  Extended Priority is enabled when
                              the lower 12 bits are set using the Bridges VLAN id default: 32768
   tx_hold_count     0-10  Configures the number of BPDUs that can be sent before pausing for 1 second.
                              default: 6

Interface Level Spanning Tree Options

localhost(config)#interface fpPort 1
localhost(config-if-eth-1)#spanning_tree brg_vlan 100
localhost(config-if-eth-1-stp-vlan-100)#?

--------------------------------------------------------------------------------------------------------------------
 Command                      Description
--------------------------------------------------------------------------------------------------------------------


   ProtocolMigration      false(2)/true(1)  When operating in RSTP (version 2) mode writing true(1) to this
                                   object forces this port to transmit RSTP BPDUs. Any other operation on this object
                                   has no effect and it always returns false(2) when read. default: 1
   admin_path_cost        0-200000000  The administratively assigned value for the contribution of this port to
                                   the path cost of paths toward the spanning tree root.  Writing a value of '0' assigns
                                   the automatically calculated default Path Cost value to the port.  If the default
                                   Path Cost is being used this object returns '0' when read.  This complements the
                                   object PathCost or PathCost32 which returns the operational value of the path cost.
                                    The value of this object MUST be retained across reinitializations of the management
                                   system. default: 200000
   admin_pointtopoint     forceTrue(0)/forceFalse(1)/auto(2)  The administrative point-to-point status of the
                                   LAN segment attached to this port using the enumeration values of the IEEE 802.1w
                                   clause.  A value of forceTrue(0) indicates that this port should always be treated as
                                   if it is connected to a point-to-point link.  A value of forceFalse(1) indicates that
                                   this port should be treated as having a shared media connection.  A value of auto(2)
                                   indicates that this port is considered to have a point-to-point link if it is an
                                   Aggregator and all of its    members are aggregatable or if the MAC entity is
                                   configured for full duplex operation default: 2
   adminedgeport          false(2)/true(1)  The administrative value of the Edge Port parameter.  A value of
                                   true(1) indicates that this port should be assumed as an edge-port and a value of
                                   false(2) indicates that this port should be assumed as a non-edge-port.  Setting this
                                   object will also cause the corresponding instance of OperEdgePort to change to the
                                   same value.  Note that even when this object's value is true the value of the
                                   corresponding instance of OperEdgePort can be false if a BPDU has been received.  The
                                   value of this object MUST be retained across reinitializations of the management
                                   system. default: 2
   bpdu_guard             false(2)/true(1)  A Port as OperEdge which receives BPDU with BpduGuard enabled will
                                   shut the port down. default: 2
   bpdu_guard_interval    The interval time to which a port will try to recover from BPDU Guard err-disable
                                   state.  If no BPDU frames are detected after this timeout plus 3 Times Hello Time
                                   then the port will transition back to Up state.  If condition is cleared manually
                                   then this operation is ignored.  If set to zero then timer is inactive and recovery
                                   is based on manual intervention. default: 15
   bridge_assurance       false(2)/true(1)  When enabled BPDUs will be transmitted out of all stp ports
                                   regardless of state.  When an stp port fails to receive a BPDU the port should
                                   transition to a Blocked state.  Upon reception of BDPU after shutdown  should
                                   transition port into the bridge. default: 2
   enable                 UP/DOWN  The enabled/disabled status of the port. default: UP
   priority               0-255  The value of the priority field that is contained in the first in network byte
                                   order octet of the 2 octet long Port ID.  The other octet of the Port ID is given by
                                   the value of StpPort. On bridges supporting IEEE 802.1t or IEEE 802.1w default: 128

Curl

Create VLAN 100 under fpPort 1 and 2: I the following examples, we create the spanning tree using the REST interface and cURL. In this example we perform the operations:

  1. Assign vlan 100 to both fpPorts.
  2. Confirm the sucessful creation of vlan 100 and its state.
  3. Get the status of SPT Bridge instance.

Create and Assign Vlan 100

Use the REST requests shown in the following example to create Vlan 100 and associate it with ports fpPort1 and fpPort2.

bash-4.3$ curl -sX POST -u admin -d '{"VlanId":100,"IntfList":["fpPort1","fpPort2"]}' 'http://localhost:8080/public/v1/config/Vlan' | python -m json.tool
Enter host password for user 'admin':
{
    "Access-Control-Allow-Headers": "Origin, X-Requested-With, Content-Type, Accept",
    "Access-Control-Allow-Methods": "POST, GET, OPTIONS, PATCH, DELETE",
    "Access-Control-Allow-Origin": "*",
    "Access-Control-Max_age": "86400",
    "ObjectId": "d4a55209-9d85-4c2a-5f09-69b101ae3774",
    "Result": "Success"
}

Confirm the Creation of Vlan 100

bash-4.3$ curl -sX GET -u admin -d '{"VlanId":100}' 'http://localhost:8080/public/v1/config/Vlan' | python -m json.tool
Enter host password for user 'admin':
{
    "Object": {
        "AdminState": "UP",
        "AutoState": "UP",
        "Description": "none",
        "IntfList": [
            "fpPort1",
            "fpPort2"
        ],
        "UntagIntfList": [],
        "VlanId": 100
    },
    "ObjectId": "d4a55209-9d85-4c2a-5f09-69b101ae3774"
}

Check the Status of Vlan 100

bash-4.3$ curl -sX GET -u admin -d '{"VlanId":100}' 'http://localhost:8080/public/v1/state/Vlan' | python -m json.tool
Enter host password for user 'admin':
{
    "Object": {
        "IfIndex": 33554732,
        "Name": "vlan300",
        "OperState": "UP",
        "SysInternalDescription": "",
        "VlanId": 100
    },
    "ObjectId": "d4a55209-9d85-4c2a-5f09-69b101ae3774"
}

This means we should be able to confirm our spanning tree instance

Check the Status of the STP Bridge Instance

bash-4.3$ curl -sX GET -u admin -d '{"Vlan":100}' 'http://localhost:8080/public/v1/state/stpbridgeinstance' | python -m json.tool
Enter host password for user 'admin':
{
    "Object": {
        "Address": "a8:2b:b5:17:b9:01",
        "AlternateBlockedPorts": null,
        "BridgeForwardDelay": 15,
        "BridgeHelloTime": 2,
        "BridgeHoldTime": 0,
        "BridgeMaxAge": 20,
        "DesignatedPorts": [
            "fpPort1",
            "fpPort2"
        ],
        "DesignatedRoot": "81:2c:a8:2b:b5:17:b9:01:",
        "DisabledPorts": null,
        "EdgePorts": null,
        "ForwardDelay": 15,
        "HelloTime": 2,
        "HoldTime": 6,
        "IfIndex": 150994950,
        "MaxAge": 20,
        "OperState": "",
        "Priority": 33068,
        "ProtocolSpecification": 2,
        "RootCost": 0,
        "RootPort": 0,
        "RootPorts": null,
        "TimeSinceTopologyChange": 0,
        "TopChanges": 0,
        "TxHoldCount": 6,
        "Vlan": 300
    },
    "ObjectId": "d114ba53-284a-47cc-6c7f-5b644979d6bb"
}