Re: [YANG] keyref

Balazs Lengyel <balazs.lengyel@ericsson.com> Wed, 23 January 2008 10:08 UTC

Return-path: <yang-bounces@ietf.org>
Received: from [127.0.0.1] (helo=stiedprmman1.va.neustar.com) by megatron.ietf.org with esmtp (Exim 4.43) id 1JHcWo-0004iV-Rj; Wed, 23 Jan 2008 05:08:18 -0500
Received: from yang by megatron.ietf.org with local (Exim 4.43) id 1JHcWn-0004iP-FG for yang-confirm+ok@megatron.ietf.org; Wed, 23 Jan 2008 05:08:17 -0500
Received: from [10.90.34.44] (helo=chiedprmail1.ietf.org) by megatron.ietf.org with esmtp (Exim 4.43) id 1JHcWn-0004iH-4G for yang@ietf.org; Wed, 23 Jan 2008 05:08:17 -0500
Received: from mailgw4.ericsson.se ([193.180.251.62]) by chiedprmail1.ietf.org with esmtp (Exim 4.43) id 1JHcWm-00006U-Cm for yang@ietf.org; Wed, 23 Jan 2008 05:08:17 -0500
Received: from mailgw4.ericsson.se (unknown [127.0.0.1]) by mailgw4.ericsson.se (Symantec Mail Security) with ESMTP id C067721461; Wed, 23 Jan 2008 11:08:15 +0100 (CET)
X-AuditID: c1b4fb3e-ad5edbb0000007e1-06-4797120ff6f8
Received: from esealmw127.eemea.ericsson.se (unknown [153.88.254.122]) by mailgw4.ericsson.se (Symantec Mail Security) with ESMTP id A690121108; Wed, 23 Jan 2008 11:08:15 +0100 (CET)
Received: from esealmw127.eemea.ericsson.se ([153.88.254.175]) by esealmw127.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Wed, 23 Jan 2008 11:08:15 +0100
Received: from [159.107.197.224] ([159.107.197.224]) by esealmw127.eemea.ericsson.se with Microsoft SMTPSVC(6.0.3790.1830); Wed, 23 Jan 2008 11:08:15 +0100
Message-ID: <4797120E.9020902@ericsson.com>
Date: Wed, 23 Jan 2008 11:08:14 +0100
From: Balazs Lengyel <balazs.lengyel@ericsson.com>
User-Agent: Thunderbird 2.0.0.4 (X11/20070604)
MIME-Version: 1.0
To: Balazs Lengyel <balazs.lengyel@ericsson.com>, Martin Bjorklund <mbj@tail-f.com>, yang@ietf.org
Subject: Re: [YANG] keyref
References: <4794D016.10107@andybierman.com> <20080121.230429.148337580.mbj@tail-f.com> <4795F496.7040309@ericsson.com> <20080122215520.GA6901@elstar.local>
In-Reply-To: <20080122215520.GA6901@elstar.local>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
X-OriginalArrivalTime: 23 Jan 2008 10:08:15.0413 (UTC) FILETIME=[DE835650:01C85DA7]
X-Brightmail-Tracker: AAAAAA==
X-Spam-Score: 0.0 (/)
X-Scan-Signature: 34d35111647d654d033d58d318c0d21a
Cc:
X-BeenThere: yang@ietf.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: YANG modeling Language for NETCONF <yang.ietf.org>
List-Unsubscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www1.ietf.org/pipermail/yang>
List-Post: <mailto:yang@ietf.org>
List-Help: <mailto:yang-request@ietf.org?subject=help>
List-Subscribe: <https://www1.ietf.org/mailman/listinfo/yang>, <mailto:yang-request@ietf.org?subject=subscribe>
Errors-To: yang-bounces@ietf.org


Juergen Schoenwaelder wrote:
> On Tue, Jan 22, 2008 at 02:50:14PM +0100, Balazs Lengyel wrote:
>> In the Ericsson DML we had something like
>>
>> leaf my-if-status> {
>>   type instance-identifier {
>>     refers-to /if:interfaces/if:ifEntry/adminStatus;
>>   }
>> }
>>
>> and in the XML
>>
>>   <myIfStatus>/if:interfaces/if:ifEntry["if:ifIndex=2"]/adminStatus</myIfStatus>
>>
>> This is quite simple, it works as a leafref as well, and works with 
>> multiple keys. refers-to restricts the kind of instance identifiers you can 
>> actually use. The actual XML value is somewhat more complicated, but I 
>> think the instance identifier format is quite intuitive even for people 
>> unfamiliar with XPATH.
> 
> It is actually unclear to me what the example does. I get back an
> xpath expression that points to some other object to consult? 
[BALAZS]: It gives you a pointer to an object that you should use for whatever reason you need 
it. E.g. points to a Diameter based server for accounting that a specific subscriber should 
use. Or points to a status to check before you start a process.
> I
> believe this is not really the same as the current keyref
[BALAZS]: Not exactly. It gives you more freedom, which you might decide to restrict with 
refers-to. In some case you will not restrict it, but rather use the freedom.
> and this
> also raises questions related to referential integrity or what if the
> expression actually refers to a node set with more than 1 node and
> similar things.
[BALAZS]: I don't see why this has bigger problems with referential integrity here then keyref. 
If you only store an ifIndex value and not the full path, the specific interface might still 
get deleted while you refer to it.
In the on-the-wire XML full XPath is not allowed, only identifier syntax, so that should take 
care of node sets with multiple nodes. It is the same kind of expression we use for augment. 
That also must point to one specific object; otherwise you get an error.
> I am also not sure management applications and humans
> like to extrace the ifIndex value 2 out of the expression. And then
> there is the question why to ship redundant information at run time if
> it is already hard wired in the scheme? 
[BALAZS]: Yes the specific value in XML is longer, although I don't see it as much more 
complicated. Anyway humans will usually be aided to write it (GUI, Wizard, tab-extension).
> What happens if the expression
> is not consistent with refers-to?
[BALAZS]: that's an ERROR
> 
> /js
[BALAZS]: On the plus side,
- it gives you more freedom when you want; you can point anywhere if you don't restrict it with 
refers-to.
- it allows you to refer to leaves
- the construct is much easier to understand for the complicated cases then  keyref

Compare the two examples for a list with two keys:

container default-address {
    leaf ifname {
      // this is actually not needed as a standalone leaf, only as an auxiliary
        type keyref {
            path "../../interface/name";
        }
    }
    leaf address {
        type keyref {
            path "../../interface[name = $this/../ifname]/address/ip";
        }
    }
}

   <default-address>
     <ifname>eth0</ifname>
     <address>192.0.2.2</address>
   </default-address>

-----------------------------------------------------------------------------
  leaf default-address {
    type instance-identifier {
      refers-to ../../interface/address/ip;
    }
  }

   <default-address>
	../../interface[ifname="eth0"][address="192.0.2.2"]/address/ip
   </default-address>

-- 
Balazs Lengyel                       Ericsson Hungary Ltd.
TSP System Manager
ECN: 831 7320                        Fax: +36 1 4377792
Tel: +36-1-437-7320     email: Balazs.Lengyel@ericsson.com


_______________________________________________
YANG mailing list
YANG@ietf.org
https://www1.ietf.org/mailman/listinfo/yang