Use this when retrieving config and state with get.
get · NETCONF
get retrieves both configuration and operational state data, such as interface counters, optionally limited by a subtree or XPath filter.
1. get retrieves config and state data.
2. Always filter (large otherwise).
3. Subtree or XPath filters.
4. Namespaces in parsing.
5. Use for verification.
<get filter> → data (config + state)
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Effective-state and workload closure Verify boundary
Use stable request/job/target identifiers, independently read the target and effective state, then run the original workload and preserve rollback evidence. For asynchronous work, require terminal state plus target read-back.
Step 2 Verification path Verify boundary
Record device, session/RPC message-id, datastore, YANG module/revision and target path; inspect the runtime/control-plane result; then query the selected configuration or operational subtree on the network device through an independent read path and compare it with the versioned intent. The negative fixture should deliberately exercise risks such as capability mismatch, namespace drift, wrong datastore, lock contention, partial edit semantics and assuming <ok/> shows final device behavior, choosing the cases most relevant to combined configuration/operational data retrieval, subtree/XPath filters when supported and interpreting returned datastore state without mutating it. Capture the exact run/request/message/task identity, versioned definition, selected target IDs and pre-state before mutation. If the operation is asynchronous, follow it to a terminal state and then query the owned target through a read path that does not depend on the write response.
Step 3 Common mistakes Narrow the fault
- Using
<get>without filters on large devices.
Step 4 Where it fails Narrow the fault
A failure at one layer must not be relabeled as another: authentication/authorization differs from target absence, parsing differs from policy/validation rejection, scheduling differs from execution, and controller success differs from consumer-visible convergence. Before retrying a mutating operation, read current target state using the stable identity device, session/RPC message-id, datastore, YANG module/revision and target path; if state is unknown, stop broad retries.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- get returns config and operational state.
- Filters limit the output.
- Use subtree or XPath filters.
- <get> with subtree/XPath filter — state + config
- Filters to limit data — efficiency
- Parse reply with namespaces — extraction
ReferenceWhy it matters1 section · depth on demand
Internals and state
Automation should be interpreted as a chain of independently observable states: request accepted, job/task succeeded, target object changed, effective runtime state confirmed and original workload verified. Automation evidence ladder: request accepted → job/task succeeded → target object changed → effective runtime state → original workload verified. Capture the identities that bind the path together—interface, namespace, process, VM, policy, session, target, device, route, principal or job as applicable—so observations from different layers refer to the same transaction.
ReferenceImportant terms & boundaries2 sections · depth on demand
Mechanics
Its durable intent is capability-aware XML RPC intent against explicit running/candidate/startup datastores; the stable identity contract is device, session/RPC message-id, datastore, YANG module/revision and target path. The consumer-visible target is the selected configuration or operational subtree on the network device. Do not collapse parser/API acceptance, controller completion and target-evidence of the actual state into one green status. This matters because automation can return success while a later reconciler, worker, transport, target subsystem or consumer still fails.
In depth
The NETCONF <get> operation retrieves both configuration and operational state from the device (the running view plus state data), optionally limited with a subtree or XPath filter. <get-config> returns configuration only.
flt = """<interfaces-state xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"><interface><name>GigabitEthernet1</name></interface></interfaces-state>"""
reply = m.get(filter=("subtree", flt))
print(reply.data_xml)
| Operation | Returns |
|---|---|
<get> | Config + state |
<get-config> | Config from chosen datastore |
<get-data> (NMDA, RFC 8526) | Any datastore incl. operational |
Always filter: an unfiltered <get> on a large device returns megabytes and can take a long time.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in NETCONF > get. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://www.rfc-editor.org/rfc/rfc6241 · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
Capture at minimum device, session, message-id, datastore, module/revision, target path, rpc-error/error-tag/error-path, commit result and read-back values. For collections or parallel work, retain per-item/per-target results so partial success remains visible. For combined configuration/operational data retrieval, subtree/XPath filters when supported and interpreting returned datastore state without mutating it, prefer typed fields and stable IDs over human presentation text.