Filtering data – H3C Technologies H3C S6300 Series Switches User Manual

Page 257

Advertising
background image

244

<rpc-reply message-id="101"

xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

<ok/>

</rpc-reply>

Filtering data

You can define a filter with the <filter> element to filter information when you perform a get, get-bulk,
get-config, or get-bulk-config operation. Data filtering mechanisms include full match, regular expression

match, and conditional match.

Full match
You can specify an element value in an XML message to implement full match. If multiple element
values are provided, the system returns the data matching all the specified values.
# Copy the following text to the client to retrieve the configuration data of all interfaces in UP state:

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

<get>

<filter type="subtree">

<top xmlns="http://www.h3c.com/netconf/data:1.0">

<Ifmgr>

<Interfaces>

<Interface>

<AdminStatus>2</AdminStatus>

</Interface>

</Interfaces>

</Ifmgr>

</top>

</filter>

</get>

</rpc>

Regular expression match
To implement a complex data filtering with characters, you can add a regExp attribute for a
specific element.
# Copy the following text to the client to retrieve the descriptions of interfaces, of which all the
characters must be upper-case letters from A to Z:

<rpc message-id="1-0" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"

xmlns:h3c="http://www.h3c.com/netconf/base:1.0">

<get-config>

<source>

<running/>

</source>

<filter type="subtree">

<top xmlns="http://www.h3c.com/netconf/config:1.0">

<Ifmgr>

<Interfaces>

<Interface>

<Description h3c:regExp="[A-Z]*"/>

</Interface>

Advertising