Subject: [YANG] Identifiers

From: Andy Bierman <[email-masked]>
Date: Fri, 22 Feb 2008 10:37:47 -0800

Hi,

I know I brought this up a year ago, but there is still a problem
with definition identifiers. (There are not defined.)

There are 3 types of identifiers in YANG/NETCONF.  Applications
may need to use all 3 types:

    1) Instance Identifier
    2) Object Identifier
    3) Definition Identifier

(1)
An instance identifier is an Xpath expression which is defined
with the instance-identifier built-in type.  It represents
one conceptual instance of an object.  It can contain prefixes,
which are XML namespace prefixes, not module prefixes.  It never
includes meta-nodes (e.g., input, output, choice, case),
only real nodes, in the config:

   /if:interfaces/if:interface[if:name='eth0']/if:ifInOctets

(2)
An object identifier is an Xpath expression that specifies
one conceptual object within a module, and it can contain
module prefixes (e.g., augment target).  Meta-nodes such
input, output, choice-identifier, case-identifier, are included
in the Xpath expression.  A missing prefix indicates the current
module, not the prefix of the parent node.  Key values are
never included in the Xpath expression.

  /interfaces/interface/ifInOctets

  /interface/interface/acme:acme-choice1/acme:case1/acme:acme-knob1

  /interface/interface/acme:acme-choice1/acme:case2/acme:acme-knob1-alt

(3)
A definition identifier is the unambiguous string that identifies
any particular user-defined object construct.  Unlike an object
identifier, it must be context-free, and cannot include any prefixes,
which must be evaluated within the context of a specific module.

YANG has several different naming scopes for objects
(objects/rpcs/notifications, and groupings), so some conventions
are needed to prevent naming collisions.

Sometimes it is useful to distinguish between the 'foo-knob'
defined in the 'foo' grouping, and a 'foo-knob' leaf expanded
from a 'uses foo;' statement.  The definition identifier must
account for nested groupings, objects, and augments.

I came up with the following hack (relying on the fact that
the first char in an identifier cannot be '.')

  - the full [sub]module name is used as the starting prefix
    and must be present.
  - the parent module is used if none is specified in a node
  - a different module can only appear if a top-level augment
    in a different module added nodes within the first module.
  - grouping names are prefixed with '.' (in the identifier only)
  - uses and augments are transparent -- only the outcome of the
    expansion is specified within a definition identifier
  - otherwise the string follows object identifier syntax

   ifmib:interfaces/interface/acme-defs:acme-choice1/case1/acme-knob1

Consider the following simple example (from the 'foomod' module):

   grouping bar {
     leaf baz { type int32; }
     grouping bar2 {
       leaf bar2 { type string; }
     }
     container bar2 {
       uses bar2;
     }
   }

   container goo {
     uses bar;
   }

A 'baz' object within the 'bar' grouping within the 'goo' container
would look like:

   foomod:goo/.bar/baz

The baz object used within the goo container would not have the grouping
in the string:

   foomod:goo/baz

The full set of definition identifiers:

   foomod:.bar
   foomod:.bar/baz
   foomod:.bar/.bar2
   foomod:.bar/.bar2/bar2
   foomod:.bar/bar2
   foomod:.bar/bar2/bar2
   foomod:goo
   foomod:goo/baz
   foomod:goo/bar2
   foomod:goo/bar2/bar2

To complete (and complicate things), a definition identifier can terminate
with a 'revision-suffix', to indicate the definition from a specific
version of the [sub]module.  A missing suffix implies the most current version:

    foomod:.bar/.bar2/bar2?2008-01-14

    foomod:goo/bar2?2008-02-22

Definition identifiers could be considered an application implementation
detail, or they could be considered part of the standard.  Comments?

Andy

_______________________________________________
YANG mailing list
[email-masked]
http://www.ietf.org/mailman/listinfo/yang

---

From: Phil Shafer <[email-masked]>
Date: Fri, 22 Feb 2008 13:47:37 -0500

>detail, or they could be considered part of the standard.  Comments?

I'm slow, but I don't follow you.  What problem does "definition
identifiers" attempt to solve?  Do you have a couple of real-world
use cases?

Thanks,
 Phil

---

From: Andy Bierman <[email-masked]>
Date: Fri, 22 Feb 2008 11:02:00 -0800

> identifiers" attempt to solve?  Do you have a couple of real-world

One use would be an application to auto-assist editing
and diffing of YANG objects, track changes over time, etc.
Since the 'uses' can refine and augment inner nodes,
they will not always be the same as the grouping.

Another use is an unambiguous reference within documents,
but outside of YANG modules. This is more in line with standards,
but does not need the grouping IDs, just context-free and version-specific.

Andy