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

Andy Bierman <andy@yumaworks.com> Fri, 09 May 2014 02:50 UTC

Return-Path: <andy@yumaworks.com>
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 6BD131A0143 for <netmod@ietfa.amsl.com>; Thu, 8 May 2014 19:50:10 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] 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 Pz6vEcefkp0q for <netmod@ietfa.amsl.com>; Thu, 8 May 2014 19:50:07 -0700 (PDT)
Received: from mail-qc0-f182.google.com (mail-qc0-f182.google.com [209.85.216.182]) by ietfa.amsl.com (Postfix) with ESMTP id 5A45E1A0139 for <netmod@ietf.org>; Thu, 8 May 2014 19:50:07 -0700 (PDT)
Received: by mail-qc0-f182.google.com with SMTP id e16so3833055qcx.41 for <netmod@ietf.org>; Thu, 08 May 2014 19:50:02 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=RJQUJF+Vr+kQBZeTHtPNLqyiyKjcWXoEOz5/L8NHkJs=; b=CuJ9Fjpqmvy7MW4kGBfEZeInOQ1TQHJtoTxgpQhH856Yx1HnknEPx9PAkRMToeXD7e c8nLzPXZRQQqfp/67WVG/Rjvj0VEPgqlXKUKNR8cl43CMO7vhLinlaaAAbNR7jZJDxuc H/QdqcQvPaM18ehnKOkW78sL1qvOOtIsHJCV/YQyXZQ4VC1yd83Hm3UuWauPCBLJcs56 RIPJT2piEDJ2PeZXwj3UvBxvrNDB5FN+Iw9pvTCnHb/lFxJgKUAlJDvjTA0QQwXJzaAM xo2UE6Sy9H8UPrxTu4ABaAIvhOk+FcWppN5/ncFsvoOqqOfom7gNaManhWwr5iTB3kvA A4nA==
X-Gm-Message-State: ALoCoQkzOd9/1JYnWX7kLnv2wZair3NovAqgIbFQ4aPgf4J+Gdmoh90/xY0S9h/GecRGhYcleZuj
MIME-Version: 1.0
X-Received: by 10.140.36.105 with SMTP id o96mr9970826qgo.25.1399603802502; Thu, 08 May 2014 19:50:02 -0700 (PDT)
Received: by 10.140.104.49 with HTTP; Thu, 8 May 2014 19:50:02 -0700 (PDT)
In-Reply-To: <20140508.095426.686508493610810924.mbj@tail-f.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>
Date: Thu, 08 May 2014 19:50:02 -0700
Message-ID: <CABCOCHSocNhJob91_4UsNBvDC5rp7=QDGNNtNFeVGqkkGkrCaA@mail.gmail.com>
From: Andy Bierman <andy@yumaworks.com>
To: Martin Bjorklund <mbj@tail-f.com>
Content-Type: multipart/alternative; boundary="001a11c17334798c9b04f8eea77c"
Archived-At: http://mailarchive.ietf.org/arch/msg/netmod/outSrHHnGNAbimYGUEeMdoxb0-U
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 02:50:10 -0000

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.

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.


> /martin
>

Andy