<load-configuration>

 

Usage

Release Information

This is a Junos XML management protocol operation. It is supported in Junos XML protocol sessions, and it is supported as a Juniper Networks proprietary extension in NETCONF sessions on devices running Junos OS that identify the URI http://xml.juniper.net/netconf/junos/1.0 in the capabilities exchange.

action attribute value set added in Junos OS Release 11.4.

format attribute value json added in Junos OS Release 16.1.

Description

Request that the NETCONF or Junos XML protocol server load configuration data into the candidate configuration or open configuration database.

If a client application issues the Junos XML protocol <open-configuration> operation to open a specific configuration database before executing the <load-configuration> operation, the server loads the configuration data into the open configuration database. Otherwise, the server loads the configuration data into the candidate configuration.

Provide the data to load in one of the following ways:

  • Set the empty <load-configuration/> tag’s rescue attribute to the value rescue. The rescue configuration completely replaces the candidate configuration.

  • Set the empty <load-configuration/> tag’s rollback attribute to the numerical index of a previous configuration. The device stores a copy of the most recently committed configuration and up to 49 previous configurations. The specified previous configuration completely replaces the candidate configuration.

  • Set the empty <load-configuration/> tag’s url attribute to the pathname of a file that contains the configuration data to load. If providing the configuration data as formatted ASCII text, set the format attribute to text. If providing the configuration data as Junos XML tag elements, either omit the format attribute or set the value to xml. If providing the configuration data as configuration mode commands, set the action attribute to set, and either omit the format attribute or set the value to text. If providing the configuration data in JavaScript Object Notation (JSON), set the format attribute to json.

    In the following example, the url attribute identifies that the configuration data should be loaded from the /tmp/add.conf file.

  • Enclose the configuration data as a data stream within an opening <load-configuration> and closing </load-configuration> tag. If providing the configuration data as formatted ASCII text, enclose the data in a <configuration-text> tag element, and set the format attribute to text. If providing the configuration data as Junos XML tag elements, enclose the data in a <configuration> tag element, and either omit the format attribute or set the value to xml. If providing the configuration data as configuration mode commands, enclose the data in a <configuration-set> tag element, set the action attribute to set, and either omit the format attribute or set the value to text. If providing the configuration data in JSON, enclose the data in a <configuration-json> tag element, and set the format attribute to json.

Attributes

actionSpecify how to load the configuration data, particularly when the target configuration database and the loaded configuration contain conflicting statements.
Note

Staring in Junos OS Release 18.1R1, the ephemeral configuration database supports loading configuration data using the action attribute values of override and replace in addition to the previously supported values of merge and set.

The following are acceptable values:

  • merge—Combine the data in the loaded configuration with the data in the target configuration. If statements in the loaded configuration conflict with statements in the target configuration, the loaded statements replace those in the target configuration. This is the default behavior if the action attribute is omitted.

  • override—Discard the entire candidate configuration and replace it with the loaded configuration. When the configuration is later committed, all system processes parse the new configuration.

  • replace—Substitute each hierarchy level or configuration object defined in the loaded configuration for the corresponding level or object in the candidate configuration.

    If providing the configuration data as formatted ASCII text (either in the file named by the url attribute or enclosed in a <configuration-text> tag element), also place the replace: statement on the line directly preceding the statements that represent the hierarchy level or object to replace. For more information, see the discussion of loading a file of configuration data in the CLI User Guide.

    If providing the configuration data as Junos XML tag elements, include the replace="replace" attribute in the opening tags of the elements that represent the hierarchy levels or objects to replace.

  • set—Load configuration data formatted as Junos OS configuration mode commands. This option executes the configuration instructions line by line as they are stored in a file named by the url attribute or enclosed in a <configuration-set> tag element. The instructions can contain any configuration mode command, such as set, delete, edit, or deactivate. When providing the configuration data as a set of commands, the only acceptable value for the format attribute is "text". If the action attribute value is "set", and the format attribute is omitted, the format attribute automatically defaults to "text" rather than xml.

  • update—Compare a complete loaded configuration against the candidate configuration. For each hierarchy level or configuration object that is different in the two configurations, the version in the loaded configuration replaces the version in the candidate configuration. When the configuration is later committed, only system processes that are affected by the changed configuration elements parse the new configuration.

formatSpecify the format used for the configuration data. Acceptable values are:
  • json–Indicate that the configuration data is formatted using JavaScript Object Notation (JSON).

  • text—Indicate that the configuration data is formatted as ASCII text or as a set of configuration mode commands.

    ASCII text format uses the newline character, tabs and other white space, braces, and square brackets to indicate the hierarchical relationships between the statements. This is the format used in configuration files stored on the routing platform and is the format displayed by the CLI show configuration command. The set command format consists of a series of Junos OS configuration mode commands and is displayed by the show configuration | display set CLI command. To load a set of configuration mode commands, you must set the action attribute to "set".

  • xml—Indicate that the configuration data is formatted using Junos XML tag elements. If the format attribute is omitted, "xml" is the default format for all values of the action attribute except "set", which defaults to format "text".

rescueSpecify that the rescue configuration replace the current candidate configuration. The only valid value is "rescue".
Note

If an application does not support executing RPCs with XML attributes, starting in Junos OS Release 18.1R1 you can also use the <rollback-config> RPC to load the rescue configuration.

rollbackSpecify the numerical index of the previous configuration to load. Valid values are 0 (zero, for the most recently committed configuration) through one less than the number of stored previous configurations (maximum is 49).
Note

If an application does not support executing RPCs with XML attributes, starting in Junos OS Release 18.1R1 you can also use the <rollback-config> RPC to load a previously committed configuration.

urlSpecify the full pathname of the file that contains the configuration data to load. The value can be a local file path, an FTP location, or a Hypertext Transfer Protocol (HTTP) URL:
  • A local filename can have one of the following forms:

    • /path/filename—File on a mounted file system, either on the local flash disk or on hard disk.

    • a:filename or a:path/filename—File on the local drive. The default path is / (the root-level directory). The removable media can be in MS-DOS or UNIX (UFS) format.

  • A filename on an FTP server has the following form:

  • A filename on an HTTP server has the following form:

In each case, the default value for the path variable is the home directory for the username. To specify an absolute path, the application starts the path with the characters %2F; for example, ftp://username:password@hostname/%2Fpath/filename.

Related Documentation