Re: [netmod] References to the "tags" typedef

Martin Bjorklund <mbj@tail-f.com> Mon, 07 October 2019 08:00 UTC

Return-Path: <mbj@tail-f.com>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 56ED112002F for <netmod@ietfa.amsl.com>; Mon, 7 Oct 2019 01:00:12 -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, SPF_HELO_NONE=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 9svjUtxDWqbO for <netmod@ietfa.amsl.com>; Mon, 7 Oct 2019 01:00:10 -0700 (PDT)
Received: from mail.tail-f.com (mail.tail-f.com [46.21.102.45]) by ietfa.amsl.com (Postfix) with ESMTP id 1C6C0120020 for <netmod@ietf.org>; Mon, 7 Oct 2019 01:00:10 -0700 (PDT)
Received: from localhost (unknown [173.38.220.41]) by mail.tail-f.com (Postfix) with ESMTPSA id A3C661AE018A; Mon, 7 Oct 2019 10:00:08 +0200 (CEST)
Date: Mon, 07 Oct 2019 09:59:43 +0200
Message-Id: <20191007.095943.1870966155557583692.mbj@tail-f.com>
To: rwilton@cisco.com
Cc: J.Schoenwaelder@jacobs-university.de, balazs.lengyel@ericsson.com, netmod@ietf.org
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <MN2PR11MB4366FEF4B3817E3605D29BBDB59E0@MN2PR11MB4366.namprd11.prod.outlook.com>
References: <MN2PR11MB436662777568D8D4746FCED0B59E0@MN2PR11MB4366.namprd11.prod.outlook.com> <20191004093533.cvxscnkgr5y4gh2p@anna.jacobs.jacobs-university.de> <MN2PR11MB4366FEF4B3817E3605D29BBDB59E0@MN2PR11MB4366.namprd11.prod.outlook.com>
X-Mailer: Mew version 6.7 on Emacs 25.2 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/acRpymy8rPrwbEsRNtL1OIcDODU>
Subject: Re: [netmod] References to the "tags" typedef
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.29
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: <https://mailarchive.ietf.org/arch/browse/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: Mon, 07 Oct 2019 08:00:12 -0000

"Rob Wilton (rwilton)" <rwilton@cisco.com> wrote:
> [Copying Balazs because this discussion is moving to instance-data
> document schema definitions.]
> 
> > -----Original Message-----
> > From: Schönwälder, Jürgen <J.Schoenwaelder@jacobs-university.de>
> > Sent: 04 October 2019 10:36
> > To: Rob Wilton (rwilton) <rwilton@cisco.com>
> > Cc: Christian Hopps <chopps@chopps.org>; Mahesh Jethanandani
> > <mjethanandani@gmail.com>; netmod@ietf.org
> > Subject: Re: [netmod] References to the "tags" typedef
> > 
> > On Fri, Oct 04, 2019 at 08:17:33AM +0000, Rob Wilton (rwilton) wrote:
> > >
> > > To use the "tags:tag" typedef, ietf-yang-package had an import on
> > > "ietf-
> > module-tags" which both defines a tags type and also a "module-tags"
> > container as well.  I want the typedef, but not the container, because
> > I
> > don't want the schema for the package file to be:
> > >       +--ro yang-package  <-- I do want this
> > >       |  +--ro name                      yang:yang-identifier
> > >       |  ...
> > >       +--ro module-tags   <--  I don't want this
> > >          +- ...
> > >
> > 
> > Isn't import-only-module in YANG library take care of this?
> [RW] 
> Yes, that is one solution.
> 
> The instance data document (probably in JSON, but I've given an XML
> snippet below) could use the "inline-spec" for specifying the schema.
> 
> But this means that every package instance file, needs to have some
> boilerplate like this before the actual package definition.:
> 
> <?xml version="1.0" encoding="UTF-8"?>
> <instance-data-set xmlns=
>     "urn:ietf:params:xml:ns:yang:ietf-yang-instance-data">
>   <name>some-yang-package</name>
>   <inline-spec>ietf-yang-library@2019-01-04.yang</inline-spec>
>   <inline-content-schema>
>     <yang-library xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
>       <module-set>
>         <name>all</name>
>         <module>
>           <name>ietf-yang-package</name>
>           <revision>2019-09-11</revision>
>         </module>
>         <import-only-module>
>           <name>ietf-yang-package-types</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>         <import-only-module>
>           <name>ietf-module-tags</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>         <import-only-module>
>           <name>ietf-yang-revisions</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>         <module>
>           <name>ietf-yang-structure-ext</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>         <module>
>           <name>ietf-yang-types</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>         <module>
>           <name>ietf-yang-library</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>         <module>
>           <name>ietf-inet-types</name>
>           <revision>xxxx-xx-xx</revision>
>         </module>
>       </module-set>
>     </yang-library>
>   </inline-content-schema>
>   <content-data>
>      // Actual package information goes here.
>   </content-data>
> </instance-data-set>
> 
> https://datatracker.ietf.org/doc/draft-ietf-netmod-yang-instance-file-format/?include_text=1
> 
> The YANG instance data draft provides some other choices:
> (1) (External Method) Don't define the schema, just assume that
> clients know what it will be for YANG packages.  E.g. it would be
> specified in the YANG packages RFC.

I prefer this solution for the packages document.

> (2) (URI method) Put the schema in a separate instance data document
> and reference that.  This could be defined in the YANG packages RFC,
> but it might open the question of what URI can you use to retrieve it.
> (3) Simplified inline schema.
> 
> It is the third one that I would ideally like to use.

Ugh, I haven't paid enough attention to the instance data
document... I will comment on this design in a separate email.

> Here, the package data would like something like this (sorry, in JSON
> this time):
> 
>   "ietf-yang-instance-data:instance-data-set": {
>     "name": "example-ietf-network-device-pkg",
>     "module": [ "ietf-yang-package@2019-09-11.yang" ],
>     "description": "YANG package definition",
>     "content-data": {
>       "ietf-yang-package:yang-package": {
>         "name": "example-ietf-network-device-pkg",
>         // Actual package information goes here.
>       }
>     }
>   }
> 
> Here, the schema is defined by the "module" line
> "ietf-yang-package@2019-09-11.yang".  I think that there are some
> details to work out, but I think that the import dependencies for
> "ietf-yang-package.yang" could be automatically resolved as
> import-only YANG modules.  I have also tried to minimize the required
> imports (e.g. don't import YANG library, perhaps don't import from
> module-tags).

You shouldn't have to do that.  You should use the appriopriate
types.

> In terms of typedefs, are two typedefs equivalent if they have exactly
> the same definition in two different modules?  Or does the fact that
> they are named given them a slightly different meaning?

By reusing appriopriate typedefs you get clearer semantics.  In the
extreme case everyting is just strings with some descripton statements
(you might think that this is absurd, but this approach has been taken
by some data model designers (not necessarily yang) ...)


/martin

> 
> Thanks,
> Rob
> 
> 
> > 
> > /js
> > 
> > --
> > Juergen Schoenwaelder           Jacobs University Bremen gGmbH
> > Phone: +49 421 200 3587         Campus Ring 1 | 28759 Bremen | Germany
> > Fax:   +49 421 200 3103         <https://www.jacobs-university.de/>
> 
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>