Python Guides

Practical Python for network engineers. Each guide is code-heavy, written for people who already automate with shell scripts and want to take the next step, and grounded in tools and libraries you would actually ship to production.

Python for Network Engineers Series

A five-part sequence from a single Netmiko script to a polished, pip-installable CLI tool — capture, parse, abstract, scale, ship. The Netmiko post is anchored on my own ciscocmd1 repo and walks through how to extend that pattern into something audit-grade. Each post layers on the previous; nothing requires throwing away what you already have.

  1. Netmiko in Practice: From a Show-Command Script to a Repeatable Audit Tool

    A working network engineer's guide to Netmiko — starting from a small repo of mine that runs show commands across a JSON inventory, and extending it into something you can use as a real audit tool with structured output, concurrency, secure credentials, and a sane dry-run for config changes.

  2. Parsing show Command Output: TextFSM, Genie, and TTP for Structured Data

    A practical comparison of the three main ways to turn Cisco show output into structured Python data — TextFSM with NTC Templates, Genie/pyATS, and TTP — with worked examples and rules of thumb for picking the right one.

  3. NAPALM vs Netmiko: Vendor-Agnostic Config vs Raw CLI, and When You Want Both

    A practical comparison of NAPALM and Netmiko for network automation — where Netmiko's raw CLI access is the right answer, where NAPALM's compare/replace/rollback abstraction earns its keep, and the hybrid pattern that most production tooling actually settles on.

  4. Nornir for Network Engineers: Running Automation Across an Inventory at Scale

    A practical introduction to Nornir for engineers whose Netmiko script has grown too big — inventory plugins, structured tasks, parallelism, filtering by site or role, and integrating Netmiko, NAPALM, and pyATS as connection plugins. The framework you reach for once one box has become a hundred.

  5. Building a Polished CLI Tool with Click and Rich: Packaging Network Automation for Other Humans

    Turn a working network-automation script into a tool your colleagues will use — moving from argparse to Click, formatted output with Rich, environment-loaded secrets, and pip-installable packaging.

Other Python Posts

  • Finding the Hop That's Eating Your Packets: pmtud-sweeper

    A per-hop Path-MTU sweeper that binary-searches the largest DF-set packet each hop will pass, then names the router that's clamping your tunnel. ICMP, UDP, TCP-SYN, end-to-end TCP MSS — pick the probe your network actually lets through.

  • Who Sent That RST? Forensic Classification of TCP Resets with rst-forensics

    A pure-Python classifier that takes a TCP RST and tells you whether the server, a mid-path firewall, or the client actually sent it. Six independent scorers — TTL, IP-ID, window, options, sequence, and timing — vote on the origin so the verdict is reproducible instead of tribal.

  • Diffing FortiGate configs the way an admin reads them — fgt-config-diff

    A small Python tool that parses FortiGate configs into a tree, aligns nodes by section path and edit key, and reports what was added, removed, or modified — in the language of policies and objects, not unified-diff line numbers. CLI plus a Flask web UI.

  • Generating a Constant Stream of Web Traffic with Python

    A small, polite Python script that round-robins through ten popular public sites at a configurable rate — useful for homelab traffic, exercising a proxy, or learning the requests library. Walks through the full code, the safety rails, and how to run it under tmux.

  • Adding Vendor Route-Table Parsers to route-compare, and Why the Work Lives on a Branch

    A follow-up on the route-compare tool: I taught it to read raw show ip route, get router info routing-table all, show route, and show routing route output directly — no Excel cleanup step. The work lives on a branch rather than on main, and this is why.

  • Comparing Route Tables Between Two Sources: A Small Python Tool for Audits and Migrations

    A self-contained Python utility that takes two Excel route lists, normalises every prefix through ipaddress, finds exact matches and overlaps, preserves invalid entries for audit, and writes a colour-coded Excel report plus CSVs. Includes install guide and full source.