Thursday 14 June 2012

How to test Spanning tree Protocol : Spanning tree protocol Test Cases

Spanning tree test cases written by me.Please add/update other test cases which will be useful to test this protocol. Please post in comments.

Setup:                               link2
                      |-----------HUB-------|
           PC1----Root/Switch1---------Switch2-----PC2

HUB is connected so that redundent link when goes down, the tcn bpdu can be captured.

1) Verify the configuration BPDU : Capture the packets using wireshark on PC1,verify following fields in Spanning tree protocol frame.

   Expected : It should have following fields with values as set in Root

bridge:
 
               protocol id :0 (2byte)
               Version :0  (1 byte)
               BPDU Type: 0 (1 byte)
               BPDU Flags: 0 (1 byte)
               Root Identifier : (8 bytes)
                       Root bridge priority : 32768
                       Root bridge system ID extension: 0
                       Root bridge System ID: MAC address

               Root path cost : 0 ( for root bridge) 4 bytes
               Bridge Identifier : (8 bytes)
                       Bridge priority : 32768
                       Bridge system ID extension: 0
                       Bridge System ID: MAC address
               Port Identifier : 0x8001 ( 2byte)
               Message Age : 0
               Max age: 20
               Hello Time :2
               Forward Delay :15

Veirfy in ethernet-II header the destination mac address is 01:80:c2:00:00:00


 2) Make link down between hub and switch 2, observe the TCN BPDU and  verify following fields:

     Spanning tree protocol :
               Protocol id :0 (2byte)
               Version :0  (1 byte)
               BPDU Type: 0x80 (1 byte)

3)  Verify STP can be enabled or disabled.

4) Verify by changing configurable parameters in Switch and verifying that updated value is reflected in BPDU

5) Verify that bridge with lowest bridge id ( same bridge priority lower

mac) becomes the root of LAN.

6) Verify by changing the bridge priority, the lowest bridge priority

bridge becomes the root bridge.

7) Verify in above two scenarios the bridge is converging. Verify all state of ports.

8) Make another loop between bridge 1 and 2 using hub. Verify the STP is converging  properly.

9) By changing the port path cost try to change the blocking port to forwarding and vice versa.

 In this test case the path cost of the upstream bridge is to be modified.

    Bridge1(root)------------Bridge 2 --------   blocking---Bridge 3
                                |                             |          
                                --------HUB------fwd----------
  
To make blocking port of bridge 3 in to fwd mode modify in bridge 2 , connected path cost to less number like 19 to 0.Immediately the blocking port should go into discarding/listening/learning/fwd mode and the other port should change into blocking.

10) Repeat same by changing port priority as above. Observe the convergence time for both the cases.

11) Root bridge down scenario:

In 3 bridge scenario make another loop  between bridge 3 and bridge 1


Bridge1(root)------------Bridge 2 --------   blocking---Bridge 3
       |                         |                             |          
        -------------------------HUB--------------fwd----------
  
Observe it converged and note down all the ports designations (root/designation, root bridge, designated bridge). Connect two pcs between non root bridge and ping between them. Lets say set such a way that root bridge is bridge 2 and ping is going between bridge 3 and bridge 1 PC.

Now make bridge 2 down and see the topology is converging properly with new bridge selection and note down the convergence time.

12) Link down scenario:

 When the topology has converged make forwarding port down of non root bridge and see if the blocking port mode is changed to forwading mode.

13) In 3 bridge scenario, after converging disable STP in one non -root bridge. Observe the topology is converging is not and note down the time taken.

14) Change parameters of Spanning tree root bridge like hello timer, max age and forward delay. Verify on non-root bridge the updated parameters are getting propagated properly in BPDU.

15) Add new root

  With two bridges converge STP, now add another bridge with bridge priority less than the original root bridge. Verify if the STP reconverges.

16) Add another bridge with lower priority than root bridge in existing network, verify STP re converges properly.

17) In all above where topology is getting changed verify TCN BPDU and corresponding TCN ack in BPDU from root bridge. Verify in sniffer.

18) Verify by entering non acceptable values in parameters and verify if it is accepting the values (negative test case)

19) Verify BPDU in 3rd bridge the Message Age is incremented to 2.

20) After the STP converges, disable the STP on forwarding port of non-root bridge and verify the topology re converges properly.


21) TCN retransmit timer: STP converged, now change hello time in non-root bridge. Make this non-root bridge link up and down, capture the TCN and verify the retransmission timer for TCN is the hello time configured on this switch.

22)  4 bridge setup : Verify that TCN are sent upstream and TCN-ACK in BPDU are sent downstream direction. TCN generated by 3rd bridge should not be seen by 4rth bridge but TCN-ACK BPDU should be observed at bridge 4 also.



References: 802.1D-2004