Pcornel
Browse topics
Options
Recent
Favorites
Automation · Technical reference

get-config

Direct answer

get-config retrieves configuration only, from a chosen datastore such as running or candidate, optionally filtered to part of the YANG tree.

When to use this

Use this when retrieving configuration only.

First 30 seconds

1. get-config returns configuration from a datastore.

2. Filter by subtree.

3. with-defaults affects output.

4. Structured backups.

5. Compare with intent.

Operational verification

<get-config> → config data

Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
NETCONF / YANG datastore automation
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

PlatformNETCONF / YANG datastore automation · Automation implementations are tool and platform specific. Use the adjacent Domain for the technology being automated and this Domain for automation behavior.
Scope / prerequisiteUse this when retrieving configuration only.
What next?3 suggested next steps
Evidence1
On this pageJump to a specific section
Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

2 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

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 references

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.

observation · 1
Key points
  • get-config returns configuration only.
  • Choose the source datastore.
  • Filter to the part you need.
Key checks
  • <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>')))
Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor docNETCONF / YANG datastore automation current

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%
Depth when you need it

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.

Confirmation

Confirm action

Continue?