Subject: [netmod] Dont reuse list and container names

From: Balazs Lengyel <[email-masked]>
Date: Tue, 28 Jul 2009 18:03:27 +0200

Hello,
YANG data modules will often be mapped to Java and C++ code and to other modeling
languages, that use complex types and managed objects like 3GPP, SAF.  Often these
mappings will create a manage object or a class for each container and list. If the list
names and container names are not unique the mapping will fail. Having unique names will
also make YAMs easier to read. I propose to add to the Yang-Usage guidelines:

"The common set of names of containers and lists in a YANG module and its submodules
SHOULD only contain unique names."

Balazs,

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Tue, 28 Jul 2009 18:25:11 +0200

On Tue, Jul 28, 2009 at 06:03:27PM +0200, Balazs Lengyel wrote:

> YANG data modules will often be mapped to Java and C++ code and to
> other modeling languages, that use complex types and managed objects
> like 3GPP, SAF.  Often these mappings will create a manage object or
> a class for each container and list. If the list names and container
> names are not unique the mapping will fail. Having unique names will
> "The common set of names of containers and lists in a YANG module
> and its submodules SHOULD only contain unique names."

I disagree. Either they MUST be unique (I do not agree to this change
at this point in time) or tools must be able to make identifiers
unique when they create code. And from the SMIv2 experience, I know
that languages really differ in their understanding of what an
identifier is. Do not open that box.

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1, 28759 Bremen, Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>

---

From: Andy Bierman <[email-masked]>
Date: Tue, 28 Jul 2009 10:34:54 -0700

> SHOULD only contain unique names."

I do not agree with this.
By definition, objects from groupings will have the same name.
XML does not place any requirement on nested name uniqueness,
just sibling name uniqueness.

I think code generators need to deal with:
 - objects from uses-stmt (duplicates will come up)
 - the dash and dot chars are not allowed in identifiers within code.
 - YANG identifiers can be infinite length

So name mangling is already mandatory for tools to implement.

> Balazs,

Andy

---

From: Ladislav Lhotka <[email-masked]>
Date: Tue, 28 Jul 2009 22:36:04 +0200

> names and container names are not unique the mapping will fail. Having unique names will

Then these mappings can mangle names to make them unique. DSDL mapping
does this with names of groupings and types.

Lada

> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod
-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C

---

From: Balazs Lengyel <[email-masked]>
Date: Wed, 29 Jul 2009 14:14:38 +0200

Hello,
Yes name mangling can be done. However the more mangling is done the more difficult it is 
to see the connection between the original YANG and the generated documents, models, code. 
Is there any real need to reuse names?
Balazs

---

From: Balazs Lengyel <[email-masked]>
Date: Wed, 29 Jul 2009 14:22:52 +0200

> So name mangling is already mandatory for tools to implement.

BALAZS: Some mangling will be mandatory for the tools. But the smaller the changes for 
mangling, and the less it is used, the better the readability of the generated document, code.

Balazs

---

From: Andy Bierman <[email-masked]>
Date: Wed, 29 Jul 2009 05:33:32 -0700

Balazs Lengyel wrote:
> Hello,
> Yes name mangling can be done. However the more mangling is done the
> more difficult it is to see the connection between the original YANG and
> the generated documents, models, code. Is there any real need to reuse
> names?

groupings cause names to be reused.

Andy

---

From: Juergen Schoenwaelder <[email-masked]>
Date: Wed, 29 Jul 2009 14:54:19 +0200

On Wed, Jul 29, 2009 at 02:14:38PM +0200, Balazs Lengyel wrote:

> more difficult it is to see the connection between the original YANG
> and the generated documents, models, code.  Is there any real need
> to reuse names?

Since we plan for success, a flat namespace will bite us.

And repeating myself, the amount of name mangling code generators need
to do is target language specific and in reality you almost always
have to do some target language mangling.

/js

---

From: Ladislav Lhotka <[email-masked]>
Date: Wed, 29 Jul 2009 15:38:45 +0200

> Is there any real need to reuse names?

Flat namespace was identified as one of the main shortcomings of DTD. In
effect, name mangling would then happen in the primary data model:

container ospf {
    container ospf-interface {
      ....
    }
    ....
}

Lada

Lada  
-- 
Ladislav Lhotka, CESNET
PGP Key ID: E74E8C0C