YANG Lifecycle Management

The YANG status statement describes the lifecycle of a definition. The shared NCX library applies status reference checks when YumaPro programs parse a YANG module.

YANG Status Requirements

RFC 7950, Section 7.21.2, defines three status values: current, deprecated, and obsolete. A definition without an explicit status defaults to current. The RFC permits continued or new implementation of deprecated definitions for compatibility with existing implementations. It recommends against implementing obsolete definitions and permits their removal.

The RFC also restricts references between definitions within the same module:

  • A current definition must not depend on a deprecated or obsolete definition in that module.

  • A deprecated definition must not depend on an obsolete definition in that module.

These restrictions do not prohibit references to definitions in another module based on status alone.

YumaPro Implementation Policy

YumaPro programs use the following implementation policy:

Status

Implementation Policy

current

Implemented.

deprecated

Implemented, just like current. Deprecated never means obsolete.

obsolete

Not implemented. Obsolete data nodes are removed from the object tree.

Treating deprecated definitions as implemented does not relax the same-module reference restrictions. A current definition still cannot reference a deprecated definition in the same module.

Status Reference Checks

For the references checked by the shared NCX library, the following status combinations are bad references:

Referencing Status

Referenced Status

Same Module

Different Module

current

deprecated

Error

Warning 1060

current

obsolete

Error

Warning 1060

deprecated

obsolete

Error

Warning 1060

The other status combinations do not produce a status reference diagnostic. NCX checks the following references while parsing a module:

Reference

Status Values Compared

A type statement referring to a typedef

The definition containing type and the referenced typedef

A uses statement referring to a grouping

The uses statement and the referenced grouping

An if-feature statement referring to a feature

The statement containing if-feature and each referenced feature

An identity statement's base referring to another identity

The derived identity and the base identity

An identityref type's base referring to an identity

The definition using the identityref type and the base identity

Warning 1060, "Referencing a deprecated or obsolete YANG statement", reports a bad status reference to a schema item. This warning applies only when the referenced schema item is defined in another module. It is subject to the normal warning controls, including:

An enabled warning does not by itself make the reference an error unless the warning is elevated to an error.

Example

  • The 't18' module uses identifiers from the 't17' module that are deprecated or obsolete.

identity external-derived {
  base t17:ident1;
}

container topcon {
  uses t17:leafs;
  leaf myleaf {
    type t17:type1;
  }
  leaf myleaf2 {
    if-feature t17:feat1;
    type string;
  }
  leaf myleaf3 {
    type identityref {
      base t17:ident1;
    }
  }
}

Compiling this module produces several warnings:

user1$ yangdump-pro t18

Warning: identity 'external-derived' is current but base identity 'ident1' is deprecated
t18.yang:8.3: warning(1060): Referencing a deprecated or obsolete YANG statement

Warning: uses-stmt is current but grouping 'leafs' is deprecated
t18.yang:13.5: warning(1060): Referencing a deprecated or obsolete YANG statement

Warning: object 'myleaf' is current but typedef 'type1' is deprecated
t18.yang:15.7: warning(1060): Referencing a deprecated or obsolete YANG statement

Warning: if-feature parent is current but feature 'feat1' is obsolete
t18.yang:18.18: warning(1060): Referencing a deprecated or obsolete YANG statement

Warning: identityref 'myleaf3' is current but base identity 'ident1' is deprecated
t18.yang:22.7: warning(1060): Referencing a deprecated or obsolete YANG statement

*** /home/user1/swdev/ypwork/netconf/modules/test/pass/t18.yang
*** 0 Errors, 5 Warnings

XPath References to Data Nodes

An XPath statement (must, when, or path) with a bad status reference to a data node is not itself a status reference error. However, removal of an obsolete node affects subsequent checks:

  • A path statement referring to the removed node fails the path-stmt check with an error because its target node no longer exists.

  • A must or when expression treats a reference to the removed node as an empty node-set. The result of the complete expression depends on how that node-set is used; removal does not necessarily make the expression false.

Deprecated nodes remain implemented and are not removed because of their deprecated status.

Module Imports

Modules do not have a status statement, so an import statement does not create a status reference problem. References to individual definitions from an imported module are still subject to the NCX checks described above.