Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request Configuration Changes Using the Junos XML Protocol

Client applications can use Junos XML protocol operations to modify the specified configuration database on a Junos device.

A client application can use the Junos XML protocol operations to modify the configuration on a device running Junos or a device running Junos OS Evolved. A client application can load the configuration data from a file or a data stream. The configuration data format can be Junos XML elements, formatted ASCII text, configuration mode commands, or JSON. The Junos XML tag elements described here correspond to configuration statements.

To change the configuration on a device running Junos OS or a device running Junos OS Evolved, the client application performs the procedures described in the indicated sections:

  1. Establishes a connection to the Junos XML protocol server on the network device.

    See Connect to the Junos XML Protocol Server.

  2. Starts a Junos XML protocol session, as described in Start a Junos XML Protocol Session.

  3. Opens the target configuration database using one of the following options:

    • Opens and optionally locks the candidate configuration. Locking the candidate configuration prevents other users or applications from changing it at the same time.

    • Creates a private copy of the candidate configuration. A private copy enables the application to make changes without affecting the candidate configuration until the copy is committed.

    • Opens an instance of the ephemeral configuration database.

    For more information, see Lock, Unlock, or Create a Private Copy of the Candidate Configuration Using the Junos XML Protocol and Understanding the Ephemeral Configuration Database.

  4. Loads the configuration data by enclosing the <load-configuration> operation in an <rpc> element.

    The <load-configuration> operation offers functionality that is analogous to configuration mode commands in the Junos OS CLI. A client application can include various attributes in the tag to specify the source and format of the configuration data. An application can completely replace the existing candidate configuration, or it can specify how the server loads the provided data into the target configuration database. The basic syntax is as follows:

  5. Accepts the tag stream emitted by the Junos XML protocol server in response to each request and extracts its contents, as described in Parse the Junos XML Protocol Server Response.

    The server returns the <rpc-reply> and the <load-configuration-results> elements in response to a load operation. If the load operation is successful, the <load-configuration-results> element encloses the <load-success/> tag.

    If the load operation fails, the <load-configuration-results> element instead encloses the <load-error-count> element, which indicates the number of errors that occurred. The reply also includes one or more <xnm:error> elements with information about each of the errors. In this case, the application or administrator must address the errors before committing the configuration.

  6. (Optional) Verifies the syntactic correctness of the candidate configuration or a private copy before committing it. See Verify Configuration Syntax Using the Junos XML Protocol.

  7. Commits the configuration.

    To commit the candidate configuration or a private copy, see Commit the Candidate Configuration Using the Junos XML Protocol.

    To commit an ephemeral database instance, see Commit and Synchronize Ephemeral Configuration Data Using the NETCONF or Junos XML Protocol.

  8. Closes or unlocks the target configuration database using one of the following options:

    • Unlocks the candidate configuration, if locked. Other users and applications cannot change the configuration while it remains locked.

    • Closes a private copy of the candidate configuration.

    • Closes an open instance of the ephemeral configuration database.

    For more information, see Lock, Unlock, or Create a Private Copy of the Candidate Configuration Using the Junos XML Protocol and Enable and Configure Instances of the Ephemeral Configuration Database.

  9. Ends the Junos XML protocol session and closes the connection to the device, as described in End a Junos XML Protocol Session and Close the Connection.