Subject: [Netconf] subtree filter normalization

From: Andy Bierman <[email-masked]>
Date: Mon, 16 Mar 2015 21:18:45 -0700

Hi,

I'm trying to rewrite some NETCONF code, and I cannot
tell if RFC 6241 allows for subtree filters to be normalized.
It is not clear how certain usage should be processed.

This text in 6.1, para 1 seems to suggest the filter does not
need to follow a schema.

   The server does not need to utilize any data-model-
   specific semantics during processing, allowing for simple and
   centralized implementation strategies.

I am not convinced NETCONF is correct here
(and I wrote a lot of this subtree text ;-)
IMO the server MUST return schema-valid content
for YANG modules it advertises,
and that requires the filter to be interpreted
and the response content normalized.

F0 is the well-behaved example on pg 25:

F0:
    <filter type="subtree">
       <top xmlns="http://example.com/schema/1.2/config">
         <users>
           <user>
             <name>fred</name>
           </user>
         </users>
       </top>
     </filter>

The RFC does not say if the 'name' select node can be repeated,
as in F1:

F1:
   <filter type="subtree">
       <top xmlns="http://example.com/schema/1.2/config">
         <users>
           <user>
             <name>fred</name>
             <name>barney</name>
           </user>
         </users>
       </top>
     </filter>

6.2.5, bullet 2 says these are ANDed together, so
filter F1 would not match anything.  IMO this should only
apply to different select leafs.  Duplicate select leafs
should be ORed together.  This will help normalization.

F2:
   <filter type="subtree">
       <top xmlns="http://example.com/schema/1.2/config">
         <users>
           <user>
             <name>fred</name>
           </user>
           <user>
             <name>fred</name>
           </user>
         </users>
       </top>
     </filter>

Is F2 allowed? (container user repeated)
Is the server required to collapse the entries for return
so the rpc-reply is schema-valid?
Same applies to F3 and F4.

F3: variant of F2
   <filter type="subtree">
       <top xmlns="http://example.com/schema/1.2/config">
         <users>
           <user>
             <name>fred</name>
           </user>
         </users>
         </users>
           <user>
             <name>fred</name>
           </user>
         </users>
       </top>
     </filter>

F4: variant of F2
   <filter type="subtree">
       <top xmlns="http://example.com/schema/1.2/config">
         <users>
           <user>
             <name>fred</name>
           </user>
         </users>
       </top>
      <top xmlns="http://example.com/schema/1.2/config">
         <users>
           <user>
             <name>barney</name>
           </user>
         </users>
       </top>
     </filter>

Andy