Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, in addition to replacing the entire configuration, a client application can create, modify, or delete one or more configuration elements (hierarchy levels and configuration objects) in the candidate configuration or open configuration database.

To use Junos XML tag elements to represent an element, the application includes the tag elements representing all levels in the configuration hierarchy from the root (represented by the <configuration> tag element) down to the element’s container tag element. The attributes and child tag elements that are included depend on the operation being performed on the element. The syntax applies both to the contents of a file and to a data stream. In the following example, the identifier tag element is called <name>:

To use formatted ASCII text to represent an element, the application includes the complete statement path, starting with a statement that can appear directly under the [edit] hierarchy level. The attributes and child statements to include depend on the operation being performed on the element. The application encloses the set of statements in a <configuration-text> tag element when it uploads the configuration data as a data stream. The application omits the <configuration-text> tag element when the configuration data is stored in and loaded from a file.

When loading formatted ASCII text, the application must include the format="text" attribute in the <load-configuration> tag.

To use configuration mode commands to create, modify, or delete an element, the application includes the commands as they would be typed in configuration mode in the CLI. The configuration instructions are executed in the order provided. You can specify the complete statement path in the command, or you can use CLI navigation commands such as edit and up, to move around the configuration hierarchy.

The application encloses the set of commands in a <configuration-set> tag element when it uploads the configuration data as a data stream. The application omits the <configuration-set> tag element when the configuration data is stored in and loaded from a file.

When loading configuration mode set commands, the application must include the action="set" and format="text" attributes in the <load-configuration> tag.

Starting in Junos OS Release 16.1, you can load configuration data formatted using JavaScript Object Notation (JSON) on the device. To use JSON format to represent an element, the application includes JSON objects representing all levels in the configuration hierarchy from the root down to the JSON object representing that element. The attributes and child objects to include depend on the operation being performed on the element. If the attribute value is a Boolean data type, the value is not enclosed in quotes.

The application encloses the JSON data in a <configuration-json> tag element when it uploads the configuration data as a data stream. The application omits the <configuration-json> tag element when the configuration data is stored in and loaded from a file.

When loading data in JSON format, the application must include the format="json" attribute in the <load-configuration> tag.

For more information about the source and formatting for configuration elements, see Uploading and Formatting Configuration Data in a Junos XML Protocol Session.

For information about the operations a client application can perform on configuration elements, see the following sections: