Request the Complete Configuration Using the Junos XML Protocol
In a Junos XML protocol session with a device running
Junos OS, to request the entire candidate configuration or the complete
configuration in an open instance of the ephemeral configuration database,
a client application encloses the <get-configuration/>
tag in an <rpc>
tag element:
<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 Specifying the Source for Configuration
Information Requests in a Junos XML Protocol Session.
<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, its opening <junoscript>
tag,
or both. For more information, see Specifying
the Source for Configuration Information Requests in a Junos XML Protocol
Session and Specifying the
Output Format for Configuration Data in a Junos XML Protocol Session.
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.