What's changed: Initial version
5.4Interpreting responses and models
Builds the ability to read RESTCONF/NETCONF responses (JSON/XML, <ok/>, rpc-reply), the underlying YANG data model (the container/list/leaf hierarchy), and the unified diff representing change (the @@ hunk, +/- lines), so you can judge "is this response success or failure," "what does this part of the model represent," and "what does this diff actually change."
In model-driven automation, what you exchange with a device is not human-oriented show output but a structured response (JSON/XML) and the model (YANG) that governs it. To judge whether automation "worked," you must read success/failure from the response shape, grasp what each part of the model represents, and read what a change diff actually changes. This section trains that reading skill as the interpretation of a given response, model, and diff, not memorization.
5.4.1Reading RESTCONF/NETCONF responses
- RESTCONF maps CRUD to HTTP methods over HTTP (GET = read / POST = create / PUT = replace / PATCH = partial update / DELETE = delete). Responses are an HTTP status plus a JSON/XML body:
200 OK/201 Createdare success,204 No Contentis success with no body,401is unauthenticated,404is a missing path (data), and409is a conflict. Read success/failure from both status and body. - NETCONF exchanges XML over SSH (usually port 830); success is
<ok/>inside<rpc-reply>and failure is<rpc-error>(cause in<error-tag>). It separates datastores as candidate (for editing) -> commit -> running (live), finalized by<commit>after<edit-config>. Judge success/failure by whether the reply is<ok/>or<rpc-error>. - Read JSON response keys with their namespace: e.g.,
"ietf-interfaces:interface": [{ "name": "GigabitEthernet2", "enabled": true }]reads as "in the interface list of the ietf-interfaces model, there is an enabled entry named GigabitEthernet2." Calmly map which model, which element, what value.
Continue reading — free sign-up
You're reading the free preview. Sign up free to read this section in full, plus every chapter (including 4+) and all questions.

