Notes from the network
Engineering lessons, automation, and lab builds.
A searchable knowledge base of networking, automation and infrastructure articles — design notes, troubleshooting write-ups and reproducible labs, written down so they’re easy to find the next time they matter.
Featured posts
View all →
Browse by category
Recent posts
Built for engineers
Articles include copy-pasteable, syntax-highlighted snippets — labelled by filename so you always know where the code belongs.
collect_bgp_state.py
# Pull BGP neighbor state from a device and flag anything not Established
from netmiko import ConnectHandler
def bgp_summary(host, creds):
conn = ConnectHandler(host=host, **creds)
rows = conn.send_command("show bgp summary", use_textfsm=True)
down = [r for r in rows if r["state"] != "Established"]
return {"host": host, "total": len(rows), "down": down}