Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Replace Only Updated Elements in Configuration Data Using the Junos XML Protocol

date_range 14-Jul-21

In a Junos XML protocol session with a device running Junos OS, to replace configuration elements (hierarchy levels and configuration objects) only if they differ between the loaded configuration and the existing configuration, the application emits the <load-configuration> tag element with the action="update" attribute in an <rpc> tag element.

content_copy zoom_out_map
<rpc>
    <!-- For a file -->
        <load-configuration action="update" url="file" [format="format"]/>
    
    <!-- For a data stream -->
        <load-configuration action="update" [format="format"]>
            <!-- configuration data -->
    </load-configuration>
</rpc>

For more information about the url and format attributes, see Uploading and Formatting Configuration Data in a Junos XML Protocol Session.

Note:

Starting in Junos OS Release 21.1R1, the ephemeral configuration database supports the action="update" attribute on supported platforms.

This operation is equivalent to the Junos OS CLI load update configuration mode command. The Junos OS configuration management software compares the two complete configurations. Each configuration element that is different in the loaded configuration replaces its corresponding element in the existing configuration. Elements that are the same in both configurations remain unchanged. When the configuration is later committed, only system processes that are affected by the changed configuration elements parse the new configuration.

To represent the replacement elements, the application uses the same syntax as for new elements, as described in Creating New Elements in Configuration Data Using the Junos XML Protocol. In the following Junos XML and JSON representations of the configuration, the object identifier is called name.

Junos XML elements:

content_copy zoom_out_map
<configuration>
    <!-- opening tag for each parent of the element -->
        <container-tag> 
            <name>identifier</name> 
            <!-- tag elements for other children, if any --> 
        </container-tag> 
    <!-- closing tag for each parent of the element --> 
</configuration>

ASCII text:

content_copy zoom_out_map
<configuration-text>
    /* statements for parent levels of the element */
        element identifier {
            /* child statements if any */
        } 
    /* closing braces for parent levels of the element */
</configuration-text>

JSON:

content_copy zoom_out_map
<configuration-json>
{
    "configuration" : {
        /* JSON objects for parent levels of the element */
            "container-tag" : {
                "object" : [
                {
                    "name" : "identifier",
                    "statement-name" : "statement-value",   # if any 
                    /* additional data and child objects */   # if any
                }
                ],
                /* data and child objects */   # if any
            }
        /* closing braces for parent levels of  the element */
    }
}
</configuration-json>
Note:

You can load configuration data formatted using JavaScript Object Notation (JSON) starting in Junos OS Release 16.1.

The following example shows how to update the candidate configuration with the contents of the file /tmp/new.conf (which resides on the device). The file contains a complete configuration represented as Junos XML tag elements (the default), so the format attribute is omitted.

external-footer-nav