Subject: [netmod] Question about node identifiers naming scheme

From: Qi Sun <[email-masked]>
Date: Mon, 9 Feb 2015 14:32:57 +0100

Hi netmod, 

I’m recently working on YANG modelling with some compiling tools. I find something a little confusing to me, about the node identifier naming scheme.

It seems that the “key words” defined in RFC6020 can also be used as a node identifier, which might cause confusions. For example:

leaf “container” {
	type uint16;
}

The above definition is valid and passes the compiling. It represents a node called “container” but is actually a leaf node, which is not allowed to “contain” more than one node. 

I checked with RFC6020, where there is no such restrictions like “the word ‘container/import/module/uint32’ SHOULD NOT be used as a node identifier”. (Like in C++ language, one is not allowed to use “case” as an identifier for a user-defined parameter)

I’m wondering if the naming scheme like the above example makes sense. Since I’m relatively new to the wg, I might have missed some stories about the develop of YANG language. Please feel free to correct me if my understanding is wrong. 

Thanks!
Qi Sun

---

From: Ladislav Lhotka <[email-masked]>
Date: Mon, 9 Feb 2015 14:42:58 +0100

> On 09 Feb 2015, at 14:32, Qi Sun <[email-masked]> wrote:
> 
> Hi netmod, 
> 

This is perfectly legal, albeit perhaps not very wise. You can see other examples in the existing NETMOD modules, e.g. this is quite common:

leaf “description” {
    type string;
    …
}

> I checked with RFC6020, where there is no such restrictions like “the word ‘container/import/module/uint32’ SHOULD NOT be used as a node identifier”. (Like in C++ language, one is not allowed to us…

It poses no problems is YANG because of the fixed structure of statements. A more appropriate comparison is with XML schema languages, and they all allow this.

Lada

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

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C

---

From: Qi Sun <[email-masked]>
Date: Mon, 9 Feb 2015 14:49:25 +0100

OK. Thanks for the explanation!

Cheers,
Qi