marvin-zhao / pyang

Automatically exported from code.google.com/p/pyang
0 stars 0 forks source link

Type identifier namespace #18

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Probably I have a problem with understanding of the specification
draft-ietf-netmod-yang-05.

The specification says:
* All derived type names defined within a parent node or at the top-     
level of the module or its submodules share the same type identifier
namespace.  This namespace is scoped to the parent node or module.

If I get it correctly, the following example should be considered as valid:
module type-uniqueness
{
    namespace "urn:test";
    prefix u1;

    container interface2 {
    typedef str1 {
        type string;
    }
    container interface2 {
        typedef str1 {
        type string;
        }
    }
    } 
}

Because both types are defined within different parent nodes and not at the
top-level of the module, i.e. the type identifiers belong to different
identifier namespaces. But pyang considers this as a collision.

If I the namespace for types is really defined in this way, then the
example should be invalid:

module type-uniqueness
{
    namespace "urn:test";
    prefix u1;

    container interface2 {
    typedef str1 {
        type string;
    }
    container interface2 {
        typedef str2 {
        type str1;
        }
    }
    } 
}

Because the second type definition is out of the 'str1' type scope. 

Original issue reported on code.google.com by kur...@gmail.com on 8 May 2009 at 9:36

Attachments:

GoogleCodeExporter commented 9 years ago

Original comment by mbj4...@gmail.com on 11 May 2009 at 7:58

GoogleCodeExporter commented 9 years ago
I see that it was corrected in the specification and now it's clearly defined:
"All derived type names defined within a parent node or at the top-level of the
module or its submodules share the same type identifier namespace.  This 
namespace is
scoped to all descendant nodes of the parent node or module.  This means that 
any
descendent node may use that typedef, and it MUST NOT define a typedef with the 
same
name".

The issue can be closed.

Original comment by kur...@gmail.com on 28 Jul 2009 at 2:57

GoogleCodeExporter commented 9 years ago

Original comment by mbj4...@gmail.com on 28 Jul 2009 at 10:26