I've got a couple of questions about the interaction of "uses" and
"augment".  I hope that these have straightforward answers that the old
hands can tell me easily enough.

1. Augmenting a grouping

I notice that "augment" is not allowed to target a "grouping", despite
that naively seems to be an operation that a module designer might like
to do.  I expect that there is a reason why this is not allowed.

For example:

     module foo {
       ...
       grouping target {
         leaf address {
           type inet:ip-address;
           description "Target IP address.";
         }
         leaf port {
           type inet:port-number;
            description "Target port number.";
         }
       }
     }

     module bar {
       ...
       import foo {
         ...
       }
       augment "/foo:target" {
         leaf new-leaf {
           type string;
         }
       }
    }

     module baz {
       ...
       import foo {
         ...
       }
       container main {
         uses foo:target;
       }
    }

giving an effective schema:

       container main {
         leaf address {
           type inet:ip-address;
           description "Target IP address.";
         }
         leaf port {
           type inet:port-number;
            description "Target port number.";
         }
         leaf new-leaf {
           type string;
         }
       }

This construct seems to be well-defined to me, other than that it's not
immediately clear what namespace baz:main/new-leaf is in.  (For some
reason, I reflexively think that it's in bar's namespace, not baz's, but
I can't state any reasoning for that.)

2.  "augment" as a substatement of "uses"

In section 7.17:

   The "augment" statement allows a module or submodule ...  to add to
   the nodes from a grouping in a "uses" statement.

When I first read this, I took it to mean that an "augment" substatement
adds a peer node to the set of nodes 'from a grouping in a "uses"
statement'.  But I suspect that it is intended to mean that an "augment"
only adds nodes *under* one of the nodes from the grouping.  There's an
ambiguity that could be fixed by better wording.

7.17 also says:

   If the "augment" statement is a substatement to the
   "uses" statement, the descendant form (defined by the rule
   "descendant-schema-nodeid" in Section 14) MUST be used.

My understanding is that "descendant-schema-nodeid" is an XPath
expression, and that the "context node" for its evaluation is the node
to which the "uses" statement adds nodes -- but that doesn't seem to be
stated anywhere.

(Those last two I should have caught in my Gen-ART review!)

Thanks for any information,

Dale

_______________________________________________
netmod mailing list
[email protected]
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to