<?xml version="1.0" encoding="US-ASCII"?>
<!-- This template is for creating an Internet Draft using xml2rfc,
     which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!-- One method to get references from the online citation libraries.
     There has to be one entity for each item to be referenced.
     An alternate method (rfc include) is described in the references. -->
<!ENTITY RFC2119 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
<!ENTITY RFC6241 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml">
<!ENTITY RFC7950 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml">
<!ENTITY RFC7149 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7149.xml">
<!ENTITY RFC7426 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.7426.xml">
<!ENTITY RFC8299 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8299.xml">
<!ENTITY RFC8309 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8309.xml">
<!ENTITY RFC8340 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml">
<!ENTITY RFC8453 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8453.xml">
<!ENTITY RFC8174 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml">
<!ENTITY RFC8345 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.8345.xml">
]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs),
     please see http://xml.resource.org/authoring/README.html. -->
<!-- Below are generally applicable Processing Instructions (PIs) that most I-Ds might want to use.
     (Here they are set differently than their defaults in xml2rfc v1.32) -->
<?rfc strict="yes" ?>
<!-- give errors regarding ID-nits and DTD validation -->
<!-- control the table of contents (ToC) -->
<?rfc toc="yes"?>
<!-- generate a ToC -->
<?rfc tocdepth="4"?>
<!-- the number of levels of subsections in ToC. default: 3 -->
<!-- control references -->
<?rfc symrefs="yes"?>
<!-- use symbolic references tags, i.e, [RFC2119] instead of [1] -->
<?rfc sortrefs="yes" ?>
<!-- sort the reference entries alphabetically -->
<!-- control vertical white space
     (using these PIs as follows is recommended by the RFC Editor) -->
<?rfc compact="yes" ?>
<!-- do not start each main section on a new page -->
<?rfc subcompact="no" ?>
<!-- keep one blank line between list items -->
<!-- end of list of popular I-D processing instructions -->
<rfc category="std" docName="draft-ma-netmod-immutable-flag-02"
     ipr="trust200902">
  <front>
    <title abbrev="Immutable Flag">YANG Extension and Metadata Annotation for
    Immutable Flag</title>

    <author fullname="Qiufang Ma" initials="Q." surname="Ma">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>101 Software Avenue, Yuhua District</street>

          <city>Nanjing</city>

          <region>Jiangsu</region>

          <code>210012</code>

          <country>China</country>
        </postal>

        <email>maqiufang1@huawei.com</email>
      </address>
    </author>

    <author fullname="Qin Wu" initials="Q." surname="Wu">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>101 Software Avenue, Yuhua District</street>

          <city>Nanjing</city>

          <region>Jiangsu</region>

          <code>210012</code>

          <country>China</country>
        </postal>

        <email>bill.wu@huawei.com</email>
      </address>
    </author>

    <author fullname="Balazs Lengyel" initials="B." surname="Lengyel">
      <organization abbrev="Ericsson">Ericsson</organization>

      <address>
        <email>balazs.lengyel@ericsson.com</email>
      </address>
    </author>

    <author fullname="Hongwei Li" initials="H." surname="Li">
      <organization>HPE</organization>

      <address>
        <email>flycoolman@gmail.com</email>
      </address>
    </author>

    <date year="2022"/>

    <area>ops</area>

    <workgroup>NETMOD</workgroup>

    <keyword>immutable read-only NETMOD</keyword>

    <abstract>
      <t>This document defines a YANG extension named "immutable" to indicate
      that specific "config true" data nodes are not allowed to be
      created/deleted/updated. To indicate that specific instances of a
      list/leaf-list node cannot be changed after initialization, a metadata
      annotation with the same name is also defined. Any data node or instance
      marked as immutable is read-only to the clients of YANG-driven
      management protocols, such as NETCONF, RESTCONF and other management
      operations (e.g., SNMP and CLI requests).</t>
    </abstract>
  </front>

  <middle>
    <section anchor="Introduction" title="Introduction">
      <t>YANG <xref target="RFC7950"/> is a data modeling language used to
      model both state and configuration data, based on the "config"
      statement. However there exists data that should not be modifiable by
      the client, but still needs to be declared as "config true" to: <list
          style="symbols">
          <t>allow configuration of data nodes under immutable lists or
          containers;</t>

          <t>ensure the existence of specific list entries that are provided
          and needed by the system, while additional list entries can be
          created, modified or deleted;</t>

          <t>place "when", "must" and "leafref" constraints between
          configuration and immutable schema nodes.</t>
        </list>E.g., the interface name and type values created by the system
      due to the hardware currently present in the device cannot be modified
      by clients, while configurations such as MTU created by the system are
      free to be modified by the client. Further examples and use-cases are
      described in <xref target="Usage_Examples"/>.</t>

      <t>Allowing some configuration to be modifiable while other parts are
      not is inconsistent and introduces ambiguity to clients.</t>

      <t>To address this issue, this document defines a YANG extension and a
      metadata annotation <xref target="RFC7952"/> named "immutable" to
      indicate the immutability characteristic of a particular schema node or
      instantiated data node. If a schema node is marked as immutable, data
      nodes based on the schema MUST NOT be added, removed or updated by
      management protocols, such as NETCONF, RESTCONF or other management
      operations (e.g., SNMP and CLI requests). If an instantiated data node
      is marked as immutable the server MUST reject changes to it by
      YANG-driven management protocols, such as NETCONF, RESTCONF and other
      management operations (e.g., SNMP and CLI requests). Marking instance
      data nodes as immutable (as opposed to marking schema-nodes) is
      important when only some instances of a list or leaf-list shall be
      marked as read-only.</t>

      <t>Theoretically, any "config true" data node is allowed to be created,
      updated and deleted. This work makes write access restrictions other
      than general YANG and NACM rules visible, which doesn't mean attaching
      such restrictions is encouraged.</t>

      <section anchor="terminology" title="Terminology">
        <t>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 <xref target="RFC2119"/> <xref target="RFC8174"/> when, and only
        when, they appear in all capitals, as shown here.</t>

        <t>The following terms are defined in <xref target="RFC6241"/> and
        <xref target="RFC8341"/> and are not redefined here:<list
            style="symbols">
            <t>configuration data</t>

            <t>access operation</t>

            <t>write access</t>
          </list></t>

        <t>The following terms are defined in this document:<list
            style="hanging">
            <t hangText="immutable: ">A property indicating that a schema node
            or data instance is not allowed to be
            created/deleted/updated.<vspace blankLines="1"/></t>
          </list></t>
      </section>
    </section>

    <section title="Overview">
      <t>The "immutable" concept only puts write access restrictions to
      read-write datastores. When a specific data node or instance is marked
      as "immutable", NACM cannot override this to allow create/delete/update
      access.</t>

      <t>A particular data node or instance MUST have the same immutability in
      all read-write datastores. The immutable annotation information should
      be visible even in read-only datastores (e.g., &lt;system&gt;,
      &lt;intended&gt;, &lt;operational&gt;), however this only serves as
      information about the data node itself, but has no effect on the
      handling of the read-only datastore. The immutability property of a
      particular data node or instance MUST be protocol-independent and
      user-independent.</t>

      <t>If a particular container/list/leaf-list node is marked as
      "immutable" without exceptions for "delete" in the schema, the server
      SHOULD NOT annotate its instances, as that provides no additional
      information. If a particular leaf/anydata/anyxml node is marked as
      "immutable" without exceptions for "delete" or "update" in the schema,
      the server SHOULD NOT annotate its instances, as that provides no
      additional information.</t>

      <t>Servers MUST reject any attempt to the "create", "delete" and
      "update" access operations on an immutable data node or instance marked
      by the metadata annotation or YANG extension (except according to the
      exceptions argument). The error reporting is performed immediately at an
      &lt;edit-config&gt; operation time, regardless what the target
      configuration datastore is. For an example of an "invalid-value" error
      response, see <xref target="error-update"/>.</t>

      <t>However the following operations SHOULD be allowed:<list
          style="symbols">
          <t>Use a create, update, delete/remove operation on an immutable
          node/instance if the effective change is null. E.g. If a leaf has a
          current value of "5" it should be allowed to replace it with a value
          of "5".</t>

          <t>Create an immutable data node/instance with a same value
          initially set by the system if it doesn't exist in the datastore.
          E.g., explicitly configure a system-generated interface name and
          type in &lt;running&gt;;</t>
        </list></t>

      <t>Note that even if a particular data node is immutable without the
      exception for "delete", it still can be deleted with its parent node,
      e.g., /if:interfaces/if:interface/if:type leaf is immutable, but the
      deletion to the /if:interfaces/if:interface list entry is allowed; if a
      particular data node is immutable without the exception for "create", it
      means the client can never create the instance of it, regardless the
      handling of its parent node.</t>

      <t>TODO: Is immutable inherited down the containment hierarchy? If it
      is, should we allow overriding the immutability of a particular
      contained element (i.e., to declare a contained data node as
      immutable=false inside an immutable container/list) ?</t>
    </section>

    <section title="&quot;Immutable&quot; YANG Extension">
      <t>The "immutable" YANG extension can be a substatement to a leaf,
      leaf-list, container, list, anydata or anyxml statement. It indicates
      that data nodes based on the parent statement MUST NOT be added, removed
      or updated except according to the exceptions argument. The server MUST
      reject any such write attempt.</t>

      <t>The "immutable" YANG extension defines an argument statement named
      "exceptions" which gives a list of operations that users are permitted
      to invoke for the specified node.</t>

      <t>The following values are supported for the "exceptions"
      argument:<list style="symbols">
          <t>Create: allow users to create instances of the data node;</t>

          <t>Update: allow users to modify instances of the data node;</t>

          <t>Delete: allow users to delete instances of the data node.</t>
        </list></t>
    </section>

    <section title="&quot;Immutable&quot; Metadata Annotation">
      <t>The "immutable" flag is used to indicate the immutability of a
      particular instantiated data node. It only applies to the list/leaf-list
      entries. The values are boolean types indicating whether the data node
      instance is immutable or not.</t>

      <t>Any list/leaf-list instance annotated with immutable="true" is
      read-only to clients, which means that once an instance is created, the
      client cannot change it. If a list entry is annotated with
      immutable="true", any contained descendant instances of any type
      (including leafs, lists, containers, etc.) inside the specific instance
      is not allowed to be created, updated and deleted without the need to
      annotate descendant nodes instances explicitly.</t>

      <t>Note that "immutable" metadata annotation is used to annotate
      instances of a list/leaf-list rather than schema nodes. For instance, a
      list node may exist in multiple instances in the data tree, "immutable"
      can annotate some of the instances as read-only, while others are
      not.</t>

      <t>When the client retrieves a particular datastore, immutable data node
      instances MUST be annotated with immutable="true" by the server. If the
      "immutable" metadata annotation inside a list entry is not specified,
      the default "immutable" value for a list/leaf-list entry is false.</t>

      <t>Different from the "immutable" YANG extension, deletion to an
      instance marked with immutable="true" metadata annotation SHOULD always
      be allowed unless the list/leaf-list data node in the schema has an
      im:immutable extension as substatement without a "delete" exception.</t>
    </section>

    <section title="YANG Module">
      <figure>
        <artwork> &lt;CODE BEGINS&gt; file="ietf-immutable@2022-04-18.yang"
// RFC Ed.: replace XXXX with RFC number and remove this note
  module ietf-immutable {
    yang-version 1.1;
    namespace "urn:ietf:params:xml:ns:yang:ietf-immutable";
    prefix im;

    import ietf-yang-metadata {
      prefix md;
    }
         
    organization
      "IETF Network Modeling (NETMOD) Working Group";
           
    contact
      "WG Web: &lt;https://datatracker.ietf.org/wg/netmod/&gt;
           
       WG List: &lt;mailto:netmod@ietf.org&gt;
          
       Author: Qiufang Ma
               &lt;mailto:maqiufang1@huawei.com&gt;

       Author: Qin Wu
               &lt;mailto:bill.wu@huawei.com&gt;

       Author: Balazs Lengyel
               &lt;mailto:balazs.lengyel@ericsson.com&gt;

       Author: Hongwei Li
               &lt;mailto:flycoolman@gmail.com&gt;";
         
    description
      "This module defines a metadata annotation named 'immutable'
       to indicate the immutability of a particular instantiated 
       data node. Any instantiated data node marked with 
       immutable='true' by the server is read-only to the clients
       of YANG-driven management protocols, such as NETCONF, 
       RESTCONF as well as SNMP and CLI requests.
       
       The module defines the immutable extension that indicates 
       that data nodes based ona data-dafinition statement cannot 
       be added removed or updated except according to the 
       exceptions argument.

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

       This version of this YANG module is part of RFC HHHH
       (https://www.rfc-editor.org/info/rfcHHHH); see the RFC
       itself for full legal notices.

       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 (RFC 2119)
       (RFC 8174) when, and only when, they appear in all
       capitals, as shown here.";
         
    revision 2022-04-18 {
      description
        "Initial revision.";
      reference
        "RFC XXXX: Immutable Metadata Annotation";
    }  
      
    extension immutable {
      argument exceptions;
      description
        "The 'immutable' extension as a substatement to a data 
         definition statement indicates that data nodes based on 
         the parent statement MUST NOT be added, removed or  
         updated by management protocols, such as NETCONF,  
         RESTCONF or other management operations (e.g., SNMP  
         and CLI requests) except when indicated by the  
         exceptions argument.
        
         Immutable data MAY be marked as config true to allow 
         'leafref', 'when' or 'must' constraints to be based 
         on it.
  
         The statement MUST only be a substatement of the leaf, 
         leaf-list, container, list, anydata, anyxml statements.
         Zero or one immutable statement per parent statement 
         is allowed. 
         No substatements are allowed.
  
         The argument is a list of operations that are 
         permitted to be used for the specified node, while 
         other operations are forbidden by the immutable extension.
         - create: allows users to create instances of the data node
         - update: allows users to modify instances of the data node
         - delete: allows users to delete instances of the data node

         To disallow all user write access, omit the argument;

         To allow only create and delete user access, provide 
         the string 'create delete' for the 'exceptions' parameter.

         Providing all 3 parameters has the same affect as not 
         using this extension at all, but can be used anyway.

         Equivalent YANG definition for this extension:
          
         leaf immutable {
           type bits {
             bit create;
             bit update;
             bit delete;
           }
           default '';
         }
         
         
         Adding immutable or removing values from the 
         exceptions argument of an existing immutable statement 
         are non-backwards compatible changes. 
         Other changes to immutable are backwards compatible.";
    }    

    md:annotation immutable {
      type boolean;
      description
        "The 'immutable' annotation indicates the immutability of an 
         instantiated data node. Any data node instance marked as 
         'immutable=true' is read-only to clients and cannot be 
         updated through NETCONF, RESTCONF or CLI. It applies to the
         list and leaf-list entries. The default is 'immutable=false'
         if not specified for an instance.";
    }
  }
 &lt;CODE ENDS&gt;</artwork>
      </figure>
    </section>

    <section anchor="IANA" title="IANA Considerations">
      <section title="The &quot;IETF XML&quot; Registry">
        <t>This document registers one XML namespace URN in the 'IETF XML
        registry', following the format defined in <xref
        target="RFC3688"/>.</t>

        <figure>
          <artwork>   URI: urn:ietf:params:xml:ns:yang:ietf-immutable
   Registrant Contact: The IESG.
   XML: N/A, the requested URIs are XML namespaces.</artwork>
        </figure>
      </section>

      <section title="The &quot;YANG Module Names&quot; Registry">
        <t>This document registers one module name in the 'YANG Module Names'
        registry, defined in <xref target="RFC6020"/>.</t>

        <figure>
          <artwork>      name: ietf-immutable
      prefix: im
      namespace: urn:ietf:params:xml:ns:yang:ietf-immutable
      RFC: XXXX // RFC Ed.: replace XXXX and remove this comment</artwork>
        </figure>
      </section>
    </section>

    <section anchor="scecurity" title="Security Considerations">
      <t>The YANG module specified in this document defines a metadata
      annotation for data nodes that is designed to be accessed network
      management protocols such as NETCONF <xref target="RFC6241"/> or
      RESTCONF <xref target="RFC8040"/>. The lowest NETCONF layer is the
      secure transport layer, and the mandatory-to-implement secure transport
      is Secure Shell (SSH) <xref target="RFC6242"/>. The lowest RESTCONF
      layer is HTTPS, and the mandatory-to-implement secure transport is TLS
      <xref target="RFC8446"/>.</t>

      <t>Since immutable information is tied to applied configuration values,
      it is only accessible to clients that have the permissions to read the
      applied configuration values.</t>

      <t>The security considerations for the Defining and Using Metadata with
      YANG (see Section 9 of [RFC7952]) apply to the metadata annotation
      defined in this document.</t>
    </section>
  </middle>

  <back>
    <references title="Normative References">
      <?rfc include="reference.RFC.2119.xml"?>

      <?rfc include="reference.RFC.3688.xml"?>

      <?rfc include="reference.RFC.6020.xml"?>

      <?rfc include="reference.RFC.6241.xml"?>

      <?rfc include="reference.RFC.6242.xml"?>

      <?rfc include="reference.RFC.8040.xml"?>

      <?rfc include="reference.RFC.7950.xml"?>

      <?rfc include="reference.RFC.7952.xml"?>

      <?rfc include="reference.RFC.8341.xml"?>

      <?rfc include="reference.RFC.8446.xml"?>
    </references>

    <references title="Informative References">
      <?rfc include="reference.RFC.8174.xml"?>

      <?rfc include="reference.I-D.ma-netmod-with-system"?>
    </references>

    <section anchor="Usage_Examples" title="Usage Examples">
      <section title="Interface Example">
        <t>This section shows how to use im:immutable YANG extension to mark
        some data node as immutable.</t>

        <t>When an interface is physically present, the system will create an
        interface entry automatically with valid name and type values in
        &lt;system&gt; (see <xref target="I-D.ma-netmod-with-system"/>). The
        system-generated data is dependent on and must represent the HW
        present, and as a consequence must not be changed by the client. The
        data is modelled as "config true" and should be marked as
        immuable.</t>

        <t>Seemingly an alternative would be to model the list and these
        leaves as "config false", but that does not work because: <list
            style="symbols">
            <t>The list cannot be marked as "config false", because it needs
            to contain configurable child nodes, e.g., ip-address or
            enabled;</t>

            <t>The key leaf (name) cannot be marked as "config false" as the
            list itself is config true;</t>

            <t>The type cannot be marked "config false", because we MAY need
            to reference the type to make different configuration nodes
            conditionally available.</t>
          </list>The immutability of the data is the same for all interface
        instances, thus following fragment of a fictional interface module
        including an "immutable" YANG extension can be used:<figure>
            <artwork>     container interfaces {
       list interface {
         key "name";
         leaf name {
           type string;
         }
         leaf type {
           im:immutable "create";
           type identityref {
             base ianaift:iana-interface-type;
           }
           mandatory true;
         }
         leaf mtu {
           type uint16;
         }
         leaf-list ip-address {
           type inet:ip-address;
         } 
       }
     }</artwork>
          </figure></t>

        <t>Note that the "name" leaf is defined as a list key which can never
        been modified for a particular list entry, there is no need to mark
        "name" as immutable.</t>

        <section title="Creating an Interface with a &quot;type&quot; Value">
          <t>As defined in the YANG model, there is an exception for "create"
          operation. Assume the interface hardware is not present physically
          at this point, the client is allowed to create an interface named
          "eth0" with a type value in &lt;running&gt;:<figure>
              <artwork>&lt;rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
     message-id="101"&gt;  
  &lt;edit-config&gt; 
    &lt;target&gt; 
      &lt;running/&gt; 
    &lt;/target&gt;  
    &lt;config&gt; 
      &lt;interface xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0" 
            xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type" 
            xc:operation="create"&gt;  
        &lt;name&gt;eth0&lt;/name&gt;  
        &lt;type&gt;ianaift:ethernetCsmacd&lt;/type&gt; 
      &lt;/interface&gt; 
    &lt;/config&gt; 
  &lt;/edit-config&gt; 
&lt;/rpc&gt;

&lt;rpc-reply message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
  &lt;ok/&gt;
&lt;/rpc-reply&gt;</artwork>
            </figure>The interface data does not appear in &lt;operational&gt;
          since the physical interface doesn't exist. When the interface is
          inserted, the system will detect it and create the associated
          configuration in &lt;system&gt;. The system tries to merge the
          interface configuration in the &lt;running&gt; datastore with the
          same name as the inserted interface configuration in &lt;system&gt;.
          If no such interface configuration named "eth0" is found in
          &lt;system&gt; or the type set by the client doesn't match the real
          interface type generated by the system, only the system-defined
          interface configuration is applied and present in
          &lt;operational&gt;.</t>
        </section>

        <section anchor="error-update"
                 title="Updating the Value of an Interface Type">
          <t>Assume the system applied the interface configuration named
          "eth0" successfully. If a client tries to change the type of an
          interface to a value that doesn't match the real type of the
          interface used by the system, the server must reject the request:
          <figure>
              <artwork>&lt;rpc message-id="101"
     xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" 
     xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;  
  &lt;edit-config&gt; 
    &lt;target&gt; 
      &lt;running/&gt; 
    &lt;/target&gt;  
    &lt;config&gt; 
      &lt;interface xc:operation="merge"
            xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type"&gt; 
        &lt;name&gt;eth0&lt;/name&gt;  
        &lt;type&gt;ianaift:tunnel&lt;/type&gt; 
      &lt;/interface&gt; 
    &lt;/config&gt; 
  &lt;/edit-config&gt; 
&lt;/rpc&gt;

&lt;rpc-reply message-id="101"
           xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
           xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;  
  &lt;rpc-error&gt; 
    &lt;error-type&gt;application&lt;/error-type&gt;  
    &lt;error-tag&gt;invalid-value&lt;/error-tag&gt;  
    &lt;error-severity&gt;error&lt;/error-severity&gt;  
    &lt;error-path xmlns:t="http://example.com/schema/1.2/config"&gt;
      /interfaces/interface[name="eth0"]/type
    &lt;/error-path&gt;  
    &lt;error-message xml:lang="en"&gt;
      Invalid type for interface eth0
    &lt;/error-message&gt; 
  &lt;/rpc-error&gt; 
&lt;/rpc-reply&gt;</artwork>
            </figure></t>
        </section>
      </section>

      <section title="Immutable System Capabilities Modelled as &quot;config true&quot;">
        <t>System capabilities might be represented as system-defined data
        nodes in the model. Configurable data nodes might need constraints
        specified as "when", "must" or "path" statements to ensure that
        configuration is set according to the system's capabilities. E.g.,
        <list style="symbols">
            <t>A timer can support the values 1,5,8 seconds. This is defined
            in the leaf-list 'supported-timer-values'.</t>

            <t>When the configurable 'interface-timer' leaf is set, it should
            be ensured that one of the supported values is used. The natural
            solution would be to make the 'interface-timer' a leaf-ref
            pointing at the 'supported-timer-values'.</t>
          </list> However, this is not possible as 'supported-timer-values'
        must be read-only thus config=false while 'interface-timer' must be
        writable thus config=true. According to the rules of YANG it is not
        allowed to put a constraint between config true and false schema
        nodes.</t>

        <t>The solution is that the supported-timer-values data node in the
        YANG Model shall be defined as "config true" and shall also be marked
        with the "immutable" extension. After this the 'interface-timer' shall
        be defined as a leaf-ref pointing at the 'supported-timer-values'.</t>
      </section>

      <section title="Immutable System-defined List Entries">
        <t>There are some system-defined entries for a "config true" list
        which are present in &lt;system&gt; (see <xref
        target="I-D.ma-netmod-with-system"/>) and cannot be updated by the
        client, such system-defined instances should be defined immutable. The
        client is free to define, update and delete their own list entries in
        &lt;running&gt;. Thus the list data node in the YANG model cannot be
        marked as "immutable" extension as a whole. But some of the
        system-defined list entries need to be protected if they are copied
        from the &lt;system&gt; datastore to &lt;running&gt;.</t>

        <t>An immutable metadata annotation can be useful in this case. When
        the client retrieves those system-defined entries towards
        &lt;system&gt; (or &lt;running&gt; if they are copied into
        &lt;running&gt;), an immutable="true" annotation is returned; so that
        the client can understand that the predefined list entries shall not
        be updated but they can configure their list entries without any
        restriction.</t>
      </section>
    </section>

    <section title="Changes between revisions">
      <t>Note to RFC Editor (To be removed by RFC Editor)</t>

      <t>v01 - v02<list style="symbols">
          <t>clarify the relation between the creation/deletion of the
          immutable data node with its parent data node;</t>

          <t>Add a "TODO" comment about the inheritance of the immutable
          property;</t>

          <t>Define that the server should reject write attempt to the
          immutable data node at an &lt;edit-config&gt; operation time, rather
          than waiting until a &lt;commit&gt; or &lt;validate&gt; operation
          takes place;</t>
        </list></t>

      <t>v00 - v01 <list style="symbols">
          <t>Added immutable extension</t>

          <t>Added new use-cases for immutable extension and annotation</t>

          <t>Added requirement that an update that means no effective change
          should always be allowed</t>

          <t>Added clarification that immutable is only applied to read-write
          datastore</t>

          <t>Narrowed the applied scope of metadata annotation to
          list/leaf-list instances</t>
        </list></t>
    </section>
  </back>
</rfc>
