Request Configuration Data Using NETCONF
In a NETCONF session with a device running Junos OS, to request
configuration data for a routing, switching, or security platform,
a client application encloses the <get-config>
, <source>
, and <filter>
tag elements in an <rpc>
tag element.
By including the appropriate child tag element in the <source>
tag element, the client application requests
information from the active configuration or from the candidate configuration
or open configuration database. By including the appropriate child
tag elements in the <filter>
tag element,
the application can request the entire configuration or specific portions
of the configuration.
<rpc> <get-config> <source> <!-- tag specifying the source configuration --> <( candidate | running )/> </source> <filter type="subtree"> <!-- tag elements representing the configuration elements to return --> </filter> </get-config> </rpc> ]]>]]>
The type="subtree"
attribute in the
opening <filter>
tag indicates that
the client application is using Junos XML tag elements to represent
the configuration elements about which it is requesting information.
If a client application issues the Junos XML protocol <open-configuration>
operation to open a specific
configuration database before executing the <get-config>
operation, setting the source to <candidate/>
retrieves the configuration data from the open configuration database.
Otherwise, the server returns the configuration data from the candidate
configuration.
If the client application locks the candidate configuration before making requests, it needs to unlock it after making its read requests. Other users and applications cannot change the configuration while it remains locked.
The NETCONF server encloses its reply in <rpc-reply>
, <data>
, and <configuration>
tag elements. It 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 information about the attributes of the <configuration>
tag, see Specify the Source for Configuration Information Requests Using NETCONF.
<rpc-reply xmlns="URN" xmlns:junos="URL"> <data> <configuration attributes> <!-- JUNOS XML tag elements representing configuration elements --> </configuration> </data> </rpc-reply> ]]>]]>
If a Junos XML tag element is returned within an <undocumented>
tag element, the corresponding configuration
element is not documented in the Junos OS configuration guides or
officially supported by Juniper Networks. Most often, the enclosed
element is used for debugging only by support personnel. In a smaller
number of cases, the element is no longer supported or has been moved
to another area of the configuration hierarchy, but appears in the
current location for backward compatibility.
When displaying operational or configuration data that contains characters outside the 7-bit ASCII character set, Junos OS escapes and encodes these character using the equivalent UTF-8 decimal character reference. For more information see How Character Encoding Works on Juniper Networks Devices.
Client applications can also request other configuration-related information, including an XML schema representation of the configuration hierarchy or information about previously committed configurations.