NETMOD Working Group L. Lhotka Internet-Draft CZ.NIC Intended status: Standards Track March 09, 2017 Expires: September 10, 2017 Using Markup in YANG Text Arguments draft-lhotka-netmod-yang-markup-00 Abstract This document defines a YANG extension that allows for specifying a media type for text in the arguments of these YANG statements: "contact", "description", "error-message", "organization" and "reference." 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. Lhotka Expires September 10, 2017 [Page 1] Internet-Draft i-d-abbrev March 2017 Table of Contents 1. Introduction . . . . . . . . . . . . . . . . . . . . . . . . 2 2. Terminology . . . . . . . . . . . . . . . . . . . . . . . . . 3 3. Declaring the Media Type of Text Arguments . . . . . . . . . 3 4. YANG Module . . . . . . . . . . . . . . . . . . . . . . . . . 4 5. IANA Considerations . . . . . . . . . . . . . . . . . . . . . 6 6. Security Considerations . . . . . . . . . . . . . . . . . . . 7 7. References . . . . . . . . . . . . . . . . . . . . . . . . . 7 7.1. Normative References . . . . . . . . . . . . . . . . . . 7 7.2. Informative References . . . . . . . . . . . . . . . . . 7 Author's Address . . . . . . . . . . . . . . . . . . . . . . . . 8 1. Introduction Descriptions play an important role in YANG data models. They may specify normative semantic constraints that cannot be expressed formally, instructions for implementors of the data model, and other vital information. That is why descriptions often comprise several paragraphs of text and sometimes also other structures such all numbered or bulleted lists. So far, YANG modules have mostly used only plain text in the argument of the "description" statement, i.e., formatted text structures using just whitespace. This is generally sufficient for human readers and also for including YANG modules in RFC documents, but less so for tools that are designed to process or use YANG modules in other ways, for example: o converting YANG compact syntax to other formats (YIN, HTML) o including YANG modules in standards and other documents whose source form in not plain text o including description text in user interface elements. The above considerations also apply, albeit to a lesser extent, to other YANG statements with more structured arguments: "contact", "error-message", "organization" and "reference". In principle, it is possible to use any kind of markup such as markdown [RFC7764] but doing so would not be not very effective and tool-friendly unless the markup format is either standardized or declared in the module source. This document defines a YANG extension statement, "text-media-type", that can be placed as a substatement of the "module" or "submodule" statement to indicate the media type that is used throughout the Lhotka Expires September 10, 2017 [Page 2] Internet-Draft i-d-abbrev March 2017 (sub)module for markup in the arguments of the five YANG statements mentioned above. 2. Terminology 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 [RFC2119]. 3. Declaring the Media Type of Text Arguments Section 4 below contains the "ietf-yang-text-media-type" module that defines a YANG language extension: "text-media-type". Its purpose is to declare media type that is used for markup in the arguments of the following YANG statements: o contact o description o error-message o organization o reference The common characteristic of these five statements is that their argument is represented as the element in YIN format (Section 13 of [RFC7950]). The "text-media-type" extension is intended to be used at the top level of a YANG module or submodule, i.e., as a substatement of either "module" or "submodule" statement. The declared media type applies to arguments of the above YANG statements throughout the module or submodule. The "text-media-type" extension MAY be ignored, and a module in which it appears MUST be valid YANG. The argument of the "text-media-type" extension is a string specifying the media type in the format defined in [RFC6838]. The media type SHOULD be registered by IANA in the "text" registry [IANA-MEDIA-TYPES]. Media type parameters MAY be used. It is RECOMMENDED to use only media types representing "lightweight" markup that is easy to read even in the unprocessed source form, such as "text/markdown". Lhotka Expires September 10, 2017 [Page 3] Internet-Draft i-d-abbrev March 2017 YANG modules have to be use the UTF-8 character encoding, see Section 6 of [RFC7950]. This implies the following rules: o Whenever the "charset" parameter is present, its value MUST be "UTF-8". o If no default value is defined for the "charset" parameter of a given media type, or if a default value is defined but is different from "UTF-8", then the "charset" parameter MUST be present with the value of "UTF-8". Even if the "text-media-type" extension statement is present and markup used in text arguments, all YANG and YIN syntax rules still apply. The "ietf-yang-text-media-type" module not only defines but also uses the "text-media-type" extension statement, which illustrates its typical use. 4. YANG Module RFC Editor: In this section, replace all occurrences of 'XXXX' with the actual RFC number and all occurrences of the revision date below with the date of RFC publication (and remove this note). file "ietf-yang-text-media-type@2017-03-09.yang" module ietf-yang-text-media-type { namespace "urn:ietf:params:xml:ns:yang:ietf-yang-text-media-type"; prefix ymt; ymt:text-media-type "text/markdown; charset=UTF-8"; organization "IETF NETMOD (NETCONF Data Modeling Language) Working Group"; contact "WG Web: WG List: WG Chair: Lou Berger WG Chair: Kent Watsen Lhotka Expires September 10, 2017 [Page 4] Internet-Draft i-d-abbrev March 2017 Editor: Ladislav Lhotka "; description "This module defines the *text-media-type* extension that allows for specifying media-type for markup that is used in arguments of these YANG statements: contact, description, error-message, organization, and reference. Copyright (c) 2016 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or without modification, is permitted pursuant to, and subject to the license terms contained in, the Simplified BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info). The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'MAY', and 'OPTIONAL' in the module text are to be interpreted as described in RFC 2119 (https://tools.ietf.org/html/rfc2119). This version of this YANG module is part of RFC XXXX (https://tools.ietf.org/html/rfcXXXX); see the RFC itself for full legal notices."; revision 2017-03-09 { description "Initial revision."; reference "RFC XXXX: Using Markup in YANG Text Arguments"; } extension text-media-type { argument type; description "This extension allows for specifying a media type that is used for markup in the arguments of the following YANG statements: - contact - description - error-message - organization Lhotka Expires September 10, 2017 [Page 5] Internet-Draft i-d-abbrev March 2017 - reference The *text-media-type* extension statement MAY be used at the top level of a module or submodule, i.e., as a substatement of *module* or *submodule*, and no more than once. The declared media type applies throughout the module or submodule. The argument SHOULD be a media type registered by IANA in the *text* registry. Media type parameters MAY be present. This YANG extension is only indicative and optional to implement. Tools MAY ignore it completely or support just a subset of markup directives that are available for a given media type."; reference "- IANA: Media Types, 2016-12-21. Available [online] (http://www.iana.org/assignments/media-types/media-types.xhtml) - [RFC 6838](https://tools.ietf.org/html/rfc6838): Media Type Specifications and Registration Procedures"; } } 5. IANA Considerations RFC Editor: In this section, replace all occurrences of 'XXXX' with the actual RFC number and all occurrences of the revision date below with the date of RFC publication (and remove this note). This document registers the following namespace URI in the "IETF XML registry" [RFC3688]: URI: urn:ietf:params:xml:ns:yang:ietf-yang-text-media-type Registrant Contact: The IESG. XML: N/A, the requested URI is an XML namespace. This document registers the following YANG module in the "YANG Module Names" registry [RFC6020]: Name: ietf-yang-text-media-type Namespace: urn:ietf:params:xml:ns:yang:ietf-yang-text-media-type Prefix: ymt Reference: RFC XXXX Lhotka Expires September 10, 2017 [Page 6] Internet-Draft i-d-abbrev March 2017 6. Security Considerations The "text-media-type" extension defined in this document provides information that is completely optional. YANG modules and submodules in which it is present have to satisfy all rules of the YANG language. The extension therefore doen't introduce any new threats. 7. References 7.1. Normative References [IANA-MEDIA-TYPES] Internet Assigned Numbers Authority, "Media Types", 12 2016. [RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, DOI 10.17487/RFC2119, March 1997, . [RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, DOI 10.17487/RFC3688, January 2004, . [RFC6020] Bjorklund, M., Ed., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, DOI 10.17487/RFC6020, October 2010, . [RFC6838] Freed, N., Klensin, J., and T. Hansen, "Media Type Specifications and Registration Procedures", BCP 13, RFC 6838, DOI 10.17487/RFC6838, January 2013, . [RFC7950] Bjorklund, M., Ed., "The YANG 1.1 Data Modeling Language", RFC 7950, DOI 10.17487/RFC7950, August 2016, . 7.2. Informative References [RFC7764] Leonard, S., "Guidance on Markdown: Design Philosophies, Stability Strategies, and Select Registrations", RFC 7764, DOI 10.17487/RFC7764, March 2016, . Lhotka Expires September 10, 2017 [Page 7] Internet-Draft i-d-abbrev March 2017 Author's Address Ladislav Lhotka CZ.NIC Email: lhotka@nic.cz Lhotka Expires September 10, 2017 [Page 8]