Re: [Netconf] Representing URLs

Andy Bierman <andy@yumaworks.com> Tue, 03 December 2013 15:56 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 0E8F81AE05B for <netconf@ietfa.amsl.com>; Tue, 3 Dec 2013 07:56:05 -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 j11ltgJoThK1 for <netconf@ietfa.amsl.com>; Tue, 3 Dec 2013 07:56:00 -0800 (PST)
Received: from mail-qa0-f45.google.com (mail-qa0-f45.google.com [209.85.216.45]) by ietfa.amsl.com (Postfix) with ESMTP id CE15F1A1F4C for <netconf@ietf.org>; Tue, 3 Dec 2013 07:55:58 -0800 (PST)
Received: by mail-qa0-f45.google.com with SMTP id o15so5675423qap.4 for <netconf@ietf.org>; Tue, 03 Dec 2013 07:55:56 -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=jw5aGFeW1B9sW6VICd7Z2D0FnazfBJxBXnTXpGfQh2I=; b=aRr9zFY5aGb0/F0EFcfuw2g8dPv1f9OSjyglbUvjGAh+ABbTBhMe7vJdkAAE4n8d6/ +ln+8Py8w/9POk0zv7VHYn02fSBzMtTnqy1eCGGQd+3yl0gsO1S0vwEWQ1GKZK0OdZbV twlpaG345x9nxMZ5bjAOhMes2PUx+ltbhqcoEsFCjc6lZVN6fNVHYvgG87w3JQ1ec78D SxDbqj5ft9dTuAbrSjiQmHSNYP6PGcmbiUy11hB+rxd1fcUX2hXj77rtE5D4eACpNbI/ F71EZnjQCNiwMvj+t9gSqd/Q2VZC+03l75BcSg/6bJYAhuOKNTrSNaUPOnTm/fZf8INM ipJQ==
X-Gm-Message-State: ALoCoQnVNjpDtb0YI7Qtd/wbCmaUMJarOMFtm+BMn3eIMsAAXWhZJBU7ghTi9lOhIQ90Tr+dWbdV
MIME-Version: 1.0
X-Received: by 10.49.38.37 with SMTP id d5mr52259330qek.17.1386086155915; Tue, 03 Dec 2013 07:55:55 -0800 (PST)
Received: by 10.140.48.75 with HTTP; Tue, 3 Dec 2013 07:55:55 -0800 (PST)
In-Reply-To: <CAFFjW4iNX1rG7VnWqvHVz+c6-WdJ3d8aT1qiGbJGVOOA1Afz9A@mail.gmail.com>
References: <CAFFjW4hXEZxTyhnaHLk-URST=6mNfX8kO1aFEVtEvTm8Z-qysw@mail.gmail.com> <CABCOCHS4rRJRy=TdXRTvM6mffG36u9uHRZWLOkm7a3rCne+Gwg@mail.gmail.com> <CAFFjW4iNX1rG7VnWqvHVz+c6-WdJ3d8aT1qiGbJGVOOA1Afz9A@mail.gmail.com>
Date: Tue, 03 Dec 2013 07:55:55 -0800
Message-ID: <CABCOCHT2kSM22DvB+gJNe3yhQhd9oFKDtJ3LE5S37rta=fWi9Q@mail.gmail.com>
From: Andy Bierman <andy@yumaworks.com>
To: Wojciech Dec <wdec.ietf@gmail.com>
Content-Type: multipart/alternative; boundary="047d7bb043b0f3a8b404eca354d4"
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: Tue, 03 Dec 2013 15:56:05 -0000

On Tue, Dec 3, 2013 at 7:39 AM, Wojciech Dec <wdec.ietf@gmail.com> wrote:

> Following up some of my earlier questions... Inline...
> ...
> >> 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).
>
>
There is none. An instance identifier is the absolution path from root
to the specific node being identified.  It cannot be used for another
purpose.  The ietf-yang-types module has an xpath1.0 typedef
that allows current() in a predicate.

Here is the ABNF from RFC 6020:

 node-identifier     = [prefix ":"] identifier

 ;; Instance Identifiers

   instance-identifier = 1*("/" (node-identifier *predicate))

   predicate           = "[" *WSP (predicate-expr / pos) *WSP "]"

   predicate-expr      = (node-identifier / ".") *WSP "=" *WSP
                         ((DQUOTE string DQUOTE) /
                          (SQUOTE string SQUOTE))

   pos                 = non-negative-integer-value





> Thanks,
> Wojciech.
>
>
Andy