Request the Complete Configuration Using the Junos XML Protocol
A Junos XML protocol client application can request the complete configuration from a
device running Junos OS or a device running Junos OS Evolved. To request the entire
candidate configuration or the complete configuration in an open instance of the
ephemeral configuration database, a client application emits the
<rpc> and <get-configuration/>
elements.
<rpc>
<get-configuration/>
</rpc>
If a client application issues the Junos XML protocol
<open-configuration> operation to open a specific
configuration database before executing the
<get-configuration> operation, the server returns the
configuration data from the open configuration database. Otherwise, the server
returns the configuration data from the candidate configuration, unless the active
configuration is explicitly requested by including the
database="committed" attribute.
When the application requests Junos XML-tagged output (the default), the Junos XML
protocol server returns the requested configuration in
<configuration> and <rpc-reply> tag
elements. For information about the attributes in the opening
<configuration> tag, see Specify the Database Source for Configuration Data to Return.
<rpc-reply xmlns:junos="URL">
<configuration attributes>
<!-- Junos XML tag elements for all configuration elements -->
</configuration>
</rpc-reply>To specify the source of the output (candidate or active configuration) and request
special formatting of the output (for example, formatted ASCII or JSON or an indicator
for identifiers), the application can include attributes in the
<get-configuration/> tag, the opening
<junoscript> tag, or both. For more information, see Specify the Database Source for Configuration Data to Return and Specify the Output Format for Configuration Data to Return.
The following example shows how to request the complete candidate configuration tagged
with Junos XML tag elements (the default). In actual output, the
JUNOS-version variable is replaced by a value such as
20.4R1 for the initial version of Junos OS Release 20.4.