Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Creating New Elements in Configuration Data Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, to create new configuration elements (hierarchy levels or configuration objects), a client application includes the basic tag elements, formatted ASCII statements, configuration mode commands, or JSON objects described in Creating, Modifying, or Deleting Configuration Elements Using the Junos XML Protocol.

For Junos XML tag elements and formatted ASCII text, new elements can be created in either merge mode or replace mode, which are described in Merging Elements in Configuration Data Using the Junos XML Protocol and Replacing Elements in Configuration Data Using the Junos XML Protocol. In replace mode, the application includes the action="replace" attribute in the <load-configuration/> tag or opening <load-configuration> tag.

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

To use formatted ASCII text to represent the element, the 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 use configuration mode commands to create new elements, the application includes the action="set" and format="text" attributes in the <load-configuration> tag. The application includes the set command as it would be executed 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.

Starting in Junos OS Release 16.1, you can load configuration data formatted using JavaScript Object Notation (JSON) on the device. When loading configuration data in JSON format, you can create new elements in merge mode only. To represent the element in JSON, the application includes each element’s identifier (if it has one) and all data and child objects being defined for the element. The application does not need to include any specific operation attributes in order to create the new element. In the following example, the JSON member that specifies the element’s identifier has the field name "name":