Request the Committed Configuration Using NETCONF
Use the <get> operation to request the committed configuration on
devices running Junos OS and devices running Junos OS Evolved.
A NETCONF client can use the <get> operation to request the
committed configuration on a device running Junos OS or a device running Junos OS
Evolved. A client can request the complete committed configuration or specific
configuration hierarchies.
To request the most recently committed configuration, a client application encloses
the <get> tag in an <rpc> tag element.
If the request does not include a subtree filter, <get>
returns the committed configuration for all schemas. The optional
format attribute specifies the return format for the
configuration data.
<rpc>
<get [format="(json | json-minified | set | text | xml | xml-minified)"]/>
</rpc>
]]>]]>
<get/> operation returns only committed configuration
data. It does not return state data.To request specific hierarchies in the committed configuration, the client includes
the <filter type="subtree"> element and appropriate child tag
elements. The client includes Junos XML elements that represent all levels of the
configuration hierarchy from the root (<configuration> tag
element) down to each element to display.
<rpc>
<get [format="(json | json-minified | set | text | xml | xml-minified)"]>
<filter type="subtree">
<configuration>
<!-- Junos tag elements representing the configuration elements to return -->
</configuration>
</filter>
</get>
</rpc>
]]>]]>
The NETCONF server encloses its reply in the <rpc-reply> and
<data> tag elements. The <data>
element encloses the configuration data for all schemas. If the client requests
configuration data in XML format, text format, or set format, the server also
encloses the Junos OS data in a <configuration>,
<configuration-text>, or
<configuration-set> element, respectively. The server
includes attributes in the opening <configuration> tag that
indicate the XML namespace for the enclosed tag elements and when the configuration
was last changed or committed. For example:
<rpc-reply xmlns="URN" xmlns:junos="URL">
<data>
<configuration xmlns="URL" junos:changed-seconds="seconds" junos:changed-localtime="time">
<!-- configuration data -->
</configuration>
<database-status-information>
</database-status-information>
</data>
</rpc-reply>
]]>]]>
If there is no configuration data in the requested hierarchy, the RPC reply depends
on whether the rfc-compliant statement is configured at the
[edit system services netconf] hierarchy. If the
rfc-compliant statement is not configured, the server returns a
<data> element with an empty
<configuration> tag. If the
rfc-compliant statement is configured, the server returns a
<data> element but omits the
<configuration> tag.