Use this when retrieving configuration only.
get-config
get-config retrieves configuration only, from a chosen datastore such as running or candidate, optionally filtered to part of the YANG tree.
1. get-config returns configuration from a datastore.
2. Filter by subtree.
3. with-defaults affects output.
4. Structured backups.
5. Compare with intent.
<get-config> → config data
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 Verification path Verify boundary
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 configuration-only datastore read, source datastore/filter identity and comparing candidate/running/startup without conflating operational state.
Step 2 Common mistakes Narrow the fault
- Reading the whole config without a filter.
- Confusing
<get>(config + state) with<get-config>.
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-config returns configuration only.
- Choose the source datastore.
- Filter to the part you need.
- <get-config source=running filter> — config only
- with-defaults handling — defaults shown
- Save as backup — structured backup
ReferenceWhy it matters1 section · depth on demand
What it is
<get-config> reads configuration from a datastore (running, candidate, startup), optionally filtered by subtree or XPath.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
<get-config> retrieves configuration from a datastore, optionally filtered so only part of it is returned. Filters keep responses small and fast on large devices.
<get-config>
<source><running/></source>
<filter type="subtree">
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface><name>GigabitEthernet1</name></interface>
</interfaces>
</filter>
</get-config>
<get-config> returns configuration only. <get> (or <get-data> on NMDA devices) also returns operational state such as counters and oper-status. Subtree filters are universally supported; XPath filters (:xpath capability) are more expressive where available.
Example
from ncclient import manager
with manager.connect(host=h, port=830, username=u, password=p, hostkey_verify=True) as m:
print(m.get_config(source="running", filter=("subtree", '<native xmlns="http://cisco.com/ns/yang/Cisco-IOS-XE-native"><hostname/></native>')))
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-config. 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
For configuration-only datastore read, source datastore/filter identity and comparing candidate/running/startup without conflating operational state, prefer typed fields and stable IDs over human presentation text.