Advanced
Nornir for Network Engineers
Python-native, inventory-driven automation — the framework version of the inventory, task execution, and concurrency built by hand in Advanced Python Automation, plus filtering and a nornir_netmiko integration.
Nornir is a real, widely-used Python framework for network automation -- positioned here directly against Ansible's YAML playbooks on one side, and the framework you built by hand in Advanced Python Automation on the other. You'll translate a device fleet into Nornir's own hosts/groups/defaults YAML inventory, bootstrap Nornir with InitNornir() and write your first task function, and filter a subset of hosts with F() and nr.filter(). The module also covers Nornir's built-in concurrency, composing one task from another, and nornir_netmiko as a way to run real Netmiko commands through a Nornir task instead of a bare script. If you've been writing your own inventory and task-running logic by hand, this is the framework version of it.
Next up
Why Nornir? Python-Native Automation, Not YAML Playbooks
0 / 7 completeLessons
- 1
Why Nornir? Python-Native Automation, Not YAML Playbooks
Nornir positioned directly against Ansible's YAML playbooks and against Phase 3.3's hand-built package — a real, popular framework providing inventory, task execution, structured results, and concurrency, still 100% Python.
Advanced11 min readNext up - 2
Nornir's Inventory: hosts.yaml, groups.yaml, defaults.yaml
Translating the SW1-SW5 fleet into Nornir's real three-file YAML inventory schema — verified directly, including how site groupings and credentials each belong in a different place.
Advanced12 min read - 3
InitNornir() and Your First Task Function
Bootstrapping Nornir from the inventory built in Lesson 2, writing a real task function, and inspecting the AggregatedResult it returns — the framework's version of the AutomationResult dataclass built by hand in Phase 3.3.
Advanced13 min read - 4
Filtering the Inventory: F() and nr.filter()
Selecting a subset of hosts by custom data, exact name, or a flexible F() query — verified directly against the SW1-SW5 fleet's HQ/Branch1 site grouping, the one genuinely new capability this module introduces.
Advanced11 min read - 5
nornir_netmiko: Wrapping Netmiko as a Task Plugin
netmiko_send_command and netmiko_send_config, verified with their real signatures and real failure behavior — the same NetmikoTimeoutException already known from Phase 2.7, now surfaced through a Nornir task instead of a bare try/except.
Advanced13 min read - 6
Built-In Concurrency and Composing Custom Tasks
Nornir's default threaded runner, measured directly against the same 5-device fleet -- 1.50s serial vs 0.30s concurrent, a real 4.97x speedup -- plus how to compose one task from another, including a genuine, non-obvious discovery about how sub-task failures actually surface.
Advanced14 min read - 7
Capstone: A Nornir-Based Network Health Check
Every piece of this module -- inventory, InitNornir(), filtering, task functions, nornir_netmiko as Option A, concurrency, and result collection -- combined into one real, runnable VLAN compliance check against the SW1-SW5 fleet, with an exact, verified report.json.
Advanced18 min read
Practice this module
Apply what you just covered -- hands-on practice and a knowledge check for this module.