Re: [Netconf] Representing URLs

Ladislav Lhotka <lhotka@nic.cz> Tue, 03 December 2013 15:58 UTC

Return-Path: <lhotka@nic.cz>
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 31A4D1AE05B for <netconf@ietfa.amsl.com>; Tue, 3 Dec 2013 07:58:51 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -0.652
X-Spam-Level:
X-Spam-Status: No, score=-0.652 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HELO_EQ_CZ=0.445, HOST_EQ_CZ=0.904, RP_MATCHES_RCVD=-0.001] autolearn=no
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 c7vbRI8ZqR6V for <netconf@ietfa.amsl.com>; Tue, 3 Dec 2013 07:58:49 -0800 (PST)
Received: from mail.nic.cz (mail.nic.cz [IPv6:2001:1488:800:400::400]) by ietfa.amsl.com (Postfix) with ESMTP id 9B9C01A1F4C for <netconf@ietf.org>; Tue, 3 Dec 2013 07:58:48 -0800 (PST)
Received: from [172.20.26.113] (fw.nic.cz [217.31.207.1]) by mail.nic.cz (Postfix) with ESMTPSA id 45F7D13F6A0; Tue, 3 Dec 2013 16:58:45 +0100 (CET)
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=nic.cz; s=default; t=1386086325; bh=2FkVSc7rcljGYCVYekGIQLp9mzpGZ+YNJb8jS1kSy+A=; h=Content-Type:Mime-Version:Subject:From:In-Reply-To:Date:Cc: Content-Transfer-Encoding:Message-Id:References:To; b=caw4eUSuZLg6muKz7MK2c7zedZbl70Onvr1pm3Rg+vVzJPNJfSGqtlfLYcqSnhC+m BtFv3vJHVHlzvQFevKvG5u3MFXprhovYcxYoGBLI8AUN9GFE1cn7C7tWtt8cFIlehA ELN+RKYtbA/axDhcIrL1/F5y98AAWuYHfx8sb5Sw=
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 7.0 \(1822\))
From: Ladislav Lhotka <lhotka@nic.cz>
In-Reply-To: <CAFFjW4iNX1rG7VnWqvHVz+c6-WdJ3d8aT1qiGbJGVOOA1Afz9A@mail.gmail.com>
Date: Tue, 03 Dec 2013 16:58:42 +0100
Content-Transfer-Encoding: quoted-printable
Message-Id: <B19C5C86-BCFE-4C81-9D86-4C9FD7BACE7C@nic.cz>
References: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com> <CABCOCHS4rRJRy=TdXRTvM6mffG36u9uHRZWLOkm7a3rCne+Gwg@mail.gmail.com> <CAFFjW4iNX1rG7VnWqvHVz+c6-WdJ3d8aT1qiGbJGVOOA1Afz9A@mail.gmail.com>
To: Wojciech Dec <wdec.ietf@gmail.com>
X-Mailer: Apple Mail (2.1822)
X-Virus-Scanned: clamav-milter 0.97.8 at mail
X-Virus-Status: Clean
Cc: draft-bierman-netconf-restconf@tools.ietf.org, Netconf <netconf@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: Tue, 03 Dec 2013 15:58:51 -0000

On 03 Dec 2013, at 16:39, Wojciech Dec <wdec.ietf@gmail.com> wrote:

> Following up some of my earlier questions... Inline...
> 
> On 29 November 2013 16:59, Andy Bierman <andy@yumaworks.com> wrote:
>> 
>> 
>> 
>> 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.
> 
> Ok, so what is the way in Yang to have a predicate (e.g. current())
> based expression that ends up being represented as a URI in Restconf?
> Use of the current() predicate in the instance-identifier appears not
> to be supported (at least by pyang).

Predicates in instance-identifiers can be used only for matching list keys against constant strings, see sec. 9.13 in RFC 6020.

Can you give an example of an effect you would like to achieve?

Lada

> 
> Thanks,
> Wojciech.
> 
>> 
>>> 
>>> Thanks,
>>> Wojciech.
>>> 
>> 
>> Andy
>> 
> _______________________________________________
> Netconf mailing list
> Netconf@ietf.org
> https://www.ietf.org/mailman/listinfo/netconf

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