Subject: [netmod] augment issue

From: Andy Bierman <[email-masked]>
Date: Thu, 3 Apr 2014 20:19:05 -0700

Hi,

I am trying to work through a customer-found bug.
When the external augment leafref path is validated, the
parser does not find the 'type' leaf in the 'name' path-stmt.
(See below).

Notice that the ../type part of the expression
has no prefix.  In YANG that means it defaults to
the 'config' module.

But the odl-sal-netconf-connector-cfg module is
augmenting the dom-register container with 'type'
and 'name' leafs that are in its own namespace,
not in the config namespace.  The XPath parser
does not think 'type' is a valid child node there,
since the module name is wrong.

Is there a way the 'name' path-expr can be written so it will match
the namespace for the expanded grouping?

Is this a general problem with XPath inside groupings (i.e.,
the target namespace of the final expanded objects is not known)?
Is this a YANG 1.1 issue?

Andy

>From config.yang:

    grouping service-ref {
        description
            "Type of references to a particular service instance. This type
             can be used when defining module configuration to refer to a
             particular service instance. Containers using this grouping
             should not define anything else. The run-time implementation
             is expected to inject a reference to the service as the value
             of the container.";

        leaf type {
            description
                "Type of the service being referenced. Users of this
grouping
                 should refine this leaf with required-identity pointing to
                 the actual service-type which is actually required.";

            mandatory true;
            type service-type-ref;
        }

        leaf name {
            mandatory true;
            type leafref {
                path
"/config:services/config:service[config:type=current()/../type]/config:instance/config:name";
            }
        }
    }

>From odl-sal-netconf-connector-cfg.yang:

            container dom-registry {
                uses config:service-ref {
                    refine type {
                        mandatory true;
                        config:required-identity
dom:dom-broker-osgi-registry;
                    }
                }
            }

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 04 Apr 2014 07:34:35 +0200 (CEST)

> has no prefix.  In YANG that means it defaults to

No, inside a grouping, unprefixed names resolve to the module where
the grouping is (eventually) instantiated.

>From 6.4.1:

   o  Names without a namespace prefix belong to the same namespace as
      the identifier of the current node.  Inside a grouping, that
      namespace is affected by where the grouping is used (see
      Section 7.12).

/martin

---

From: Andy Bierman <[email-masked]>
Date: Fri, 4 Apr 2014 01:35:25 -0700

>       namespace is affected by where the grouping is used (see

OK -- except the path-expr is considered a schema node identifier (6.5)
not an XPath expression (6.4.1) So this text in 6.5 seems relevant:

   References to identifiers defined in external modules MUST be
   qualified with appropriate prefixes, and references to identifiers
   defined in the current module and its submodules MAY use a prefix.

The text in 6.4.1 does not seem to also apply to sec. 6.5.

Andy

---

From: Martin Bjorklund <[email-masked]>
Date: Fri, 04 Apr 2014 10:41:38 +0200 (CEST)

Andy Bierman <[email-masked]> wrote:
> not an XPath expression (6.4.1)

No, path is not a schema node identifier.  See section 9.9.2, where it
is defined as a restricted XPath expression:

   The "path" XPath expression is conceptually evaluated in the
   following context, in addition to the definition in Section 6.4.1:

So it does explicitly refer to 6.4.1.

/martin