Upload Configuration Data as a Data Stream Using the Junos XML Protocol
Junos XML protocol client applications can use the
<load-configuration> operation to load configuration data onto a
Junos device as a data stream.
A Junos XML protocol client application can load configuration data as a data stream onto a
device running Junos OS or a device running Junos OS Evolved. To load the
configuration as a data stream, a client application emits the
<rpc> element and the
<load-configuration> element with the appropriate child
tags. The configuration data format can be Junos XML elements, formatted ASCII text,
Junos OS configuration mode commands, or JavaScript Object Notation (JSON).
To load configuration data as Junos XML elements, the application emits the elements representing
all levels of the configuration hierarchy from the root (represented by the
<configuration> element) down to each element to
change.
<rpc>
<load-configuration>
<configuration>
<!-- elements representing the configuration data -->
</configuration>
</load-configuration>
</rpc>
To load configuration data as formatted ASCII text, the application includes the
format="text" attribute in the opening
<load-configuration> tag. The application encloses the
configuration statements in a <configuration-text>
element.
<rpc>
<load-configuration format="text">
<configuration-text>
/* formatted ASCII configuration data */
</configuration-text>
</load-configuration>
</rpc>
To load configuration data as Junos OS configuration mode commands, the application includes the
action="set" and format="text" attributes in
the opening <load-configuration> tag. The application
encloses the configuration mode commands in a
<configuration-set> element.
<rpc>
<load-configuration action="set" format="text">
<configuration-set>
/* configuration mode commands */
</configuration-set>
</load-configuration>
</rpc>
To load configuration data using JSON format, the application includes the
format="json" attribute in the opening
<load-configuration> tag. The application encloses the
JSON data in a <configuration-json> element.
<rpc>
<load-configuration format="json">
<configuration-json>
/* JSON configuration data */
</configuration-json>
</load-configuration>
</rpc>
For information about the syntax for Junos XML elements, formatted ASCII text, configuration mode commands, and JSON format, see Define the Format of Configuration Data to Upload in a Junos XML Protocol Session.