Network Working Group                                         B. Lengyel
Internet-Draft                                                  Ericsson
Intended status: Standards Track                               B. Claise
Expires: January 3, 2019                             Cisco Systems, Inc.
                                                            July 2, 2018

     YANG Instance Data Files and their use for Documenting Server


   This document specifies a standard file format for YANG instance
   data, that is data that could be stored in a datastore and whose
   syntax and semantics is defined by YANG models.  Instance data files
   can be used to provide information that is defined in design time.
   There is a need to document Server capabilities (which are often
   specified in design time).  Defining server capabilities is foreseen
   as the most important use of YANG instance data files.

Status of This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts is at

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   This Internet-Draft will expire on January 3, 2019.

Copyright Notice

   Copyright (c) 2018 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   ( in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect

Lengyel & Claise         Expires January 3, 2019                [Page 1]

Internet-Draft             YANG Instance Data                  July 2018

   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1.  Terminology . . . . . . . . . . . . . . . . . . . . . . . . .   2
   2.  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     2.1.  Use Case 1: Early Documentation of Server Capabilites . .   4
     2.2.  Use Case 2: Preloading Data . . . . . . . . . . . . . . .   4
   3.  Instance Data File Format . . . . . . . . . . . . . . . . . .   4
     3.1.  Data Life cycle . . . . . . . . . . . . . . . . . . . . .   7
   4.  YANG Model  . . . . . . . . . . . . . . . . . . . . . . . . .   8
   5.  Security Considerations . . . . . . . . . . . . . . . . . . .   9
   6.  IANA Considerations . . . . . . . . . . . . . . . . . . . . .   9
   7.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  10
     7.1.  Normative References  . . . . . . . . . . . . . . . . . .  10
     7.2.  Informative References  . . . . . . . . . . . . . . . . .  10
   Appendix A.  Open Issues  . . . . . . . . . . . . . . . . . . . .  10
   Appendix B.  Changes between revisions  . . . . . . . . . . . . .  11
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  12

1.  Terminology

   Design time: A time during which a YANG model and the implementation
   behind it is created.  Sometimes in other documents this period is
   divided into design and implementation time.

   Instance Data Set: A named set of data items that can be used as
   instance data in a YANG data tree.

   Instance Data File: A file containing an instance data set formatted
   according to the rules described in this document.

2.  Introduction

   A YANG server has a number of server-capabilities that can be
   retrieved from the server using protocols like NETCONF or RESTCONF.
   YANG server capabilities include

   o  data defined in ietf-yang-library: YANG modules, submodules,
      features, deviations, schema-mounts

   o  datastores supported

   o  alarms supported ([I-D.ietf-ccamp-alarm-module])

Lengyel & Claise         Expires January 3, 2019                [Page 2]

Internet-Draft             YANG Instance Data                  July 2018

   o  data nodes, subtrees that support or do not support on-change
      notifications ([I-D.ietf-netconf-yang-push])

   o  netconf-capabilities

   While it is good practice to allow a client to query these
   capabilites from the live YANG server, that is often not enough.
   Most server-capabilities are relatively stable but the fact is that
   some might change.  Looking at the change frequency, we have roughly
   three categories:

   1.  only at upgrade, e.g. introduced with a new SW package

   2.  rarely e.g. due to licensing or HW inserted

   3.  more frequently e.g. a capability might be dependent on the CPU
       or traffic load, although that would be most unusual

   Most capabilities belong to type 1), some to type 2) and a relatively
   small set to type 3).  Many network nodes only have type 1) or type
   1+2) capabilities.  Stable capabilities are usually defined by a
   vendor in design time, before the product is released.  While these
   capabilities can be retrieved from the live server in run-time, there
   is a strong need to provide the same data already during design time.
   (Often only a part of all the server capabilities can be made

   Often when a network node is released an associated NMS (network
   management system) is also released with it.  The NMS depends on the
   capabilities of the YANG server.  During NMS implementation
   information about server capabilities is needed.  If the information
   is not available early in some off-line document, but only as
   instance data from the live network node, the NMS implementation will
   be delayed, because it has to wait for the network node to be ready.
   Also assuming that all NMS implementors will have a correctly
   configured network node available to retrieve data from, is a very
   expensive proposition.  (An NMS may handle dozens of node types.)

   Beside NMS implementors, system integrators and many others also need
   the same information early.  Examples could be model driven testing,
   generating documentation, etc.

   As capabilities are often already known in design time and are
   relativaly stable, it feasible and advantageous to define/document
   them early.  This document specifies a file format for YANG instance
   data that may be used to provide server capability information,
   allowing vendors to specify capabilities early, in design time.

Lengyel & Claise         Expires January 3, 2019                [Page 3]

Internet-Draft             YANG Instance Data                  July 2018

   The same instance data file format can be used for other purposes,
   like providing initial data for any YANG module.  E.g. a basic set of
   access control groups can be provided either by a device vendor or an
   operator using the network device.

2.1.  Use Case 1: Early Documentation of Server Capabilites

   An operator wants to integrate his own, in-house built management
   system with the network node from ACME Systems.  The management
   integration must be ready by the time the first AcmeRouter is
   installed in the network.  To do the integration the operator needs
   the list of supported YANG modules and features.  While this list
   could be read from the ietf-yang-library via Netconf, in order to
   allow time for developing the management integration, the operator
   demands this information early.  The operator will value that this
   information is available in a standard format, that is actually the
   same format that can be read later from the node via Netconf.

   YANG instance data files are used to provide design time information
   about server capabilities.

2.2.  Use Case 2: Preloading Data

   There are parts of the configuration that must be fully configurable
   by the operator, however for which often a semi-standard default
   configuration will be sufficient.

   One example is access control groups/roles and related rules.  While
   a sophisticated operator may define dozens of different groups often
   a basic (read-only operator, read-write system administrator,
   security-administrator) triplet will be enough.  Vendors will often
   provide such default configuration data to make device configuration
   easier for an operator.

   Defining Access control data is a complex task.  To help the device
   vendor pre-defines a set of default groups (/nacm:nacm/groups) and
   rules for these groups to access specific parts of common models

   YANG instance data files are used to document and/or preload the
   default configurationp.

3.  Instance Data File Format

   Two standard formats to represent YANG Instance Data are specified
   based on the XML and JSON encoding.  The XML format is based on
   [RFC7950] while the JSON format is based on [RFC7951].  Later as

Lengyel & Claise         Expires January 3, 2019                [Page 4]

Internet-Draft             YANG Instance Data                  July 2018

   other YANG encodings (e.g.  CBOR) are defined further Instance Data
   formats may be specified.

   For both formats data is placed in a top level auxiliary container
   named "instance-data-set".  The purpose of the container, which is
   not part of the real data itself, is to carry meta-data for the
   complete instance-data-set.

   The XML format SHALL follow the format returned for a NETCONF GET
   operation.  The <data> anydata (which is not part of the real data
   itself) SHALL contain all data that would be inside the <data>
   wrapper element of a reply to the <get> operation.  XML attributes
   SHOULD NOT be present, however if a SW receiving a YANG instance data
   file encounters XML attributes unknown to it, it MUST ignore them,
   allowing them to be used later for other purposes.

   The JSON format SHALL follow the format of the reply returmed for a
   RESTCONF GET request directed at the datastore resource:
   {+restconf}/data.  ETags and Timestamps SHOULD NOT be included, but
   if present SHOULD be ignored.

   A YANG Instance data file MUST contain a single instance data set.
   Instance data MUST conform to the corresponding YANG Modules and
   follow the XML/JSON encoding rules as defined in [RFC7950] and
   [RFC7951] and use UTF-8 character encoding.  Default values SHOULD
   NOT but MAY be included.  Config=true and config=false data MAY be
   mixed in the instance data file.  Instance data files MAY contain
   partial data sets.  This means mandatory, min-elements or require-
   instance=true constrains MAY be violated.

   The name of the file SHOULD be of the form:

      instance-data-set-name ['@' revision-date] ( '.yid' )

      E.g. acme-router-modules@2018-01-25.yid

   Meta data, information about the data set itself SHALL be included in
   the instance data set.  This data will be children of the top level
   instance-data-set container as defined in the ietf-instance-data YANG
   module.  Meta data SHALL include:

   o  Name of the instance data set

   Meta data SHOULD include:

   o  Revision date of the instance data set (later a semantic version
      MAY also be included)

Lengyel & Claise         Expires January 3, 2019                [Page 5]

Internet-Draft             YANG Instance Data                  July 2018

   o  Description of the instance data set.  The description SHOULD
      contain information whether and how the data can change during the
      lifetime of the YANG server.

<?xml version="1.0" encoding="UTF-8"?>
<instance-data-set xmlns=
    <description>Defines the minimal set of modules that any acme-router
       will contain. These modules will always be present.</description>
    <yang-library xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-library">
          <!-- description "A later revision may be used."; -->

                 Figure 1: XML Instance Data File example

Lengyel & Claise         Expires January 3, 2019                [Page 6]

Internet-Draft             YANG Instance Data                  July 2018

     "ietf-yang-instance-data:instance-data-set": {
       "name": "acme-router-modules",
       "revision": "2108-01-25",
       "contact": "",
         "Defines the set of modules that an acme-router will contain.",
       "data": {
         "ietf-yang-library:yang-library": {
           "module-set": [
             "name": "basic",
             "module": [
                 "name": "ietf-system",
                 "revision": "2014-08-06",
                 "namespace": "urn:ietf:params:xml:ns:yang:ietf-system",
                 "feature": ["authentication", "radius-authentication"]

                 Figure 2: JSON Instance Data File example

3.1.  Data Life cycle

   Data defined or documented in YANG Instance Data Sets may be used for
   preloading a YANG server with this data, but the server may populate
   the data without using the actual file in which case the Instance
   Data File is only used as documentation.

   While such data will usually not change, data documented by Instance
   Data Files MAY be changed by the YANG server itself or by management
   operations.  It is out of scope for this document to specify a method
   to prevent this.  If the information retrieved in run-time via
   Netconf/Restconf and the YANG Instance Data File for the same YANG
   module are in conflict, the run-time data MUST be considered
   authorative.  Whether this data changes and if so, when and how,
   SHOULD be described either in the instance data file description
   statements or some other implementation specific manner.

   Notifications about the change of data documented by Instance Data
   Sets may be supplied by e.g. the Yang-Push mechanism, but it is out
   of scope for this document.

Lengyel & Claise         Expires January 3, 2019                [Page 7]

Internet-Draft             YANG Instance Data                  July 2018

4.  YANG Model

   <CODE BEGINS> file "ietf-yang-instance-data.yang"

   module ietf-yang-instance-data {
     yang-version 1.1;
     prefix yid ;

     import ietf-yang-data-ext { prefix yd; }

     organization  "IETF NETMOD Working Group";
      "WG Web:   <>
       WG List:  <>

       Author:  Balazs Lengyel

     description "The module defines the structure and content of YANG
          Instance Data Sets.";

     revision 2018-06-30 {
       description  "Initial revision.";
       reference "RFC XXXX: YANG Instance Data";

     yd:yang-data instance-data-format {
       container instance-data-set {
         description "Auxiliary container to carry meta-data for
           the complete instance data set.";

         leaf name {
           type string;
           mandatory true;
           description "Name of a YANG instance data set.";

         leaf description { type string; }

         leaf contact {
           type string;
           description "Contains the same information the contact
               statement carries for a YANG module.";

         leaf organization {

Lengyel & Claise         Expires January 3, 2019                [Page 8]

Internet-Draft             YANG Instance Data                  July 2018

           type string;
           description "Contains the same information the
               organization statement carries for a YANG module.";

         list revision {
           key date;
           description "An instance-data-set SHOULD have at least
               one revision entry.  For every published
               editorial change, a new one SHOULD be added in front
               of the revisions sequence so that all revisions are
               in reverse chronological order.";

           leaf date {
             type string {
               pattern '\d{4}-\d{2}-\d{2}';
             description "Specifies the data the revision
                 was last modified. Formated as YYYY-MM-DD";

           leaf description { type  string; }

         anydata data {
           mandatory true;
           description "Contains the real instance data.
               The data MUST conform to the relevant YANG Modules.";


5.  Security Considerations

   Depending on the nature of the instance data, instance data files MAY
   need to be handled in a secure way.  The same type of handling should
   be applied, that would be needed for the result of a <get> operation
   returning the same data.

6.  IANA Considerations

   To be completed, all the usual requests for a new YANG module

Lengyel & Claise         Expires January 3, 2019                [Page 9]

Internet-Draft             YANG Instance Data                  July 2018

7.  References

7.1.  Normative References

              Bierman, A., Bjorklund, M., and K. Watsen, "YANG Data
              Extensions", draft-ietf-netmod-yang-data-ext-01 (work in
              progress), March 2018.

   [RFC7950]  Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language",
              RFC 7950, DOI 10.17487/RFC7950, August 2016,

   [RFC7951]  Lhotka, L., "JSON Encoding of Data Modeled with YANG",
              RFC 7951, DOI 10.17487/RFC7951, August 2016,

7.2.  Informative References

              Vallin, S. and M. Bjorklund, "YANG Alarm Module", draft-
              ietf-ccamp-alarm-module-01 (work in progress), February

              Bierman, A., Bjorklund, M., Schoenwaelder, J., Watsen, K.,
              and R. Wilton, "YANG Library", draft-ietf-netconf-
              rfc7895bis-06 (work in progress), April 2018.

              Clemm, A., Voit, E., Prieto, A., Tripathy, A., Nilsen-
              Nygaard, E., Bierman, A., and B. Lengyel, "YANG Datastore
              Subscription", draft-ietf-netconf-yang-push-17 (work in
              progress), July 2018.

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,

   [RFC8174]  Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC
              2119 Key Words", BCP 14, RFC 8174, DOI 10.17487/RFC8174,
              May 2017, <>.

Appendix A.  Open Issues

Lengyel & Claise         Expires January 3, 2019               [Page 10]

Internet-Draft             YANG Instance Data                  July 2018

   o  Shall we create tags to hold instance data blocks in RFCs just as
      we have similar tags for YANG modules: <CODE BEGINS> <CODE ENDS>

   o  Should we use yang-data-ext to define the instance data module?
      Proposal: yes.  This is the perfect use case for it.  It does not
      affect the actual instance-data-file format.  It maybe more
      difficult for some tools.  Exactly how ? Using it is important in
      mixed modules, but might not be important here.

   o  Do we need to specify which datastore the data belongs to?
      Proposal: Not now.  Only if we find a use-case for it.  As for now
      config=false data always belongs to the operational datastore,
      while config=true belongs to running or candidate.  Even selecting
      between candidate and running might be dependent on other run-time

   o  Shall we recommend as a general practice: servers SHOULD document
      their capabilities using instance data?  While I very strongly
      believe it SHOULD be a preferred practice, there were other
      opinions raised.  If we don't document it here, should we create a
      separate draft to recommend documenting server properties (e.g.
      for ietf-yang-library) as instance data?  Or maybe an rfc7895bis-

   o  Allow multiple instance-data-sets in one file?  Proposal: No.  One
      instance-data-set can contain data for any number of modules.
      Packaging multiple separate instance-data-sets together in a file
      is out-of-scope just as packaging multiple YANG modules in one
      file was never considered.

   o  Shall we specify the revision/semantic version of the YANG modules
      we are defining data for?  Proposal: No.  Revision is too strict,
      semver is not ready.  Maybe later.

   o  Shall we define a semantic version for the instance-data-set?
      Proposal: No.  We don't know what compatibility mean for instance
      data?  Maybe later.

Appendix B.  Changes between revisions

   v01 - v02

   o  The recommendation to document server capabilities was changed to
      be just the primary use-case.  (Merged chapter 4 into the use case

Lengyel & Claise         Expires January 3, 2019               [Page 11]

Internet-Draft             YANG Instance Data                  July 2018

   o  Stated that RFC7950/7951 encoding must be followed which also
      defines (dis)allowed whitespace rules.

   o  Added UTF-8 encoding as it is not specified in t950 for instance

   o  added XML declaration

   v00 - v01

   o  Redefined using yang-data-ext

   o  Moved meta data into ordinary leafs/leaf-lists

Authors' Addresses

   Balazs Lengyel
   1117 Budapest

   Phone: +36-70-330-7909

   Benoit Claise
   Cisco Systems, Inc.
   De Kleetlaan 6a b1
   1831 Diegem

   Phone: +32 2 704 5622

Lengyel & Claise         Expires January 3, 2019               [Page 12]