Request All Configuration Objects of a Specific Type Using the Junos XML Protocol
In a Junos XML protocol session with a device running Junos
OS, to request complete information about all configuration objects
of a specified type in a hierarchy level, a client application emits
a <get-configuration>
tag element that
encloses the tag elements representing all levels of the configuration
hierarchy from the root (represented by the <configuration>
tag element) down to the immediate parent level for the object type.
An empty tag represents the requested object type. The entire request
is enclosed in an <rpc>
tag element.
<rpc> <get-configuration> <configuration> <!-- opening tags for each parent of the object type --> <object-type/> <!-- closing tags for each parent of the object type --> </configuration> </get-configuration> </rpc>
This type of request is useful when the object’s parent hierarchy level has child objects of multiple types and the application is requesting just one of the types. If the requested object is the only possible child type, then this type of request yields the same output as a request for the complete parent hierarchy (described in Requesting a Configuration Hierarchy Level or Container Object Without an Identifier Using the Junos XML Protocol).
When the application requests Junos XML-tagged output
(the default), the Junos XML protocol server returns the requested
objects in <configuration>
and <rpc-reply>
tag elements. For information about
the attributes in the opening <configuration>
tag, see Specifying the Source for Configuration
Information Requests in a Junos XML Protocol Session.
<rpc-reply xmlns:junos="URL"> <configuration attributes> <!-- opening tags for each parent of the object type --> <first-object> <!-- child tag elements for the first object --> </first-object> <second-object> <!-- child tag elements for the second object --> </second-object> <!-- additional instances of the object --> <!-- closing tags for each parent of the object type --> </configuration> </rpc-reply>
To specify the source of the output (candidate or active configuration)
and request special formatting of the output (for example, formatted
ASCII or JSON or an indicator for identifiers), the application can
include attributes in the opening <get-configuration>
tag, its opening <junoscript>
tag,
or both. For more information, see Specifying
the Source for Configuration Information Requests in a Junos XML Protocol
Session and Specifying the
Output Format for Configuration Data in a Junos XML Protocol Session.
The application can also request additional configuration elements
of the same or other types by including the appropriate tag elements
in the same <get-configuration>
tag
element. For more information, see Requesting
Multiple Configuration Elements Using the Junos XML Protocol.