Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Filter Operational Command Output in NETCONF and Junos XML Protocol Sessions

In a NETCONF or Junos XML protocol session with a device running Junos OS, a client application can request operational information for the device and instruct the server to return the entire set of operational data or return only a subset of that information in the RPC reply. All Junos OS operational RPCs support XML subtree filtering, which enables you to filter the RPC reply to select for particular elements in the operational command output. Filtering the output to include only a subset of the data results in smaller, faster transfers, requires less storage space for archived information, and can reduce the time required to parse the operational command output, which can be extensive in some cases.

Note:

Filtering for operational command output is only supported when requesting RPC output in XML format.

By default, the NETCONF and Junos XML protocol servers return the entire set of operational data for an RPC request in their reply. An application can request specific portions of the operational command output by including the <filter type="subtree"> element in the RPC request. Within the <filter> tag, the application specifies the filter selection criteria by including zero or more XML subtrees.

To filter the operational command output returned in the RPC reply, create the RPC request, include the <filter type="subtree"> element, and then specify the XML tree of elements to return starting with the top-level response tag element for that operational command. The filter can include containment nodes, selection nodes, and content match nodes.

Note:

To determine the top level response tag element for a command, which is the first element enclosed in the <rpc-reply> element, you can execute the command in the CLI with the | display xml option.

The type="subtree" attribute in the opening <filter> tag indicates that the client application is using Junos XML elements to represent the operational elements about which it is requesting information. If you include an empty <filter type="subtree"/> element, the server returns an empty RPC reply.

For more information about filtering operational command output, see the following topics: