Automation: Data Formats, APIs, and Model-Driven Operations
Data formats and Python
JSON uses double-quoted keys and strings, with objects and arrays as its two containers. YAML is whitespace-sensitive, and XML uses tags with attributes. Python questions typically test lists versus tuples versus dictionaries, loops, functions, string methods, and exception handling. In the json module, loads parses a string into objects and dumps serializes objects back into a string; mixing those up is a classic distractor.
APIs
REST relies on stateless HTTP requests. GET reads, POST creates, PUT replaces, PATCH modifies, and DELETE removes. Status codes matter: 200 OK, 201 created, 204 no content, 400 bad request, 401 unauthenticated, 403 unauthorized, 404 not found, 500 server error. Cisco controllers typically require an authentication call that returns a token, which is then presented in a header for subsequent intent API calls, such as DNA Center or vManage workflows.
Model-driven programmability
YANG defines the data model. NETCONF carries XML RPC over SSH port 830 and supports get-config, edit-config, copy-config, lock, and commit. RESTCONF exposes the same models over HTTPS with JSON or XML. gRPC telemetry streams operational data.
Configuration management
Ansible is agentless, uses YAML playbooks, and pushes over SSH or NETCONF. Puppet uses agents and manifests, Chef uses cookbooks and recipes. Version control with Git underpins change review and CI/CD pipelines.
Traps
PUT replaces an object while PATCH partially updates it. Ansible is agentless; Puppet and Chef are not. JSON with single quotes is invalid. Idempotency means running a playbook twice yields the same end state, which is a design property, not a transport feature.
Worked example
To pull an address from a nested JSON payload, index the outer key, then the inner key, then the list position, and finally the value field. Validate each step rather than assuming depth, since a missing key raises a KeyError.