Re: [Netconf] Representing URLs

Andy Bierman <andy@yumaworks.com> Fri, 29 November 2013 15:59 UTC

Return-Path: <andy@yumaworks.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 5D8AB1ACCE2 for <netconf@ietfa.amsl.com>; Fri, 29 Nov 2013 07:59:45 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.978
X-Spam-Level:
X-Spam-Status: No, score=-1.978 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, FM_FORGED_GMAIL=0.622, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, 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 4b6_1yYrFYey for <netconf@ietfa.amsl.com>; Fri, 29 Nov 2013 07:59:42 -0800 (PST)
Received: from mail-qe0-f48.google.com (mail-qe0-f48.google.com [209.85.128.48]) by ietfa.amsl.com (Postfix) with ESMTP id 97B311AC4C5 for <netconf@ietf.org>; Fri, 29 Nov 2013 07:59:42 -0800 (PST)
Received: by mail-qe0-f48.google.com with SMTP id gc15so10387047qeb.21 for <netconf@ietf.org>; Fri, 29 Nov 2013 07:59:41 -0800 (PST)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=gv3uRIUhMWU1PYVqN856q10ULLkclBykxb66CbJ0LBI=; b=ZP/WLTDUjGA1ANUus4aBnMBV+mesIrK7fbZtG6ykszq81+tFJ2jbjgmOFKsboDzFrV iDoT3+R1YkHyhjUsexc8wHtZSbURJH3HbT3kyX41VbHZdeCl7tZMBz2ZmrvgLjKs6y4u OIi1UizIQ7Cg85j+rZZhazEwYrcriT2s1SAQLWDvnPn+sjdCKGmueGiVqOh6EehZr5MB 8corM5G2b7Qo8qlX7OA/0Sk+T/RpO8SBwWUPTFZvyfB5oClHte+Lm+h1yF16q9xP1O2N eAwQt+RO+YmS/86O63CzwARflkF7AMPVzg8dYLtHUquIpIle46Plvk0mxrhvLZzSn3Iq ockA==
X-Gm-Message-State: ALoCoQmRh8OTCJSyBghUKQQxSUU8JWcBdQq/Q8OqmyiVdfPtiDdY5D+iVMt+H7ZFUkcAC0VKo1bQ
MIME-Version: 1.0
X-Received: by 10.49.84.105 with SMTP id x9mr35619617qey.65.1385740781094; Fri, 29 Nov 2013 07:59:41 -0800 (PST)
Received: by 10.140.48.75 with HTTP; Fri, 29 Nov 2013 07:59:41 -0800 (PST)
In-Reply-To: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com>
References: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com>
Date: Fri, 29 Nov 2013 07:59:41 -0800
Message-ID: <CABCOCHS4rRJRy=TdXRTvM6mffG36u9uHRZWLOkm7a3rCne+Gwg@mail.gmail.com>
From: Andy Bierman <andy@yumaworks.com>
To: Wojciech Dec <wdec.ietf@gmail.com>
Content-Type: multipart/alternative; boundary="047d7bdc0ef0021bdf04ec52eb23"
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
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:59:45 -0000

On Fri, Nov 29, 2013 at 6:01 AM, Wojciech Dec <wdec.ietf@gmail.com> 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
> }
>
> 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:
>
> 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"
> }
>


I do not understand the concern.
One leaf is //restconf/config/someUri and the other is
/restconf/config/anotherUri.
What is the manipulation magic?  Constructing /path/to/data/node based on
YANG?
That is the point of RESTCONF.  There are already plenty of solutions for
using
REST APIs for ad-hoc data.  I do not see any reason to develop RESTCONF for
clients that want to ignore YANG.  There are already have plenty of choices
for that.



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

Can you describe the solution you have in mind?


>
> 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"]
>     }
> }
>
>
The API already has /restconf/operations/<YANG-rpc-name>.

YANG is not object-oriented, so /restconf/config/routing/<RPC-name>
is not how the RPC is defined.  You are describing a proprietary
extension.

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

The URI is not an XPath expression. There are no predicates allowed,
I don't think current() is allowed outside a predicate.


> Thanks,
> Wojciech.
>
>
Andy