Learning paths › Automation › Addresses, functions, modules and classes
Addresses, functions, modules and classes
Moving from scripts to structure: one connection function called for any device, arguments passed by position or keyword, your own module imported without running itself, and a device modelled as a class whose connect and parsing methods reuse the same collector — then the reference behaviour underneath, rebinding told apart from mutation and the shared-reference trap met twice, and finally concurrency: a thread started per device, work submitted to a pool, and an existing command function threaded as it stands. Explanation and checks; eight written exercises.
Lessons
- Filter parsed interfaces by their address
- Call one connection function for any device
- Pass arguments by position or keyword
- Generate commands from a list of user records
- Import your own module into a script
- Stop imported code from running itself
- Model a Cisco device as a class
- Give the device object a connect method
- Add parsing methods that reuse the collector
- See how names refer to objects
- Index and slice a list of devices
- Reach into nested lists and dictionaries
- Tell rebinding apart from mutation
- Store a device record under a key
- Drop duplicate device names
- Group values that must not change
- See the same reference trap with lists
- Iterate over devices, lines and keys
- Repeat until state says stop
- Chain conditions so only one branch runs
- Start a thread per device
- Submit work to a thread pool
- Thread an existing Cisco command function
- Let the executor schedule the same worker
More in Automation
- First scripts that configure devices
- NAPALM: structured data across vendors
- Concurrency, and the Python types device output returns
- Parsing show output and testing conditions
- Readable code, branching and loops
- Build the workstation and the toolchain
- Files, CSV, JSON and pickle
- Paramiko: SSH to devices from Python
- Netmiko at fleet scale
- Tuples, sets and dictionaries for device records
- Exceptions and your first classes
- Plan and build the automation lab
- Files, formatting and regular expressions
- CSV inventories, logging and scheduling
- Netmiko, SCP and structured parsing
- Agents, async and model-driven workflows
- NETCONF, YANG and RESTCONF
- NX-API, pyATS and Genie
- A small GenAI app, end to end
- macOS, Linux and the virtual lab
- Agile delivery and Python fundamentals
- REST APIs, authentication and requests
- Flask, Docker and Jenkins
- Managing a router with NETCONF and RESTCONF
- Ansible: inventory, ad-hoc commands and first playbooks
- Roles and zero-touch provisioning for Linux switches
- Installing the controller and applying a project
- Setting up Python 3
- The Ansible lab and the controller
- Vault, variables and config changes
- Parsing output and knowing which variable wins
- Jinja filters and PAN-OS automation
- Loops, callbacks, strategy and run control
- Roles, imports and writing your own module
- Running playbooks from AWX