Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Upload Configuration Data as a File Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, to upload configuration data stored 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, either include the format="xml" attribute or omit the format attribute, which defaults to XML.

If the data is formatted ASCII text, include the format="text" attribute.

If the data is configuration mode set commands, include the action="set" and format="text" attributes.

Starting in Junos OS Release 16.1, you can load configuration data formatted using JavaScript Object Notation (JSON) on devices running Junos OS. If the data uses JSON format, include the format="json" attribute.

Before loading the file, the client application or an administrator saves the configuration data as the contents of the file. Enclose Junos XML tag elements in a <configuration> tag element. For information about the syntax for the data in the file, see Defining the Format of Configuration Data to Upload in a Junos XML Protocol Session.

Note:

Configuration data formatted as ASCII text, Junos OS configuration mode commands, or JSON data is not enclosed in <configuration-text>, <configuration-set>, or <configuration-json> tag elements when it is loaded from a file.

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:

  • A filename on an HTTP server has the following form:

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 attributes in the <load-configuration/> tag:

  • format

  • action

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.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
16.1
Starting in Junos OS Release 16.1, you can load configuration data formatted using JavaScript Object Notation (JSON) on devices running Junos OS.