Re: [YANG] so many naming scopes

Andy Bierman <ietf@andybierman.com> Thu, 03 January 2008 20:19 UTC

Return-path: <yang-bounces@ietf.org>
Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1JAWX4-0006EN-5U; Thu, 03 Jan 2008 15:19:14 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JAWX2-0006EH-RL for yang-confirm+ok@megatron.ietf.org; Thu, 03 Jan 2008 15:19:12 -0500
Received: from [10.91.34.44] (helo=ietf-mx.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JAWX2-0006E9-He for yang@ietf.org; Thu, 03 Jan 2008 15:19:12 -0500
Received: from smtp121.sbc.mail.sp1.yahoo.com ([69.147.64.94]) by ietf-mx.ietf.org with smtp (Exim 4.43) id 1JAWX0-0007VV-7X for yang@ietf.org; Thu, 03 Jan 2008 15:19:12 -0500
Received: (qmail 78137 invoked from network); 3 Jan 2008 20:19:09 -0000
Received: from unknown (HELO ?192.168.0.10?) (andybierman@att.net@68.120.80.25 with plain) by smtp121.sbc.mail.sp1.yahoo.com with SMTP; 3 Jan 2008 20:19:09 -0000
X-YMail-OSG: oER.1A4VM1lKWYyqRnHBiKGLBQaZu8a2QeyvpFckV1KItbfcp_VhLpfwjwrzaFdOZHBMWVP9wCkcwRcDWamMXmJp
Message-ID: <477D433C.1000709@andybierman.com>
Date: Thu, 03 Jan 2008 12:19:08 -0800
From: Andy Bierman <ietf@andybierman.com>
User-Agent: Thunderbird 2.0.0.9 (Windows/20071031)
MIME-Version: 1.0
To: Martin Bjorklund <mbj@tail-f.com>
Subject: Re: [YANG] so many naming scopes
References: <477D2D00.2010108@andybierman.com> <20080103.204950.147781910.mbj@tail-f.com>
In-Reply-To: <20080103.204950.147781910.mbj@tail-f.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: 0.0 (/)
X-Scan-Signature: b5d20af10c334b36874c0264b10f59f1
Cc: yang@ietf.org
X-BeenThere: yang@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: YANG modeling Language for NETCONF <yang.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www1.ietf.org/pipermail/yang>
List-Post: <mailto:yang@ietf.org>
List-Help: <mailto:yang-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=subscribe>
Errors-To: yang-bounces@ietf.org

Martin Bjorklund wrote:
> Andy Bierman <ietf@andybierman.com> wrote:
>> Hi,
>>
>> Sec. 6.2 lists several naming scopes for various YANG constructs.
>> Most of it seems fine, except I am concerned about the confusion factor
>> that can result:
>>
>> module foo {
>>    namespace "http://example.com/foo-ns";
>>    prefix "foo";
>>    description "do you have anything without foo in it?";
>>
>>    typedef foo {
>>      type int32;
>>    }
>>
>>    grouping foo {
>>      leaf x { type foo; }
>>    }
>>
>>    container foo {
>>      leaf a { type foo; }
>>      uses foo;
>>      choice b {
>>        case foo {
>>          leaf c { type foo; }
>>        }
>>        case b {
>>          container d {
>>            uses foo;
>>          }
>>        }
>>      }
>>    }
>>
>> }
>>
>>
>> Is this much flexibility such a good idea?
> 
> Maybe not.
> 
>> I don't think the lack of individual naming scopes for every
>> type of identifier has been a big problem in the SNMP world.
> 
> No, but I don't think we should have a single flat namespace for
> identifiers like SNMP has.  I can live with one namespace per nesting
> level though.
> 

Yes, of course one naming scope (the term namespace is taken)
amongst siblings, except nested typedef and grouping names
cannot mask similar definitions within an ancestor node,
or globally within the same module.  (This part already in the draft.)

OK:

   container foo {
     container foo { ... }
   }

Not OK:

  container foo {
    typedef foo { type int32; }
    container foo {
      typedef foo { type int32; }    // invalid! masks previous typedef
      leaf foo { type foo; }
    }
  }


Only the top level definitions can be exported to other modules.
SMIv2 rules are too restrictive for XML naming, but the ability is lost
to import nested leafs like 'ifIndex' in addition to top-level objects
like 'ifTable'.  The schema-nodeid Xpath form must be used
to access such nodes (/if:ifTable/if:ifIndex).


> Earlier we had a separate namespace for rpcs and a separate for
> notifications as well, but the drawback with that was that we couldn't
> use 'augment' to augment these, so we had to have separate statements
> 'augment-rpc' and 'augment-notification'.  Having a single namespace
> actually made 'augment' more flexible.
> 
> 
> /martin
> 
> 


Andy


_______________________________________________
YANG mailing list
YANG@ietf.org
https://www1.ietf.org/mailman/listinfo/yang