Re: [netmod] yang-data-ext issues

Andy Bierman <andy@yumaworks.com> Mon, 16 April 2018 14:55 UTC

Return-Path: <andy@yumaworks.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 77B9F126B6E for <netmod@ietfa.amsl.com>; Mon, 16 Apr 2018 07:55:09 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.61
X-Spam-Level:
X-Spam-Status: No, score=-2.61 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001, T_DKIMWL_WL_MED=-0.01] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=yumaworks-com.20150623.gappssmtp.com
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 psY_n1uMpK_y for <netmod@ietfa.amsl.com>; Mon, 16 Apr 2018 07:55:07 -0700 (PDT)
Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com [IPv6:2a00:1450:4010:c07::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 82FFC124319 for <netmod@ietf.org>; Mon, 16 Apr 2018 07:55:06 -0700 (PDT)
Received: by mail-lf0-x235.google.com with SMTP id g203-v6so22518077lfg.11 for <netmod@ietf.org>; Mon, 16 Apr 2018 07:55:06 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nSS/A06gQoOiZ4RiW6z1VmWmIqMAR6nRhVHZrHP5c/8=; b=HkSsKJqz0j7c5R3CWRiSTMHhlOidYDknAc3vOw6AffFgwLqWyLGd32nYIpsoxO2xq/ SUyEdXS5LDI5SFhQhArzw9nxwgvlvpYnwlzvFJyaGr+GBSPnVkeJypCZClo+Qk4Oz4W+ X2+XflkAxIQSRTMuvL08b54oWzWTF6ctwPGhdNTnFRx+S0HBx6AU8Vb1vcr5HWbFUtY/ KMs3kQ6mLuc/WJG17jqYGnzQH0lVVrudGFJ3IXacBbQt32wekbIvGplFyKNv+B9Gk9uy 8gLBsEYjXm46xvkektJWRX+PNqGaCKHCDIz7nMMAErM0g3pLr+QhQnJKyUIdTmcZcplJ 6uSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=nSS/A06gQoOiZ4RiW6z1VmWmIqMAR6nRhVHZrHP5c/8=; b=lSPUgHCw6kPcYlZ1iAOmE3tzXTuf90BTWOQosAxSOC1XockxUH0JZJ6IU+ix3kd+TC jm7poLSpMkVbTAykgywCIjdVRX6nBPL0prw9Of3v1KNLFOOjviQjmhIl/ssZrcs9tWOG Zjm0EXZgo1CWmfEL/60bkcDFjO61FiKo1r2dMNEHUMyEjnwLryF8xWTDNX0f5y7GPu1U qT1nxv0Sisdw5NlpyFjORgAIpN7SqU7bLPEmg56wYbb8M5PoItg0uHIyR1EjX2H1YgAd nDoF9HgN48P0UFeJl1L+Idio1zjwphFCk+DVbfuIGR/PDUSWdyYsVvZbldDgQOm8LwyY 5BuA==
X-Gm-Message-State: ALQs6tBChVqevkwJH9PCsam59uOwVreJyuEy5bXFpV7GOGmG4jccvClJ QJ4oxA0fu5i7mYpPANcMLJ4F/zKol/hVrSBfbty6JQ==
X-Google-Smtp-Source: AIpwx4+cHEPWLwc8oQAHBF0tIUijKQB7ORjsZQHJgR1wNp6X0gWHDv9v9E0qnF5FDTa7lDj6b9URzV5DLlxXcK/+8FQ=
X-Received: by 2002:a19:a087:: with SMTP id j129-v6mr1011921lfe.101.1523890504719; Mon, 16 Apr 2018 07:55:04 -0700 (PDT)
MIME-Version: 1.0
Received: by 2002:a19:d8c6:0:0:0:0:0 with HTTP; Mon, 16 Apr 2018 07:55:03 -0700 (PDT)
In-Reply-To: <f5336084-ebc5-de9e-35f8-89730db69b78@cisco.com>
References: <20180416.145617.1262098657698751846.mbj@tail-f.com> <f5336084-ebc5-de9e-35f8-89730db69b78@cisco.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Mon, 16 Apr 2018 07:55:03 -0700
Message-ID: <CABCOCHRY9tOoz4PB-EtrU4pC1o3Qi22_AX887yU_Mo2cx8mSAw@mail.gmail.com>
To: Joe Clarke <jclarke@cisco.com>
Cc: Martin Bjorklund <mbj@tail-f.com>, NetMod WG <netmod@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000003616470569f86861"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/XUouMRhpki2vcCggC9BkA7XP-TA>
Subject: Re: [netmod] yang-data-ext issues
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.22
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, 16 Apr 2018 14:55:09 -0000

On Mon, Apr 16, 2018 at 6:33 AM, Joe Clarke <jclarke@cisco.com>; wrote:

> On 4/16/18 08:56, Martin Bjorklund wrote:
> > Hi,
> >
> > While preparing draft-ietf-netmod-yang-data-ext-02, it turned out that
> > it is not clear what, if any, restrictions should be enforced for
> > yang-data structures.  Even among the authors we have different ideas
> > for how this should work.
> >
> > Background:
> >
> > In 8040, the original yang-data extension had a restriction that said
> > that a yang-data structure MUST have exactly one container, since it
> > wouldn't be possible to have a yang-data structure in an XML instance
> > document otherwise.
> >
> > Since people want to use yang-data structures in other places, this
> > restriction was lifted in the new draft:
> >
> >    There is no longer an assumption that a yang data structure can
> >    only be used as a top-level abstraction, instead of nested within
> >    some other data structure.
> >
> >
> > With this in mind, here's a use case that I think we ought to support:
> >
> >   rpc my-first-rpc {
> >     description
> >       "Bla bla...
> >        If an error occurs, <error-info> will contain an instance of
> >        the yang-data structure 'my-first-rpc-error-info'.";
> >     ...
> >   }
> >
> >   yang-data my-first-rpc-error-info {
> >     leaf reason { ... }
> >     container user-info { ... }
> >   }
> >
> >   rpc my-second-rpc {
> >     description
> >       "Bla bla...
> >        If an error occurs, <error-info> will contain an instance of
> >        the yang-data structure 'my-second-rpc-error-info'.";
> >     ...
> >   }
> >
> >   yang-data my-second-rpc-error-info {
> >     leaf reason { ... }
> >     leaf important-url { ... }
> >   }
> >
> > (maybe in the future we could even have a YANG extension statement to
> > formalize the description:
> >
> >    rpc my-first-rpc {
> >      ...
> >      opx:error-info-structure my-first-rpc-error-info;
> >    }
> >
> > but this is not point now.)
> >
> > In the example above, note that the leaf "reason" is present in both
> > structures.  IMO this is not a problem, since these structures are
> > used in different contexts.
> >
> > My point is that I think we should impose as few restrictions as
> > possible to the yang-data extension.  It should be up to the user of
> > yang-data to ensure that the structure is defined in such a way so
> > that it can be used properly.  For example, a structure that is
> > supposed to describe an XML instance document cannot define two leafs
> > at the top level.
> >
> > If the WG agrees with what I wrote above, we need to change the
> > augment-yang-data extension so that you would write for example:
> >
> >   yx:augment-yang-data /ex:my-first-rpc-error-info/ex:user-info {
> >     ...
> >   }
> >
> > Comments?
>
> I found the "single container only" policy to be too restricting.  I was
> modeling data that would [typically] be serialized to something other
> than XML, and this just made me jump through more hoops than I wanted to
> use rc:yang-data.
>
> I agree with your laissez-faire proposal here.  I think there should be
> some text to the same effect about how it is up to the author of the
> yd:yang-data elements to make sure the modeled data can be encoded as
> they require.
>
>

How will your tool handle this?


module foo {
   x:yang-data fake-namespace1 {
      container top { ... }
   }

   x:yang-data fake-namespace2 {
      container top { ... }
   }

   container top { ... }

}


You parse an artifact file:

<top  xmlns="module-foo-namespace">
   <next> ... </next>
</top>

Current YANG says that the <toip> node can only be defined once.
This makes it possible for a parser to pick the correct schema.
If 2 or or more yang-data definitions have this name (foo:top)
then how does your tool pick the right one.?

This existing restriction in YANG serves a useful purpose.
Removing it would be unwise.

There is no restriction to limit the yang-data to a container.
This has already been removed.


My counter-proposal is to remove the argument for yang-data
since it servers no purpose:


  x:yang-data  {
     container top { ... }
  }

  x:yang-data {
      list bar { ... }
   }

Joe
>
>

Andy



> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>