STP - Spanning Tree Protocol

What is STP?

STP (Spanning Tree Protocol) is a network protocol used to prevent loops in Ethernet networks. It ensures a loop-free topology by selectively blocking redundant paths.

Why is STP useful?

  • Automatically detects loops

  • Disables redundant paths

  • Re-enables them if the active path fails

How it works

  • Root Bridge Election – Switches elect one switch as the Root Bridge (lowest Bridge ID)

  • Path Cost Calculation – Each switch finds the shortest path to the Root Bridge

  • Loop Prevention – STP blocks extra paths to prevent loops

  • Failure Recovery – If a path fails, STP activates a backup

Where is STP used?

  • Enterprise LANs with multiple switches

  • Data centers with redundant links

  • Campus networks

  • Any Ethernet-based network with loop potential

Which OSI layer does this protocol belong to?

  • Layer 2 – Data Link Layer

  • Operates using MAC addresses

  • No dependence on IP addresses

  • Manages switch-to-switch behavior

What are common types of STP?

  • STP (802.1D) – Original standard

  • RSTP (802.1w) – Rapid STP for faster convergence

  • MSTP (802.1s) – Supports multiple spanning trees for VLANs

What are the port roles in STP?

  • Root Port (RP) – Best path to the Root Bridge (one per switch)

  • Designated Port (DP) – Forwards frames on a segment

  • Blocked Port – Does not forward traffic (backup path)

  • Disabled Port – Shut down or not participating

What are the STP port states?

  • Blocking – Listens for BPDUs only

  • Listening – Prepares for data forwarding

  • Learning – Learns MACs but does not forward

  • Forwarding – Active traffic forwarding

  • Disabled – Manually turned off

What is a BPDU?

A Bridge Protocol Data Unit (BPDU) is a special message used by STP to share topology information between switches.

What happens during a topology change?

  • A switch detects a change (e.g., link down/up)

  • It sends a Topology Change Notification (TCN) BPDU

  • The Root Bridge updates the topology

  • Switches flush MAC tables and reconverge

What is the working flow of STP?

  • All Switches Send BPDUs – Each switch assumes it’s the Root and sends its Bridge ID (priority + MAC) with path cost = 0

  • Elect the Root Bridge – Lowest Bridge ID wins – Other switches become non-root

  • Calculate Path Cost to Root
    • Cost based on link speed:

    • 10 Mbps = 100

    • 100 Mbps = 19

    • 1 Gbps = 4

    • 0 Gbps = 2

  • Assign Port Roles * Based on best paths and BPDUs: * Root Port * Designated Port * Blocked Port

  • Block Redundant Links – Only Root & Designated Ports forward – Blocked ports prevent loops

  • Transition Port States (802.1D) – Blocking → Listening → Learning → Forwarding – Takes 30–50 seconds to converge

  • Handle Topology Changes – Affected switch sends TCN BPDU – MAC tables are flushed – Tree recalculates and stabilizes

What are the real-time applications of STP?

  • VoIP (Voice over IP)

  • Video Conferencing (e.g., Zoom, Microsoft Teams)

  • Industrial Automation

  • IPTV / Live Video Streaming

  • In this section, you are going to learn

  • Terminology

  • Version Info

S.No

Version

IEEE

Year

contribution/core ideas

1

STP (CST)

IEEE 802.1D

1990

Original version; prevents loops in Layer 2 networks using a single spanning tree.

2

RSTP

IEEE 802.1w

2001

Rapid Spanning Tree Protocol; faster convergence than STP.

3

MSTP

IEEE 802.1s

2002

Multiple Spanning Tree Protocol; maps multiple VLANs to a few spanning tree instances.

4

PVST+

Cisco proprietary

Per-VLAN STP; runs a separate STP instance per VLAN.

5

Rapid PVST+

Cisco proprietary

Ciscos enhancement of RSTP with per-VLAN support.

6

MST (Cisco MSTP)

Cisco implementation of IEEE 802.1s

Supports up to 16 RSTP instances mapped to VLANs.

  • setup

  • setup

STP CONFIGURATION BPDU Packet

S.No

packet details

Description

Size (Bytes)

1

Configuration BPDU

It contains information about the root bridge, path cost, timers, and is used to maintain and calculate the spanning tree topology.

35 Bytes

Protocol Identifier

Identifies the protocol as STP (usually 0x0000)

2

Protocol Version

Version of STP (0 for IEEE 802.1D)

1

BPDU Type

Type of BPDU (0x00 = Configuration)

1

BPDU Flags

TC and TCA flags

1

Root Bridge ID

Priority (2 bytes) + MAC (6 bytes)

8

Root Path Cost

Cost to reach the root bridge

4

Sender Bridge ID

Priority (2 bytes) + MAC (6 bytes)

8

Port Identifier

ID of the port sending the BPDU

2

Message Age

Time since the root sent the configuration message

2

Max Age

Maximum age before the BPDU is discarded

2

Hello Time

Time interval between BPDUs sent by the root bridge

2

Forward Delay

Time spent in listening and learning states

2

STP TOPOLOGY CHANGE NOTIFICATION Packet

2

Topology Change Notification

Sent by a bridge when it detects a topology change. It notifies the root bridge to initiate a topology change process.

4 Bytes

Protocol Identifier

Identifies the protocol as STP (usually 0x0000)

2

Protocol Version

Version of STP (0 for IEEE 802.1D)

1

BPDU Type

Type of BPDU (0x80 = TCN)

1

S.No

Use Case

Description

1

Loop Prevention in LANs

Prevents broadcast storms and data duplication by blocking redundant paths in Ethernet networks.

2

Redundant Link Management

Allows multiple physical links between switches for redundancy without causing loops.

3

Automatic Failover

If the active path fails, STP reactivates a previously blocked path to maintain connectivity.

4

Network Topology Stability

Maintains a stable and loop-free topology even when switches or links are added or removed.

5

Data Center Networking

Used in data centers to manage complex switch topologies with multiple redundant paths.

6

Campus and Enterprise Networks

Ensures reliable communication across large networks with many interconnected switches.

7

Bridge and Switch Interconnection

Helps manage traffic between multiple bridges/switches in a scalable way.

8

Minimizing Downtime

Reduces manual intervention during link failures by dynamically recalculating paths.

S.No

STP features

Description

1

Loop Prevention

Prevents network loops by blocking redundant paths in a switched network.

2

Redundancy Support

Allows multiple physical links for backup without causing loops.

3

Automatic Topology Change Handling

Automatically recalculates paths when a switch or link fails.

4

Bridge Election

Elects a Root Bridge to serve as the central point of the network.

5

Port Roles Assignment

Assigns roles like Root Port, Designated Port, and Blocked Port to manage traffic flow.

6

Path Cost Calculation

Uses path cost to determine the shortest and most efficient route to the Root Bridge.

7

Timer-Based Operation

Uses timers like Hello Time, Max Age, and Forward Delay to manage state transitions.

8

Dynamic Reconfiguration

Adapts to changes in the network without manual intervention.

9

Standardized Protocol

Defined by IEEE 802.1D, ensuring compatibility across vendors.

10

Layer 2 Operation

Operates at the Data Link Layer (Layer 2) of the OSI model.

Loop Prevention - Testcases

S.No

Test Case

Description

Expected Result

1

STP Initialization

Start STP on all switches

STP begins topology calculation

2

Root Bridge Election

Elect root bridge

Lowest bridge ID becomes root

3

Loop Detection

Create physical loop

STP blocks redundant path

4

Port Blocking

Verify blocked port

One port is placed in blocking state

5

Port Forwarding

Verify forwarding port

Only one path is active

6

Port Listening State

Check transition to listening

Port enters listening before learning

7

Port Learning State

Check transition to learning

Port learns MAC addresses

8

Port Forwarding State

Check transition to forwarding

Port forwards frames

9

BPDU Transmission

Send BPDUs between switches

BPDUs are exchanged correctly

10

BPDU Reception

Receive BPDUs

Switch updates topology info

11

BPDU Filtering

Filter BPDUs on edge port

BPDUs are blocked

12

BPDU Guard

Enable BPDU Guard

Port is disabled on BPDU receipt

13

BPDU Attack Simulation

Simulate rogue BPDU

STP protects root bridge

14

Topology Change Notification

Trigger topology change

STP recalculates paths

15

Loop Recovery

Remove loop

Blocked port transitions to forwarding

16

Redundant Link Addition

Add redundant link

STP blocks one path

17

Root Bridge Failure

Power off root bridge

New root bridge is elected

18

Port Priority Change

Change port priority

STP recalculates path cost

19

Path Cost Adjustment

Modify path cost

STP selects new best path

20

STP Convergence Time

Measure convergence

Network stabilizes within expected time

21

STP on VLANs

Enable STP per VLAN

Each VLAN has independent topology

22

Rapid STP (RSTP) Test

Use RSTP instead of STP

Faster convergence observed

23

Multiple Root Bridges

Configure multiple root bridges

STP selects one root bridge

24

Loop in Access Layer

Create loop in access layer

STP blocks redundant access port

25

Loop in Distribution Layer

Create loop in distribution layer

STP blocks redundant uplink

26

Loop in Core Layer

Create loop in core layer

STP blocks one core path

27

STP Port Roles

Verify port roles (Root, Designated, etc.)

Roles are assigned correctly

28

STP Timer Configuration

Adjust hello, forward delay timers

STP behavior changes accordingly

29

STP Timer Expiry

Simulate timer expiry

STP recalculates topology

30

STP Disabled

Disable STP on switch

Loop forms and causes broadcast storm

31

STP Enabled

Enable STP on switch

Loop is prevented

32

STP Loop Simulation

Simulate loop in testbed

STP blocks one path

33

STP Loop Detection Tool

Use loop detection tool

Tool confirms STP loop prevention

34

STP with Link Aggregation

Use STP with LACP

STP treats aggregated links correctly

35

STP with Redundant Switches

Add redundant switches

STP blocks unnecessary paths

36

STP with Wireless Bridge

Use STP over wireless bridge

STP blocks redundant wireless path

37

STP with Edge Devices

Connect edge devices

STP does not block edge ports

38

STP with Server Farm

Connect servers with dual NICs

STP blocks one NIC path

39

STP with VoIP Phones

Connect VoIP phones

STP does not interfere with voice traffic

40

STP with IP Cameras

Connect IP cameras

STP prevents loop from camera switches

41

STP with IoT Devices

Connect IoT devices

STP handles low-bandwidth devices

42

STP with Legacy Switches

Use old switches

STP still prevents loops

43

STP with Managed Switches

Use managed switches

STP configuration is supported

44

STP with Unmanaged Switches

Use unmanaged switches

STP may not function properly

45

STP with Cloud Network

Simulate STP in cloud topology

STP prevents virtual loop

46

STP with SDN Controller

Integrate STP with SDN

SDN respects STP decisions

47

STP with Network Emulator

Test STP in emulated environment

Loop prevention is verified

48

STP with Monitoring Tools

Monitor STP status

Loop-free topology is confirmed

49

STP with Logging

Enable STP logs

Loop events are recorded

50

STP Compliance Test

Validate STP against IEEE 802.1D

STP passes compliance checks

Redundancy Support - Testcases

S.No

Test Case

Description

Expected Result

1

Verify Primary Node Activation

Ensure primary node is active initially

Primary node is active

2

Verify Secondary Node Standby

Ensure secondary node is in standby mode

Secondary node is in standby

3

Failover Trigger

Simulate primary node failure

Secondary node takes over

4

Failback Trigger

Restore primary node

Primary node resumes control

5

Heartbeat Monitoring

Check heartbeat signal between nodes

Heartbeat is consistent

6

Heartbeat Loss Detection

Simulate heartbeat loss

Failover is triggered

7

Manual Failover

Trigger manual failover

Secondary node becomes active

8

Manual Failback

Trigger manual failback

Primary node becomes active

9

Data Sync Check

Verify data sync between nodes

Data is consistent

10

Data Loss Prevention

Simulate failure during sync

No data loss occurs

11

Load Balancing

Distribute load between nodes

Load is balanced

12

Network Partition

Simulate network split

Redundancy handles partition

13

Node Rejoin

Reconnect failed node

Node rejoins cluster

14

Redundancy Mode Switch

Switch between active-active and active-passive

Mode switches successfully

15

Configuration Sync

Change config on primary

Syncs to secondary

16

Alert on Failover

Check alert system on failover

Alert is generated

17

Alert on Failback

Check alert system on failback

Alert is generated

18

Logging Failover Events

Check logs for failover

Logs are accurate

19

Logging Heartbeat Events

Check logs for heartbeat

Logs are accurate

20

CPU Load During Failover

Monitor CPU during failover

Load remains stable

21

Memory Usage During Sync

Monitor memory during sync

Memory usage is optimal

22

Disk Space Monitoring

Check disk usage on both nodes

Disk usage is within limits

23

Redundancy Disabled Mode

Disable redundancy

System runs in standalone mode

24

Redundancy Enabled Mode

Enable redundancy

Redundancy is active

25

Backup Node Health Check

Monitor backup node health

Node is healthy

26

Primary Node Health Check

Monitor primary node health

Node is healthy

27

Redundancy Status API

Call API for status

Returns correct status

28

Redundancy Status UI

Check UI for status

Displays correct status

29

Redundancy Recovery Time

Measure time to recover

Within acceptable limits

30

Redundancy Timeout Config

Change timeout settings

Takes effect immediately

31

Redundancy Role Swap

Swap roles of nodes

Roles are swapped

32

Redundancy Role Lock

Lock roles to prevent swap

Roles remain fixed

33

Redundancy Role Unlock

Unlock roles

Roles can be swapped

34

Redundancy Under Load

Test failover under high load

System handles it

35

Redundancy During Upgrade

Upgrade one node

Redundancy remains intact

36

Redundancy During Reboot

Reboot one node

Other node takes over

37

Redundancy with Firewall

Enable firewall

Redundancy still works

38

Redundancy with VPN

Enable VPN

Redundancy still works

39

Redundancy with Encryption

Enable data encryption

Redundancy still works

40

Redundancy with Compression

Enable compression

Redundancy still works

41

Redundancy with Logging Off

Disable logging

Redundancy unaffected

42

Redundancy with Logging On

Enable logging

Logs are captured

43

Redundancy with Custom Ports

Use non-default ports

Redundancy works

44

Redundancy with DNS Failover

Use DNS-based failover

Works as expected

45

Redundancy with Load Balancer

Add load balancer

Redundancy integrates

46

Redundancy with Cloud Sync

Sync with cloud

Redundancy supports it

47

Redundancy with Local Backup

Use local backup

Redundancy supports it

48

Redundancy with Scheduled Tasks

Run scheduled tasks

Tasks run on active node

49

Redundancy with Time Sync

Sync time between nodes

Time is consistent

50

Redundancy with Power Failure

Simulate power loss

Secondary takes over

Automatic Topology Change Handling - Testcases

S.No

Test Case

Description

Expected Result

1

Detect Node Join

Add a new node to the network

Topology updates automatically

2

Detect Node Leave

Remove a node from the network

Topology updates automatically

3

Node Failure Detection

Simulate node crash

Topology reflects node removal

4

Node Recovery Detection

Restart failed node

Node rejoins topology

5

Link Failure Detection

Disconnect a link

Topology updates to reflect change

6

Link Recovery Detection

Reconnect a link

Topology restores original state

7

Dynamic Routing Update

Change network path

Routing table updates automatically

8

Loop Prevention

Introduce loop in topology

System prevents loop formation

9

Redundant Path Handling

Add redundant path

Topology includes backup path

10

Load-Based Topology Change

Simulate high load

Topology adapts to balance load

11

Latency-Based Topology Change

Introduce latency

Topology reroutes traffic

12

Bandwidth-Based Topology Change

Reduce bandwidth

Topology adapts accordingly

13

Topology Snapshot Logging

Log topology changes

Snapshot is recorded

14

Topology Change Alert

Trigger topology change

Alert is generated

15

Topology Change Rollback

Revert to previous topology

Rollback is successful

16

Topology Change Audit Trail

Check audit logs

All changes are logged

17

Topology Change API

Call API to fetch topology

Returns updated topology

18

Topology Change UI

View topology on UI

UI reflects changes

19

Topology Change Under Load

Change topology under load

System remains stable

20

Topology Change During Upgrade

Upgrade node

Topology updates without error

21

Topology Change During Failover

Trigger failover

Topology adapts automatically

22

Topology Change During Maintenance

Put node in maintenance

Topology excludes node

23

Topology Change with Firewall

Enable firewall

Topology adapts correctly

24

Topology Change with VPN

Enable VPN

Topology reflects secure links

25

Topology Change with NAT

Enable NAT

Topology handles address translation

26

Topology Change with DHCP

Enable DHCP

Topology updates with new IPs

27

Topology Change with Static IP

Use static IPs

Topology remains stable

28

Topology Change with DNS

Change DNS entries

Topology updates accordingly

29

Topology Change with IPv6

Use IPv6 addresses

Topology handles IPv6

30

Topology Change with IPv4

Use IPv4 addresses

Topology handles IPv4

31

Topology Change with Mixed IP

Use IPv4 and IPv6

Topology supports dual stack

32

Topology Change with Wireless Node

Add wireless node

Topology includes wireless link

33

Topology Change with Wired Node

Add wired node

Topology includes wired link

34

Topology Change with Mobile Node

Move node location

Topology updates dynamically

35

Topology Change with Cloud Node

Add cloud-based node

Topology includes cloud node

36

Topology Change with Edge Node

Add edge node

Topology includes edge node

37

Topology Change with IoT Device

Add IoT device

Topology includes IoT node

38

Topology Change with Gateway

Add gateway

Topology includes gateway

39

Topology Change with Proxy

Add proxy server

Topology includes proxy

40

Topology Change with Load Balancer

Add load balancer

Topology reflects new path

41

Topology Change with Redundant Gateway

Add redundant gateway

Topology includes both

42

Topology Change with VLAN

Add VLAN

Topology reflects segmentation

43

Topology Change with Subnet

Add subnet

Topology includes subnet

44

Topology Change with Broadcast Domain

Change broadcast domain

Topology adapts

45

Topology Change with Multicast

Enable multicast

Topology supports multicast

46

Topology Change with QoS

Enable QoS

Topology prioritizes traffic

47

Topology Change with ACL

Apply access control list

Topology respects ACL rules

48

Topology Change with Security Policy

Apply policy

Topology enforces policy

49

Topology Change with Monitoring Tool

Integrate monitoring

Tool reflects real-time topology

50

Topology Change with Automation Script

Run script to change topology

Topology updates automatically

Bridge Election - Testcases

S.No

Test Case

Description

Expected Result

1

Default Bridge Election

Power on all switches with default priority

Switch with lowest MAC becomes root bridge

2

Custom Bridge Priority

Set lowest priority on one switch

That switch becomes root bridge

3

Equal Priority, Lower MAC

Set same priority on all switches

Switch with lowest MAC wins

4

Priority Change After Election

Change priority after election

Re-election occurs

5

MAC Address Conflict

Two switches with same MAC

Election fails or logs error

6

Root Bridge Failure

Power off root bridge

New root bridge is elected

7

Root Bridge Recovery

Restore original root bridge

Re-election may occur

8

Manual Root Bridge Assignment

Manually configure root bridge

Configured switch becomes root

9

Bridge ID Verification

Verify bridge ID format

Correct format: priority + MAC

10

Election Logging

Check logs during election

Election events are logged

11

Election Notification

Check for alerts on election

Notification is generated

12

Election Time Measurement

Measure time taken for election

Within protocol-defined limits

13

Election During Topology Change

Trigger topology change

Election adapts accordingly

14

Election with Redundant Links

Add redundant links

Election still functions

15

Election with Loop Prevention

Create loop

Election prevents loop

16

Election with VLANs

Use multiple VLANs

Separate root bridges per VLAN

17

Election with MSTP

Use Multiple Spanning Tree Protocol

Election per instance

18

Election with RSTP

Use Rapid STP

Faster election process

19

Election with PVST+

Use Per VLAN STP

Election per VLAN

20

Election with STP Disabled

Disable STP

No election occurs

21

Election with STP Enabled

Enable STP

Election occurs

22

Election with PortFast

Enable PortFast

Election unaffected

23

Election with BPDU Guard

Enable BPDU Guard

Unauthorized BPDUs blocked

24

Election with BPDU Filter

Enable BPDU Filter

BPDUs are filtered

25

Election with Root Guard

Enable Root Guard

Prevents unauthorized root

26

Election with TCN

Trigger topology change notification

Election responds correctly

27

Election with Edge Ports

Use edge ports

No impact on election

28

Election with Non-STP Switch

Add unmanaged switch

Election unaffected

29

Election with Loopback

Create loopback

Election handles loop

30

Election with Link Aggregation

Use LAG

Election considers logical link

31

Election with STP Timers

Modify STP timers

Election adapts

32

Election with High Latency

Introduce latency

Election still completes

33

Election with Packet Loss

Simulate BPDU loss

Election retries

34

Election with CPU Load

High CPU on switch

Election completes successfully

35

Election with Memory Pressure

Low memory on switch

Election completes

36

Election with Firmware Upgrade

Upgrade firmware

Election re-triggers if needed

37

Election with Power Cycle

Power cycle switch

Election re-evaluates

38

Election with Port Flap

Flap root port

Election remains stable

39

Election with STP Debugging

Enable debug logs

Election steps visible

40

Election with STP Convergence

Measure convergence time

Within expected range

41

Election with STP Loop Detection

Enable loop detection

Election prevents loop

42

Election with STP Topology View

View topology

Root bridge is correctly shown

43

Election with STP Simulation

Simulate election in lab

Matches expected outcome

44

Election with STP Redundancy

Add redundant root bridge

Backup does not interfere

45

Election with STP Priority Tuning

Tune priorities

Desired root bridge elected

46

Election with STP MAC Spoofing

Spoof MAC address

Election detects anomaly

47

Election with STP VLAN Pruning

Enable VLAN pruning

Election per active VLAN

48

Election with STP Path Cost

Modify path cost

Election considers cost

49

Election with STP Root Path Cost

Verify root path cost

Lowest cost path selected

50

Election with STP Reboot Storm

Reboot multiple switches

Election stabilizes eventually

Port Roles Assignment - Testcases

S.No

Test Case

Description

Expected Result

1

Assign Root Port

Connect switch to root bridge

Port becomes Root Port

2

Assign Designated Port

Connect to non-root segment

Port becomes Designated Port

3

Assign Blocked Port

Create redundant link

Port becomes Blocked Port

4

Assign Alternate Port

Use RSTP with backup path

Port becomes Alternate Port

5

Assign Backup Port

Use RSTP with backup on shared segment

Port becomes Backup Port

6

Root Port Reassignment

Change root bridge

New port becomes Root Port

7

Designated Port Reassignment

Change topology

New port becomes Designated Port

8

Blocked Port Activation

Remove active link

Blocked port becomes active

9

Port Role on Edge Port

Enable PortFast

Port does not participate in STP

10

Port Role on Trunk Port

Use trunk port

Role assigned based on topology

11

Port Role on Access Port

Use access port

Role assigned based on topology

12

Port Role on VLAN

Assign role per VLAN

Role assigned per VLAN instance

13

Port Role on MSTP

Use MSTP

Role assigned per instance

14

Port Role on PVST+

Use PVST+

Role assigned per VLAN

15

Port Role on RSTP

Use RSTP

Roles include Alternate and Backup

16

Port Role on STP Disabled

Disable STP

No role assigned

17

Port Role on STP Enabled

Enable STP

Role assigned based on topology

18

Port Role Change Logging

Change port role

Event logged

19

Port Role Change Alert

Change port role

Alert generated

20

Port Role Change During Failover

Simulate failover

Roles re-evaluated

21

Port Role Change During Reboot

Reboot switch

Roles reassigned

22

Port Role Change During Upgrade

Upgrade firmware

Roles reassigned

23

Port Role Change During Link Flap

Flap link

Role may change

24

Port Role Change During Load

High traffic

Role remains stable

25

Port Role Change During Loop

Create loop

Role changes to prevent loop

26

Port Role with BPDU Guard

Enable BPDU Guard

Unauthorized port blocked

27

Port Role with Root Guard

Enable Root Guard

Prevents root port assignment

28

Port Role with PortFast

Enable PortFast

Port skips STP states

29

Port Role with STP Timers

Modify timers

Role assignment adapts

30

Port Role with Path Cost

Change path cost

Role assignment changes

31

Port Role with Priority Change

Change bridge priority

Role assignment changes

32

Port Role with MAC Address Change

Change MAC

Role assignment may change

33

Port Role with VLAN Pruning

Enable pruning

Role assigned to active VLANs

34

Port Role with ACL

Apply ACL

Role assignment unaffected

35

Port Role with QoS

Enable QoS

Role assignment unaffected

36

Port Role with Loopback

Create loopback

Role changes to prevent loop

37

Port Role with Redundant Links

Add redundant links

One port blocked

38

Port Role with Link Aggregation

Use LAG

Role assigned to logical group

39

Port Role with Wireless Link

Use wireless bridge

Role assigned normally

40

Port Role with Cloud Node

Connect to cloud node

Role assigned based on topology

41

Port Role with Edge Node

Connect edge node

Role assigned based on topology

42

Port Role with Monitoring Tool

Monitor port roles

Roles visible in tool

43

Port Role with Automation Script

Automate role assignment

Roles assigned correctly

44

Port Role with Manual Override

Manually set role

Override takes effect

45

Port Role with Security Policy

Apply policy

Role assignment respects policy

46

Port Role with Firmware Bug

Simulate bug

Role assignment fails or logs error

47

Port Role with STP Loop Detection

Enable loop detection

Role changes to prevent loop

48

Port Role with STP Convergence

Measure convergence time

Roles assigned within limits

49

Port Role with STP Simulation

Simulate topology

Roles assigned correctly

50

Port Role with STP Topology View

View topology

Roles displayed accurately

Path Cost Calculation - Testcases

S.No

Test Case

Description

Expected Result

1

Default Path Cost

Use default STP settings

Path cost calculated based on link speed

2

Custom Path Cost

Manually set path cost

Custom cost is applied

3

Path Cost for 10 Mbps

Use 10 Mbps link

Cost = 100

4

Path Cost for 100 Mbps

Use 100 Mbps link

Cost = 19

5

Path Cost for 1 Gbps

Use 1 Gbps link

Cost = 4

6

Path Cost for 10 Gbps

Use 10 Gbps link

Cost = 2

7

Path Cost for 100 Gbps

Use 100 Gbps link

Cost = 1

8

Path Cost for Wireless Link

Use wireless bridge

Cost calculated based on speed

9

Path Cost for Fiber Link

Use fiber optic link

Cost reflects high speed

10

Path Cost for Copper Link

Use copper cable

Cost reflects lower speed

11

Path Cost with VLAN

Calculate cost per VLAN

Cost calculated per VLAN instance

12

Path Cost with MSTP

Use MSTP

Cost calculated per instance

13

Path Cost with PVST+

Use PVST+

Cost calculated per VLAN

14

Path Cost with RSTP

Use RSTP

Cost calculated normally

15

Path Cost with STP Disabled

Disable STP

No cost calculated

16

Path Cost with STP Enabled

Enable STP

Cost calculated

17

Path Cost with Link Aggregation

Use LAG

Cost calculated for logical link

18

Path Cost with Redundant Links

Add redundant links

Lowest cost path selected

19

Path Cost with Loopback

Create loopback

Loop avoided using cost

20

Path Cost with Manual Override

Override cost manually

Manual cost used

21

Path Cost with Port Priority

Change port priority

Cost calculation unaffected

22

Path Cost with PortFast

Enable PortFast

Port excluded from STP

23

Path Cost with Root Guard

Enable Root Guard

Cost calculation unaffected

24

Path Cost with BPDU Guard

Enable BPDU Guard

Cost calculation unaffected

25

Path Cost with ACL

Apply ACL

Cost calculation unaffected

26

Path Cost with QoS

Enable QoS

Cost calculation unaffected

27

Path Cost with VLAN Pruning

Enable pruning

Cost calculated for active VLANs

28

Path Cost with STP Timers

Modify timers

Cost calculation unaffected

29

Path Cost with MAC Address Change

Change MAC

Cost calculation unaffected

30

Path Cost with Firmware Upgrade

Upgrade switch

Cost recalculated if needed

31

Path Cost with Reboot

Reboot switch

Cost recalculated

32

Path Cost with Link Flap

Flap link

Cost recalculated

33

Path Cost with High Latency

Introduce latency

Cost remains based on speed

34

Path Cost with Packet Loss

Simulate loss

Cost calculation unaffected

35

Path Cost with CPU Load

High CPU usage

Cost calculation unaffected

36

Path Cost with Memory Pressure

Low memory

Cost calculation unaffected

37

Path Cost with Monitoring Tool

Monitor cost

Cost visible in tool

38

Path Cost with Automation Script

Automate cost setting

Script sets correct cost

39

Path Cost with Security Policy

Apply policy

Cost calculation respects policy

40

Path Cost with Simulation

Simulate topology

Cost calculated correctly

41

Path Cost with Topology Change

Change topology

Cost recalculated

42

Path Cost with Root Bridge Change

Change root bridge

Cost recalculated

43

Path Cost with Designated Port Change

Change designated port

Cost recalculated

44

Path Cost with Alternate Path

Add alternate path

Lowest cost path selected

45

Path Cost with Backup Path

Add backup path

Backup path has higher cost

46

Path Cost with Edge Node

Connect edge node

Cost calculated normally

47

Path Cost with Cloud Node

Connect cloud node

Cost calculated based on link

48

Path Cost with Wireless Mesh

Use mesh network

Cost calculated per hop

49

Path Cost with VPN Tunnel

Use VPN link

Cost calculated based on tunnel speed

50

Path Cost with Firewall

Enable firewall

Cost calculation unaffected

Timer Based Operation - Testcases

S.No

Test Case

Description

Expected Result

1

Default Hello Time

Use default settings

Hello Time = 2 seconds

2

Default Forward Delay

Use default settings

Forward Delay = 15 seconds

3

Default Max Age

Use default settings

Max Age = 20 seconds

4

Custom Hello Time

Set Hello Time to 5s

Hello messages sent every 5s

5

Custom Forward Delay

Set Forward Delay to 10s

Port transitions faster

6

Custom Max Age

Set Max Age to 30s

Root info retained longer

7

Invalid Hello Time

Set Hello Time > Max Age

Configuration rejected

8

Invalid Forward Delay

Set Forward Delay < Hello Time

Configuration rejected

9

Invalid Max Age

Set Max Age < Hello Time

Configuration rejected

10

Hello Timer Expiry

Wait for Hello interval

BPDU sent

11

Forward Delay Expiry

Wait for delay interval

Port transitions to next state

12

Max Age Expiry

Wait for Max Age

Root info discarded

13

Timer Sync Across VLANs

Use PVST+

Timers applied per VLAN

14

Timer Sync Across Instances

Use MSTP

Timers applied per instance

15

Timer Sync in RSTP

Use RSTP

Timers adjusted automatically

16

Timer Sync in STP

Use classic STP

Timers manually configured

17

Timer Change Logging

Modify timer values

Change logged

18

Timer Change Alert

Modify timer values

Alert generated

19

Timer Change During Failover

Simulate failover

Timers re-evaluated

20

Timer Change During Reboot

Reboot switch

Timers restored

21

Timer Change During Upgrade

Upgrade firmware

Timers preserved

22

Timer Change During Link Flap

Flap link

Timers reset

23

Timer Change During Load

High traffic

Timers remain stable

24

Timer Change During Loop

Create loop

Timers help prevent loop

25

Timer with PortFast

Enable PortFast

Timers bypassed

26

Timer with BPDU Guard

Enable BPDU Guard

Timer operation unaffected

27

Timer with Root Guard

Enable Root Guard

Timer operation unaffected

28

Timer with ACL

Apply ACL

Timer operation unaffected

29

Timer with QoS

Enable QoS

Timer operation unaffected

30

Timer with VLAN Pruning

Enable pruning

Timers apply to active VLANs

31

Timer with MAC Change

Change MAC

Timers re-evaluated

32

Timer with Firmware Bug

Simulate bug

Timer misbehavior logged

33

Timer with Monitoring Tool

Monitor timers

Values visible in tool

34

Timer with Automation Script

Automate timer config

Script sets correct values

35

Timer with Security Policy

Apply policy

Timer values enforced

36

Timer with Simulation

Simulate topology

Timers behave as expected

37

Timer with Topology Change

Change topology

Timers re-triggered

38

Timer with Root Bridge Change

Change root bridge

Timers reset

39

Timer with Designated Port Change

Change designated port

Timers re-evaluated

40

Timer with Alternate Path

Add alternate path

Timers apply to new path

41

Timer with Backup Path

Add backup path

Timers apply to backup

42

Timer with Edge Node

Connect edge node

Timers apply normally

43

Timer with Cloud Node

Connect cloud node

Timers apply normally

44

Timer with Wireless Mesh

Use mesh network

Timers apply per link

45

Timer with VPN Tunnel

Use VPN link

Timers apply based on delay

46

Timer with Firewall

Enable firewall

Timers unaffected

47

Timer with STP Convergence

Measure convergence time

Timers influence convergence

48

Timer with STP Loop Detection

Enable loop detection

Timers help prevent loop

49

Timer with STP Debugging

Enable debug logs

Timer events visible

50

Timer with STP Topology View

View topology

Timer values displayed accurately

Dynamic Reconfiguration - Testcases

S.No

Test Case

Description

Expected Result

1

Add New Switch

Connect a new switch

STP recalculates topology

2

Remove Existing Switch

Disconnect a switch

STP recalculates topology

3

Change Bridge Priority

Modify bridge priority

Root bridge re-election occurs

4

Change Port Cost

Modify path cost

STP updates port roles

5

Change Hello Time

Modify Hello timer

STP updates BPDU interval

6

Change Forward Delay

Modify Forward Delay

Port transition timing updates

7

Change Max Age

Modify Max Age

BPDU aging behavior updates

8

Enable PortFast

Enable PortFast on edge port

Port bypasses STP states

9

Disable PortFast

Disable PortFast

Port follows STP transitions

10

Enable BPDU Guard

Activate BPDU Guard

Unauthorized BPDUs blocked

11

Disable BPDU Guard

Deactivate BPDU Guard

BPDUs allowed

12

Enable Root Guard

Activate Root Guard

Root bridge protection enabled

13

Disable Root Guard

Deactivate Root Guard

Root bridge protection disabled

14

Enable Loop Guard

Activate Loop Guard

Loop prevention enabled

15

Disable Loop Guard

Deactivate Loop Guard

Loop prevention disabled

16

Change STP Mode

Switch to RSTP or MSTP

STP mode changes dynamically

17

VLAN Addition

Add new VLAN

STP instance created

18

VLAN Removal

Remove VLAN

STP instance removed

19

Link Failure

Disconnect active link

STP recalculates path

20

Link Recovery

Reconnect link

STP reconfigures topology

21

Port Role Change

Change port role manually

STP updates role assignment

22

MAC Address Change

Change switch MAC

STP recalculates bridge ID

23

Firmware Upgrade

Upgrade switch firmware

STP resumes with updated config

24

Switch Reboot

Reboot switch

STP recalculates topology

25

Port Flap

Rapid link up/down

STP stabilizes topology

26

Add Redundant Link

Add backup link

STP blocks one path

27

Remove Redundant Link

Remove backup link

STP unblocks active path

28

Change STP Timers

Modify all timers

STP adapts timing behavior

29

Enable MSTP

Activate MSTP

Multiple instances created

30

Enable PVST+

Activate PVST+

VLAN-specific STP enabled

31

Enable RSTP

Activate RSTP

Fast convergence enabled

32

Disable STP

Turn off STP

No topology recalculation

33

Enable STP

Turn on STP

Topology recalculation begins

34

Add Edge Node

Connect edge device

STP adapts port role

35

Add Core Node

Connect core switch

STP recalculates root bridge

36

Add Wireless Bridge

Connect wireless link

STP recalculates path cost

37

Add Cloud Node

Connect cloud-based switch

STP adapts topology

38

Add VPN Tunnel

Connect via VPN

STP recalculates path cost

39

Add Firewall

Insert firewall in path

STP adapts to new topology

40

Add Load Balancer

Insert load balancer

STP recalculates path

41

Add Proxy Server

Insert proxy

STP adapts to new node

42

Add Monitoring Tool

Integrate monitoring

STP events logged

43

Add Automation Script

Automate config changes

STP adapts dynamically

44

Add ACL

Apply access control

STP adapts port behavior

45

Add QoS Policy

Apply QoS

STP unaffected

46

Add VLAN Pruning

Enable pruning

STP recalculates active paths

47

Add Loopback Interface

Create loopback

STP blocks loop path

48

Add High Latency Link

Connect slow link

STP prefers faster path

49

Add Low Bandwidth Link

Connect low-speed link

STP assigns higher cost

50

Add High-Speed Link

Connect 10G+ link

STP assigns lower cost

Standardized Protocol - Testcases

S.No

Test Case

Description

Expected Result

1

STP Protocol Compliance

Verify STP follows IEEE 802.1D

Protocol behavior matches standard

2

RSTP Protocol Compliance

Verify RSTP follows IEEE 802.1w

Protocol behavior matches standard

3

MSTP Protocol Compliance

Verify MSTP follows IEEE 802.1s

Protocol behavior matches standard

4

PVST+ Compatibility

Use PVST+ on Cisco devices

VLAN-specific STP instances created

5

Protocol Version Detection

Detect STP version on switch

Correct version identified

6

Protocol Negotiation

Connect different STP versions

Compatible protocol selected

7

BPDU Format Validation

Inspect BPDU structure

Matches IEEE standard format

8

BPDU Transmission Interval

Verify Hello Time interval

Matches configured timer

9

BPDU Reception Handling

Receive BPDU from peer

Correctly processed

10

BPDU Filtering

Enable BPDU Filter

BPDUs blocked on configured ports

11

BPDU Guard

Enable BPDU Guard

Unauthorized BPDUs cause port shutdown

12

Root Bridge Election

Verify election logic

Follows standardized rules

13

Port Role Assignment

Verify role logic

Matches STP specification

14

Path Cost Calculation

Verify cost logic

Matches IEEE cost table

15

Timer Configuration

Validate Hello, Max Age, Forward Delay

Matches protocol limits

16

Protocol Interoperability

Connect Cisco and HP switches

STP operates correctly

17

Protocol on VLANs

Use STP per VLAN

VLAN-specific instances created

18

Protocol on Trunk Ports

Use trunk ports

STP operates across VLANs

19

Protocol on Access Ports

Use access ports

STP operates normally

20

Protocol on Edge Ports

Enable PortFast

STP bypasses states

21

Protocol with Loop Prevention

Create loop

STP blocks redundant path

22

Protocol with Redundant Links

Add backup link

STP blocks one path

23

Protocol with Link Aggregation

Use LAG

STP treats as single logical link

24

Protocol with Wireless Links

Use wireless bridge

STP operates normally

25

Protocol with Cloud Nodes

Connect cloud switch

STP operates normally

26

Protocol with VPN Tunnel

Use VPN link

STP operates across tunnel

27

Protocol with Firewall

Insert firewall

STP operates normally

28

Protocol with Load Balancer

Insert load balancer

STP adapts to topology

29

Protocol with Proxy Server

Insert proxy

STP operates normally

30

Protocol with Monitoring Tool

Integrate monitoring

STP events visible

31

Protocol with Automation Script

Automate config

STP adapts dynamically

32

Protocol with ACL

Apply ACL

STP operates normally

33

Protocol with QoS

Enable QoS

STP unaffected

34

Protocol with VLAN Pruning

Enable pruning

STP recalculates active paths

35

Protocol with Loopback Interface

Create loopback

STP blocks loop path

36

Protocol with High Latency Link

Connect slow link

STP prefers faster path

37

Protocol with Low Bandwidth Link

Connect low-speed link

STP assigns higher cost

38

Protocol with High-Speed Link

Connect 10G+ link

STP assigns lower cost

39

Protocol with MAC Spoofing

Spoof MAC address

STP detects anomaly

40

Protocol with Firmware Upgrade

Upgrade switch

STP resumes with updated config

41

Protocol with Reboot

Reboot switch

STP recalculates topology

42

Protocol with Port Flap

Rapid link up/down

STP stabilizes topology

43

Protocol with Topology Change

Change topology

STP recalculates paths

44

Protocol with Root Bridge Change

Change root bridge

STP re-elects root

45

Protocol with Designated Port Change

Change designated port

STP updates roles

46

Protocol with Alternate Path

Add alternate path

STP selects lowest cost

47

Protocol with Backup Path

Add backup path

STP blocks backup

48

Protocol with Edge Node

Connect edge device

STP adapts port role

49

Protocol with Simulation

Simulate STP topology

Behavior matches standard

50

Protocol with Compliance Audit

Run audit tool

STP passes compliance checks

Layer 2 Operation - Testcases

S.No

Test Case

Description

Expected Result

1

MAC Address Learning

Connect host to switch

MAC address learned on correct port

2

MAC Address Aging

Wait for aging time

MAC entry is removed

3

Frame Forwarding

Send frame between hosts

Frame is forwarded correctly

4

Broadcast Frame Handling

Send broadcast

Frame is flooded to all ports except source

5

Unknown Unicast Handling

Send unknown unicast

Frame is flooded

6

Loop Prevention

Create physical loop

STP blocks redundant path

7

Root Bridge Election

Power on switches

Root bridge elected

8

Port Role Assignment

Observe port roles

Correct roles assigned (Root, Designated, Blocked)

9

BPDU Transmission

Monitor BPDUs

BPDUs sent from root bridge

10

BPDU Reception

Receive BPDUs

Switch processes BPDUs

11

Topology Change Notification

Disconnect link

TCN BPDU generated

12

MAC Table Update on TCN

Trigger topology change

MAC table flushed

13

VLAN Segmentation

Use VLANs

Layer 2 separation maintained

14

Trunk Port Operation

Use trunk port

Frames tagged and forwarded correctly

15

Access Port Operation

Use access port

Frames untagged and forwarded

16

PortFast Behavior

Enable PortFast

Port skips STP states

17

BPDU Guard Behavior

Enable BPDU Guard

Port shuts down on BPDU receipt

18

Root Guard Behavior

Enable Root Guard

Prevents unauthorized root bridge

19

Loop Guard Behavior

Enable Loop Guard

Prevents alternate port from becoming designated

20

STP Convergence Time

Measure convergence

Within expected time

21

MAC Table Consistency

Check MAC table

Entries match active topology

22

MAC Flooding Protection

Send excessive MACs

Switch handles or limits entries

23

STP Mode Change

Switch to RSTP

Layer 2 operation continues

24

MSTP Instance Operation

Use MSTP

Layer 2 separation per instance

25

PVST+ Operation

Use PVST+

VLAN-specific Layer 2 paths

26

MAC Address Filtering

Apply filter

Blocked MACs not learned

27

Port Mirroring

Enable mirroring

Traffic copied to mirror port

28

STP with Link Aggregation

Use LAG

STP treats as single logical link

29

STP with Wireless Bridge

Use wireless link

Layer 2 operation continues

30

STP with VPN Tunnel

Use Layer 2 VPN

STP operates across tunnel

31

STP with Cloud Switch

Connect cloud-managed switch

Layer 2 operation continues

32

STP with Edge Device

Connect IoT device

MAC learned and forwarded

33

STP with Loopback Interface

Create loopback

STP blocks loop

34

STP with VLAN Pruning

Enable pruning

Frames not forwarded to pruned VLANs

35

STP with ACL

Apply Layer 2 ACL

Frames filtered as configured

36

STP with QoS

Enable QoS

Frames prioritized correctly

37

STP with Storm Control

Enable storm control

Broadcast/multicast limited

38

STP with Port Security

Enable port security

MAC violations handled

39

STP with MAC Spoofing

Spoof MAC

STP detects or logs anomaly

40

STP with Firmware Upgrade

Upgrade switch

Layer 2 operation resumes

41

STP with Reboot

Reboot switch

Layer 2 operation restored

42

STP with Port Flap

Flap port

STP recalculates topology

43

STP with High Latency Link

Add slow link

STP assigns higher path cost

44

STP with High-Speed Link

Add 10G+ link

STP assigns lower path cost

45

STP with Monitoring Tool

Monitor Layer 2 traffic

Accurate visibility

46

STP with Automation Script

Automate config

Layer 2 behavior adapts

47

STP with Compliance Audit

Run audit

Layer 2 operation passes checks

48

STP with Simulation

Simulate Layer 2 topology

STP behaves as expected

49

STP with MAC Table Overflow

Exceed MAC table size

Switch handles overflow gracefully

50

STP with Multicast Traffic

Send multicast

Frames forwarded per Layer 2 rules

  • Reference links