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 loopback configuration for all loopback interfaces configured on the device, use the following filter. This operation returns all configuration data for all loop ports on the managed device.

<?xml version="1.0" ?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<get-config>
		<source>
			<running/>
		</source>
		<filter type="subtree">
			<routing-system xmlns="urn:brocade.com:mgmt:brocade-common-def">
				<interface xmlns="urn:brocade.com:mgmt:brocade-interface">
					<loopback xmlns="urn:brocade.com:mgmt:brocade-intf-loopback">
						<id>1</id>
					</loopback>
				</interface>
			</routing-system>
		</filter>
	</get-config>
</rpc>
The purpose of each filter element is as follows:

To further restrict the output and retrieve loopback configuration data for only one specific loopback interface, use the following filter. In this example, the <id> element is termed a content match node; the filter returns the values of all loopback attributes for the specified port.

<?xml version="1.0" ?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<get-config>
		<source>
			<running/>
		</source>
		<filter type="subtree">
			<routing-system xmlns="urn:brocade.com:mgmt:brocade-common-def">
				<interface xmlns="urn:brocade.com:mgmt:brocade-interface">
					<loopback xmlns="urn:brocade.com:mgmt:brocade-intf-loopback">
						<id>1</id>
						<vrf/>
					</loopback>
				</interface>
			</routing-system>
		</filter>
	</get-config>
</rpc>

If all you want to know is the setting of one specific loopback port attribute, such as the name of VRF, use a filter such as the following. In this case, <vrf> suppresses the inclusion of all its sibling nodes. It is termed a selection node.

<?xml version="1.0" ?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<get-config>
		<source>
			<running/>
		</source>
		<filter type="subtree">
			<routing-system xmlns="urn:brocade.com:mgmt:brocade-common-def">
				<interface xmlns="urn:brocade.com:mgmt:brocade-interface">
					<loopback xmlns="urn:brocade.com:mgmt:brocade-intf-loopback">
						<id>1</id>
						<vrf>
							<forwarding/>
						</vrf>
					</loopback>
				</interface>
			</routing-system>
		</filter>
	</get-config>
</rpc>

The following example retrieves the configuration for the loopback interface.

<?xml version="1.0" ?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
	<get-config>
		<source>
			<running/>
		</source>
		<filter type="subtree">
			<routing-system xmlns="urn:brocade.com:mgmt:brocade-common-def">
				<interface xmlns="urn:brocade.com:mgmt:brocade-interface">
					<loopback xmlns="urn:brocade.com:mgmt:brocade-intf-loopback">
						<id>1</id>
						<shutdown/>
					</loopback>
				</interface>
			</routing-system>
		</filter>
	</get-config>
</rpc>