Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Requesting an XML Schema for the Configuration Hierarchy Using NETCONF


The schema represents all configuration elements available in the version of the Junos OS that is running on a device. (To determine the Junos OS version, emit the <get-software-information> operational request tag element, which is documented in the Junos XML API Operational Developer Reference.)

Client applications can use the schema to validate the configuration on a device or simply to learn which configuration statements are available in the version of the Junos OS running on the device. The schema does not indicate which elements are actually configured or even that an element can be configured on that type of device (some configuration statements are available only on certain device types). To request the set of currently configured elements and their settings, emit the <get-config> tag element instead, as described in Requesting Configuration Data Using NETCONF.

Explaining the structure and notational conventions of the XML Schema language is beyond the scope of this document. For information, see XML Schema Part 0: Primer, available from the World Wide Web Consortium (W3C) at . The primer provides a basic introduction and lists the formal specifications where you can find detailed information.

For further information, see the following sections:

Requesting an XML Schema for the Configuration Hierarchy

In a NETCONF session with a device running Junos OS, to request an XML Schema-language representation of the entire configuration hierarchy, a client application emits the Junos XML <get-xnm-information> tag element and its <type> and <namespace> child tag elements with the indicated values in an <rpc> tag element:

The NETCONF server encloses the XML schema in <rpc-reply> and <xsd:schema> tag elements:

Creating the junos.xsd File

Most of the tag elements defined in the schema returned in the <xsd:schema> tag belong to the default namespace for Junos OS configuration elements. However, at least one tag, <junos:comment>, belongs to a different namespace: By XML convention, a schema describes only one namespace, so schema validators need to import information about any additional namespaces before they can process the schema.

Starting with Junos OS Release 6.4, the <xsd:import> tag element is enclosed in the <xsd:schema> tag element and references the file junos.xsd, which contains the required information about the junos namespace. For example, the following <xsd:import> tag element specifies the file for Junos OS Release 20.2R1 (and appears on two lines for legibility only):

To enable the schema validator to interpret the <xsd:import> tag element, you must manually create a file called junos.xsd in the directory where you place the .xsd file that contains the complete Junos OS configuration schema. Include the following text in the file. Do not use line breaks in the list of attributes in the opening <xsd:schema> tag. Line breaks appear in the following example for legibility only. For the Junos-version variable, substitute the release number of the Junos OS running on the device (for example, 20.2R1 for the first release of Junos OS 20.2).


Schema validators might not be able to process the schema if they cannot locate or open the junos.xsd file.

Whenever you change the version of Junos OS running on the device, remember to update the Junos-version variable in the junos.xsd file to match.

Example: Requesting an XML Schema

The following examples show how to request the Junos OS configuration schema. In the NETCONF server’s response, the first <xsd:element> statement defines the <undocumented> Junos XML tag element, which can be enclosed in most other container tag elements defined in the schema (container tag elements are defined as <xsd:complexType>).

The attributes in the opening tags of the NETCONF server’s response appear on multiple lines for legibility only. The NETCONF server does not insert newline characters within tags or tag elements. Also, in actual output the JUNOS-version variable is replaced by a value such as 20.2R1 for the initial version of Junos OS Release 20.2.

Another <xsd:element> statement near the beginning of the schema defines the Junos XML <configuration> tag element. It encloses the <xsd:element> statement that defines the <system> tag element, which corresponds to the [edit system] hierarchy level. The statements corresponding to other hierarchy levels are omitted for brevity.