RUGGEDCOM NETCONF
Reference Guide
Chapter 4
Getting Data
Using XPaths with <get> and <get-config>
31
• construct the path to the desired element within the
<filter>
element
• specify the namespace for the root element in the path
You can also use an XPath in the
<filter>
element, instead of the hierarchical XML element structure. For
information on how to use an XPath, refer to
Section 4.3, “Using XPaths with <get> and <get-config>”
.
The following example shows how to return the list of users from the running configuration:
<rpc message-id="3050"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get-config>
<source>
<running/>
</source>
<filter type="subtree">
<admin xmlns="http://ruggedcom.com/ns/rmf_admin">
<users />
</admin>
</filter>
</get-config>
</rpc>]]>]]>
The device returns the following:
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3050">
<data>
<admin xmlns="http://ruggedcom.com/ns/rmf_admin">
<users>
<userid>
<name>admin</name>
<password>$1$z6HPcW$nIHgNp6EXWzN.l9SlhAVE1</password>
<role>administrator</role>
</userid>
<userid>
<name>guest</name>
<password>$1$YEkflk$EEEV0mzCClp9oFVWVAiba1</password>
<role>guest</role>
</userid>
<userid>
<name>oper</name>
<password>$1$1iSWr$S64yY2AzheWLDhSdbwfQP0</password>
<role>operator</role>
</userid>
</users>
</admin>
</data>
</rpc-reply>]]>]]>
Section 4.3
Using XPaths with <get> and <get-config>
Instead of using a structure of hierarchical XML elements, you can use XPaths with the
<get>
and
<get-
config>
commands. XPaths are easy to construct and remove the need to specify the namespace of the data
path's root element in the query.
When using an XPath, do the following:
• specify the
<filter>
element's
type
attribute as
xpath
.
• specify the
<filter>
element's
select
attribute with the XPath to the desired element.
Содержание RUGGEDCOM MX5000RE
Страница 8: ...Table of Contents RUGGEDCOM NETCONF Reference Guide viii ...
Страница 12: ...Preface RUGGEDCOM NETCONF Reference Guide xii Customer Support ...
Страница 26: ...Chapter 1 Introduction RUGGEDCOM NETCONF Reference Guide 14 Sample Session Editing Data ...
Страница 40: ...Chapter 3 NETCONF Sessions RUGGEDCOM NETCONF Reference Guide 28 Killing a Session ...
Страница 64: ...Chapter 5 Changing Configuration Data RUGGEDCOM NETCONF Reference Guide 52 Committing Changes ...
Страница 148: ...Chapter 8 NETCONF XML Elements RUGGEDCOM NETCONF Reference Guide 136 validate ...