
244
Configuration procedure
# Enter XML view.
<Sysname> xml
# Exchange capabilities.
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<capabilities>
<capability>
urn:ietf:params:netconf:base:1.0
</capability>
</capabilities>
</hello>
# Save the configuration of the device to the configuration file
my_config.cfg
.
<?xml version="1.0" encoding="UTF-8"?>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<save>
<file> my_config.cfg</file>
</save>
</rpc>
Verifying the configuration
If the client receives the following response, the <save> operation is successful:
<?xml version="1.0" encoding="UTF-8"?>
<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 that matches 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>