Request All Configuration Objects of a Specified Type Using NETCONF
In a NETCONF session with a device running Junos OS, to request information about all
configuration objects of a specified type in a hierarchy level, a client application
emits a <filter>
tag element that encloses the tag elements
representing all levels in 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 returns all configuration objects of the
requested object type and all child tags for each object. To return only specific
child tags for the configuration objects, enclose the desired child tags in the
opening and closing tags of the object. The entire request is enclosed in an
<rpc>
tag
element:
<rpc> <get-config> <source> <!-- tag specifying the source configuration --> </source> <filter type="subtree"> <configuration> <!-- opening tags for each parent of the requested object type --> <object-type> <!-- optionally select specific child tags --> </object-type> <!-- closing tags for each parent of the requested object type --> </configuration> </filter> </get-config> </rpc> ]]>]]>
For
information about the <source>
tag element, see Specify the Source for Configuration Information Requests Using NETCONF.
This type of request is useful when the object’s parent hierarchy level has more than one type of child object. If the requested object is the only child type that can occur in its parent hierarchy level, then this type of request yields the same output as a request for the complete parent hierarchy, which is described in Request a Configuration Hierarchy Level or Container Object Without an Identifier Using NETCONF.
The NETCONF server returns the requested objects in
<data>
and <rpc-reply>
tag
elements. For information about the attributes in the opening
<configuration>
tag, see Specify the Source for Configuration Information Requests Using NETCONF.
<rpc-reply xmlns="URN" xmlns:junos="URL"> <data> <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> </data> </rpc-reply> ]]>]]>
The
application can also request additional configuration elements of the same or other
types by including the appropriate tag elements in the same
<get-config>
tag element. For more information, see Request Multiple Configuration Elements Simultaneously Using NETCONF.
The following example shows how to request complete information about
all radius-server
objects at the [edit system]
hierarchy level in the candidate configuration.