RFC 9195: A File Format for YANG Instance Data
- B. Lengyel,
- B. Claise
Abstract
There is a need to document data defined in YANG models at design time, implementation time, or when a live server is unavailable. This document specifies a standard file format for YANG instance data, which follows the syntax and semantics of existing YANG models and annotates it with metadata.¶
Status of This Memo
This is an Internet Standards Track document.¶
This document is a product of the Internet Engineering Task Force (IETF). It represents the consensus of the IETF community. It has received public review and has been approved for publication by the Internet Engineering Steering Group (IESG). Further information on Internet Standards is available in Section 2 of RFC 7841.¶
Information about the current status of this document, any
errata, and how to provide feedback on it may be obtained at
https://
Copyright Notice
Copyright (c) 2022 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://
1. Introduction
There is a need to document data defined in YANG models when a live server is unavailable.
Data is often needed at design time, implementation time, or even later
when a live running server is unavailable.
To facilitate this offline delivery of data, this document specifies a standard
format for YANG instance data sets and YANG instance data files.
The format of the instance data set is defined by the "ietf
The following is a list of already
- UC1
-
Documentation of server capabilities¶
- UC2
-
Preloading default configuration data¶
- UC3
-
Documenting factory default settings¶
- UC4
-
Storing the configuration of a device, e.g., for backup, archive, or audit purposes¶
- UC5
-
Storing diagnostics data¶
- UC6
-
Allowing YANG instance data to potentially be carried within other inter-process communication (IPC) message formats¶
- UC7
-
Default instance data used as part of a templating solution¶
- UC8
-
Providing data examples in RFCs or internet drafts¶
Appendix B describes the first three use cases in detail.¶
There are many and varied use cases where YANG instance data could be used. This document does not limit future uses of instance data sets, so specifying how and when to use YANG instance data is out of scope for this document. It is anticipated that other documents will define specific use cases. Use cases are listed only as examples.¶
1.1. Terminology
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
- Instance Data:
- A collection of instantiated data nodes.¶
- Instance Data Set:
- A named set of data items annotated with metadata 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.¶
- Content-schema:
- A set of YANG modules with their revision, supported features, and deviations for which the instance data set contains instance data.¶
- Content-defining YANG Module:
- An individual YANG module that is part of the content-schema.¶
1.2. Principles
The following is a list of the basic principles of the instance data format:¶
- P1
- Two standard formats shall be defined based on the XML and JSON encodings.¶
- P2
- Instance data shall reuse existing encoding rules for YANG-defined data.¶
- P3
- Metadata about the instance data set (Section 2, Paragraph 14) shall be defined.¶
- P4
- A YANG instance data set shall be allowed to contain data for multiple YANG modules.¶
- P5
- Instance data shall be allowed to contain configuration data, state data, or a mix of the two.¶
- P6
- Partial data sets shall be allowed.¶
- P7
- The YANG instance data format shall be usable for any data for which YANG module(s) are defined and available to the reader, independent of whether the module is implemented by a server.¶
- P8
- It shall be possible to report the identity of the datastore with which the instance data set is associated.¶
1.3. Delivery of Instance Data
Instance data sets that are produced as a result of some sort of specification or design effort may be available without the need for a live server, e.g., via download from the vendor's website or in any other way that product documentation is distributed.¶
Other instance data sets may be read from or produced by the YANG server itself, e.g., UC5 documenting diagnostic data.¶
1.4. Data Life Cycle
A YANG instance data set is created at a specific
point of time. If the data changes afterwards, the instance data set
will no longer represent the current data unless it is updated.
The current values may be
retrieved at runtime via NETCONF
Whether the instance data changes and, if so, when and how
should be described either in the instance data set's description
statement or in some other implementation
2. Instance Data File Format
A YANG instance data file MUST contain a single instance data set and no additional data.¶
The format of the instance data set is defined by the
"ietf
Two formats are specified based on the XML and JSON YANG encodings. The file formats are achieved by applying the respective XML and JSON encoding rules for the YANG structure included in this document. Later, as other YANG encodings (e.g., CBOR) are defined, further instance data formats may be specified.¶
The content-data part MUST conform to the content-schema while allowing for the exceptions listed below. The content-data part SHALL follow the encoding rules defined in [RFC7950] for XML and [RFC7951] for JSON and MUST use UTF-8 character encoding. Content-data MAY include:¶
An instance data set MAY contain data for any number of YANG modules; if needed, it MAY carry the complete configuration and state data for a server. Default values should be excluded where they do not provide additional useful data.¶
Configuration ("config true") and operational state data ("config false") MAY be mixed in the instance data file.¶
Instance data files MAY contain partial data sets. This means "mandatory",
"min-elements", "require
The name of the instance data file SHOULD be of the following form (using ABNF notation [RFC5234]):¶
Examples include:¶
If the leaf "name" is present in the instance data header,
its value SHOULD be used for the "instance
Metadata, information about the
data set itself, MUST be included. Some metadata items are
defined in the YANG module "ietf
Metadata MUST include:¶
Metadata SHOULD include:¶
2.1. Specifying the Content Schema
To properly understand and use an instance data set, the user needs to know the content-schema. The content-schema can be specified either in external documents or within the instance data set. In the latter case, one of the following methods MUST be used:¶
- Inline method:
- Include the needed information as part of the instance data set.¶
- Simplified
-inline method: - Include the needed information as part of the instance data set; only the modules' name and revision-date are used.¶
- URI method:
- Include a URI that references another YANG instance data file. This instance data file will use the same content-schema as the referenced YANG instance data file (if you don't want to repeat the info again and again).¶
Additional methods, e.g., a YANG
Note that the specified content-schema only indicates the set of modules that were used to define this YANG instance data set. Sometimes instance data may be used for a server supporting a different YANG module set (e.g., for the "Preloading default configuration data" use case, UC2 in Section 1, the instance data set may not be updated every time the YANG modules on the server are updated). Whether an instance data set originally defined using a specific content-schema is usable with another schema depends on many factors, including the number of differences and the compatibility between the original and the other schema when considering modules, revisions, features, deviations, the scope of the instance data, etc.¶
2.1.1. Inline Method
The "inline
2.1.2. Simplified-Inline Method
The instance data set contains a list of content
2.1.3. URI Method
The "same
The referenced instance data file MAY have no content-data if it is used solely for specifying the content-schema.¶
If a referenced instance data file is unavailable, the content-schema is unknown.¶
The URI method is advantageous when the user wants to avoid the overhead of specifying the content-schema in each instance data file -- for example, in UC6, when the system creates a diagnostic file every minute to document the state of the server.¶
An example of the URI method is provided in Section 2.2.3.¶
2.2. Examples
2.2.1. Documentation of Server Capabilities
The example file acme
2.2.2. Preloading Default Configuration Data
The example file read
2.2.3. Storing Diagnostics Data
The example file acme
3. YANG Instance Data Model
3.1. Tree Diagram
The following tree diagram [RFC8340] provides an overview of the data model.¶
4. Security Considerations
The YANG module defined in this document only defines a wrapper structure specifying a format and a metadata header for YANG instance data defined by the content-schema. Because of this, the security considerations template for YANG models in Section 3.7.1 of [RFC8407] is not followed. The instance data is designed to be accessed as a stored file or over any file access method or protocol.¶
The document does not specify any method to influence the behavior of a server.¶
The header part is usually not security sensitive; however, sensitive information may be included, in which case it needs to be handled securely, as mentioned below. Information to consider includes:¶
The content part may contain sensitive data. The security sensitivity of this data is completely dependent on the content-schema. Depending on the nature of the instance data, instance data files MAY need to be handled securely. The same kind of handling should be applied to this file at rest and in transit that would be needed for the result of a read operation returning the same data. These in-transit protection mechanisms will also mitigate integrity issues when transporting the file.¶
Instance data files should be protected against modification or
unauthorized access using normal file-handling mechanisms.
When copying the original files or providing file access for
additional users, care should be taken not to reveal information
unintentionally
If the URI method is used for specification of the content-schema, there is a risk that the config schema section in the referenced YANG instance data file may be altered maliciously or even as part of its normal handling. In this case, the content-schema might differ from the one expected. Protecting the integrity and stability of the referenced file should be ensured.¶
5. IANA Considerations
This document registers one URI and one YANG module.¶
5.1. URI Registration
This document registers the following URI in the "IETF XML Registry" [RFC3688]:¶
5.2. YANG Module Name Registration
This document registers the following YANG module in the "YANG Module Names" registry [RFC6020]:¶
6. References
6.1. Normative References
- [RFC2119]
-
Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10
.17487 , , <https:///RFC2119 www >..rfc -editor .org /info /rfc2119 - [RFC5234]
-
Crocker, D., Ed. and P. Overell, "Augmented BNF for Syntax Specifications: ABNF", STD 68, RFC 5234, DOI 10
.17487 , , <https:///RFC5234 www >..rfc -editor .org /info /rfc5234 - [RFC6020]
-
Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10
.17487 , , <https:///RFC6020 www >..rfc -editor .org /info /rfc6020 - [RFC6243]
-
Bierman, A. and B. Lengyel, "With-defaults Capability for NETCONF", RFC 6243, DOI 10
.17487 , , <https:///RFC6243 www >..rfc -editor .org /info /rfc6243 - [RFC6991]
-
Schoenwaelder, J., Ed., "Common YANG Data Types", RFC 6991, DOI 10
.17487 , , <https:///RFC6991 www >..rfc -editor .org /info /rfc6991 - [RFC7950]
-
Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10
.17487 , , <https:///RFC7950 www >..rfc -editor .org /info /rfc7950 - [RFC7951]
-
Lhotka, L., "JSON Encoding of Data Modeled with YANG", RFC 7951, DOI 10
.17487 , , <https:///RFC7951 www >..rfc -editor .org /info /rfc7951 - [RFC7952]
-
Lhotka, L., "Defining and Using Metadata with YANG", RFC 7952, DOI 10
.17487 , , <https:///RFC7952 www >..rfc -editor .org /info /rfc7952 - [RFC8174]
-
Leiba, B., "Ambiguity of Uppercase vs Lowercase in RFC 2119 Key Words", BCP 14, RFC 8174, DOI 10
.17487 , , <https:///RFC8174 www >..rfc -editor .org /info /rfc8174 - [RFC8342]
-
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "Network Management Datastore Architecture (NMDA)", RFC 8342, DOI 10
.17487 , , <https:///RFC8342 www >..rfc -editor .org /info /rfc8342 - [RFC8525]
-
Bierman, A., Bjorklund, M., Schoenwaelder, J., Watsen, K., and R. Wilton, "YANG Library", RFC 8525, DOI 10
.17487 , , <https:///RFC8525 www >..rfc -editor .org /info /rfc8525 - [RFC8526]
-
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "NETCONF Extensions to Support the Network Management Datastore Architecture", RFC 8526, DOI 10
.17487 , , <https:///RFC8526 www >..rfc -editor .org /info /rfc8526 - [RFC8527]
-
Bjorklund, M., Schoenwaelder, J., Shafer, P., Watsen, K., and R. Wilton, "RESTCONF Extensions to Support the Network Management Datastore Architecture", RFC 8527, DOI 10
.17487 , , <https:///RFC8527 www >..rfc -editor .org /info /rfc8527 - [RFC8791]
-
Bierman, A., Björklund, M., and K. Watsen, "YANG Data Structure Extensions", RFC 8791, DOI 10
.17487 , , <https:///RFC8791 www >..rfc -editor .org /info /rfc8791
6.2. Informative References
- [RFC3688]
-
Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10
.17487 , , <https:///RFC3688 www >..rfc -editor .org /info /rfc3688 - [RFC8340]
-
Bjorklund, M. and L. Berger, Ed., "YANG Tree Diagrams", BCP 215, RFC 8340, DOI 10
.17487 , , <https:///RFC8340 www >..rfc -editor .org /info /rfc8340 - [RFC8407]
-
Bierman, A., "Guidelines for Authors and Reviewers of Documents Containing YANG Data Models", BCP 216, RFC 8407, DOI 10
.17487 , , <https:///RFC8407 www >..rfc -editor .org /info /rfc8407 - [RFC8632]
-
Vallin, S. and M. Bjorklund, "A YANG Data Model for Alarm Management", RFC 8632, DOI 10
.17487 , , <https:///RFC8632 www >..rfc -editor .org /info /rfc8632 - [RFC8641]
-
Clemm, A. and E. Voit, "Subscription to YANG Notifications for Datastore Updates", RFC 8641, DOI 10
.17487 , , <https:///RFC8641 www >..rfc -editor .org /info /rfc8641 - [RFC8792]
-
Watsen, K., Auerswald, E., Farrel, A., and Q. Wu, "Handling Long Lines in Content of Internet-Drafts and RFCs", RFC 8792, DOI 10
.17487 , , <https:///RFC8792 www >..rfc -editor .org /info /rfc8792 - [RFC8808]
-
Wu, Q., Lengyel, B., and Y. Niu, "A YANG Data Model for Factory Default Settings", RFC 8808, DOI 10
.17487 , , <https:///RFC8808 www >..rfc -editor .org /info /rfc8808
Appendix A. Backwards Compatibility
The concept of "backwards compatibility" and what changes are backwards compatible are not defined for instance data sets as they are highly dependent on the specific use case and the content-schema.¶
In case of "instance data sets" that are the result of design or specification activity, some changes that may be good to avoid are listed below.¶
YANG uses the concept of managed entities identified by key values; if the connection between the represented entity and the key value is not preserved during an update, this may lead to the following problems.¶
Appendix B. Detailed Use Cases
This section is non-normative.¶
B.1. Use Case 1: Early Documentation of Server Capabilities
A server has a number of server capabilities that are defined in YANG modules and can be retrieved from the server using protocols like NETCONF or RESTCONF. Server capabilities include:¶
While it is good practice to allow a client to query these capabilities from the live server, that is often not possible.¶
Often when a network node is released, an associated Network Management System (NMS) is also released with it. The NMS depends on the capabilities of the server. During NMS implementation, information about server capabilities is needed. If the information is unavailable early in some offline document but only as instance data from the live network node, the NMS implementation will be delayed because it has to wait until the network node is ready. Also, assuming that all NMS implementors will have correctly configured network nodes from which data can be retrieved is a very expensive proposition. (An NMS may handle dozens of node types.)¶
Network operators often build their own homegrown NMS systems that need to be integrated with a vendor's network node. The operator needs to know the network node's server capabilities in order to do this. Moreover, the network operator's decision to buy a vendor's product may even be influenced by the network node's Operations, Administration, and Maintenance (OAM) feature set documented as the server's capabilities.¶
Beside NMS implementors, system integrators and many others also need the same information early. Examples could be model-driven testing, generating documentation, etc.¶
Most server capabilities are relatively stable and change only during upgrade or due to licensing or the addition or removal of hardware. They are usually defined by a vendor at design time, before the product is released. It is feasible and advantageous to define and document them early, e.g., in a YANG instance data file.¶
It is anticipated that a separate IETF document will define in detail how and which set of server capabilities should be documented.¶
B.2. Use Case 2: Preloading Data
There are parts of the configuration that must be fully configurable by the operator. However, a simple default configuration often 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
The device vendor may define a set of default groups
YANG instance data files can be used to document and/or preload the default configuration.¶
B.3. Use Case 3: Documenting Factory Default Settings
Nearly every server has a factory default configuration. If the system is really badly misconfigured or if the current configuration is to be abandoned, the system can be reset to the default factory configuration.¶
YANG instance data can be used to document the factory default configuration. See [RFC8808].¶
Acknowledgments
For their valuable comments, discussions, and feedback, we wish to acknowledge Andy Bierman, Juergen Schoenwaelder, Rob Wilton, Joe Clarke, Kent Watsen, Martin Bjorklund, Ladislav Lhotka, Qin Wu, and other members of the Netmod Working Group.¶