Pcornel
Automation · Network Automation

CLI Automation

Cheat sheet · https://pcornel.dk/topic.php?topic=5590

Back to the Topic

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

BoundaryHealthy evidenceSuspicious evidence
Intent / scopeSource revision and exact targets are explicitStale inventory, hidden selector or wrong variables change scope
Management operationTransport/model/payload and per-device response are traceableAuth/capability/parser differences hide partial or wrong execution
Device stateEffective and persistent state are read backAccepted config/API result is mistaken for convergence
Network proofOriginal control/data-plane or service test passesAutomation 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

Confirmation

Confirm action

Continue?