Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request Identifiers for Configuration Elements Using the Junos XML Protocol

Junos XML protocol client applications can request configuration data that indicates which elements are identifiers for configuration objects.

A Junos XML protocol client application can request the identifiers for configuration objects on devices running Junos and devices running Junos OS Evolved. To request that the server indicate whether a child configuration element is an identifier for its parent element, a client application can use one of the following methods:

  • Include the junos:key="key" attribute in the opening <junoscript> tag for the Junos XML protocol session.

  • Include the junos:key="key" attribute or the key="key" attribute in the <get-configuration> request tag.

For more information about the <junoscript> tag, see Start a Junos XML Protocol Session.

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 object uses name for the identifier, a metadata object "@" is added as a new member of the object. If the object uses an identifier other than name, the metadata object is added as a sibling name/value pair that uses "@" 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:

The client application can include one or more of the following attributes in the <get-configuration> tag when it includes the junos:key attribute in either the <junoscript> tag or the <get-configuration> tag:

  • changed

  • commit-scripts

  • database

  • inherit and optionally groups and interface-ranges

The junos:key="key" attribute appears only in Junos XML output (the default) and JSON output. Thus, you cannot combine the junos:key="key" attribute with the format="text" attribute or with the compare attribute, which produces only text output.

The following example requests indicators for identifiers for elements in the [edit interfaces] hierarchy level of the candidate configuration. The output is truncated for brevity. Client application sends XML request to Junos XML Protocol Server for interfaces configuration. Server responds with XML containing interface name lo0, unit 0, and IP 127.0.0.1/32.