Subject: Re: [netmod] instance-identifier ABNF broken

From: Martin Bjorklund <[email-masked]>
Date: Thu, 05 Mar 2009 22:17:07 +0100 (CET)

Hi,

Martin Bjorklund <[email-masked]> wrote:
> Andy Bierman <[email-masked]> wrote:
> > Every single node in a NETCONF PDU or a NETCONF database
> > needs to be identified for select, error-path, and must/when
> > expressions.  The only way to tell 2 list entries apart
> > (if they do not have keys) is by their relative position.
> > 
> > There is no danger in the agent generating relative expressions
> > for error-path (for example).  The netconf-state DM has a
> > read-only list without a key.
> > E.g., /netconf/configurations/configuration[1]/name is
> > the only way to specify the 'name' field in an instance-identifier.
> 
> You're right.  I think think this will work:
> 
> 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-decimal-value)

Suppose I have an instance-identifier in my configuration data model,
and it points to some other configuration object.  Is an
implementation required to accept the positional version of an
instance identifier?  I hope not.  How will this be specified?  Do we
need two types?  (ugh).  Do we really need to add this positional
version?  Maybe another solution could be to use the new 'yang:xpath'
derived type in the use case you brought up?

/martin

---

From: Andy Bierman <[email-masked]>
Date: Thu, 05 Mar 2009 14:21:32 -0800

> derived type in the use case you brought up?

The positional form must only be used if there are
no keys available.  It doesn't matter why -- when the
error-path is getting generated, there may be missing keys
(hence the error) The code is basically:

  for each node:
     1) is 'foo' a list? are there any keys available to use?
     2) no --> count up all the instances of 'foo'
    2a) if more than 1 instance (including 'foo') then use
        the position in the instance ID (e.g., foo[2]).
        Never generate 'foo[1]' unless there are more than one
        of them (just 'foo' instead)

So a manager can never specify 'foo[2]' in an instance-identifier
if the YANG definition has any keys defined for list 'foo'.

> /martin

Andy