Use this when changing configuration via edit-config.
edit-config
edit-config changes a datastore with an XML payload, using operations like merge, replace, create, delete and remove on specific nodes of the YANG data tree.
1. edit-config changes configuration.
2. Operations: merge (default), replace, create, delete, remove.
3. error-option rollback-on-error when supported.
4. Validate payloads against YANG.
5. Prefer candidate datastore.
payload + operation → datastore
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 target datastore, default-operation/test-option/error-option capability, edit operation attributes and verifying exact affected subtree.
Step 2 Common mistakes Narrow the fault
- Using
replaceat a high level and deleting siblings. - Not reading back after the edit.
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.
- Operations: merge, replace, create, delete.
- Payload must follow YANG.
- Target datastore matters.
- <edit-config> with operation=merge/replace/create/delete — semantics
- default-operation setting — behaviour
- test-option/error-option — validation and rollback
ReferenceWhy it matters1 section · depth on demand
What it is
<edit-config> changes a datastore with operations merge (default), replace, create, delete and remove.
ReferenceImportant terms & boundaries1 section · depth on demand
In depth
<edit-config> changes configuration in a target datastore. The operation attribute on elements controls how the change is applied, which is the key to writing safe NETCONF changes.
| Operation | Effect |
|---|---|
| merge (default) | Combine with existing configuration |
| replace | Replace the element and its children |
| create | Create; error if it exists |
| delete | Delete; error if it does not exist |
| remove | Delete if present; no error if absent |
<edit-config>
<target><candidate/></target>
<config>
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>GigabitEthernet2</name>
<description>Uplink to core</description>
</interface>
</interfaces>
</config>
</edit-config>
A misplaced replace high in the tree can wipe large parts of the configuration; scope it to the exact element.
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 > edit-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 target datastore, default-operation/test-option/error-option capability, edit operation attributes and verifying exact affected subtree, prefer typed fields and stable IDs over human presentation text.