Specifying the Source and Format of New Configuration Data
A client application can provide new configuration data either in a file or as a data stream, and as either Junos XML tag elements or formatted ASCII text. See the following sections:
- Providing Configuration Data in a File
- Providing Configuration Data as a Data Stream
- Defining Configuration Data as Formatted ASCII Text or Junos XML Tag Elements
Providing Configuration Data in a File
To provide new configuration data in a file, a client application encloses the <load-configuration/> tag with the url attribute in an <rpc> tag element. If the data is Junos XML tag elements, it either includes the format="xml" attribute or omits the format attribute:
If the data is formatted ASCII text, the format="text" attribute is included:
Before loading the file, the client application or an administrator saves either Junos XML tag elements (enclosed in a <configuration> tag element) or formatted ASCII as the contents of the file (formatted ASCII text is not enclosed in a <configuration-text> tag element in the file). For information about the syntax for the data in the file, see Defining Configuration Data as Formatted ASCII Text or Junos XML Tag Elements.
The value of the url attribute 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:ftp://username:password@hostname/path/filename
- A filename on an HTTP server has the following form:http://username:password@hostname/path/filename
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.
The url attribute can be combined with one or more of the following other attributes in the <load-configuration/> tag:
- format, which is described in Defining Configuration Data as Formatted ASCII Text or Junos XML Tag Elements.
- action, which is described in Replacing the Entire Configuration and the subsections of Creating, Modifying, or Deleting Configuration Elements.
The following example shows how to incorporate Junos XML-tagged configuration data stored in the file /var/configs/user-accounts on the FTP server called cfg-server.mycompany.com. The opening <load-configuration> tag appears on two lines for legibility only.

Providing Configuration Data as a Data Stream
To provide new configuration data as a data stream, a client application encloses the <load-configuration> tag element in an <rpc> tag element.
To define the configuration elements to change as Junos XML tag elements, the application emits the tag elements representing all levels of the configuration hierarchy from the root (represented by the <configuration> tag element) down to each element to change:
To define the configuration elements to change as formatted ASCII text, the application encloses them in a <configuration-text> tag element and includes the format="text" attribute in the opening <load-configuration> tag:
For information about the syntax for Junos XML tag elements and formatted ASCII text, see Defining Configuration Data as Formatted ASCII Text or Junos XML Tag Elements.
Defining Configuration Data as Formatted ASCII Text or Junos XML Tag Elements
As discussed in Providing Configuration Data in a File and Providing Configuration Data as a Data Stream, a client application can provide new configuration data to the Junos XML protocol server either in a file or as a data stream emitted during the Junos XML protocol session. In both cases, it can use either Junos XML tag elements or formatted ASCII text to define the new configuration data.
If the application uses Junos XML tag elements, it includes the tag elements representing all levels of the configuration hierarchy from the root (the <configuration> tag element) down to each new or changed element. The notation is the same as that used to request configuration information, and is described in detail in Overview of Configuration Changes.
If the application provides the new data as formatted ASCII text, it uses the standard Junos OS CLI notation to indicate the hierarchical relationships between configuration statements—the newline character, tabs and other white space, braces, and square brackets. For each new or changed element, the complete statement path is specified, starting with the top-level statement that appears directly under the [edit] hierarchy level.
When ASCII text is provided as a data stream, it is enclosed in the <configuration-text> tag element:
When ASCII text is provided in a previously saved file, the <configuration-text> tag element is not included in the file.
When providing new data as ASCII text, the application also includes the format="text" attribute in the <load-configuration/> tag or opening <load-configuration> tag.
<rpc>
<load-configuration url="file-location" format="text"/>
</rpc>
<rpc>
<load-configuration format="text">
<configuration-text>
/* formatted ASCII configuration data */
</configuration-text>
</load-configuration>
</rpc>
The format attribute can be combined with one or more of the following attributes:
- url, which is discussed in Providing Configuration Data in a File.
- action, which is discussed in Replacing the Configuration with New Data and the subsections of Creating, Modifying, or Deleting Configuration Elements.
For reference pages for the <configuration> and <configuration-text> tag elements, see the Junos XML API Operational Reference.
Hide Navigation Pane
Show Navigation Pane
Download
SHA1