NETMOD Working Group L. Lhotka
Internet-Draft CZ.NIC
Intended status: Standards Track November 28, 2014
Expires: June 1, 2015

Common Metadata Annotations for Data Modelled with YANG
draft-lhotka-netmod-yang-annotations-00

Abstract

This document introduces a collection of common metadata annotations intended for use in data modeled with the YANG language.

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 June 1, 2015.

Copyright Notice

Copyright (c) 2014 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.


Table of Contents

1. Introduction

This document introduces a collection of metadata annotations that are intended for general use in data modeled with the YANG data modeling language [RFC6020]. YANG module "ietf-yang-annotations" (Section 4) defines these annotations using the extension statement "annotation" that is defined in the "ietf-yang-metadata" module [I-D.lhotka-netmod-yang-metadata].

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].

The following terms are defined in [RFC6241]:

3. Common Metadata Annotations

YANG module "ietf-yang-annotations" (Section 4) contains normative definitions of the following metadata annotations:

The following subsections provide an informal explanation and examples showing typical use of these annotations. The examples are based on YANG modules "ietf-interfaces" [RFC7223] and "ietf-system" [RFC7317].

3.1. The "inactive" Annotation

A client uses the "inactive" annotation for deactivating a subtree in a configuration datastore while keeping the subtree in place.

For example, a NETCONF client can use the following <edit-config> operation to deactivate the configuration of an interface in the "running" datastore:

<nc:rpc message-id="101"
     xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <nc:edit-config>
    <nc:target>
      <nc:running/>
    </nc:target>
    <nc:config>
      <interfaces
        xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces"
        xmlns:yan="urn:ietf:params:xml:ns:yang:ietf-yang-annotations">
        <interface yann:inactive="true">
          <name>eth0</name>
        </interface>
      </interfaces>
    </nc:config>
  </nc:edit-config>
</nc:rpc>
	  

A RESTCONF client can achieve the same effect with the following HTTP request:

PATCH /restconf/data/ietf-interfaces:interfaces/
   interface/name=eth0 HTTP/1.1
Host: example.com
Content-Type: application/yang.data+json

{
  "@": {
    "ietf-yang-annotations:inactive": true
  }
}	    
	  

3.2. The "type" Annotation

Clients and servers use the "type" annotation to specify the actual type for an instance of a leaf that has the "union" type (or a type derived from "union"). The value of this annotation has to be one of the member types appearing in the specification of the "union" type.

For example, a NETCONF client can use the following <edit-config> operation to set an IPv6 address of a name server in DNS resolver configuration:

<nc:rpc message-id="101"
     xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
  <nc:edit-config>
    <nc:target>
      <nc:running/>
    </nc:target>
    <nc:config>
      <system
        xmlns="urn:ietf:params:xml:ns:yang:ietf-system"
        xmlns:yan="urn:ietf:params:xml:ns:yang:ietf-yang-annotations">
        <dns-resolver>
	  <server>
            <name>primary</name>
	    <udp-and-tcp>
	      <address yann:type="ietf-inet-types:ipv6-address">
	        2001:db8:0:2::1
	      </address>
	    </udp-and-tcp>
	  </server>
	</dns-resolver>
      </system>
    </nc:config>
  </nc:edit-config>
</nc:rpc>
	  

A RESTCONF client can perform the same configuration with the following HTTP request:

PUT /restconf/data/ietf-system:system/
   dns-resolver/server/name=eth0/udp-and-tcp/address HTTP/1.1
Host: example.com
Content-Type: application/yang.data+json

{
  "@address": {
    "ietf-yang-annotations:type": "ietf-inet-types:ipv6-address"
  },
  "address": "2001:db8:0:2::1"
}	    
	  

4. YANG Annotations 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).

<CODE BEGINS> file "yang-annotations@2014-11-28.yang"

module ietf-yang-annotations {

  namespace "urn:ietf:params:xml:ns:yang:ietf-yang-annotations";

  prefix "yann";

  import ietf-yang-metadata {
    prefix "md";
  }

  organization
    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";

  contact
    "WG Web:   <http://tools.ietf.org/wg/netmod/>
     WG List:  <mailto:netmod@ietf.org>

     WG Chair: Thomas Nadeau
               <mailto:tnadeau@lucidvision.com>

     WG Chair: Juergen Schoenwaelder
               <mailto:j.schoenwaelder@jacobs-university.de>

     Editor:   Ladislav Lhotka
               <mailto:lhotka@nic.cz>";

  description
    "This module defines generally useful metadata annotations for
     data modelled with YANG.

     Copyright (c) 2014 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
     (http://trustee.ietf.org/license-info).

     This version of this YANG module is part of RFC XXXX; see the
     RFC itself for full legal notices.";

  revision 2014-11-28 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: Common Metadata Annotations for Data Modelled with
       YANG.";
  }

  md:annotation "inactive" {
    type boolean;
    description
      "A client uses this annotation for deactivating a subtree in a
       configuration datastore.

       If a server advertises support for this annotation, then a
       client MAY attach it to any data node instance in any
       configuration datastore via standard editing methods. If its
       value is 'true', then the server MUST behave as if the subtree
       rooted at this data node was not present. If its value is
       'false' the server MUST behave as if the annotation is not
       present.";
  }

  md:annotation "type" {
    description
      "This annotation is used for indicating the actual type for a
       value of a leaf with the 'union' type, or a type derived from
       'union' (henceforth denoted as 'a union type').

       The value of this annotation can be

       - the name of a YANG built-in type,

       - the name of a derived type prepended with the name of the
         YANG module where the type is defined and the colon
         character (':').

       If a server advertises support for this annotation, then:

       - A client MAY attach this annotation to a leaf of a union
         type when creating or modifying the value of this leaf in a
         configuration datastore, or when such a leaf is contained in
         RPC request parameters. The server MUST take this
         information into account when interpreting the type of the
         received value.

       - If a client doesn't do so, the server SHOULD attach this
         annotation to a leaf of a union type upon its creation or
         modification in a configuration datastore.

       - The server SHOULD attach this annotation to all leafs of a
         union type that are sent to a client as state data, in an
         RPC reply, or in a notification.

       In all cases mentioned above, the receiving party SHALL ignore
       this annotation if it is attached to an instance of a data
       node that is not a leaf of a union type.

       A server supporting this annotation SHALL report an error if

       - the type specified in the annotation is not among member
         types of the annotated leaf's type,

       - the value of the annotated leaf is not valid for the type
         specified by the annotation.";
  }
}

<CODE ENDS>

5. IANA Considerations

RFC Ed.: In this section, replace all occurrences of 'XXXX' with the actual RFC number (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-annotations

Registrant Contact: The IESG.

XML: N/A, the requested URI is an XML namespace.
----------------------------------------------------------
	

This document registers the following YANG modules in the YANG Module Names registry [RFC6020]:

-------------------------------------------------------------------
name:         ietf-yang-annotations
namespace:    urn:ietf:params:xml:ns:yang:ietf-yang-annotations
prefix:       yann
reference:    RFC XXXX
-------------------------------------------------------------------
	

6. Security Considerations

TBD

7. References

7.1. Normative References

[I-D.lhotka-netmod-yang-metadata] Lhotka, L., "Defining and Using Metadata with YANG", Internet-Draft draft-lhotka-netmod-yang-metadata-00, September 2014.
[RFC2119] Bradner, S., "Key words for use in RFCs to Indicate Requirement Levels", BCP 14, RFC 2119, March 1997.
[RFC3688] Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688, January 2004.
[RFC6020] Bjorklund, M., "YANG - A Data Modeling Language for the Network Configuration Protocol (NETCONF)", RFC 6020, October 2010.
[RFC6241] Enns, R., Bjorklund, M., Schoenwaelder, J. and A. Bierman, "Network Configuration Protocol (NETCONF)", RFC 6241, June 2011.

7.2. Informative References

[RFC7223] Bjorklund, M., "A YANG Data Model for Interface Management", RFC 7223, May 2014.
[RFC7317] Bierman, A. and M. Bjorklund, "A YANG Data Model for System Management", RFC 7317, August 2014.

Author's Address

Ladislav Lhotka CZ.NIC EMail: lhotka@nic.cz