Re: [netmod] structured metadata for schema nodes using YANG extensions

Martin Björklund <mbj+ietf@4668.se> Thu, 14 March 2024 08:26 UTC

Return-Path: <mbj+ietf@4668.se>
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 D0034C151092 for <netmod@ietfa.amsl.com>; Thu, 14 Mar 2024 01:26:31 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.807
X-Spam-Level:
X-Spam-Status: No, score=-2.807 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_ZEN_BLOCKED_OPENDNS=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, URIBL_BLOCKED=0.001, URIBL_DBL_BLOCKED_OPENDNS=0.001, URIBL_ZEN_BLOCKED_OPENDNS=0.001] autolearn=ham autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=4668.se header.b="RuuP9M3O"; dkim=pass (2048-bit key) header.d=messagingengine.com header.b="nW8bMosB"
Received: from mail.ietf.org ([50.223.129.194]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w0PRvGQ52k68 for <netmod@ietfa.amsl.com>; Thu, 14 Mar 2024 01:26:25 -0700 (PDT)
Received: from out3-smtp.messagingengine.com (out3-smtp.messagingengine.com [66.111.4.27]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 16074C14F5EF for <netmod@ietf.org>; Thu, 14 Mar 2024 01:26:24 -0700 (PDT)
Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 4EA715C006D; Thu, 14 Mar 2024 04:26:21 -0400 (EDT)
Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Thu, 14 Mar 2024 04:26:21 -0400
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=4668.se; h=cc:cc :content-transfer-encoding:content-type:content-type:date:date :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1710404781; x=1710491181; bh=5/O/iFUv9J9quJxnfkYxVKKXOJRkmWFdBoMosHrgv8A=; b= RuuP9M3OvhvpXGj0La4E08Vu+zPM7PN4sAF8L6CunLODxNwatyHjAdln520Y7u/d sEIS++XHEPmhMRk8X4FNfuY0vpujhtgr9IJGuo/tKgt9JwO1FzshgmbPwmAbx7Tx Ucjh/Y5nlq4VZlCb5dbd5FJZbp866Hak5xSFyW0+e3tt7krDWKi50Z7GJ/TDuwS5 mMZVjiU55XRh1DPq3CltdzTzBdPs7oxOlvV9iYFd6Ry3WPjBG5azM+oC411ImSip w5ylG7H61r1zswrgXR8KX4y7MDY0YFelFadqUktq8NvRtdlsz5RjVNKNjtLVqCje +AS6/Vb47TRQREA7CmntLA==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1710404781; x= 1710491181; bh=5/O/iFUv9J9quJxnfkYxVKKXOJRkmWFdBoMosHrgv8A=; b=n W8bMosBQsT+Uo0ZFD82KJlZ+07qubd+PQ4PZlrWGas9n4wjDBCkIqeHalxnYpjKS mUDT3h9wvv3mk4zXtmFOL1ZyJCSPX+HTII0Q09jafBaZGsa3GrcIUugUYSU//Xly HXPWFMBKBcYj7U4LDUIVpBHwDlMal0QOZXgsY7iFGHGHTEsq+rtfZDsIsOB9zNJm i5rJb8RDHj3UlDJI37n3WfBrIeynZbZeGFUOqDsjdojslxmECTR1O7gL4rRnAdXn Rj0kGI3fruRploB5bYdTHkK0oZs9vzvL/dMI3a09DXBIO8WMBNTjVGTNQYh4/haG qi7MTThTsaxDcBFFUxRtA==
X-ME-Sender: <xms:rLTyZQTDnxR4PM0WDaSevVRhGi-dHHTmGycdqK3k1WFi3pOn0Rb9mA> <xme:rLTyZdy84dirZpZsFpQb_f7thzwM1526z-450iwHQ00ASXOeFeAxhnCR8waDQhXZV xB_NjQb_WvqayrfBgM>
X-ME-Received: <xmr:rLTyZd1p-wEtOwCxutM5URBRDzyEpGufKzTZGqhFXpMvh3D3d0OdX4tMGXCYlqgxqkfoKYovC142AMBNRi96ApkcVlLq6wP20w>
X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrjeeigdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgoufhushhpvggtthffohhmrghinhculdegledmne cujfgurhepfffkvfevuffhjghfofggtgfgsehtqhertdertddunecuhfhrohhmpeforghr thhinhcuuehjnphrkhhluhhnugcuoehmsghjodhivghtfhesgeeiieekrdhsvgeqnecugg ftrfgrthhtvghrnhephfehfeegtdehvdfhffdugeekuefhheehleeghfeugeeigfffhefh vdeikedvtdfhnecuffhomhgrihhnpehnohhkrdhithdpghhithhhuhgsrdgtohhmnecuve hluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgsjhdoihgv thhfseegieeikedrshgv
X-ME-Proxy: <xmx:rbTyZUANyDsMLZw_6WM9s0EG5o4BmBQgCHeFEeq7FwMNtJ_HSUV3iQ> <xmx:rbTyZZjoWCOQzfPBFT06ROfLERGP6o6ACR3QfscCnuLus3dMv3n45w> <xmx:rbTyZQo12qrD0D15WnwWfGqBX21K76NY36nappBPIkrW_CYzE6M2YQ> <xmx:rbTyZcgiZc5fNFQ2SYbcxht5vmfmvRuRAmeomUTzCE0QHHnnzLyS_Q> <xmx:rbTyZZaAm7p5gpoMnwpx5q2YrAyDSYNjU6t7h2hLmjy2w48ON7b6Dg>
Feedback-ID: icc614784:Fastmail
Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 14 Mar 2024 04:26:20 -0400 (EDT)
Date: Thu, 14 Mar 2024 09:26:17 +0100
Message-Id: <20240314.092617.1402769857121666317.id@4668.se>
To: jason.sterne@nokia.com
Cc: netmod@ietf.org
From: Martin Björklund <mbj+ietf@4668.se>
In-Reply-To: <SN6PR08MB48479709AB9B95C7594132579B2A2@SN6PR08MB4847.namprd08.prod.outlook.com>
References: <SN6PR08MB4847A4E43785C38E77331CC89B2B2@SN6PR08MB4847.namprd08.prod.outlook.com> <20240313.100742.1986844484799977524.id@4668.se> <SN6PR08MB48479709AB9B95C7594132579B2A2@SN6PR08MB4847.namprd08.prod.outlook.com>
X-Mailer: Mew version 6.8 on Emacs 27.1
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/1suDFDQr4-RbV7_iOd4OAFX2mpQ>
Subject: Re: [netmod] structured metadata for schema nodes using YANG extensions
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.39
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: Thu, 14 Mar 2024 08:26:31 -0000

"Jason Sterne (Nokia)" <jason.sterne@nokia.com> wrote:
> Thanks Martin.
> 
> I can see how that approach can be used to create a structure of containers and leafs (where each leaf could have a type). So that's helpful for some scenarios.
> 
> I'm not sure how to deal with leaf-lists or lists though.
> 
> If we wanted a leaf-list like this:
> 	myext:colors "red green"
> it isn't obvious to me how to extend the approaches in yang-next issue 54 to specify it. I'm also not sure how to specify the format of the "instance data" in the leaf-list or if there is any sort of "right" format for that. In my example I show space separated names (any separator may need escape mechanisms).

A "leaf-list" would be:

  myext:color "red";
  myext:color "green";

It could be specified as:

  extension color {
    argument color-name {
      tailf:arg-type {
        type enumeration {
          enum red;
          enum green;
        }
      }
    }
    tailf:occurence "*";
  }



> 
> Similarly I'm not sure how a list could work. In theory extension "saturation" could be a substatement of extension "color" and then "color" could have an argument. That could act as a sort of list:

Yes.

But the approach we took was to be able to specify a grammar for
extension statements so that they could express what ordinary YANG can
do, rather than having a way to add "instance data" to a module.


/martin



> 
> extension color {
>     argument "color-name";
> }
> extension saturation {
>     argument "saturation-level";
>     tailf:use-in "myext:color";
> }
> 
> Leaf foo {
>     myext:color "red" {
>         saturation "45";
>     }
>     myext:color "blue" {
>         saturation "12";
>     }
> 
> Maybe another approach is to somehow allow full RFC 9195 instance data to be the argument of an extension, and then also have some way to define the data model of that instance data as part of the extension definition.
> 
> Jason
> 
> > -----Original Message-----
> > From: Martin Björklund <mbj+ietf@4668.se>
> > Sent: Wednesday, March 13, 2024 5:08 AM
> > To: Jason Sterne (Nokia) <jason.sterne@nokia.com>
> > Cc: netmod@ietf.org
> > Subject: Re: [netmod] structured metadata for schema nodes using YANG
> > extensions
> > 
> > 
> > CAUTION: This is an external email. Please be very careful when clicking links or
> > opening attachments. See the URL nok.it/ext for additional information.
> > 
> > 
> > 
> > "Jason Sterne \(Nokia\)" <jason.sterne=40nokia.com@dmarc.ietf.org> wrote:
> > > Hi all,
> > >
> > > I'm looking for information about doing more complex YANG extensions
> > > that the basic <name,value> type, e.g.:
> > > oc-ext:openconfig-version "2.5.0";
> > 
> > See https://github.com/netmod-wg/yang-next/issues/54 for a discussion
> > about one approach.
> > 
> > 
> > 
> > /martin
> > 
> > 
> > 
> > 
> > 
> > 
> > >
> > > The node-tags approach doesn't fit what I'm trying to do (tags can't
> > > have values).
> > >
> > > RFC7950 says the following:
> > >    The substatements of an
> > >    extension are defined by the "extension" statement, using some
> > >    mechanism outside the scope of this specification.  Syntactically,
> > >    the substatements MUST be YANG statements, including extensions
> > >    defined using "extension" statements.
> > >
> > > Let me start with a simple example and build on it. Say I want to
> > > associate a color with any schema node. That's easy:
> > >
> > >     extension color {
> > >         argument "color";
> > >         description "Takes a value of red, green or blue";
> > >     }
> > >
> > >     leaf foo {
> > >         myext:color "red";
> > >     }
> > >
> > > But what if I want a more complex structure for my color metadata like
> > > this?  (a leaf-list and leaf inside a container)
> > >
> > >     leaf foo {
> > >         myext:chroma-metadata {
> > >             myext:colors "red green";
> > >             myext:saturation "45";
> > >         }
> > >
> > > >From what I can tell, I'd have to define it like this:
> > >
> > >     extension chroma-metadata {
> > >     }
> > >     extension colors {
> > >         argument "color-list";
> > >         description "sub-statement of chroma-metadata. Space separated list of
> > >         colors red, green and blue.";
> > >     }
> > >     extension saturation {
> > >         argument "saturation-level";
> > >         description "sub-statement of chroma-metadata";
> > >     }
> > >
> > > Or if I wanted a list like this?
> > >
> > >     myext:chroma-metadata {
> > >         myext:color "red" {
> > >             myext:saturation "45";
> > >         }
> > >         myext:color "green" {
> > >             myext:saturation "23";
> > >         }
> > >     }
> > >
> > > I don't think there is any formal way to do it, but could I say that
> > > the structure of the chroma-metadata follows a grouping I define?
> > >
> > >     grouping cm-struct {
> > >         list color {
> > >             leaf saturation { ... }
> > >         }
> > >     }
> > >
> > > Could another option be to just define the top level extension
> > > chroma-metadata with a single argument, and then describe that the
> > > argument itself is a json-ietf blob of instance data that conforms to
> > > YANG grouping xyz?
> > >
> > > Jason (he/him)
> > >