Chapter 4
Getting Data
</users>
</admin>
</data>
</rpc-reply>]]>]]>
Section 4.4.2
Specifying Objects with XPaths
When using XPath, use the following syntax in the select statement:
select="{element}/.../{element}[{element}='{data}']/{element}"/>
• {element} is an element in the data model.
• ... represents multiple elements in the data model to the target element.
• {data} is the identifying data for the object whose information you want to retrieve.
For example, to return the role for a specific user, send an rpc-message similar to the following:
<rpc message-id="3030"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" with-defaults="true">
<get>
<filter type="xpath"
select="admin/users/userid[name='oper']/role"/>
</get>
</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="3030">
<data>
<admin xmlns="http://ruggedcom.com/ns/rmf_admin">
<users>
<userid>
<name>oper</name>
<role>operator</role>
</userid>
</users>
</admin>
</data>
</rpc-reply>]]>]]>
Section 4.5
Getting Default Values
The NETCONF standard does not require NETCONF servers to return the default values from the database. If you
query an object that has a default value, the server may return just the data structure and not the default value.
For example, the NETCONF Trace Log Enabled setting is disabled by default. When you query this value, NETCONF
does not return the default setting. When you issue this query:
<rpc message-id="3030"
xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
<get>
<filter type="xpath" select="admin/logging/diagnostics/xpath-trace-log/enabled" />
</get>
34
RUGGEDCOM NETCONF
Reference Guide
Specifying Objects with XPaths