Subject: [netmod] Specification on netconf modifications to xpath filtering

From: Xiao SHI <[email-masked]>
Date: Mon, 3 Nov 2014 08:19:45 -0500

Hi folks,

I was looking into the xpath filtering capabilities in netconf, especially
the part in Section 8.9.5.1 (
https://tools.ietf.org/html/rfc6241#section-8.9.5.1)

===Question 1===
The RFC reads: All ancestor nodes of the result node MUST be encoded first,
so the <data> element returned in the reply contains only fully specified
subtrees, according to the underlying data model.

How does this interact with XPATH union?

For example, if we had a data model:
list top {
  leaf server-id;
  leaf user-count;
  list user {
    key name;
    leaf name;
  }
}

If I would like to select any user whose name is Fred and include the
server they are on as well as the user-count on those servers, I would use
XPATH query filter such as the following:

<rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <get-config>
        <source>
            <running/>
        </source>
        <filter xmlns:t="http://example.com/schema/1.2/config"
                type="xpath"
                select="/t:top/t:user[t:name='fred']/../server-id |
/t:top/t:users/t:user[t:name='fred']/../user-count |
/t:top/t:users/t:user[t:name='fred']"/>
    </get-config>
</rpc>

Say the node set returned by the XPATH result is the following:
<server-id>myServer1</server-id>
<user-count>99</user-count>
<user><name>fred</name></user>
<server-id>myServer3</server-id>
<user-count>123</user-count>
<user><name>fred</name></user>

According to the NETCONF modification, the ancestor nodes of each node in
this node set will be encoded first, meaning the returned XML contains only
fully specified subtrees. "For each such subtree, the path from the data
model root node down to the subtree, including any elements or attributes
necessary to uniquely identify the subtree, are included in the response
message." (Sec 8.9.1)

I see two options depending on how this modification process is evaluated
in netconf:
Option 1: each node/subtree in the node set is evaluated individually and
produced the following output:
<top><server-id>myServer1</server-id></top>
<top><user-count>99</user-count></top>
<top><user><name>fred</name></user></top>
<top><server-id>myServer3</server-id></top>
<top><user-count>123</user-count></top>
<top><user><name>fred</name></user></top>

Option 2: each node is put into context of the data model, and yields the
following output:
<top>
  <server-id>myServer1</server-id>
  <user-count>99</user-count>
  <user><name>fred</name></user>
</top>
<top>
  <server-id>myServer3</server-id>
  <user-count>123</user-count>
  <user><name>fred</name></user>
</top>

Which one would NETCONF server produce?

===Question 2===
The second paragraph reads: If any sibling or ancestor nodes of the result
node are needed to identify a particular instance within a conceptual data
structure, then these nodes MUST also be encoded in the response.

I was wondering how a server would know whether a node is needed to
"identify the instance within a conceptual data structure," i.e. is there a
detailed specification for that (other than the key of a list)?

Thank you!
Xiao