Re: [netmod] yang-json document

Ladislav Lhotka <lhotka@nic.cz> Thu, 12 February 2015 08:47 UTC

Return-Path: <lhotka@nic.cz>
X-Original-To: netmod@ietfa.amsl.com
Delivered-To: netmod@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id ABF3C1A0117 for <netmod@ietfa.amsl.com>; Thu, 12 Feb 2015 00:47:30 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9] autolearn=ham
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 UwXobSJwFKS2 for <netmod@ietfa.amsl.com>; Thu, 12 Feb 2015 00:47:28 -0800 (PST)
Received: from trail.lhotka.name (trail.lhotka.name [77.48.224.143]) by ietfa.amsl.com (Postfix) with ESMTP id 9FE591A003B for <netmod@ietf.org>; Thu, 12 Feb 2015 00:47:27 -0800 (PST)
Received: from localhost (unknown [195.113.220.110]) by trail.lhotka.name (Postfix) with ESMTPSA id EBB071CC0051; Thu, 12 Feb 2015 09:47:27 +0100 (CET)
From: Ladislav Lhotka <lhotka@nic.cz>
To: Andy Bierman <andy@yumaworks.com>, Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <CABCOCHT-B0BSzY1dTYAUPAfy1VbUyqgzSze53DN_XgHBL2Dycw@mail.gmail.com>
References: <CABCOCHTpH2-AQrHw0QN79AG6Ef7=MTN8EtSMxkOJEe79hPyjvA@mail.gmail.com> <20150210.215550.1438604762585678944.mbj@tail-f.com> <CABCOCHSLVXFoH_X4gFayG4y2KnsNEmDR7LBPKR1UcbOJ7zddDg@mail.gmail.com> <20150210.221935.1416907161721598337.mbj@tail-f.com> <CABCOCHT-B0BSzY1dTYAUPAfy1VbUyqgzSze53DN_XgHBL2Dycw@mail.gmail.com>
User-Agent: Notmuch/0.19 (http://notmuchmail.org) Emacs/24.4.51.2 (x86_64-apple-darwin14.0.0)
Date: Thu, 12 Feb 2015 09:47:26 +0100
Message-ID: <m2386b1ppd.fsf@birdie.labs.nic.cz>
MIME-Version: 1.0
Content-Type: text/plain
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/7UrAovT6WyvimdzKWIY4-LSuW6Q>
Cc: "netmod@ietf.org" <netmod@ietf.org>
Subject: Re: [netmod] yang-json document
X-BeenThere: netmod@ietf.org
X-Mailman-Version: 2.1.15
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: <http://www.ietf.org/mail-archive/web/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, 12 Feb 2015 08:47:30 -0000

Andy Bierman <andy@yumaworks.com> writes:

> On Tue, Feb 10, 2015 at 1:19 PM, Martin Bjorklund <mbj@tail-f.com> wrote:
>> Andy Bierman <andy@yumaworks.com> wrote:
>>> On Tue, Feb 10, 2015 at 12:55 PM, Martin Bjorklund <mbj@tail-f.com> wrote:
>>> > Andy Bierman <andy@yumaworks.com> wrote:
>>> >> On Tue, Feb 10, 2015 at 12:29 PM, Martin Bjorklund <mbj@tail-f.com> wrote:
>>> >> > Andy Bierman <andy@yumaworks.com> wrote:
>>> >> >> On Tue, Feb 10, 2015 at 11:56 AM, Martin Bjorklund <mbj@tail-f.com> wrote:
>>> >> >> > Andy Bierman <andy@yumaworks.com> wrote:
>>> >> >> >> On Tue, Feb 10, 2015 at 2:30 AM, Ladislav Lhotka <lhotka@nic.cz> wrote:
>>> >> >> >> > Hi,
>>> >> >> >> >
>>> >> >> >> > I'll try to summarize this long thread. Please comment.
>>> >> >> >> >
>>> >> >> >> > Ladislav Lhotka <lhotka@nic.cz> writes:
>>> >> >> >> >
>>> >> >> >> >> Hi,
>>> >> >> >> >>
>>> >> >> >> >> $SUBJ is already several months late, so I think we should proceed
>>> >> >> >> >> towards delivering it. I checked my mail archive since the -02 revision,
>>> >> >> >> >> and it seems two issues need to be resolved:
>>> >> >> >> >>
>>> >> >> >> >> 1. Andy objected to making redundant namespace prefixes illegal. I
>>> >> >> >> >>    propose the following change to 4th paragraph in sec. 4 (SHOULD NOT
>>> >> >> >> >>    instead of MUST NOT):
>>> >> >> >> >
>>> >> >> >> > It seems Andy is now the only supporter of this change, and I think
>>> >> >> >> > there are strong technical reasons for keeping namespace rules strict,
>>> >> >> >> > stable and deterministic. I am therefore inclined to keep "MUST NOT", or
>>> >> >> >> > reformulate the text in the same sense without using 2119 keywords.
>>> >> >> >
>>> >> >> > I think it would be wise to rewrite the text to explain how the
>>> >> >> > different nodes (top-level in module, top-level in remote augment and
>>> >> >> > other) are encoded.  The current 2119 language seems to indicate that
>>> >> >> > there is some kind of choice involved.
>>> >> >> >
>>> >> >> >> >>    OLD
>>> >> >> >> >>
>>> >> >> >> >>    Names with namespace identifiers in the form shown in Figure 1 MUST
>>> >> >> >> >>    be used for all top-level YANG data nodes, and also for all nodes
>>> >> >> >> >>    whose parent node belongs to a different namespace.  Otherwise, names
>>> >> >> >> >>    with namespace identifiers MUST NOT be used.
>>> >> >> >> >>
>>> >> >> >> >>    NEW
>>> >> >> >> >>
>>> >> >> >> >>    Names with namespace identifiers in the form shown in Figure 1 MUST
>>> >> >> >> >>    be used for all top-level YANG data nodes, and also for all nodes
>>> >> >> >> >>    whose parent node belongs to a different namespace.  Otherwise, names
>>> >> >> >> >>    with namespace identifiers SHOULD NOT be used.
>>> >> >> >> >>
>>> >> >> >>
>>> >> >> >>
>>> >> >> >> I strongly object to changing the text above back to OLD.
>>> >> >> >> The debate has been over top-level nodes missing the prefix,
>>> >> >> >> not nested nodes that redundantly declare the same module
>>> >> >> >> as the parent node.
>>> >> >> >
>>> >> >> > No, the debate has been for all nodes.
>>> >> >> >
>>> >> >> >> We already agreed that the receiver has to parse the module name
>>> >> >> >> every time in case it is different.  It has to remember the parent
>>> >> >> >> module name in case it is missing in the child nodes.
>>> >> >> >
>>> >> >> > No, the point is that with deterministic rules, the receiver doesn't
>>> >> >> > have to do any special parsing at all.  The top-level node
>>> >> >> > "interfaces" in "ietf-interfaces" is *always* send as
>>> >> >> > "ietf-interfaces:interfaces", and its child node "interface" is
>>> >> >> > *always* sent as "interface" and the node "ipv4" that augments the
>>> >> >> > interface list is *always* sent as "ietf-ip:ipv4".
>>> >> >> >
>>> >> >> >
>>> >> >>
>>> >> >> But what if there is an "acme:interface" that augments
>>> >> >> "ietf-interfaces:interfaces"?
>>> >> >> Then the child node will not always be "interface". It might be
>>> >> >> "acme:interface"
>>> >> >> instead.
>>> >> >
>>> >> > No, in that case there are two separate nodes, one always encoded as
>>> >> > "interface" and one always encoded as "acme:interface", regardless of
>>> >> > how many other augments there are.
>>> >> >
>>> >> >> The server better check, right?
>>> >> >>
>>> >> >> Not checking for a module name means the server might assume
>>> >> >> that "junk:interface" is a valid node and child of ietf-interfaces:interfaces.
>>> >> >> Seems like the server has to check every node.
>>> >> >
>>> >> > No, since with this scheme there is no flexibility, everything is 100%
>>> >> > predictable and stable.
>>> >> >
>>> >>
>>> >> You really think it's a good idea to assume the data from the sender
>>> >> is always valid and doesn't need to be checked?
>>> >
>>> > That is a completely separate question.  We're discussing the best way
>>> > to encode YANG node names in json.  It is up to us to specify this.
>>> > There is no given answer.  With clear and simple rules, chances are
>>> > higher that implementations are correct.
>>> >
>>> >> I don't see how interoperability is increased if the server is
>>> >> forced to reject input it understands.  I doubt customers will
>>> >> see this as a feature instead of a bug.
>>> >
>>> > I think you are missing the point.  If the rule is that a top-level
>>> > node is encoded as <module-name>:<node-name>, why would a server
>>> > "understand" just "interfaces"?  Surely a server would also understand
>>> > <module-name>-<node-name> or <module-name> <node-name>?
>>> >
>>> > Your code can be as liberal as you program it to be, but the
>>> > specification needs to be clear and specify what is *valid*.
>>> >
>>>
>>> The pattern is <module-name>:<local-name> so why would one
>>> change the delimiter to a character that is invalid within a YANG
>>> identifier?  Or to whitespace?  That doesn't make sense.
>>
>> Exactly - the encoding is <module-name>:<local-name>, why would anyone
>> send <local-name>?  If there is just one node, why would your server
>> care about the name at all?
>>
>>
>>> Since everything is 100% predictable as you say, the server
>>> knows that "foo" matches the only node with a a local-name of "foo".
>>> It seems to violate the Postel Principle to reject this input.
>>
>> The Postel Principle says that an implementation should be liberal in
>> what it accepts, i.e., accept things that do not follow the
>> specification.  We are talking about what the *specification* should
>> be.  If the spec says that two forms are legal, the Postel Principle
>> doesn't apply to these two forms, since it is not liberal to accept
>> something that is legal!
>>
>>
>
> So the standard will specify what the server MUST do if a client deviates
> from the mandatory encoding?

If a client deviates from the spec, it is an error. A server implementor
can follow Postel Principle and make the software tolerant to that
error, but it is an error nonetheless.

Along the same lines, server software can tolerate that a client send an
uint8 value as "42." (ending with a dot), which is not permitted by RFC
6020.

Lada

>
> I guess you can write MUST in the standard and I will add yet another
> config parameter to our server to allow more lax parsing.
>
>
>> /martin
>
> Andy

-- 
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C