Request Identifiers for Configuration Objects of a Specified Type Using NETCONF
In a NETCONF session with a device running Junos OS, to request output that shows only
the identifier for each configuration object of a specific type in a hierarchy, a
client application emits a <filter>
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. The object type is represented by
its container tag element enclosing an empty <name/>
tag.
(The <name>
tag element can always be used, even if the
actual identifier tag element has a different name. The actual name is also valid.)
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 object type --> <object-type> <name/> </object-type> <!-- closing tags for each parent of the object type --> </configuration> </filter> </get-config> </rpc> ]]>]]>
For
information about the <source>
tag element, see Specify the Source for Configuration Information Requests Using NETCONF.
You cannot request only identifiers for object types that have multiple identifiers. However, for many such objects the identifiers are the only child tag elements, so requesting complete information yields the same output as requesting only identifiers. For instructions, see Request All Configuration Objects of a Specified Type Using NETCONF.
The NETCONF server returns the requested objects in
<data>
and <rpc-reply>
tag
elements (here, objects for which the identifier tag element is called
<name>
). 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> <name>identifier-for-first-object</name> </first-object> <second-object> <name>identifier-for-second-object</name> </second-object> <!-- additional objects --> <!-- 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 the identifier for each BGP
neighbor configured at the [edit protocols bgp group
next-door-neighbors]
hierarchy level in the candidate
configuration.