Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request Identifier Indicators for Configuration Elements Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, to request that the server indicate whether a child configuration element is an identifier for its parent element, a client application includes the junos:key="key" attribute in the opening <junoscript> tag for the Junos XML protocol session or includes the junos:key="key" or key="key" attribute in the <get-configuration> request tag:

For more information about the <junoscript> tag, see Starting Junos XML Protocol Sessions.

When the identifier indicator is requested, the Junos XML protocol server includes the junos:key="key" attribute in the opening tag for each identifier. As always, the Junos XML protocol server encloses its response in <rpc-reply> and <configuration> tag elements. In the following example, the identifier tag element is called <name>:

If the requested output format is JSON, the Junos XML protocol server adds a metadata object that includes "junos:key" : "key" to indicate the identifier. If the Junos OS object uses name for the identifier, a metadata object with name "@" is added as a new member of the object. If the Junos OS object uses an identifier other than name, the metadata object is added as a sibling name/value pair that uses the name "@" concatenated with the identifier name. The response is enclosed in <configuration-json> and <rpc-reply> tag elements.

In the following output, the combination of name and next-hop uniquely identify the static route:

Note:

Starting in Junos OS Release 16.1, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization. The new default uses the "@" symbol instead of the field name "attribute" to indicate an attribute.

The client application can include one or more of the following other attributes in the <get-configuration/> tag or opening <get-configuration> tag when the junos:key attribute is included in the opening <junoscript> or <get-configuration> tags:

When requesting an indicator for identifiers, it does not make sense to include the format="text" attribute in the <get-configuration> tag element (as described in Specifying the Output Format for Configuration Data in a Junos XML Protocol Session). The junos:key="key" attribute appears only in Junos XML-tagged output, which is the default output format, and in JSON output. The compare attribute produces only text output, so when the compare attribute is included in the <get-configuration> tag, the junos:key="key" attribute does not appear in the output.

The following example shows how indicators for identifiers appear on configuration elements at the [edit interfaces] hierarchy level in the candidate configuration when the junos:key="key" attribute is included in the opening <junoscript> tag emitted by the client application for the session. The two opening <junoscript> tags appear on multiple lines for legibility only. Neither client applications nor the Junos XML protocol server insert newline characters within tags. Also, for brevity the output includes just one interface, the loopback interface lo0.

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, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization.