Subject: [netmod] Leaf node ambiguity in container elements

From: Alex Dickinson <[email-masked]>
Date: Fri, 24 Apr 2009 14:55:50 -0700

Hello,

Suppose I define the following container:

container aaa {

  leaf bar {
    description: "Some configuration parameter"
    mandatory: false;
    type: string;
  }

  leaf bar {
    description:
      "Some other configuration parameter, but distinct from
       the first"
    mandatory: false;
    type: int;
  }
}

Now given the following XML instance document:

<aaa>
  <bar>123</bar>
</aaa>

It is ambiguous as to which bar leaf node definition that the <bar>
element represents.

Are there any constraints present in the YANG spec that prevents the
initial container from being formed?

Cheers,
Alex Dickinson

---

From: Andy Bierman <[email-masked]>
Date: Fri, 24 Apr 2009 18:13:53 -0700

>       "Some other configuration parameter, but distinct from

This is invalid YANG.

Section 6.2.1, bullet 7:

    o  All leafs, leaf-lists, lists, containers, choices, rpcs, and
       notifications defined within a parent node or at the top-level of
       the module or its submodules share the same identifier namespace.
       This namespace is scoped to the parent node or module, unless the
       parent node is a case node.  In that case, the namespace is scoped
       to the parent node of the case node's parent choice node.

Andy

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

---

From: Alex Dickinson <[email-masked]>
Date: Mon, 27 Apr 2009 09:08:17 -0700

>       to the parent node of the case node's parent choice node.

Ahhh, I see. Too many years of XML is blinding me I guess. Am I correct
in saying that the namespace of the identifiers bar nodes defined in the
aaa container would be in a namespace that is unique to the aaa
container, and not that of the defining module?

Thanks,
Alex

---

From: Andy Bierman <[email-masked]>
Date: Mon, 27 Apr 2009 09:58:31 -0700

> container, and not that of the defining module?

yes.  I guess sentences 2 and 3 are confusing.
The choice and case nodes are not present in the XML,
so they do no not define a naming scope in the YANG module
either.

Andy