Re: [Netconf] Representing URLs

Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de> Fri, 29 November 2013 15:03 UTC

Return-Path: <j.schoenwaelder@jacobs-university.de>
X-Original-To: netconf@ietfa.amsl.com
Delivered-To: netconf@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id A093E1AD9A9 for <netconf@ietfa.amsl.com>; Fri, 29 Nov 2013 07:03:07 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.251
X-Spam-Level:
X-Spam-Status: No, score=-2.251 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, HELO_EQ_DE=0.35, RCVD_IN_DNSWL_LOW=-0.7, RP_MATCHES_RCVD=-0.001] 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 Z8lipHB6e_J2 for <netconf@ietfa.amsl.com>; Fri, 29 Nov 2013 07:03:05 -0800 (PST)
Received: from hermes.jacobs-university.de (hermes.jacobs-university.de [212.201.44.23]) by ietfa.amsl.com (Postfix) with ESMTP id 3A0021AD94A for <netconf@ietf.org>; Fri, 29 Nov 2013 07:03:05 -0800 (PST)
Received: from localhost (demetrius4.jacobs-university.de [212.201.44.49]) by hermes.jacobs-university.de (Postfix) with ESMTP id C7D672008C; Fri, 29 Nov 2013 16:03:03 +0100 (CET)
X-Virus-Scanned: amavisd-new at jacobs-university.de
Received: from hermes.jacobs-university.de ([212.201.44.23]) by localhost (demetrius4.jacobs-university.de [212.201.44.32]) (amavisd-new, port 10024) with ESMTP id q6pROHfZwZnS; Fri, 29 Nov 2013 16:03:03 +0100 (CET)
Received: from elstar.local (elstar.jacobs.jacobs-university.de [10.50.231.133]) by hermes.jacobs-university.de (Postfix) with ESMTP id 2C37420040; Fri, 29 Nov 2013 16:03:03 +0100 (CET)
Received: by elstar.local (Postfix, from userid 501) id EF2CE29990B3; Fri, 29 Nov 2013 16:02:57 +0100 (CET)
Date: Fri, 29 Nov 2013 16:02:57 +0100
From: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
To: Wojciech Dec <wdec.ietf@gmail.com>
Message-ID: <20131129150257.GA95546@elstar.local>
Mail-Followup-To: Wojciech Dec <wdec.ietf@gmail.com>, draft-bierman-netconf-restconf@tools.ietf.org, Andy Bierman <andy@yumaworks.com>, Netconf <netconf@ietf.org>
References: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="us-ascii"
Content-Disposition: inline
In-Reply-To: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com>
User-Agent: Mutt/1.5.21 (2010-09-15)
Cc: Netconf <netconf@ietf.org>, draft-bierman-netconf-restconf@tools.ietf.org
Subject: Re: [Netconf] Representing URLs
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
Reply-To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>
List-Id: Network Configuration WG mailing list <netconf.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/netconf>, <mailto:netconf-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/netconf/>
List-Post: <mailto:netconf@ietf.org>
List-Help: <mailto:netconf-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/netconf>, <mailto:netconf-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 29 Nov 2013 15:03:07 -0000

On Fri, Nov 29, 2013 at 03:01:36PM +0100, Wojciech Dec wrote:
> Hello Restconf authors,
> 
> I would like to ask a few questions and seek your thoughts on the topic of
> URL representation in the API
> Currently Yang allows two forms by which one could seek to have URI data be
> represented in a model:
> 
> A.
> leaf someUri {
>     type instance-identifier;
> //some Xpath expression to a node
> }

An instance-identifier is not a URI.
 
> B.
> leaf anotherUri {
>     type yang:uri;
>     default "/my_uri/is/here"
> }
> 
> Now, while the above is perhaps sufficient for some well known absolute
> paths, there appear to be a couple of problems in terms of  a Restful API:

A path is not a URI either. It seems you are talking about some form of
paths but not URIs.

That said, I may agree that having a hard-wired logic how URIs to
RESTful resources are constructed is somewhat unRESTful. It seems that
discovery of URIs for such resources is what people prefer. But of
course, the flexibility this allows comes at a price - you sometimes
neeed to do additional lookups. The good news is that HTTP is
providing decent caching support.

/js

> 1. Based on the current Restconf spec, both A and B above when faced with a
> GET would appear to expose a URI, which the client would have to do some
> manipulation magic on it before use. What a Restful API would be more
> likely to expose instead is a URL, eg in JSON:
> {
>     "url" : "http://example.com/files/v1/documents/abc123"
> }
> 
> It would appear to be sensible to add to the Restconf spec a URL generation
> capability. I.e. have Restconf transform URIs into canonical URLs. Thoughts?
> 
> 2. A URL to a data-model specific method
> Suppose that the model was also defining an RPC, along the lines of the
> "play" RPC in the Jukebox example. Now, as part of the song resource access
> API, it would be natural to have such a method returned in a URL. That
> would also be much more Resful than the currently implicit "/operations"
> resource listing.
> While it may be possible to use B. above to some degree, that is still
> below par as it is not validated in the model.
> Use of A. appears, to me at least, not possible since the RPC is not a node.
> Thus, is there a way to have Restconf return an RPC/services list for the
> data? Eg:
> 
> {
>     "songs":
>     [
>         a list of songs, 1, 2, etc
>     ],
>     "rpc":
>     {
>         "play": [ "http://example.com/operations/example-jukebox:play"]
>     }
> }
> 
> 3. Use of current() function as predicate in URIs/URLs
> 
> It would be useful to be able to use the "current()" function to construct
> URIs/URLs returned in Restconf. The spec does not make it clear on whether
> this would actually work in A or B above. Would it, or is there some other
> way?

/js

-- 
Juergen Schoenwaelder           Jacobs University Bremen gGmbH
Phone: +49 421 200 3587         Campus Ring 1, 28759 Bremen, Germany
Fax:   +49 421 200 3103         <http://www.jacobs-university.de/>