Internet Engineering Task Force B. Yan, Ed. Internet-Draft Z. Li, Ed. Intended status: Standards Track Y. Zhao, Ed. Expires: November 16, 2020 Beijing Univ. of Posts and Telecom. May 15, 2020 YANG Model Conversion draft-yby-yang-model-conversion-00 Abstract This document introduces the grammer extensions and relavant rules for YANG 1.0 [RFC6020] to complete the mapping between two similar YANG modules that describe the same entity. 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 November 16, 2020. Copyright Notice Copyright (c) 2020 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 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. Yan, et al. Expires November 16, 2020 [Page 1] Internet-Draft Abbreviated Title May 2020 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 3 2. Requirements Language . . . . . . . . . . . . . . . . . . . . 3 3. Overview . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 5. Mapping Relationships . . . . . . . . . . . . . . . . . . . . 4 5.1. One-to-one Mapping . . . . . . . . . . . . . . . . . . . 4 5.2. One-to-many Mapping . . . . . . . . . . . . . . . . . . . 4 5.3. One-to-none Mapping . . . . . . . . . . . . . . . . . . . 4 6. Grammer Extension for YANG . . . . . . . . . . . . . . . . . 4 6.1. The mapto Statement . . . . . . . . . . . . . . . . . . . 4 6.2. The statements Statement . . . . . . . . . . . . . . . . 4 6.2.1. The statements's Substatements . . . . . . . . . . . 4 6.2.2. The source Substatement . . . . . . . . . . . . . . . 4 6.2.3. The destination Substatement . . . . . . . . . . . . 4 6.2.4. Usage example . . . . . . . . . . . . . . . . . . . . 4 6.3. The maptype Statement . . . . . . . . . . . . . . . . . . 4 6.3.1. The value of oto . . . . . . . . . . . . . . . . . . 4 6.3.2. The value of otm . . . . . . . . . . . . . . . . . . 5 6.3.3. The value of otn . . . . . . . . . . . . . . . . . . 5 6.3.4. Usage example . . . . . . . . . . . . . . . . . . . . 5 6.4. The deviation Statement . . . . . . . . . . . . . . . . . 5 6.4.1. Usage example . . . . . . . . . . . . . . . . . . . . 5 7. Mapping for statements . . . . . . . . . . . . . . . . . . . 5 7.1. Mapping of module Statement . . . . . . . . . . . . . . . 5 7.2. Mapping of submodule Statement . . . . . . . . . . . . . 5 7.3. Mapping of typedef Statement . . . . . . . . . . . . . . 5 7.4. Mapping of type Statement . . . . . . . . . . . . . . . . 5 7.5. Mapping of container Statement . . . . . . . . . . . . . 5 7.6. Mapping of leaf Statement . . . . . . . . . . . . . . . . 5 7.7. Mapping of leaf-list Statement . . . . . . . . . . . . . 5 7.8. Mapping of list Statement . . . . . . . . . . . . . . . . 5 7.9. Mapping of choice Statement . . . . . . . . . . . . . . . 5 7.10. Mapping of anyxml Statement . . . . . . . . . . . . . . . 5 7.11. Mapping of grouping Statement . . . . . . . . . . . . . . 5 7.12. Mapping of uses Statement . . . . . . . . . . . . . . . . 5 7.13. Mapping of rpc Statement . . . . . . . . . . . . . . . . 5 7.14. Mapping of notification Statement . . . . . . . . . . . . 5 7.15. Mapping of augment Statement . . . . . . . . . . . . . . 5 7.16. Mapping of identity Statement . . . . . . . . . . . . . . 6 7.17. Mapping of extension Statement . . . . . . . . . . . . . 6 7.18. Mapping of conformance-related Statements . . . . . . . . 6 7.19. Mapping of common Statements . . . . . . . . . . . . . . 6 8. Synchronization among Multiple Model's Datastores . . . . . . 6 9. Mapping Deviation Evaluation . . . . . . . . . . . . . . . . 6 10. Acknowledgements . . . . . . . . . . . . . . . . . . . . . . 6 11. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 Yan, et al. Expires November 16, 2020 [Page 2] Internet-Draft Abbreviated Title May 2020 12. Security Considerations . . . . . . . . . . . . . . . . . . . 6 13. References . . . . . . . . . . . . . . . . . . . . . . . . . 6 13.1. Normative References . . . . . . . . . . . . . . . . . . 6 13.2. Informative References . . . . . . . . . . . . . . . . . 7 Appendix A. Additional Stuff . . . . . . . . . . . . . . . . . . 7 Authors' Addresses . . . . . . . . . . . . . . . . . . . . . . . 7 1. Introduction YANG 1.0 [RFC6020] and YANG 1.1 [RFC7950] are proposed originally as a domain-specific language to define the network model for NETCONF [RFC6241] protocol. Based on YANG language, some organizations define their own public network models, and many companies (the equipment manufacturer, the telecom operators, the Internet companies, etc.) define their private models. Therefore, a network entity (device, etc.) MAY be described as different YANG data trees by different organizations and companies. In some cases, the data is required to be converted among different YANG models. This document proposes some extensions, named Yang Model Conversion (YMC), for YANG 1.0 [RFC6020] to define the mapping rules of the nodes under the schema tree. By using YMC, the conversion rules MUST be clear, and the information deviation of conversion SHOULD be evaluated properly. 2. Requirements Language The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 [RFC2119]. 3. Overview YMC is consisted of a set of new statements based on YANG language. These statements are designed to represent the mapping relationships of one-to-one, one-to-many, and one-to-none for different schema nodes under different XPath. The statements that includes leaf, leaf-list, list, etc. MAY be mapped to other statements with some limitations. For the nested usage of statements, the mapping statements SHOULD be also nested. When there is a big gap between two YANG models, the mapping deviation MAY be introduced and result in failures in networks. YMC proposes a method to evaluate the information loss while mapping. Thus, the performance SHOULD be predicted, and some potential risks SHOULD be avoided in advance. 4. Terminology The following terminologies are defined in this document: o YMC - YANG model conversion. Yan, et al. Expires November 16, 2020 [Page 3] Internet-Draft Abbreviated Title May 2020 o map set - a set of map nodes that define the mapping rules between two YANG modules. A YANG file SHOULD include only one map set. o map node - a node in the map set that SHOULD be used to map the schema node from one module to the schema node in another module. o mapto - a node of map nodes. o statements - a node of map nodes. o maptype - a node of map nodes. o oto - a value of maptype node that means the one-to-one mapping. o otm - a value of maptype node that means the one-to-many mapping. o otn - a value of maptype node that means the one-to-none mapping. 5. Mapping Relationships 5.1. One-to-one Mapping 5.2. One-to-many Mapping 5.3. One-to-none Mapping 6. Grammer Extension for YANG 6.1. The mapto Statement 6.2. The statements Statement 6.2.1. The statements's Substatements 6.2.2. The source Substatement 6.2.3. The destination Substatement 6.2.4. Usage example 6.3. The maptype Statement 6.3.1. The value of oto Yan, et al. Expires November 16, 2020 [Page 4] Internet-Draft Abbreviated Title May 2020 6.3.2. The value of otm 6.3.3. The value of otn 6.3.4. Usage example 6.4. The deviation Statement 6.4.1. Usage example 7. Mapping for statements This section divides all statements of YANG 1.0 into several kinds of categories. 7.1. Mapping of module Statement 7.2. Mapping of submodule Statement 7.3. Mapping of typedef Statement 7.4. Mapping of type Statement 7.5. Mapping of container Statement 7.6. Mapping of leaf Statement 7.7. Mapping of leaf-list Statement 7.8. Mapping of list Statement 7.9. Mapping of choice Statement 7.10. Mapping of anyxml Statement 7.11. Mapping of grouping Statement 7.12. Mapping of uses Statement 7.13. Mapping of rpc Statement 7.14. Mapping of notification Statement 7.15. Mapping of augment Statement Yan, et al. Expires November 16, 2020 [Page 5] Internet-Draft Abbreviated Title May 2020 7.16. Mapping of identity Statement 7.17. Mapping of extension Statement 7.18. Mapping of conformance-related Statements 7.19. Mapping of common Statements 8. Synchronization among Multiple Model's Datastores 9. Mapping Deviation Evaluation 10. Acknowledgements This document is Supported by BUPT Excellent Ph.D. Students Foundation (CX2019314). 11. IANA Considerations This memo includes no request to IANA. 12. Security Considerations All drafts are required to have a security considerations section. See RFC 3552 [RFC3552] for a guide. 13. References 13.1. Normative References [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10.17487/RFC6020, October 2010, . [RFC6241] Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed., and A. Bierman, Ed., "Network Configuration Protocol (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June 2011, . [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, August 2016, . Yan, et al. Expires November 16, 2020 [Page 6] Internet-Draft Abbreviated Title May 2020 13.2. Informative References [RFC3552] Rescorla, E. and B. Korver, "Guidelines for Writing RFC Text on Security Considerations", BCP 72, RFC 3552, DOI 10.17487/RFC3552, July 2003, . Appendix A. Additional Stuff This becomes an Appendix. Authors' Addresses Boyuan Yan (editor) Beijing Univ. of Posts and Telecom. No. 10 Xitucheng Rd. Beijing, Haidian Dist. CN Phone: +86 188 1052 8290 Email: yanboyuan@bupt.edu.cn Zhuotong Li (editor) Beijing Univ. of Posts and Telecom. No. 10 Xitucheng Rd. Beijing, Haidian Dist. CN Email: lizhuotong@bupt.edu.cn Yongli Zhao (editor) Beijing Univ. of Posts and Telecom. No. 10 Xitucheng Rd. Beijing, Haidian Dist. CN Email: yonglizhao@bupt.edu.cn Yan, et al. Expires November 16, 2020 [Page 7]