What You Are Building
This post walks through a complete Python script that reads a YAML file of desired interface configurations and applies each one to a Cisco router via RESTCONF. The script gets the before state, applies changes, then verifies the after state. It's idempotent: run it twice and nothing breaks.
This is the pattern behind most real network automation: define desired state in a human-readable file, apply it programmatically, verify the result. No SSH, no screen-scraping, no manual verification.
The YAML Config File
The source of truth is a YAML file (interfaces.yaml) that defines the desired state for each interface: