Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Create New Elements in Configuration Data Using the Junos XML Protocol

A Junos XML protocol client application can create new configuration elements (hierarchy levels or configuration objects) on devices running Junos OS or devices running Junos OS Evolved. A client application first includes the basic tag elements, formatted ASCII statements, configuration mode commands, or JSON objects described in Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol.

For Junos XML elements and formatted ASCII text, you can create new elements in either merge mode or replace mode. For more information, see Merge Elements in Configuration Data Using the Junos XML Protocol and Replace Elements in Configuration Data Using the Junos XML Protocol. In replace mode, the application includes the action="replace" attribute in the <load-configuration> tag. When you use JavaScript Object Notation (JSON), you must use merge mode to create new objects.

The following sections outline how to create new configuration items using the different formats:

Junos XML

To use Junos XML to create the element, an application includes each of the element’s identifier tags (if it has them) and all child tag elements that it is defining for the element. In the following example, the identifier tag is <name>. The application does not need to include any attributes in the opening container tag for the new element.

Formatted ASCII Text

To use formatted ASCII text to create the element, an application includes each of the element’s identifiers (if it has them) and all child statements (with values if appropriate) that it is defining for the element. It does not need to include an operator before the new element. To provide the configuration data as a data stream, enclose the data in a <configuration-text> element.

Configuration Mode Commands

To use configuration mode commands to create new elements, an application includes the set command as you would execute it in the CLI. The command includes the statement path to the element, the element’s identifier if it has one, and all child statements (with values if appropriate) that it is defining for the element. To provide the configuration data as a data stream, enclose the commands in a <configuration-set> element.

JSON

To use JSON to create the object, an application includes the object’s identifiers (if it has them) and all data and child objects that it is defining for the object. The application does not need to include any specific operation attributes to create the new object. To provide the configuration data as a data stream, enclose the data in a <configuration-json> element.

In the following example, the object’s identifier is the field designated as "name".