YANG augment Statement: Extending Existing Modules with New Nodes

300-435 By islever Editorial Last updated

Short answer

A The YANG augment statement adds new schema nodes, such as a container or leaf, beneath a target path in an existing module without modifying the original definition.

Question

What is the YANG 'augment' statement?
  1. Adds nodes to an existing YANG module Correct Answer
  2. Removes nodes
  3. Replaces nodes
  4. Deletes module

Key Takeaways

YANG's augment statement extends an existing module by inserting new schema nodes at a target path, leaving the original module definition untouched. That makes the add-nodes description the correct one, while removal, replacement, and module deletion belong to deviation or lifecycle operations. In 300-435 scenarios, identify augment by its target path and added child nodes rather than treating it as an edit to existing definitions.

Expert Analysis

Because augment inserts new schema nodes into an existing module's tree at a declared target path while leaving every original definition intact, the statement is the YANG mechanism for adding nodes to an existing module (A).

Augment extends a YANG tree by inserting nodes at a target path

In YANG, a module can declare augment /interfaces/interface {... } (with prefixes when crossing module boundaries) and place new containers, lists, leaves, or other schema nodes beneath the target. The original module file is not rewritten; the augmenting module contributes the extra nodes when the combined schema is compiled. This is how a standards module such as ietf-interfaces can be extended by ietf-ip with IP-specific configuration without forking the base model. The key condition is that the statement creates schema children that did not previously exist at that location. It does not mutate an existing leaf's type, remove a case from a choice, or retire a module. The added nodes inherit placement in the data tree, so a NETCONF or RESTCONF request can later address them at their augmented path once the device's YANG modules are loaded. If the augment includes a when condition, those nodes are present in the schema but their use is conditional; mandatory nodes under a false when are not enforced. This compile-time, additive behaviour is the decisive condition: adding nodes is the only operation augment performs.

Removal, replacement, and module deletion break the additive contract

Treating augment as a subtractive or destructive tool would make the combined schema inconsistent with the base module that other implementations import. B — augment has no remove operation; a module that needs to suppress an existing node uses a deviation with deviate not-supported, not an augment, and pretending otherwise would leave the supposedly removed node visible in the base schema. C — an augment cannot replace a node already defined at the target; it adds new child nodes, and a name collision at the same location is a schema error rather than an overwrite, so replacement semantics belong to deviation properties or to editing the original model, not to augment. D — deleting a module is a repository or deployment action that breaks every import and augment that references it; the augment statement itself has no module lifecycle effect and cannot erase the file or its namespace. Each alternative therefore converts an additive schema extension into an operation that changes or destroys existing definitions, which is exactly what the target-path insertion model avoids. The cost is not merely a wrong definition on paper: it would mislead anyone troubleshooting a device that imports a base model plus an augmenting module, because the expected node set would be wrong.

The boundary separates schema extension from schema deviation

The concept paired with augment in YANG practice is deviation, and the distinction is visible in the statements used. An augment names a target path and supplies new child nodes under it; those children appear in the schema tree with their own definitions and, when the augmenting module is external, their own namespace prefix. A deviation names an existing node and applies deviate not-supported to remove it from the implementation's usable schema, deviate replace to change a property such as a type or default, deviate delete to remove a property, or deviate add to add a property to that existing node. Thus the boundary is not add versus change in the abstract; it is new node creation at a target versus modification or suppression of a node already present. The wording removes nodes matches deviate not-supported, and replaces nodes is closest to deviate replace, but neither is the augment statement. Module deletion is outside both mechanisms. Using ietf-interfaces again, adding an IP address container under an interface is an augment; declaring that an existing interface leaf is unsupported on a particular platform is a deviation. Confusing the two leads to models that either fail to compile or silently omit capabilities the design intended to add.

Carry the target-path test into any YANG statement classification

If a stem or option describes a YANG construct that specifies a target path and contributes new child nodes — a container, leaf, list, or case — classify it as an augment; if it describes suppressing or altering a node that is already defined, classify it as a deviation. Apply that test before evaluating any alternative, because misleading descriptions often swap the verbs: add, remove, replace, delete. The evidence to look for is the phrase target path and the presence of a prefix-qualified path such as /if:interfaces/if:interface; that prefix tells you the augmenting module is reaching into another module's hierarchy. A useful validation step is to render the combined schema with pyang -f tree: augmented nodes appear beneath the target with the augmenting module's prefix, while deviations change or remove what the base tree shows. If the tree gains a branch that was not there before, the statement is augment. If an existing branch disappears or changes its type, the statement is deviation. This rule transfers to NETCONF and RESTCONF payload work as well: the path used in the payload follows the augmented schema location, not the original module's top-level structure. The mechanical test is schema growth at a target path, not the wording of the option.

Official Reference

https://www.rfc-editor.org/rfc/rfc7950.html#section-7.17

This link opens the official vendor documentation in a new tab.

Exam Strategy

When a YANG statement definition appears, reduce it to schema mechanics: augment inserts new child nodes at a target path, deviation alters or suppresses nodes that already exist, and deleting a module is a repository action. Look for words such as target path, added container or leaf, and a prefix from another namespace. If the stem describes changing something already defined, rule out augment; if it describes growing a hierarchy without touching the original module, choose the add-nodes description. Verify with a pyang tree if the stem includes one, because augmented branches appear under the target with the augmenting module prefix.

Practice All 300-435 Questions

Access 150 questions with complete answers and detailed explanations.

View Full 300-435 Practice Test →

← Back to 300-435 Study Guide