All scripts
fault
Expert
1–3 min
STP Loop Detector
Spanning-tree topology change forensics: TCN flood detection, root bridge verification, blocked port audit, BPDU guard/filter violations, PVST+ inconsistency across VLANs, and loop-risk scoring.
Cisco IOS/NX-OS
Arista
HP/Aruba
You're viewing a preview
The full script, parameters, and execution console are available with a free account.
Already have access? Sign in →
Capabilities
- TCN rate & source tracking
- Root bridge per-VLAN verify
- Blocked port inventory
- BPDU guard violation log
- PVST+ VLAN inconsistency
- Port-fast on trunk detection
- Loop risk score 0–100
Required inputs
Parameters the script accepts. Defaults shown; some are vendor- or context-gated.
| Parameter | Type | Default | Notes |
|---|---|---|---|
Expected root bridge MAC expected_root | string | — | — |
TCN alert threshold /min tcn_threshold | number | 5 | — |
Check PVST consistency check_pvst | bool | true | — |
VLAN range to check vlan_range | string | 1-4094 | — |
Sample inventory schema
Authoritative shape of the device/policy data this script consumes.
switches.csv
csv
12 dist+access switches across two DCs (Cisco + Arista)terminal
hostname,mgmt_ip,site,role,vendor,os,stack_size,vlan_count,uplink_speed dist-sw-01,10.40.0.11,LON1-DC,distribution,cisco,iosxe-17.9,1,148,40G dist-sw-02,10.40.0.12,LON1-DC,distribution,cisco,iosxe-17.9,1,148,40G dist-sw-03,10.40.0.13,FRA1-DC,distribution,arista,eos-4.31.2F,1,124,40G
expected_roots.yaml
yaml
Per-VLAN-range root/secondary expectations + BPDU-guard policyyaml
# Per-VLAN expected root bridge (used for primary/secondary verification)
expected_roots:
- vlan_range: 10-99 # user VLANs
primary: dist-sw-01Expected output
Reference terminal output the script should produce — used as a stylistic and structural target.
terminal
[14:45:11] STP topology analysis — 12 switches, 47 VLANs ROOT BRIDGE VERIFICATION VLAN 1: Expected 00:1A:2B:3C:4D:5E | Actual 00:1A:2B:3C:4D:5E ✓ VLAN 100: Expected 00:1A:2B:3C:4D:5E | Actual AA:BB:CC:DD:EE:FF ✗ MISMATCH! VLAN 200: Expected 00:1A:2B:3C:4D:5E | Actual 00:1A:2B:3C:4D:5E ✓ [CRITICAL] VLAN 100 root bridge mismatch! Expected: core-sw-01 (00:1A:2B:3C:4D:5E) Actual: access-sw-07 (AA:BB:CC:DD:EE:FF) — rogue root detected