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

Ladislav Lhotka <ladislav.lhotka@nic.cz> Mon, 14 February 2022 09:05 UTC

Return-Path: <ladislav.lhotka@nic.cz>
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 5FB633A08ED for <netmod@ietfa.amsl.com>; Mon, 14 Feb 2022 01:05:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.9
X-Spam-Level:
X-Spam-Status: No, score=-6.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, 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 vBsgbENaTrWi for <netmod@ietfa.amsl.com>; Mon, 14 Feb 2022 01:05:24 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [217.31.204.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id C620C3A0CDB for <netmod@ietf.org>; Mon, 14 Feb 2022 01:05:22 -0800 (PST)
Received: from localhost (unknown [IPv6:2a01:5e0:29:ffff::d2d]) by mail.nic.cz (Postfix) with ESMTPSA id 2C6FE1409EE; Mon, 14 Feb 2022 10:05:19 +0100 (CET)
From: Ladislav Lhotka <ladislav.lhotka@nic.cz>
To: Andy Bierman <andy@yumaworks.com>, Jürgen Schönwäl der <j.schoenwaelder@jacobs-university.de>, Robert Wilton <rwilton@cisco.com>, tom petch <ietfc@btconnect.com>, "netmod@ietf.org" <netmod@ietf.org>
In-Reply-To: <CABCOCHS5fqKMVa1=Db5aVU99RySD19fjBSLypD2qnr4=vB4dAw@mail.gmail.com>
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>
Mail-Followup-To: Andy Bierman <andy@yumaworks.com>, Jürgen Schönwälder <j.schoenwaelder@jacobs-university.de>, Robert Wilton <rwilton@cisco.com>, tom petch <ietfc@btconnect.com>, "netmod@ietf.org" <netmod@ietf.org>
Date: Mon, 14 Feb 2022 10:05:18 +0100
Message-ID: <878rudizsh.fsf@nic.cz>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: quoted-printable
X-Virus-Scanned: clamav-milter 0.102.4 at mail
X-Virus-Status: Clean
Archived-At: <https://mailarchive.ietf.org/arch/msg/netmod/sQ9bTEbrX9VBtDZnDcXmzA-JmC8>
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 09:05:30 -0000

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