NETCONF Data Modeling Language L. Bertz Internet-Draft Sprint Intended status: Standards Track March 9, 2017 Expires: September 10, 2017 YANG extension for Common Augmentations draft-bertz-netmod-commonaugment-01 Abstract This document defines a YANG extension to convey common schema augmentations. 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 http://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 September 10, 2017. Copyright Notice Copyright (c) 2017 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 (http://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. This document may contain material from IETF Documents or IETF Contributions published or made publicly available before November Bertz Expires September 10, 2017 [Page 1] Internet-Draft YANG extension for Common Augmentations March 2017 10, 2008. The person(s) controlling the copyright in some of this material may not have granted the IETF Trust the right to allow modifications of such material outside the IETF Standards Process. Without obtaining an adequate license from the person(s) controlling the copyright in such materials, this document may not be modified outside the IETF Standards Process, and derivative works of it may not be created outside the IETF Standards Process, except to format it for publication as an RFC or to translate it into languages other than English. 1. Introduction This document provides a mechanism for the specification of an augmentation at multiple locations of a YANG schema using the extension statement as defined in Section 7.15 of [RFC7950]. YANG extensions commonly add one augmentation to a common structure. Figure 1 shows a small module and another that will be used to extend it. Bertz Expires September 10, 2017 [Page 2] Internet-Draft YANG extension for Common Augmentations March 2017 ... basemodule { prefix b; ... grouping base_element { ... } rpc my_rpc { input { uses b:base_element; } output { uses b:base_element; } } rpc my_bestrpc { input { uses b:base_element; } } } ... newstuffmodule { grouping new_things { ... } } Figure 1: Reference Modules When extending my_rpc in the base module by adding new_things to the base element, one must use two augment statements. If the author of the newstuff module wishes to extend base_element then they must write an augment statement for every schema location it which it appears. An extension with the key word "also-augments" is proposed that allows one augment statement to be used for augmentations. Figure 2 shows the traditional and common augment examples. Bertz Expires September 10, 2017 [Page 3] Internet-Draft YANG extension for Common Augmentations March 2017 module old_way { import base { prefix base_module; } import newstuff { prefix new_module; } augment "/base_module:my_rpc/base_element/input" { uses new_module:new_things; } augment "/base_module:my_rpc/base_element/output" { uses new_module:new_things; } augment "/base_module:my_bestrpc/base_element/input" { uses new_module:new_things; } } module new_way { import base { prefix base_module; } import newstuff { prefix new_module; } import commonaugment { prefix c; } augment "/base_module:my_rpc/base_element/input" { uses new_module:new_things; c:also-augments "/base_module:my_rpc/base_element/output"; c:also-augments "/base_module:my_bestrpc/base_element/input"; } } Figure 2: Augment Options The also-augments statement takes a single argument that is the same one defined for the augment statement [RFC7950]. This has two purposes: Reduces the amount of YANG written when common augmentations are invovled. Provides a hint to the tools that translate YANG to code that a common augmentation exists. The importance of the second benefit for is significant as it permits them to leverage any common structure or inheritence functions. Bertz Expires September 10, 2017 [Page 4] Internet-Draft YANG extension for Common Augmentations March 2017 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 This module defines only the also-augmennts extension. This extension is ONLY meaningful as a child of an augment statement and is otherwise ignored. It is semantically equivalent to writing an augment statement whose target node is the argument of the also- augment node. This is shown in Figure 3. augment "/base_module:my_rpc/base_element/input" { uses new_module:new_things; } augment "/base_module:my_rpc/base_element/output" { uses new_module:new_things; } ... semantically equivalent version below ... augment "/base_module:my_rpc/base_element/input" { uses new_module:new_things; c:also-augments "/base_module:my_rpc/base_element/output"; } Figure 3: Statement Equivalence of also-augments Multiple also-augments statements MAY appear in a single augment statement. This statement MAY appear in a module that is intended to be backwards compatible as shown in Figure 4. In such cases, it is used as a hint to readers and compilation software that the augmentations are intended to be the same augmentation at multiple schema tree locations. Bertz Expires September 10, 2017 [Page 5] Internet-Draft YANG extension for Common Augmentations March 2017 augment "/base_module:my_rpc/base_element/input" { uses new_module:new_things; c:also-augments "/base_module:my_rpc/base_element/output"; } augment "/base_module:my_rpc/base_element/output" { uses new_module:new_things; } Figure 4: Backwards compatible usage of also-augment 4. Module Definition This section contains the module definition. file "ietf-commonaugment@2017-03-04.yang" module ietf-commonaugment { yang-version 1.1; namespace "urn:ietf:params:xml:ns:yang:ietf-commonaugment"; prefix commonaug; organization "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; contact "WG Web: WG List: WG Chair: Lou Berger WG Chair: Kent Watsen Editor: Lyle Bertz "; description "This module contains YANG definition for common augments. Copyright (c) 2016 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 (http://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 Bertz Expires September 10, 2017 [Page 6] Internet-Draft YANG extension for Common Augmentations March 2017 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."; revision 2017-03-04 { description "Initial Revision."; reference "draft-bertz-netmod-commonaugment-00"; } extension also-augments { argument "target-node"; description "The argument is a string that identifies a node in the schema tree and is the same argument that is defined for the YANG argument statement"; } } 5. IANA Considerations This document registers six URIs in the "IETF XML Registry" [RFC3688]. Following the format in RFC 3688, the following registrations have been made. URI: urn:ietf:params:xml:ns:yang:commonaug Registrant Contact: The NETMOD WG of the IETF. XML: N/A, the requested URI is an XML namespace. This document registers the following YANG module in the "YANG Module Names" registry [RFC7950]. name: ietf-dmm-fpc namespace: urn:ietf:params:xml:ns:yang:commonaug prefix: commonaug reference: TBD1 6. Security Considerations This document provides an alternative mechanism to express augmentations that can exist in a YANG module. It does not provide new informaiton elements to the module but does provide a hint as to the commonality of a set of augment statements. This, however, SHOULD have already been described in the module's definition or specification. Thus, the use of this statement does not yield new information. Bertz Expires September 10, 2017 [Page 7] Internet-Draft YANG extension for Common Augmentations March 2017 7. References 7.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, . [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, August 2016, . 7.2. Informative References [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, January 2004, . Author's Address Lyle Bertz Sprint 6220 Sprint Parkway Overland Park, KS 66251 United States Email: lylebe551144@gmail.com Bertz Expires September 10, 2017 [Page 8]