Foundations Pro Subscription Required

Network Automation in Practice: Python for Network Engineers

Learn network automation by doing it on a company's real-looking network. Read device output into data, plan addresses with the ipaddress module, find configuration drift, generate configurations from facts, clean an inventory, find a flapping port in a log, audit configurations against a baseline, plan changes that can be undone, and build the nightly report. Real Python runs in your browser, on files generated for you alone.

5-6 hours of study Builds toward: Network Automation Engineer 9 modules

Practise on your own computer

The labs in the lessons run in your browser. To repeat them, go further and try the capstone on your own machine, set up the environment with these free guides:

Most network work is repetition: read the same table on forty devices, check the same ten lines on every router, make the same small change in the same careful order. People are bad at repetition and computers are good at it. The skill is not typing commands into a library; it is knowing what to ask of the data, and how to make the result safe to trust.

This is the fourth season of Sabi Logistics’ story, told from the network room. Tunde, Musa, Dayo, Halima and Chidi need answers from their routers and switches. Every case hands you a network generated for you alone (an interface table, an address plan, two configurations, an inventory, a syslog, a set of device configurations), a starter script, and checks that read what your Python leaves behind. Functions you write are also run on hidden data, so a solution that only fits the sample fails.

You need no extra libraries. Everything uses the Python standard library (re, json, csv, ipaddress), which is also what you will have on any server you log in to. The Python runs in your browser (about 10 MB the first time).

What you need first

The case files use Python (it runs in your browser, nothing to install). You should be comfortable with variables, lists, dictionaries, loops and functions. If you are not yet, read the Python primer for the case files first (it takes about an hour), or take the free course Python for Case Files, which teaches the same ideas with nine small hands-on jobs.

Every lab starts with a how to do this lab panel: the steps, what each answer must look like (its shape, never its value), and the first lines of your own files. A wrong answer comes with a hint, and when every answer is right you can see one good way to write it. These labs teach the rules and edge cases behind the real tools, and how to automate an audit with a script. Each lesson ends with a box of the real commands that you would type on a real system.

What you will learn

  1. Turn device text into data: split a table, handle a two-word status, tell a port shut down on purpose from a real fault.
  2. Plan addresses with the right tool: network objects, overlaps, usable hosts, longest prefix match, the first free block.
  3. Find configuration drift: missing, extra and changed settings, and the commands that fix them without removing a setting that only needs a new value.
  4. Generate configurations from facts: a function from site data to text, optional sections, sorted lists, tested on sites it has not seen.
  5. Trust an inventory only after measuring it: duplicates, missing values, invalid and clashing addresses.
  6. Read a log: regular expressions with groups, severity, a flapping port, the first event.
  7. Audit against a baseline: rules as code, comments ignored, whole words matched, the empty case.
  8. Plan a change that can be undone: protected settings, idempotency, a rollback in reverse order.
  9. Report honestly: one pass, many counters, a clear “nothing is wrong”, and a report that proves it ran.

How it works

Each case is a call from someone at Sabi Logistics, a short brief, a lab with a starter script, a twist and a debrief that says what a senior engineer would do next. Write the Python, run it, press Check my answers, and fix what the checker tells you. When every check passes you get a case reference to submit, and a short write-up to practise explaining the work to the person who asked for it.

The capstone asks you to automate one real task of your own, with tests, a rollback and a report.