Re: [netmod] Use XML namespaces in YANG document examples

Andy Bierman <andy@yumaworks.com> Mon, 14 February 2022 18:15 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 3C5943A0908 for <netmod@ietfa.amsl.com>; Mon, 14 Feb 2022 10:15:15 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.887
X-Spam-Level:
X-Spam-Status: No, score=-6.887 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_HI=-5, SPF_HELO_NONE=0.001, T_SPF_PERMERROR=0.01, 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.20210112.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 1UvgAXaXRm-x for <netmod@ietfa.amsl.com>; Mon, 14 Feb 2022 10:15:05 -0800 (PST)
Received: from mail-lf1-x132.google.com (mail-lf1-x132.google.com [IPv6:2a00:1450:4864:20::132]) (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 0678F3A0A99 for <netmod@ietf.org>; Mon, 14 Feb 2022 10:15:03 -0800 (PST)
Received: by mail-lf1-x132.google.com with SMTP id u6so32309016lfc.3 for <netmod@ietf.org>; Mon, 14 Feb 2022 10:15:03 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yumaworks-com.20210112.gappssmtp.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=+yXhhJPDYGG26j6DuwpwYY0OlKgFIcmqFNb8Gke6GUA=; b=RHSYTyc4jy0ccHOLgqaW8BAS/Ivy4TOSqJXjXry3yxAU7Fa/hcwszi1YUpXM8taJ6x mYSppAw8kIWgeCB4Fnl0k7ahK8CX9DaE/8uVwQ9wL1eKHXqtuiTBuS8tapwSReHR0hcO tVvcObrtNg2CywGgpHJToLxPLwC3JsjRCpagVRkKTd/teMhGzWlE3JWj0sVfJmvOEsqq V36lNGVKgj6DFzoeKJZTwrLvPchudgAosJiK+tTLHW8TbndngL3RSuBod+2IBkEWNulY SOXQ/8d1Gu91hMLFfRUsfxXsu6plaHsNV1stsSONrHChjI7+YotYt/c6Vja2OSti1yZR RIQQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=+yXhhJPDYGG26j6DuwpwYY0OlKgFIcmqFNb8Gke6GUA=; b=Pya5d5hP/PppOASrc28MoEEjMLYLurKP7ZosdBcjHS/Shbmflr7zlnL8TrcCthI98X qyI83rwnntZyREQ5zLPE55t0Maq7qIa0uAXi3+aioSp4iJMDBrZsmD1a3YHaDmPeCrcN vGA/iJYjw7ZdubCNDGTk4b5Nv+zkUTlvs99D1q1DjiCrUMotfXuTYb/koP8gcT6mrB6X slsDxeqFoaG0aTWzFX5zGjhnKXWLYpiE7/93lN7Mi4UKMDuxLkbL/nGy2D1QeMCcN3Zv epnBYrUNym1O5Ip+dLH+AoId4h8nan8h5FKtz8sXj6WvalR8r4rsOtQjIaT3o5i05m2o 8fiw==
X-Gm-Message-State: AOAM533O16gxortLxTrcv9YqQQR95kz7RsEMSsq7fLB7e701EFJUc723 lvnG9j0jY7BjJ3xWyeo3uhwu0pVWkXzRZ2crPXHDZn+8mjIzkw==
X-Google-Smtp-Source: ABdhPJzCsBZKG6IHDNDCMYEBpleC8n0nlJYbGJV4udr46h/v1DAJ5zkUZ7PSbhQ41BIQeHQQ34a/1IFDIjD2on4U/Bs=
X-Received: by 2002:a05:6512:1398:: with SMTP id p24mr159634lfa.635.1644862499314; Mon, 14 Feb 2022 10:14:59 -0800 (PST)
MIME-Version: 1.0
References: <866e763b-88ce-ca3f-300a-7f702467fe7c@mg-soft.si> <20220204.161536.1816358672148417997.id@4668.se> <5BDB40B2-F191-41BC-92DF-BD0A94B6E992@gmx.com> <20220207200304.qhkvwrxwl5i56qqk@anna> <AM7PR07MB6248E7E96CBA846EC59C2DC4A02F9@AM7PR07MB6248.eurprd07.prod.outlook.com> <B30D2207-BE27-4E68-A9D1-3F17B0154345@tzi.org> <AM7PR07MB62480FC33CDC9A1FA31CFE26A02F9@AM7PR07MB6248.eurprd07.prod.outlook.com> <F9A842A4-DCD4-4860-BA4A-6AB341583ED4@tzi.org> <AM7PR07MB6248796A4130EA81F152886AA0309@AM7PR07MB6248.eurprd07.prod.outlook.com> <AM7PR07MB6248CCC0A25127719C516582A0319@AM7PR07MB6248.eurprd07.prod.outlook.com> <20220212145640.2bzp5p524fdx443i@anna> <CABCOCHS5fqKMVa1=Db5aVU99RySD19fjBSLypD2qnr4=vB4dAw@mail.gmail.com> <878rudizsh.fsf@nic.cz> <BB26DD4D-93A0-4A7A-B991-428F76213A59@cisco.com>
In-Reply-To: <BB26DD4D-93A0-4A7A-B991-428F76213A59@cisco.com>
From: Andy Bierman <andy@yumaworks.com>
Date: Mon, 14 Feb 2022 10:14:48 -0800
Message-ID: <CABCOCHRdJ96Pzxjf7ua5==5H4sFkCbMXtzisrToXcEB5WO9LaQ@mail.gmail.com>
To: "Jan Lindblad (jlindbla)" <jlindbla@cisco.com>
Cc: Ladislav Lhotka <ladislav.lhotka@nic.cz>, Jürgen Schönwälder <j.schoenwaelder@jacobs-university.de>, "Rob Wilton (rwilton)" <rwilton@cisco.com>, tom petch <ietfc@btconnect.com>, "netmod@ietf.org" <netmod@ietf.org>
Content-Type: multipart/alternative; boundary="000000000000fa01f605d7fe6442"
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/9LpTMmvoon-ongyJQxOWTYRdWqY>
Subject: Re: [netmod] Use XML namespaces in YANG document examples
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, 14 Feb 2022 18:15:15 -0000

On Mon, Feb 14, 2022 at 1:19 AM Jan Lindblad (jlindbla) <jlindbla@cisco.com>
wrote:

> Just to add to the complexity here, it's not only about identityrefs.
>
> People (including IETF) have also defined types that use qname:s inside
> YANG strings, which the servers and clients would have to recognize and
> treat properly in order to interoperate well.
>
> module ietf-yang-types {
> ...
>   typedef xpath1.0 {
>     type string;
>     description
>      "This type represents an XPATH 1.0 expression.
>
>       When a schema node is defined that uses this type, the
>       description of the schema node MUST specify the XPath
>       context in which the XPath expression is evaluated.";
>     reference
>      "XPATH: XML Path Language (XPath) Version 1.0";
>   }
>
>

Good point.  Not just a server implementation detail I guess.
We had a YANG extension for this before this xpath type came out.
https://www.yumaworks.com/pub/latest/yangauto/yumapro-yangauto-guide.html#ncx-xpath

The server implementation definitely needs to know (early in the
processing) which strings are plain strings
and which are XPath expressions.  Usually it is too late to get the
namespace bindings
after the XML parser is finished.

Maybe a solution for YANG 2.0...
Create a standard algorithm to convert QName and xpath:1.0 strings to a
canonical format,
using the module-name approach defined in RFC 7951.

For now, there is no real problem to solve. Supporting YANG 1.1 requires the
implementation to be aware of XML prefixes in string node content.
Leaf value comparisons involving strings with XML prefixes are not reliable.
(Maybe a whole new can of worms there...)



> /jan
>
>
Andy


> On 14 Feb 2022, at 10:05, Ladislav Lhotka <ladislav.lhotka@nic.cz> wrote:
>
> Andy Bierman <andy@yumaworks.com> writes:
>
> On Sat, Feb 12, 2022 at 6:57 AM Jürgen Schönwälder <
> j.schoenwaelder@jacobs-university.de> wrote:
>
> I agree that this should not go forward as is.
>
> The XML representation of YANG instance data does indeed use QNames in
> element values and hence applications must be able to resolve XML
> namespace prefixes. If this is not clear enough in RFC 7950, then we
> need to address the lack of clarity where it belongs to be addressed.
>
> If we were to add a warning to all (past and) future YANG modules to
> help implementors who did not read RFC 7950, then the warning should
> be concise ("Applications using the XML representation of YANG
> instance data must be able to resolve XML namespace prefixes."). My
> preference, though, is to assume that implementors read RFC 7950 when
> they are not sure how to implement the prefixes correctly.
>
>
> It seems clear that this is not an issue specific to a particular YANG
> module,
> so the fix needs to be an errata against RFC 7950.
> The text in question is probably limited to the first paragraph (first
> sentence).
>
> 9.10.3 <https://datatracker.ietf.org/doc/html/rfc7950#section-9.10.3>.
> Lexical Representation
>
>   An identityref is lexically represented as the referred identity's
>   qualified name as defined in [XML-NAMES
> <https://datatracker.ietf.org/doc/html/rfc7950#ref-XML-NAMES>].  If
> the prefix is not
>   present, the namespace of the identityref is the default namespace
>   in effect on the element that contains the identityref value.
>
>
>
> The problem is that XML-NAMES only applies to elements and attributes (not
> string node content).
>
>
> I looked into XSLT 2.0, sec. 5.1 [1], hoping that we could use it as a
> model, but it became clear to me that we have a bigger problem: equality of
> identityref values isn't properly defined in YANG. We resolved this in YANG
> 1.1 for identityrefs appearing in XPath expressions by adding the functions
> "derived-from" and "derived-from-or-self", but the problem still persists
> e.g. when comparing identityref values serving as list keys (sec. 9.1 in
> RFC 7950 doesn't help here).
>
> Lada
>
> [1] https://www.w3.org/TR/xslt20/#qname
>
>
> I do not know the proper replacement text for the first sentence, but it
> seems maybe
> a specific definition of the expanded name for identityref:
>
>   The expanded name for an identityref value consists of a namespace name
> equal
>   to a module namespace (defined in 5.3) and a local name equal to an
> identity identifier.
>   The reffered identity is defined within the module bound to the module
> namespace
>   value.
>
>
>
> /js
>
>
>
>
> Andy
>
>
>
> On Sat, Feb 12, 2022 at 12:54:18PM +0000, tom petch wrote:
>
> Going back to the original issue and so top-posting.
>
> NSF Monitoring Interface YANG Data Model
> is on the IESG Telechat  17feb2022.
>
> It contains the text - not an easy read unless you are an XML expert -
> "In order for the XML
>   data to be used correctly, the prefix (i.e., the characters before
>   the colon or 'nsfmi' in the example) in the content of the element
>   that uses the "identityref" type (e.g., /i2nsf-event/i2nsf-system-
>   detection-alarm/alarm-category/) in the YANG module described in this
>   document MUST be the same as the namespace prefix (i.e., 'nsfmi' in
>   the example) for urn:ietf:params:xml:ns:yang:ietf-i2nsf-nsf-
>   monitoring.  Therefore, XML software MUST be chosen that makes the
>   namespace prefix information available."
>
> This is the result of discussions between IANA and the XML directorate,
>
> which I have seen copied to the WG list, and seems to me to be in direct
> contradiction of the consensus of the NETMOD WG list as shown in the
> discussions this month on this thread over the DHCP I-D and a separate
> thread on the I2NSF I-D in January and is likely to be a source of
> confusion for the future.
>
>
> NSF-Facing Interface YANG Data Model
> is on the same Telechat but I do not see the same text.
>
> I would like an AD to throw a flag, in the shape of a DISCUSS so I am
>
> copying Robert.
>
>
> My take is that the text should not be included in any I-D based on the
>
> consensus of the NETMOD WG (as I perceive it).  One suggestion was that it
> needed an update to RFC7950 to make it justified.
>
>
> (Also, my rant of 2022, these late stage non-WG interventions should not
>
> be over-riding the WG discussions but that is not going to change any time
> soon).
>
>
> Tom Petch
> ________________________________________
> From: netmod <netmod-bounces@ietf.org> on behalf of tom petch <
>
> ietfc@btconnect.com>
>
> Sent: 11 February 2022 17:03
>
> From: Carsten Bormann <cabo@tzi.org>
> Sent: 11 February 2022 08:21
>
> (I’m also still not sure I’ve got an answer to my question about
>
> using inconsistent prefixes between YANG and the XML example.  What is
> being demonstrated here?)
>
>
> <tp>
> If you are referring to
> " Is there a reason to violate the SHOULD?"
>
>
> I’m referring to the question I was trying to ask when I said this :-)
>
> I did not see that as related to the thread but thought it was
>
> answered anyway by Juergen.  As he said, the SHOULD gets violated when
> prefix clash which, in the absence of a registry, a namespace, for prefix
> is possible.
>
>
> Yes, and thanks to him for answering my question as a general question.
>
> I was answering to a throwaway note that the authors got flak when their
>
> XML did not use the defined prefix.  My question was: why do that, then?
> Maybe that was not understood because “ianaift” actually *is* the prefix
> preferred in the YANG module, so my question doesn’t make sense.  (I’m not
> sure what the throwaway referred to.)
>
>
> <tp>
>
> Try again.
>
> I have commented a number of times on a YANG import which defines a
>
> prefix other than that in the RFC.  Last month, it was
>
>     import ietf-hardware {
>       prefix ietfhw;
> Usually, when I comment on this, the authors accept my comment and
>
> change the prefix - they did on this occasion - but sometimes I get
> pushback along the lines that YANG Guidelines is only a 'SHOULD' and we
> think that we have a good reason to ignore the 'SHOULD' .  To date, I have
> never agreed with the reason and go on commenting:-)  If that is flack,
> then yes, I have - and will - generate flack:-)
>
>
> Tom Petch
>
>
> Grüße, Carsten
>
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>
>
> --
> Jürgen Schönwälder              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
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>
>
> --
> Ladislav Lhotka
> Head, CZ.NIC Labs
> PGP Key ID: 0xB8F92B08A9F76C67
>
> _______________________________________________
> netmod mailing list
> netmod@ietf.org
> https://www.ietf.org/mailman/listinfo/netmod
>
>
>