Xpath filtering – Brocade Network OS NETCONF Operations Guide v4.1.1 User Manual
Page 46

14
Network OS NETCONF Operations Guide
53-1003231-02
Retrieving configuration data
2
<trunk-enable></trunk-enable>
</fc-port>
</interface>
</rpc-reply>
xpath filtering
Sometimes the data element that qualifies the information you want is at a lower level in the data
hierarchy than the information you need. For example, if you want to return a list of interfaces that
are bound to a CoS-to-CoS mutation QoS map, the element to be used for the selection criteria
(<cos-mutation>name</cos-mutation>) resides at a lower level in the hierarchy than the
information to be retrieved (the interface name), as shown in the following representation of the
QoS map structure. In such cases, you must use an xpath filter and not a subtree filter.
| +--rw tengigabitethernet [name]
+--rw name interface-type
.
.
.
+--rw qos:qos
+--rw qos:default-cos? int32
+--rw qos:trust
+--rw qos:trust-cos? empty
+--rw qos:trust-dscp? empty
+--rw qos:cos-mutation? map-name-type
+--rw qos:cos-traffic-class? map-name-type
+--rw qos:dscp-mutation? map-name-type
The following example returns the interface names to which the CoS-to-CoS mutation QoS map
named “test” is bound. In this case, the map named “test” is bound to interfaces 0/59 and 0/60.
The <filter> element tag specifies that the filter type is xpath and also specifies the data path and
selection criteria.
<?xml version="1.0" encoding="UTF-8"?>
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="205">
<get-config>
<source>
<running></running>
</source>
<filter type="xpath"
select="/interface/tengigabitethernet/qos[cos-mutation='test']">
</filter>
</get-config>
</rpc>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="205">
<data>
<interface xmlns="urn:brocade.com:mgmt:brocade-interface">
<tengigabitethernet>
<name>0/59</name>
<qos xmlns="urn:brocade.com:mgmt:brocade-qos">
<default-cos>0</default-cos>
<cos-mutation>test</cos-mutation>
</qos>
</tengigabitethernet>
<tengigabitethernet>
<name>0/60</name>
<qos xmlns="urn:brocade.com:mgmt:brocade-qos">