Re: [netmod] YANG 1.1: clarify nested submodule behavior

Ladislav Lhotka <lhotka@nic.cz> Fri, 09 May 2014 09:54 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E4A051A023D for <netmod@ietfa.amsl.com>; Fri, 9 May 2014 02:54:47 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ej9jSr1mbP3q for <netmod@ietfa.amsl.com>; Fri, 9 May 2014 02:54:45 -0700 (PDT)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 6B7161A023C for <netmod@ietf.org>; Fri, 9 May 2014 02:54:45 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1]) by trail.lhotka.name (Postfix) with ESMTP id 5A2F85405BE; Fri, 9 May 2014 11:54:39 +0200 (CEST)
Received: from trail.lhotka.name ([127.0.0.1]) by localhost (trail.lhotka.name [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mNsQ-uXMbaRR; Fri, 9 May 2014 11:54:35 +0200 (CEST)
Received: from localhost (unknown [172.29.2.201]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by trail.lhotka.name (Postfix) with ESMTPSA id 6D47754000E; Fri, 9 May 2014 11:54:34 +0200 (CEST)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Andy Bierman <andy@yumaworks.com>, Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <CABCOCHSocNhJob91_4UsNBvDC5rp7=QDGNNtNFeVGqkkGkrCaA@mail.gmail.com>
References: <CABCOCHRN85zz1JT_5HauSrwZzCFoH3Hz2Z07j5Yh+mDGC5xeoA@mail.gmail.com> <20140507.222120.122843926.mbj@tail-f.com> <A543A9BC-9F1A-4154-8CBB-B0A52EC9C3EB@nic.cz> <20140508.095426.686508493610810924.mbj@tail-f.com> <CABCOCHSocNhJob91_4UsNBvDC5rp7=QDGNNtNFeVGqkkGkrCaA@mail.gmail.com>
User-Agent: Notmuch/0.17 (http://notmuchmail.org) Emacs/24.3.50.2 (x86_64-apple-darwin13.0.0)
Date: Fri, 09 May 2014 11:54:33 +0200
Message-ID: <m2y4ybnup2.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/6D8_h82JnsCvP0kfOaoeiB8BxVw
Cc: "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] YANG 1.1: clarify nested submodule behavior
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: NETMOD WG list <netmod.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netmod>, <mailto:netmod-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/netmod/>
List-Post: <mailto:netmod@ietf.org>
List-Help: <mailto:netmod-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netmod>, <mailto:netmod-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 09 May 2014 09:54:48 -0000

Andy Bierman <andy@yumaworks.com> writes:

> On Thu, May 8, 2014 at 12:54 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
>
>> Ladislav Lhotka <lhotka@nic.cz> wrote:
>> >
>> > On 07 May 2014, at 22:21, Martin Bjorklund <mbj@tail-f.com> wrote:
>> >
>> > > Andy Bierman <andy@yumaworks.com> wrote:
>> > >> On Wed, May 7, 2014 at 9:11 AM, Martin Bjorklund <mbj@tail-f.com>
>> > >> wrote:
>> > >>> I am confused.   There are no additional namespaces today - just one,
>> > >>> introduced by the module.  What did you agree on?
>> > >>>
>> > >>>
>> > >> There are 2 issues -- we agree on 1
>> > >>
>> > >> 1) how to indicate that submodule contents are exported from the main
>> > >> module
>> > >>     to external modules?
>> > >>
>> > >>    a) include must be in main module
>> > >>    b) include must be in main module or submodule
>> > >>
>> > >> 2) what definitions are visible within a submodule?
>> > >>
>> > >>    a) only self and includes
>> > >>    b) main module, self, and includes
>> > >
>> > > Thank you, this is a clear summary of the alternatives.
>> > >
>> > > I think we were all over the map when we discussed this during the
>> > > initial design of YANG.  We looked at all these alternatives, and
>> > > ended up with what we have today.  I'll go back and look in the
>> > > archives to see how much of the discussions are captured.
>> >
>> > I wasn't there. :-)
>> >
>> > >
>> > > One design rule we had was that we wanted it to be possible to compile
>> > > / check each submodule on its own (only follow explicit
>> > > import/include), w/o having to bring in the complete module.  With
>> > > option 2b, this is no longer possible.
>> >
>> > I don't think this is important - the top-level definitions from the
>> > main module and all submodules are easy to look up. On the other hand,
>> > submodules cannot use conflicting names even if they don't include
>> > each other, so it doesn't help submodule writers in this respect.
>> >
>> > >
>> > > Re. issue 1, it seems to me no real problem is solved by going from 1a
>> > > to 1b.
>> >
>> > I agree. It would be different if a submodule tree could be grafted to
>> > a non-root node, but it is not the case.
>> >
>> > >
>> > > Re. issue 2, solution 2b actually solves a real problem - today you
>> > > have to place common definitions in a separate submodule; they cannot
>> > > go into the main module.  Since circular includes are not possible,
>> > > references within a module (across submodules) have to be done
>> > > carefully, and might impose a non-intuitive submodule design.
>> >
>> > Right, this is a serious contender for the most peculiar rule in YANG.
>> >
>> > >
>> > > So I think we need to think more about this, but solution 2b seems
>> > > attractive to me.
>> >
>> > With 1a, the following is a logical option:
>> >
>> > 2c) main module and all submodules included from it.
>>
>> Yes, that's how I interpreted 2b!  Essentially each submodule has
>> access to all definitions in all other submodules.
>>
>>
> This is what I wanted from the start.
> That is why I do not agree that the include-stmts need to be in the main
> module.
>
> module A {
>    prefix a;
>    include B;
>    container foo;
>  }
>  submodule B {
>     belongs-to A { prefix a; }
>     include C;
>  }
>  submodule C {
>     belongs-to A { prefix a; }
>     leaf top { type string; }
>     augment /a:foo {
>        leaf should-be-ok { type string; }
>      }
>  }
>
> IMO, the include-stmts just say "go find this file and add all the
> definitions to the module namespace". Therefore, leaf 'top'
> is visible in the main module and also to external modules.
> This is the detail we do not agree on.  Forcing the include-stmt
> to also appear in the main module seems like a CLR.

The include statement would appear *only* in the main module. I think it is better because the main module is advertized but submodules aren't, so it's safer to get all submodules in one step and from an authoritative source. With includes in submodules it is IMO much more likely that the server and client will unintentionally work with different data models.  

>
> It is not really OK to declare that submodules can use definitions
> without include-stmts, unless we don't care about the self-compiling
> sub-modules. (IMO a real low priority). If so, then it is also
> OK to allow submodules to access the main module definitions.

Since submodules aren't really isolated, I think the self-compilation is largely a red herring. A submodule defining a name that's in conflict with the main module will be sucessfully compiled even though it is broken.  

Lada

>
>
>> /martin
>>
>
> Andy

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