Re: [netmod] Y34: use cases for anydata

Martin Bjorklund <mbj@tail-f.com> Wed, 28 January 2015 11:19 UTC

Return-Path: <mbj@tail-f.com>
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 522FE1A1A3C for <netmod@ietfa.amsl.com>; Wed, 28 Jan 2015 03:19:34 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.91
X-Spam-Level:
X-Spam-Status: No, score=-1.91 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01] 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 slluw-L2Q2MX for <netmod@ietfa.amsl.com>; Wed, 28 Jan 2015 03:19:32 -0800 (PST)
Received: from mail.tail-f.com (mail.tail-f.com [83.241.162.140]) by ietfa.amsl.com (Postfix) with ESMTP id A3E971A039F for <netmod@ietf.org>; Wed, 28 Jan 2015 03:19:31 -0800 (PST)
Received: from localhost (unknown [193.13.112.215]) by mail.tail-f.com (Postfix) with ESMTPSA id 8B44012801A6; Wed, 28 Jan 2015 12:19:30 +0100 (CET)
Date: Wed, 28 Jan 2015 12:22:03 +0100
Message-Id: <20150128.122203.1679178904226428559.mbj@tail-f.com>
To: lhotka@nic.cz
From: Martin Bjorklund <mbj@tail-f.com>
In-Reply-To: <C39F992C-12AB-40D5-9018-4B9166245202@nic.cz>
References: <06E2712F-AFAF-4652-BFED-1AEC0C98457A@nic.cz> <20150128.111052.1569834530678944655.mbj@tail-f.com> <C39F992C-12AB-40D5-9018-4B9166245202@nic.cz>
X-Mailer: Mew version 6.5 on Emacs 24.3 / Mule 6.0 (HANACHIRUSATO)
Mime-Version: 1.0
Content-Type: Text/Plain; charset="utf-8"
Content-Transfer-Encoding: base64
Archived-At: <http://mailarchive.ietf.org/arch/msg/netmod/70av--LlisSX35aAdPdcjrBFO3E>
Cc: netmod@ietf.org
Subject: Re: [netmod] Y34: use cases for anydata
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: Wed, 28 Jan 2015 11:19:34 -0000

Ladislav Lhotka <lhotka@nic.cz> wrote:
> 
> > On 28 Jan 2015, at 11:10, Martin Bjorklund <mbj@tail-f.com> wrote:
> > 
> > Ladislav Lhotka <lhotka@nic.cz> wrote:
> >> 
> >>> On 28 Jan 2015, at 10:06, Martin Bjorklund <mbj@tail-f.com> wrote:
> >>> 
> >>> Ladislav Lhotka <lhotka@nic.cz> wrote:
> >>>> 
> >>>>> On 28 Jan 2015, at 09:10, Martin Bjorklund <mbj@tail-f.com> wrote:
> >>>>> 
> >>>>> Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> wrote:
> >>>>>> I do not think we make progress this way and we probably need to find
> >>>>>> a way to do a mailing list hum to figure out where the _WG_ stands on
> >>>>>> this issue and not just the two of us.
> >>>>> 
> >>>>> At this point, I think it would be useful if you could take a step
> >>>>> back and formulate the problem.  I must I admit I got lost in the
> >>>>> discussion.  I *think* the issue now has to do with the json encoding
> >>>>> of anydata and anyxml, if we decide to introduce anydata?
> >>>> 
> >>>> Yes, the discussion sometimes wandered into areas that are unrelated
> >>>> to anyxml/anydata.
> >>>> 
> >>>> As for anydata, I’d be happy with just renaming anyxml to anydata,
> >>> 
> >>> I don't think works.  It is not backwards compatible, and it would
> >>> break the definition in 6241.
> >> 
> >> Well, yes, I mean keeping anyxml as a (deprecated) synonym.
> > 
> > Not synonym, since 'anyxml' truly is any xml, which 'anydata' is not.
> > And probably not deprecated, but rather "think twice before using”.
> 
> Do you mean that for modules containing anyxml no JSON encoding will
> be defined?

The json doc has to say *something*, and maybe the current text is
fine.  It should be pointed out that the anyxml mapping is
implementation dependent.


/martin



> 
> I’d prefer to keep the current definition in the yang-json draft even though anyxml is a misnomer. There are other formulations in 6020 that are XML- and NETCONF-specific.
> 
> > 
> >> Which 6241
> >> definition do you mean?
> > 
> > rpc edit-config etc.  Search for anyxml.
> 
> Sure, but it’s OK if anyxml continues to exist.
> 
> Lada
> 
> > 
> >> The advantage of this solution is that existing data formats (RDF
> >> comes to my mind) that have nothing in common with YANG can be
> >> potentially piggybacked in anydata. Andy will say such a use case
> >> doesn’t exist yet but I think this *might* be potentially
> >> useful. Assuming that YANG will become the universal schema language
> >> for network protocols is not realistic.
> >> 
> >>> 
> >>> My preference would be Y34-02 (keep anyxml, add anydata), with the
> >>> clarifications suggested by Juergen (discourage the usage of anyxml).
> >>> 
> >>>> I understand that Andy wants to exclude XML mixed content, so I can
> >>>> also agree with adding restrictions for anydata in the sense that the
> >>>> content can *potentially* be modelled in YANG.
> >>> 
> >>> Yes, I think we want to allow for the case where a consumer/producer
> >>> of 'anydata' does not know the YANG data model (generic logger, some
> >>> proxy, etc).  So "potentially" modelled in YANG should be fine.
> >>> 
> >>> The issue I see can be illustrated like this:
> >>> 
> >>>                      +--------+
> >>> input w/ anydata --> | server | -- output -->
> >>>                      +--------+
> >>> 
> >>> I.e., some implementation gets data w/ anydata in it, and is supposed
> >>> to send this to some client that needs to be able to interpret this
> >>> data.
> >>> 
> >>> Let's assume the data is this:
> >>> 
> >>> namespace urn:x;
> >>>  ...
> >>> container x {
> >>>   anydata y;
> >>> }
> >>> 
> >>> and one example of something we can put into this anydata is:
> >>> 
> >>> namespace urn:foo;
> >>> ...
> >>> container foo {
> >>>   leaf bar {
> >>>     type int32;
> >>>   }
> >>>   leaf if-type {
> >>>     type identityref {
> >>>       base if:interface-type;
> >>>     }
> >>>   }
> >>> }
> >>> 
> >>> module ex-ethernet {
> >>>   namespace urn:exeth;
> >>>   ...
> >>>   identity ethernet { ... }
> >>> }
> >>> 
> >>> 
> >>> 
> >>> So the input could be:
> >>> 
> >>> (A)
> >>> <x xmlns="urn:x">
> >>>   <y>
> >>>     <foo xmlns="urn:foo" xmlns:p0="urn:exeth">
> >>>       <bar>42</bar>
> >>>       <if-type>p0:ethernet</if-type>
> >>>     </foo>
> >>>   </y>
> >>> </x>
> >>> 
> >>> 
> >>> There are four cases:
> >>> 
> >>> 1.  input xml, output xml
> >>> 
> >>> The problem here has to do with namespace prefixes.
> >>> 
> >>> Suppose the input was received as:
> >>> 
> >>> (B)
> >>> <x xmlns="urn:x" xmlns:p1="urn:exeth">
> >>>   <y>
> >>>     <foo xmlns="urn:foo">
> >>>       <bar>42</bar>
> >>>       <if-type>p1:ethernet</if-type>
> >>>     </foo>
> >>>   </y>
> >>> </x>
> >>> 
> >>> The server doesn't know that if-type is of type identityref, so it
> >>> doesn't know that "eth:" is a prefix.  It just stores everything as
> >> 
> >> You probably mean “p1:” here.
> > 
> > Yes.
> > 
> >> But if the server has the data model, it
> >> should know this is an identityref and “p1:” is a prefix, right?
> > 
> > Sure.  The use case is about servers that do not know about the data
> > model.
> > 
> >>> strings.  But when it returns this node to a client, it must make
> >>> sure the prefix is declared properly.
> >>> 
> >>> We can solve this for anydata by saying that 
> >>> the anydata node must have all namespace declarations in the anydata
> >>> subtree in the XML encoding.  Thus the input (B) would be illegal,
> >>> but (A) legal.
> >>> 
> >>> 
> >>> 2.  input json, output json
> >>> 
> >>> In json, there are no namespace prefixes, so that is not an issue.
> >>> Also, if both input and output is json, the implementation can store
> >>> the data as received, and return it in the same way.
> >>> 
> >>> 
> >>> 3.  input xml, output json
> >>> 
> >>> This is tricky, since in order to produce correct json both for leaf
> >>> 'bar' and leaf 'if-type', the server needs schema knowledge; 'bar'
> >>> must be encoded as 42 rather than "42", and 'if-type' must be
> >>> encoded as "ex-ethernet:ethernet" rather than "p0:ethernet”.
> >> 
> >> It doesn’t make much sense to me that the server act as a transparent
> >> relay. I think one can assume that for every anydata node the server
> >> has a schema, although it needn’t be expressed in YANG.
> > 
> > I would stay out of "needn't be expressed in YANG".  Let's just say
> > that the server knows the schema.
> > 
> > 
> >> If there really was a use case for a schema-agnostic server, we could
> >> define a default (and lossy) XML->JSON translation.
> > 
> > 
> > 
> > /martin
> 
> --
> Ladislav Lhotka, CZ.NIC Labs
> PGP Key ID: E74E8C0C
> 
> 
> 
>