Network Working Group B. Lengyel Internet-Draft Ericsson Intended status: Standards Track B. Claise Expires: August 10, 2018 Cisco Systems, Inc. February 6, 2018 YANG Instance Data Files and their use for Documenting Server Capabilities draft-lengyel-netmod-yang-instance-data-00 Abstract 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), which should be done using 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 https://datatracker.ietf.org/drafts/current/. 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 August 10, 2018. 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 (https://trustee.ietf.org/license-info) 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 August 10, 2018 [Page 1] Internet-Draft YANG Instance Data February 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. 1. Terminology 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 among other things o data defined in ietf-yang-library (YANG modules, submodules, features, deviations, schema-mounts) o datastores supported o alarms supported (draft-vallin-ccamp-alarm-module) o data nodes, subtrees that support or do not support on-change notifications (draft-ietf-netconf-yang-push)- o netconf-capabilities o etc. While it is good practice to allow a client to query these capabilites from the live YANG server, that is often not enough. Many of these server-capabilities are relatively stable. They may change 1. only at upgrade, or 2. rarely (e.g. due to licensing), or 3. more frequently 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 Lengyel & Claise Expires August 10, 2018 [Page 2] Internet-Draft YANG Instance Data February 2018 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 available.) 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 the 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 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. This document specifies a file format for YANG instance data and proposes to use it to provide server capability information, allowing vendors to specify capabilities together with the YANG modules. 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 a network device. 2.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, a 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. 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 August 10, 2018 [Page 3] Internet-Draft YANG Instance Data February 2018 2.2. 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 9000 is installed in the network. To do the integration the operator needs the 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 he can later read from the node via Netconf. 2.3. Use Case 2: Preloading Data Defining Access control data is a complex task. To help with this the device vendor pre-defines some of the data. Among others a set of default groups (/nacm:nacm/nacm:groups) are defined e.g. "read- only", "operator", "sys-admin". The operator will often use these default groups, but is also free to completely remove them and define his own set of groups. 3. Instance Data File Format Two standard formats to represent YANG Instance Data are specified based on the XML and JSON serialization. The XML format is defined in [RFC7950] while the JSON format is defined in [RFC7951] with the additions below. For both formats data is placed in a top level auxiliary container named "instance-data". The purpose of the container, which is not part of the real data itself, is to contain the potentially multiple top level XML elements and to carry meta-data for the complete instance-data-set. The XML format SHALL follow the format returned for a NETCONF GET operation. The container SHALL contain all data that would be inside the wrapper element. XML attributes SHOULD NOT be used, however if a SW receiving a YANG instance data file encounters XML attributes it MUST discard them silently, 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. A YANG Instance data file MUST contain a single instance data set. Instance data MUST conform to the corresponding YANG Modules. Lengyel & Claise Expires August 10, 2018 [Page 4] Internet-Draft YANG Instance Data February 2018 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. Meta data, information about the data set itself SHALL be included in the instance data file. Metadata SHALL be formulated following [RFC7952] using the annotations defined in module ietf-yang-instance- data-annotations. All metadata SHOULD be connected to the top level "instance-data" container. Meta data SHALL include: o Name of the instance data set o Revision date of the instance data set (later a semantic version MAY also be included) o Description of the instance data set. The description SHOULD contain information whether and how the data can change during the lifetime of the network element. Any other metadata may also be included after these items. ietf-system 2014-08-06 urn:ietf:params:xml:ns:yang:ietf-system implement authentication radius-authentication Figure 1: XML Instance Data File example Lengyel & Claise Expires August 10, 2018 [Page 5] Internet-Draft YANG Instance Data February 2018 { "instance-data": { "@": { "ietf-yang-instance-data-annotations:instance-data-set": "acme-router-modules", "ietf-yang-instance-data-annotations:revision": "2108-01-25", "ietf-yang-instance-data-annotations:contact": "info@acme.com", "ietf-yang-instance-data-annotations:description": "Defines the set of modules that an acme-router will contain." }, "ietf-yang-library:modules-state": { "module": [ { "name": "ietf-system", "revision": "2014-08-06", "namespace": "urn:ietf:params:xml:ns:yang:ietf-system", "conformance-type": "implement", "feature": ["authentication", "radius-authentication"] } ] } } } Figure 2: JSON Instance Data File example 4. Providing Initial Data YANG instance data files SHOULD be used to provide design time information about server capabilities. The content of the instance data file SHOULD describe the capabilities of the server, however there is no general guarantee that the capabilities will not change over time. Whether capabilities change and if so, when and how SHOULD be described either in the instance data file description statements or some other implementation specific manner. The set of server capabilities to be documented will be defined by other standards and specifications, and is out of scope for this document. Whether and how the instance data files are used by SW implementing a YANG server is out of scope for this specification. 5. YANG Model file "ietf-yang-instance-data-annotations.yang" module ietf-yang-instance-data-annotations { yang-version 1.1; namespace Lengyel & Claise Expires August 10, 2018 [Page 6] Internet-Draft YANG Instance Data February 2018 "urn:ietf:params:xml:ns:yang:ietf-yang-instance-data-annotations"; prefix ida ; import ietf-yang-types { prefix "yang"; } import ietf-yang-metadata { prefix "md"; } organization "IETF NETMOD Working Group"; contact "WG Web: WG List: Author: Balazs Lengyel "; description "The module defines annotations to allow defining metadata for YANG Instance Data files."; reference "RFC 7950, RFC 7962"; revision 2017-08-24 { description "Initial revision."; reference "RFC XXXX: YANG Instance Data"; } md:annotation instance-data-set { type yang:yang-identifier; description "Defines the name of a YANG instance data set. The annotation SHALL only be used on the top level element in RFC XXXX defined YANG Instance Data files. Exactly one instance-data-set annotation SHALL be used per element."; } md:annotation contact { type string; description "Contains the same information the ontact statement carries for a YANG module. The annotation SHALL only be used on the top level element in RFC XXXX defined YANG Instance Data files. Zero or one contact annotation SHALL be used per element."; } md:annotation organization { type string; Lengyel & Claise Expires August 10, 2018 [Page 7] Internet-Draft YANG Instance Data February 2018 description "Contains the same information the organization statement carries for a YANG module. The annotation SHALL only be used on the top level element in RFC XXXX defined YANG instance data files. Zero or one organization annotation SHALL be used per element."; } md:annotation revision { type string { pattern '\d{4}-\d{2}-\d{2}'; } description "Specifies the data the instance-data-set was modified for this release. The annotation SHALL only be used on the top level element in RFC XXXX defined YANG Instance Data files. One or more revision annotations SHALL be used per element. A separate annotation SHOULD be added each time the instance-data-set is released."; } md:annotation description { type string; description "Defines the name of a YANG instance data set. The annotation SHALL be used on the top level element in RFC XXXX defined YANG Instance Data files, and MAY be used on other data elements of an instance data file. Zero one description annotation SHALL be used per element, but exactly one description annotation SHALL be used on the top level element."; } } 6. Security Considerations To be completed 7. IANA Considerations No IANA action is requested. Lengyel & Claise Expires August 10, 2018 [Page 8] Internet-Draft YANG Instance Data February 2018 8. References 8.1. Normative References [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, . [RFC7952] Lhotka, L., "Defining and Using Metadata with YANG", RFC 7952, DOI 10.17487/RFC7952, August 2016, . 8.2. Informative References [I-D.ietf-netconf-rfc7895bis] Bierman, A., Bjorklund, M., Schoenwaelder, J., Watsen, K., and R. Wilton, "YANG Library", draft-ietf-netconf- rfc7895bis-04 (work in progress), January 2018. [I-D.ietf-netconf-yang-push] Clemm, A., Voit, E., Prieto, A., Tripathy, A., Nilsen- Nygaard, E., Bierman, A., and B. Lengyel, "YANG Datastore Subscription", draft-ietf-netconf-yang-push-13 (work in progress), February 2018. [I-D.vallin-ccamp-alarm-module] Vallin, S. and M. Bjorklund, "YANG Alarm Module", draft- vallin-ccamp-alarm-module-01 (work in progress), October 2017. [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, . Authors' Addresses Lengyel & Claise Expires August 10, 2018 [Page 9] Internet-Draft YANG Instance Data February 2018 Balazs Lengyel Ericsson xxx 1117 Budapest Hungary Phone: +36-70-330-7909 Email: balazs.lengyel@ericsson.com Benoit Claise Cisco Systems, Inc. De Kleetlaan 6a b1 1831 Diegem Belgium Phone: +32 2 704 5622 Email: bclaise@cisco.com Lengyel & Claise Expires August 10, 2018 [Page 10]