CLI Automation
Cheat sheet · https://pcornel.dk/topic.php?topic=5590
Answer
CLI Automation drives device command-line interfaces programmatically while handling prompts, privilege modes, command ordering, parsing and platform-specific output.
Remember
- Prompt returned ≠ command succeeded.
- No obvious error string ≠ device accepted the intended semantics.
- Parsed field exists ≠ parser matched the correct platform/version output.
- Configuration mode exit ≠ configuration saved or effective.
First checks
ansible <dev> -m cisco.ios.ios_command -a "commands='show ip int brief'"— run command- Parsers (TextFSM/Genie/ttp) — structured output
- Config mode via *_config modules with diff — changes
Verify in this order
commands → CLI → text → parser → structured data
Where it usually breaks
CLI automation proves commands were sent and responses observed; it does not by itself prove the parser was correct or the network outcome converged.
Input/desired state → request accepted → job/task terminal status → target object read-back → effective runtime state → original workload → regression/rollback readiness.
CLI Automation Network Automation proof-boundary map
| Boundary | Healthy evidence | Suspicious evidence |
|---|---|---|
| Intent / scope | Source revision and exact targets are explicit | Stale inventory, hidden selector or wrong variables change scope |
| Management operation | Transport/model/payload and per-device response are traceable | Auth/capability/parser differences hide partial or wrong execution |
| Device state | Effective and persistent state are read back | Accepted config/API result is mistaken for convergence |
| Network proof | Original control/data-plane or service test passes | Automation summary substitutes for actual network acceptance |
Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=5590