OcNOS-DC : NetConf User Guide : With-defaults Capability
With-defaults Capability
OcNOS supports the with-defaults capability which is identified by the following capability string:
<nc:capability>urn:ietf:params:netconf:capability:with-defaults:1.0?basic-mode=explicit&amp;also-supported=trim,report-all,report-all-tagged</nc:capability>
The basic mode supported by OcNOS is “explicit” mode, but you can request any other mode during a get or get-config request by adding the with-defaults tag as described in RFC 6243.
Explicit Mode
This is the default mode when a with-defaults tag is not specified. When data is retrieved using this mode, data nodes containing default values are reported only when explicitly set by the client.
Trim Mode
To use this mode, the client must send the with-defaults tag with the value “trim”:
<get-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<source>
<running/>
</source>
<with-defaults xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults">trim</with-defaults>
</get-config>
 
In this mode, the server reports only the data nodes that are not set to its default values, even if explicitly set.
Report-All Mode
To use this mode, the client must send the with-defaults tag with the value “report-all”:
<get-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<source>
<running/>
</source>
<with-defaults xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults">report-all</with-defaults>
</get-config>
 
In this mode, the server does not consider any data to be default, so all data nodes are reported.
Report-All-Tagged Mode
To use this mode, the client must send the with-defaults tag with the value “report-all-tagged”:
<get-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<source>
<running/>
</source>
<with-defaults xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults">report-all-tagged</with-defaults>
</get-config>
 
This mode is similar to “report-all” mode, but the leaves that are considered the default are tagged with the ‘default’ attribute:
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:wd="urn:ietf:params:xml:ns:netconf:default:1.0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:a2be19b7-e61a-405b-b844-59f99702316d" last-modified="2021-08-13T08:56:01Z">
<data>
<interfaces xmlns="http://www.ipinfusion.com/yang/ocnos/ipi-interface">
<interface>
<name>eth1</name>
<config>
<name>eth1</name>
<enabled wd:default="true">true</enabled>
<switchport-status wd:default="true">false</switchport-status>
</config>
</interface>
</interfaces>
</data>
</rpc-reply>
Edit-config Behavior
The edit-config command behaves according to the basic mode supported by OcNOS which is the ‘”explicit” mode. All nodes explicitly set are considered as existing so, a “create” operation on this node will fail with a “data-exists” error, otherwise, the operation succeeds. Likewise, a “delete” operation on an explicitly set node will succeed, while on a node which has its default value it receives a “data-missing” error.
As “report-all-tagged” mode is supported, the “default” attribute can also be used to set the attribute back to its default value. When this attribute is used in edit-config, the value of the attribute must be equal to its default value otherwise an “Invalid Value” error will be returned.