Re: [Netconf] Representing URLs

Wojciech Dec <wdec.ietf@gmail.com> Fri, 29 November 2013 16:00 UTC

Return-Path: <wdec.ietf@gmail.com>
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 F02E81AE141 for <netconf@ietfa.amsl.com>; Fri, 29 Nov 2013 08:00:39 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.999
X-Spam-Level:
X-Spam-Status: No, score=-1.999 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, SPF_PASS=-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 Zdus_93WNVxy for <netconf@ietfa.amsl.com>; Fri, 29 Nov 2013 08:00:37 -0800 (PST)
Received: from mail-pd0-x22f.google.com (mail-pd0-x22f.google.com [IPv6:2607:f8b0:400e:c02::22f]) by ietfa.amsl.com (Postfix) with ESMTP id F3EB51AE0EE for <netconf@ietf.org>; Fri, 29 Nov 2013 08:00:36 -0800 (PST)
Received: by mail-pd0-f175.google.com with SMTP id w10so14054043pde.34 for <netconf@ietf.org>; Fri, 29 Nov 2013 08:00:35 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tIRm6uSpDQAv6zlb5bSpWTarqr+Yhn7/qyr8REvLyE4=; b=G4eGlej5/4eXPir7kPZBB8EGUVFV6T8YNWUcz4Bqghd9Q7HRrN89+trh44nHeWyEXq 4lOxTdYVlJB/e92Bg5ywbgdXs+yeOo0e2E6/g43tgr9DJfAnKovHvd3lKaI3L2yjaoy3 9JNus+y1gQmUiQ16/UlXbUx53w6SW3LUxC/bhV4H/gWZ3/Rr0THb7HPOFqr0zUNZG8eO kEhI2y1QCc6Dycj+3sEM39OZs5FzeOJSfvBQdnxeD/1Ul9XA/wPiIKnyyh+0ycKCXW3d WZ6oB9RFSifOT1MMeovUu4q0RNYzTqPJ0RTMzsw6GdZfeS5KnqxP9VwaA7RM0AtP1CYr 24CA==
MIME-Version: 1.0
X-Received: by 10.66.179.143 with SMTP id dg15mr53193749pac.52.1385740835855; Fri, 29 Nov 2013 08:00:35 -0800 (PST)
Received: by 10.70.57.163 with HTTP; Fri, 29 Nov 2013 08:00:35 -0800 (PST)
In-Reply-To: <20131129150257.GA95546@elstar.local>
References: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com> <20131129150257.GA95546@elstar.local>
Date: Fri, 29 Nov 2013 17:00:35 +0100
Message-ID: <CAFFjW4jyjLieiH_KqZ+UAwCpWGu8kn9rgY=_NMt_E_v=te5kDw@mail.gmail.com>
From: Wojciech Dec <wdec.ietf@gmail.com>
To: Juergen Schoenwaelder <j.schoenwaelder@jacobs-university.de>, Wojciech Dec <wdec.ietf@gmail.com>, draft-bierman-netconf-restconf@tools.ietf.org, Andy Bierman <andy@yumaworks.com>, Netconf <netconf@ietf.org>
Content-Type: multipart/alternative; boundary="047d7bea3f6445a40304ec52eeab"
Subject: Re: [Netconf] Representing URLs
X-BeenThere: netconf@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
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 16:00:40 -0000

On 29 November 2013 16:02, Juergen Schoenwaelder <
j.schoenwaelder@jacobs-university.de> wrote:

> 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.
>

Granted, but
http://tools.ietf.org/html/draft-bierman-netconf-restconf-02#page-57 speaks
about how it ends up being a URI, possibly a URL, in the context of
Now, what is missing, or  at least not clear to me, is how this data-type
ends up being transformed into something more usable in a Rest context (IMO
a canonical URL). And then the other bits and pieces 1-3 below.


> > 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.
>

With Restconf, the Yang data-nodes are effectively being mapped to Restful
resources, accessible via URLs.
Putting URLs direlcty into the data model does not look right, so I'm
looking at ways in which these URLs could be generated by Restconf.

Cheers,
Wojciech.


>
> 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/>
>