Re: [netconf] YANG attributes in a datastore

Andy Bierman <andy@yumaworks.com> Tue, 10 December 2019 16:25 UTC

Return-Path: <andy@yumaworks.com>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id D734812082A for <netconf@ietfa.amsl.com>; Tue, 10 Dec 2019 08:25:20 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.898
X-Spam-Level:
X-Spam-Status: No, score=-1.898 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_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001] 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 vIfyCdhAuJ87 for <netconf@ietfa.amsl.com>; Tue, 10 Dec 2019 08:25:18 -0800 (PST)
Received: from mail-lj1-x22d.google.com (mail-lj1-x22d.google.com [IPv6:2a00:1450:4864:20::22d]) (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 91A1C120828 for <netconf@ietf.org>; Tue, 10 Dec 2019 08:25:17 -0800 (PST)
Received: by mail-lj1-x22d.google.com with SMTP id m6so20631063ljc.1 for <netconf@ietf.org>; Tue, 10 Dec 2019 08:25:17 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=q4M+rXwSkYXGd9S+HEG/lans/NerEJWmJyWqD5F2+RY=; b=P65NSNa0EOqyr/S2XHEvEHeLLopG5eECQKAwd6igXLzwmJFhfEFlL8HWTZGl6mhBr9 BKw0OvPY7Dp3SuxnYAbagSdKAM1gkgC+DBq7pJyVjW87Nm5631P6DSkeuJog6at4zT4s di4KfIiJEIQldj3hshL0oPuA2m6/MIcuOmqINN3JvjiMhAJ/r0fIZc7OKWssOsb2sJtZ vlaG7uu7XSlkm2JGcx6ExDBjoPw7Ei5s2h0fn64JeJY4+StyS4w/EbLSag9jszeDPoNh Imt0AVVNOYL0Ryq1g79NukGNfGW3Dj93jqbw56CT+rxyi3aOI3w++7bCZS9xgzMGIDdW Hu0Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=q4M+rXwSkYXGd9S+HEG/lans/NerEJWmJyWqD5F2+RY=; b=Jnd7cyBsjt+Tw1PIYCayJbsu32s9dnKLM8aJxvU8CIIk36zqjSz6D48+pKx+iRIMo3 fVj5x7R/vDlJyTp3gCTfLOzBc17Z6noQoYzOQ+r/qLSm/k9CyzLmV8R/O7uDZBKPa0iu Q9/dltraM95/Oq0Ki9qnTwttiJiHNhaGcFbqWb63O7swezulfzAC8JD1m377VowC/9On YuXC335HtERmCJbGtHjO2aL3eeAjJjZGqFkSCnZzkVMPRbML7wEFzz0OiWDB3OZ1RBFZ 0lsNnlx9RlHGzxnLhJzDhLvfqkz44J+9Q6Ut1Lm/9sOtsZ9o5KJ9FuvurBHJzRCkgASE GX3w==
X-Gm-Message-State: APjAAAWsi8Kfbhf9n6Eds6VeY1MHYw/z+N9gUU9iYZ3+0LtIQdggv1id Ni1ERFqGirw/tv/yt7ebJZRlqG4ccZPhN0z645wrJg==
X-Google-Smtp-Source: APXvYqyrU6PwdzYQtw2hdFMGp7UsA+iiuoTHTj/jIoFuDUg7/HVmb6Bz05t4wLtgluldoLZlNt++Cb3EtHm0RG9xF4A=
X-Received: by 2002:a2e:6e10:: with SMTP id j16mr21271573ljc.202.1575995115755; Tue, 10 Dec 2019 08:25:15 -0800 (PST)
MIME-Version: 1.0
References: <5cce-5def9a00-11-66c7ce00@101566344> <20191210.150333.2171238725445540389.mbj@tail-f.com> <AM0PR0702MB3665FD1B4EFB1797333EE77DF05B0@AM0PR0702MB3665.eurprd07.prod.outlook.com> <514fe834eaa528c42f6dc31009399a3392b05dfe.camel@nic.cz> <CABCOCHSgZYDOVC7cj=1jaf4_N4pWc0B5vXPDmtm93vw5srrRkQ@mail.gmail.com> <677480c1606c027b43afda383378a5a9320b15dd.camel@nic.cz>
In-Reply-To: <677480c1606c027b43afda383378a5a9320b15dd.camel@nic.cz>
From: Andy Bierman <andy@yumaworks.com>
Date: Tue, 10 Dec 2019 08:25:04 -0800
Message-ID: <CABCOCHQsxzX3raf8FmbXCcQp3mdfFRrcGhSP5c88cumhdNJDVw@mail.gmail.com>
To: Ladislav Lhotka <lhotka@nic.cz>
Cc: Netconf <netconf@ietf.org>
Content-Type: multipart/alternative; boundary="0000000000000aee6205995bf51f"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netconf/bHLGqeK-Yo3cYDAXic83m7oMAGY>
Subject: Re: [netconf] YANG attributes in a datastore
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: NETCONF WG list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 10 Dec 2019 16:25:21 -0000

On Tue, Dec 10, 2019 at 7:50 AM Ladislav Lhotka <lhotka@nic.cz> wrote:

> On Tue, 2019-12-10 at 07:42 -0800, Andy Bierman wrote:
> > Hi,
> >
> > YANG already has the "annotation" statement to define metadata.
> > YANG has data-def-stmt to define data.  It would be very unwise
> > to use metadata inside a leaf as if it were a leaf inside a container.
>
> A typical example is a "comment" annotation - you want to permit it
> basically
> everywhere but don't want to clutter the schema with "comment" leaves.
>
>
I understand the difference between annotation-stmt and leaf-stmt.
If the semantics can apply to all data nodes then annotation is appropriate.
We should not change the protocols and YANG to reinvent a leaf-stmt.

When we created YANG 1.0, we explicitly rejected the then-current style of
XML

   <address street="123 Elm" city="Anytown" zipcode="100036" />

We rejected the use of attributes as leafs. We should not change that
decision now.


Lada
>
>
Andy


> >
> >
> > Andy
> >
> >
> > On Tue, Dec 10, 2019 at 7:31 AM Ladislav Lhotka <lhotka@nic.cz> wrote:
> > > On Tue, 2019-12-10 at 14:58 +0000, Balázs Lengyel wrote:
> > > > Hello,
> > > > If we try to standardize editing metadata, we will face a number of
> issues
> > > > that need to be clarified:
> > > >
> > > > - Will you model whether the attribute (metadata) is writable?
> Config is
> > > > not an allowed substatement in
> > > https://tools.ietf.org/html/rfc7952#section-3
> > >
> > > In my view annotations should never be configuration because they
> should not
> > > influence the device state. The read-only/read-write propertly might be
> > > useful.
> > >
> > > > - Can a metadata have other additional properties? (mandatory,
> > > cardinality,
> > > > uniqueness of some kind?)
> > >
> > > By design, annotations do not have a specific place in the schema, so
> they
> > > cannot be mandatory.
> > >
> > > Cardinality: if you mean annotations with a list of values, this was
> > > discussed
> > > but rejected due to difficulties with XML encoding.
> > >
> > > > - If it is modified, will it be subject to validation,
> error-messages?
> > > Will
> > > > a bad metadata result in a failed error-config?
> > >
> > > I would say yes because otherwise it makes no sense to define them and
> their
> > > properties.
> > >
> > > Lada
> > >
> > > >
> > > > Regards Balazs
> > > >
> > > > -----Original Message-----
> > > > From: netconf <netconf-bounces@ietf.org> On Behalf Of Martin
> Bjorklund
> > > > Sent: 2019. december 10., kedd 15:04
> > > > To: mvasko@cesnet.cz
> > > > Cc: netconf@ietf.org
> > > > Subject: Re: [netconf] YANG attributes in a datastore
> > > >
> > > > Hi,
> > > >
> > > > Michal Vaško <mvasko@cesnet.cz> wrote:
> > > > > Hello,
> > > > > we are thinking about adding support for arbitrary attributes [1]
> in
> > > > > our YANG/NETCONF datastore. To my knowledge, only the
> representation
> > > > > in XML or JSON is defined and standardized but there are no
> guidelines
> > > > > for editing (CRUD) these attributes.
> > > > >
> > > > > So, my question is a rather general one, regarding implementations
> > > > > that support editing these attributes, would you mind sharing some
> > > > > basic ideas or principles used? Or is this outside any consensus
> and
> > > > > each implementation is free to handle this completely in its own
> > > > > fashion? Thanks for any input.
> > > >
> > > > I think this depends on the attribute defintion.  Some attributes are
> > > > read-only from the northbound's protocol point of view.  Internally
> in the
> > > > server you may need some API to set/change them of course.  Some
> other
> > > > attributes are read-write.
> > > >
> > > > In our implementation we support a few read-write attributes (and
> some
> > > > read-only).  Here's a simple example (in an edit-config):
> > > >
> > > >   <foo annotation="hello"/>
> > > >
> > > > This would set/change the "annotation" attribute's value to "hello",
> > > > regardless of its previous value.
> > > >
> > > > To delete an annotation, you would do:
> > > >
> > > >   <foo annotation=""/>
> > > >
> > > > Each of our attributes has a special value that means "delete" (in
> most
> > > > cases it is the empty string.
> > > >
> > > >
> > > > /martin
> > > >
> > > >
> > > >
> > > >
> > > > > Regards,
> > > > > Michal
> > > > >
> > > > > [1] https://tools.ietf.org/html/rfc7952
> > > > >
> > > > > _______________________________________________
> > > > > netconf mailing list
> > > > > netconf@ietf.org
> > > > > https://www.ietf.org/mailman/listinfo/netconf
> > > > >
> > > > _______________________________________________
> > > > netconf mailing list
> > > > netconf@ietf.org
> > > > https://www.ietf.org/mailman/listinfo/netconf
> > > > _______________________________________________
> > > > netconf mailing list
> > > > netconf@ietf.org
> > > > https://www.ietf.org/mailman/listinfo/netconf
> --
> Ladislav Lhotka
> Head, CZ.NIC Labs
> PGP Key ID: 0xB8F92B08A9F76C67
>
>