No relevant resource is found in the selected language.

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Read our privacy policy>Search

Reminder

To have a better experience, please upgrade your IE browser.

upgrade

Configuration Guide - Network Management and Monitoring

CloudEngine 12800 and 12800E V200R005C10

This document describes the configurations of Network Management and Monitoring, including SNMP, RMON, LLDP, NQA, Service Diagnosis, Mirroring, Packet Capture, sFlow, and NETCONF.
Rate and give feedback:
Huawei uses machine translation combined with human proofreading to translate this document to different languages in order to help you better understand the content of this document. Note: Even the most advanced machine translation cannot match the quality of professional translators. Huawei shall not bear any responsibility for translation accuracy and it is recommended that you refer to the English document (a link for which has been provided).
Subtree Filtering

Subtree Filtering

Overview

Subtree filtering allows an application to include particular XML subtrees in the <rpc-reply> elements for a <get> or <get-config> operation.

Subtree filtering provides a small set of filters for inclusion, simple content exact-match, and selection. The NETCONF agent does not need to use any data-model-specific semantics during processing, allowing for simple and centralized implementation policies.

Subtree Filter Components

Each node specified in subtree filtering represents a filter. The filter only selects nodes associated with the basic data model of a specified database on the NETCONF server. A node matching any filtering rule and element hierarchy is selected. Table 3-7 describes subtree filter components.

Table 3-7 Subtree filter components

Component

Description

Namespace

If namespaces are used, then the filter output will include only elements from the specified namespace.

Containment node

A containment node is a node that contains child elements within a subtree filter.

For each containment node specified in a subtree filter, all data model instances which are exact matches for the specified namespaces and element hierarchy are included in the filter output.

Content match node

A content match node is a leaf node which contains simple content within a subtree filter.

A content match node is used to select some or all of its relevant nodes for filter output and represents an exact-match filter of the leaf node element content.

Selection node

A selection node is an empty leaf node within a subtree filter.

A selection node represents an explicit selection filter of the underlying data model. Presence of any selection nodes within a set of sibling nodes will cause the filter to select the specified subtrees and suppress automatic selection of the entire set of sibling nodes in the underlying data model.

  • Namespace

    If the XML namespace associated with a specific node in the <filter> element is the same as that in the underlying data model, the namespace is matched.

    <filter type="subtree">
     <top xmlns="http://example.com/schema/1.2/config"/>
    </filter>

    In this example, the <top> element is a selection node. If the node namespace complies with http://example.com/schema/1.2/config, the node and its child nodes will be included in the filter for output.

  • Containment node

    The child element of a containment node can be a node of any type, including another container node. For each containment node specified in the subtree filter, all data model instances that completely match the specified namespace and element hierarchy, and any attribute matching expression are included in the output result.

    <filter type="subtree">
     <top xmlns="http://example.com/schema/1.2/config">
      <users/>
     </top>
    </filter>

    In this example, the <top> element is a containment node.

  • Content match node

    A leaf node that contains simple content is called a content match node. It is used to select some or all of its sibling nodes for filter output and represents exact match of the leaf node element content.

    <filter type="subtree">
     <top xmlns="http://example.com/schema/1.2/config">
      <users>
       <user>
        <name>fred</name>
       </user>
      </users>
     </top>
    </filter>

    In this example, both the <users> and <user> nodes are containment nodes, and the <name> node is a content match node. Because the sibling nodes of the <name> node are not specified, only <user> nodes that comply with namespace http://example.com/schema/1.2/config, with their element hierarchies matching the name element and their values being fred, can be included in the filter output. All sibling nodes of the <name> node are included in the filter output.

  • Selection node

    Represents a basic data model for an explicit selection of filters. If any selection node appears in a group of same-level sibling nodes, the filter selects a specified subtree and suppresses the automatic selection of the entire sibling node set in the basic data model. In a filtering expression, an empty tag (such as <foo/>) or an expression with explicit start and end tags (such as <foo> </ foo>) can be used to specify an empty leaf node. In this case, all blank characters will be ignored.

    <filter type="subtree">
     <top xmlns="http://example.com/schema/1.2/config">
      <users/>
     </top>
    </filter>

    In this example, the <top> node is a containment node, and the <users> node is a selection node. The <users> node can be included for filter output only when the <users> node complies with namespace http://example.com/schema/1.2/config and is contained in the <top> element in the root directory of the configuration database.

Subtree Filter Processing

First, the subtree filter output is set as empty. Each subtree filter can contain one or more data model segments, each of which represents one of the selected output parts of the selected data model. Each subtree data segment is composed of data models supported by the NETCONF server. If the entire subtree data segment completely matches part of the data models supported by the NETCONF server, all nodes and child nodes of the subtree data segment are selected and output to the query result.
  • If no filter is used, all data in the current data model is returned in the query result.

    RPC request:

    <rpc message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <get/>
    </rpc>

    RPC reply:

    <rpc-reply message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <data>
      <!-- ... entire set of data returned ... -->
     </data>
    </rpc-reply>
  • If an empty filter is used, the query result contains no data output, in that no content match or selection node is specified.

    RPC request:

    <rpc message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <get>
      <filter type="subtree">
      </filter>
     </get>
    </rpc>

    RPC reply:

    <rpc-reply message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <data>
     </data>
    </rpc-reply>
  • Multi-subtree filtering

    The following example uses the root, fred, and barney subtree filters.

    The root subtree filter contains two containment nodes (<users> and <user>), one content match node (<name>), and one selection node (<company-info>). As for subtrees that meet selection criteria, only <company-info> is selected.

    The fred subtree filter contains three containment nodes (<users>, <user>, and <company-info>), one content match node (<name>), and one selection node (<id>). As for subtrees that meet the selection criteria, only the <id> element in <company-info> is selected.

    The barney subtree filter contains three containment nodes (<users>, <user>, and <company-info>), two content match nodes (<name> and <type>), and one selection node (<dept>). User barney is not a super user and does not comply with the subtree filtering rule. Therefore, the entire subtree of barney (including its parent node <user>) is not selected.

    RPC request:

    <rpc message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
      <get-config>
        <source>
          <running/>
        </source>
        <filter type="subtree">
          <ifm xmlns="http://example.com/schema/1.2/config">
            <users>
              <user>
                <name>root</name>
                <company-info/>
              </user>
              <user>
                <name>fred</name>
                <company-info>
                  <id/>
                </company-info>
              </user>
              <user>
                <name>barney</name>
                <type>superuser</type>
                <company-info>
                  <dept/>
                </company-info>
              </user>
            </users>
          </ifm>
        </filter>
      </get-config>
    </rpc>

    RPC reply:

    <rpc-reply message-id="101"
    xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
     <data>
      <ifm xmlns="http://example.com/schema/1.2/config">
       <users>
        <user>
         <name>root</name>
         <company-info>
          <dept>1</dept>
          <id>1</id>
         </company-info>
        </user>
        <user>
         <name>fred</name>
         <company-info>
          <id>2</id>
         </company-info>
        </user>
       </users>
      </ifm>
     </data>
    </rpc-reply>
Translation
Download
Updated: 2019-04-20

Document ID: EDOC1100075344

Views: 29045

Downloads: 29

Average rating:
This Document Applies to these Products
Related Documents
Related Version
Share
Previous Next