Subtree filtering – Brocade Network OS NETCONF Operations Guide v4.1.1 User Manual
Page 44

12
Network OS NETCONF Operations Guide
53-1003231-02
Retrieving configuration data
2
The following example shows a client message that issues the <get-config> operation in its most
basic form. It retrieves the entire running configuration.
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="200" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get-config>
<source>
<running/>
</source>
</get-config>
</rpc>
Such a request, however, typically results in an unwanted or unmanageable amount of output. To
restrict the output to the portion of the configuration you want, Brocade supports two types of
filtering: subtree filtering and xpath filtering.
For complete details about subtree filtering and xpath filtering, refer to the RFC 4741, The
NETCONF Protocol. The following sections provide some examples.
Subtree filtering
Subtree filtering defines a point in the configuration hierarchy that limits the returned configuration
data. Only data at this point and the subtrees below it are returned. For example, to retrieve the
Fibre Channel configuration for all Fibre Channel interfaces configured on the switch, use the
following filter. This operation returns all configuration data for all Fibre Channel ports on the
managed device.
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="201" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get-config>
<source>
<running/>
</source>
<filter type="subtree">
<interface xmlns="urn:brocade.com:mgmt:brocade-interface">
<fc-port/>
</interface>
</filter>
</get-config>
</rpc>
The purpose of each filter element is as follows:
•
The <filter> element tag contains a type statement that identifies the filter type as a subtree
filter.
•
The <interface> element constrains the output to the interface configuration in the
urn:brocade.com:mgmt:brocade-interface namespace.
•
The <fc-port> element further constrains the output to the information under the <fc-port>
node. Used in this way, <fc-port> is termed a containment node.
To further restrict the output and retrieve Fibre Channel configuration data for only one specific
Fibre Channel interface, use the following filter. In this example, the <name> element is termed a
content match node; the filter returns the values of all Fibre Channel attributes for the specified
port.
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="202" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get-config>