<?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 RFC2697 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2697.xml">
<!ENTITY RFC2698 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2698.xml">
<!ENTITY RFC6020 SYSTEM "http://xml.resource.org/public/rfc/bibxml/reference.RFC.6020.xml">
]>
<rfc category="std" docName="draft-wu-netmod-base-notification-nmda-03"
     ipr="trust200902">
  <?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>

  <?rfc toc="yes" ?>

  <?rfc symrefs="yes" ?>

  <?rfc sortrefs="yes"?>

  <?rfc iprnotified="no" ?>

  <?rfc strict="yes" ?>

  <front>
    <title abbrev="NMDA Base Notification">NMDA Base Notification for Intent
    based configuration update</title>

    <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="Ran Tao" initials="R." surname="Tao">
      <organization>Huawei</organization>

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

    <author fullname="Rohit R Ranade" initials="R." surname="Ranade">
      <organization>Huawei</organization>

      <address>
        <postal>
          <street>Divyashree Techno Park, Whitefield</street>

          <city>Bangalore</city>

          <region>Karnataka</region>

          <code>560066</code>

          <country>India</country>
        </postal>

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

    <date year="2019"/>

    <area>OPS Area</area>

    <workgroup>NETMOD Working Group</workgroup>

    <abstract>
      <t>The Network Configuration Protocol (NETCONF)and RESTCONF provides
      mechanisms to manipulate configuration datastores. NMDA introduces
      additional datastores for systems that support more advanced processing
      chains converting configuration to operational state. However, client
      applications are not able to be aware of common events in these
      additional datstores of the management system, such as a intended
      configuration state change in NETCONF server or RESTCONF server, that
      may impact management applications,especially when a server is managed
      by multiple clients or management applications. This document define a
      YANG module that allows a client to receive additional notifications for
      some common system events pertaining to the Network Management Datastore
      Architecture (NMDA) defined in [RFC8342].</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t>The Network Configuration Protocol (NETCONF) [RFC6241] and RESTCONF
      [RFC8040] provides mechanisms to manipulate configuration datastores.
      NMDA introduces additional datastores (e.g.,&lt;intended&gt;,
      &lt;operational&gt;) for systems that support more advanced processing
      chains converting configuration to operational state. However, client
      applications are not able to be aware of common events in those
      additional datastores of the management system, e.g., there are many
      background system activities (e.g.,system internal interactions with
      hardware, interaction with protocols or other devices) that happen
      during propagation of a configuration change to the software and
      hardware components of a system. It is possible that some configuration
      could not be applied to &lt;operational&gt; due to either remnant
      Configuration, or missing resource, etc. There is a need for user or an
      application (configuration) to know the origin of failed configuration
      node and the reason why the configuration changes were not applied.</t>

      <t>This document define a YANG module that allows a client to receive
      additional notifications for some common system events pertaining to the
      Network Management Datastore Architecture (NMDA) defined in [RFC8342].
      These notifications are designed to support the monitoring of the base
      system events within the server and not specific to any network
      management protocols such as NETCONF and RESTCONF.</t>

      <t>The solution presented in this document is backwards compatible with
      [RFC6470].</t>

      <section 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 [RFC2119] [RFC8174] when, and only when, they appear in all
        capitals, as shown here.</t>

        <t>The following terms are defined in [RFC8342] and are not redefined
        here:</t>

        <t><list style="symbols">
            <t>operational state datastore</t>

            <t>running configuration datastore</t>

            <t>intended configuration datastore</t>
          </list></t>
      </section>
    </section>

    <!-- intro -->

    <section anchor="extension"
             title="NMDA Base Notifications for Intent based configuration Update">
      <section title="Overview">
        <t>The YANG module in NETCONF Base Notifications [RFC6470] specifies
        the following 5 event notifications for the 'NETCONF' stream to notify
        a client application that the NETCONF server state has changed:</t>

        <t><list style="symbols">
            <t>netconf-config-change</t>

            <t>netconf-capability-change</t>

            <t>netconf-session-start</t>

            <t>netconf-session-end</t>

            <t>netconf-confirmed-commit</t>
          </list></t>

        <t>These event notifications used within the 'NETCONF' stream are
        accessible to clients via the subscription mechanism described in
        [RFC5277].</t>

        <t>This document introduces NMDA specific extension which allows a
        client to receive 1 notifications for additional common system events
        as follows: <list style="hanging">
            <t hangText="apply-configuration-updated:">Generated when a server
            with network management protocol support interacts with hardware
            and detects that a set of configurations are not applied or none
            of them are not applied. Indicates the event and the current state
            of the applied configuration or data inconsistency issue between
            intended data initiated from the client and operational data saved
            in the server. NMDA datastore compare [I-D.ietf-netmod-nmda-diff]
            can be used to trigger consistency data check, i.e.,indicate the
            source of configuration node and check which part of configuration
            data is applied or which part of configuration data is not
            applied. A server MAY report events for non-NETCONF management
            sessions (such as RESTCONF,gPRC), using the 'session-id' value of
            zero.</t>
          </list></t>

        <t>The following figure shows event notification sequence defined in
        this document.</t>

        <figure>
          <artwork>
                                 +----------------------------+
                                 |Server (device)             |
                                 |                            |
                                 |                            |
                                 |       +----------+         |
                                 |       | Intended |         |
+------------+                   |       | datastore|         |
|            |                   |       +----------+         |
|+----------+|                   |           ^                |
|| Intended ||                   |           |                |
|| config   ||                   |           v                |
|+----------+|                   |     +-------------+        |
|            |&lt;----------------------&gt; |             |        |
|   Client   |  &lt;nmda-diff&gt; rpc        |  NETCONF    |        |
|    (app)   |                   |     |   engine    |        |
|            |&lt;----------------------  |             |        |
|            | &lt;intent-configuration   +-------------+        |
|            |  -update&gt; notification    /        \           |
+------------+                   |      /          \          |
                                 |     /            \         |
                                 |+------------++---------+   |
                                 || Operational||system   |+  |
                                 ||  datastore ||software ||+ |
                                 ||            ||component||| |
                                 |+------------++---------+|| |
                                 |               +---------+| |
                                 |                +---------+ |
                                 +----------------------------+
</artwork>
        </figure>

        <t>These notification messages are accessible to clients via either
        the subscription mechanism described in [RFC5277] or dynamic
        subscription mechanism and configured subscription mechanism described
        in [I-D.ietf-netconf-netconf-event-notifications].</t>
      </section>

      <section title="Data Model Design">
        <t>The data model is defined in the ietf-nmda-notifications YANG
        module. Its structure is shown in the following figure. The notation
        syntax follows [RFC8340].</t>

        <figure>
          <artwork>  notifications:
     +---n intent-configuration-update
       +--ro app-tag?                string
       +--ro src-ds?                 identityref
       +--ro dst-ds?                 identifyref
       +--ro (filter-spec)?
       |  +--:(subtree-filter)
       |  |  +--ro subtree-filter?   &lt;anydata&gt;
       |  +--:(xpath-filter)
       |     +--ro xpath-filter?     yang:xpath1.0 {nc:xpath}?
       |--ro apply-result            enumeration
       +--ro fail-applied-object* [edit-id]
          +--ro edit-id      string
          +--ro operation    enumeration
          +--ro object?      ypatch:target-resource-offset
          +--ro value?       &lt;anydata&gt;
          +--ro errors
             +--ro error* []
                +--ro error-type       enumeration
                +--ro error-tag        string
                +--ro error-app-tag?   string
                +--ro error-path?      instance-identifier
                +--ro error-message?   string
                +--ro error-info?      &lt;anydata&gt;</artwork>
        </figure>

        <t>The following are examples of a apply-configuration-updated
        notification message:<figure>
            <artwork>  &lt;notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"&gt;
    &lt;eventTime&gt;2017-06-16T16:30:59.137045+09:00&lt;/eventTime&gt;
    &lt;intent-configuration-update xmlns="urn:ietf:params:xml:ns:yang:ietf-nmda-notifications"&gt;
      &lt;app-tag&gt;ds--module-a&lt;/app-tag&gt;
      &lt;datastore&gt;intended&lt;/datastore&gt;
      &lt;datastore&gt;operational&lt;/datastore&gt;
      &lt;fail-applied-object&gt;
        &lt;edit-id&gt;1&lt;edit-id&gt;
        &lt;operation&gt;merge&lt;/operation&gt;
        &lt;target&gt;/ietf-interfaces:interfaces-state&lt;/target&gt;
         &lt;value&gt;
            &lt;interfaces-state xmlns="http://foo.com/ietf-interfaces"&gt;
                 &lt;interface&gt;
                   &lt;name&gt;eth0&lt;/name&gt;
                   &lt;oper-status&gt;down&lt;/oper-status&gt;
                 &lt;/interface&gt;
            &lt;/interfaces-state&gt;
         &lt;/value&gt;
      &lt;/fail-applied-object&gt;
      &lt;fail-applied-object&gt;
        &lt;edit-id&gt;2&lt;edit-id&gt;
        &lt;target&gt;/ietf-system:system&lt;/target&gt;
        &lt;errors&gt;
         &lt;error-type&gt;protocol&lt;/error-type&gt;
         &lt;error-tag&gt;mis-resource&lt;/error-tag&gt;
         &lt;error-path xmlns:ops="https://example.com/ns/ietf-system"&gt;\
          \/if:interfaces-state\
          \&lt;/error-path&gt;
         &lt;error-message&gt;refer to resources that are not \
         \available or otherwise not physically present.\
         \&lt;/error-message&gt;
       &lt;/errors&gt;
      &lt;/fail-applied-object&gt;
   &lt;/intent-configuration-update&gt;
  &lt;/notification&gt;</artwork>
          </figure></t>
      </section>

      <section title="Relation with NMDA Datastore Compare">
        <t>NMDA datastore compare [I-D.ietf-netmod-nmda-diff] could be used to
        check which part of configuration data is applied or which part of
        configuration data is not applied,e.g.,If a client creates an
        interface "et-0/0/0" but the interface does not physically exist at
        this point, the interface will appear in &lt;intended&gt; but does not
        does not exist in the &lt;operational&gt;. By comparing configuration
        difference between &lt;intended&gt; and &lt;operational&gt;, the
        interface that is not applied can be sorted out. Unlike
        [I-D.ietf-netmod-nmda-diff], the notification message only focuses on
        the configuration data that is not applied and the reason why the
        configuration changes were not applied. Also system internal
        interactions with hardware is needed within the server to make sure
        fail applied object is caused by mis-resource or remnant
        Configuration, etc.</t>
      </section>

      <section title="Definitions">
        <t/>

        <t>This section presents the YANG module defined in this document.
        This module imports data types from the 'ietf-datastores' module
        defined in [RFC8342] and 'ietf-inet-types' module defined in
        [RFC6021].</t>

        <figure>
          <artwork> &lt;CODE BEGINS&gt; file "ietf-nmda-notifications@2019-06-19.yang"
module ietf-nmda-notifications {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-nmda-notifications";
  prefix ndn;
  import ietf-datastores {
    prefix ds;
  }
  import ietf-inet-types { prefix inet; }
  import ietf-yang-types { prefix yang;}
  import ietf-yang-patch {
    prefix ypatch;
  }
  import ietf-netconf {
    prefix nc;
  }
  import ietf-restconf { prefix rc;}
  organization
    "IETF NETMOD (Network Modeling) Working Group";
  contact
    "WG Web:   &lt;http://tools.ietf.org/wg/netmod/&gt;
     WG List:  &lt;mailto:netmod@ietf.org&gt;
 
     Editor:   Qin Wu
               &lt;mailto:bill.wu@huawei.com&gt;
     Editor:   Rohit R Ranade
               &lt;mailto:rohitrranade@huawei.com&gt;";
  description
    "This module defines a YANG data model for use with the
     NETCONF and RESTCONF protocol that allows the client to
     receive additional common event notifications related to NMDA.

     Copyright (c) 2012 IETF Trust and the persons identified as
     the document authors.  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 2019-06-19 {
    description
      "Initial version.";
    reference "RFC xxx: NETCONF Base Notifications for NMDA";
  }
  typedef session-id-or-zero-type {
     type uint32;
     description
       "NETCONF Session Id or Zero to indicate none";
   }
  feature error-info {
      description
        "This feature must
         also be enabled for that session if error-info
        can be advertised by the server.  Otherwise,
         this feature must not be enabled.";
    }
  grouping common-session-parms {
    description
      "Common session parameters to identify a
       management session or internal interaction
       on a set of configuration data.";

    leaf username {
      type string;
      description
        "Name of the user for the session.";
    }
    leaf source-host {
      type inet:ip-address;
      description
        "Address of the remote host for the session.";
    }

    leaf session-id {
      type session-id-or-zero-type;
      description
        "Identifier of the session.
         A NETCONF session MUST be identified by a non-zero value.
         A non-NETCONF session MAY be identified by the value zero.";
    }
    leaf app-tag {
      type string;
      description
        "The application tag used to identify the managment session 
       or internal interaction on a set of configuration data.";
    }

  }

    notification intent-configuration-updated {
      description
        "Generated when a server detects that a
         intended configuration applied event has occurred. Indicates
         the event and the current state of the intended data applying
          procedure in progress.";
      reference "RFC 8342, Section 5";
      uses common-session-parms;
      leaf src-ds {
          type identityref {
            base ds:datastore;
          }
           description
            "Indicates which datastore is
             source of edit-data operation.";
        }
      leaf dst-ds {
          type identityref {
            base ds:datastore;
          }
           description
            "Indicates which datastore is
             target of edit-data operation.";
        }
        choice filter-spec {
           description
             "The content filter specification for this request.";
           anydata subtree-filter {
             description
               "This parameter identifies the portions of the
                target datastore to retrieve.";
             reference
               "RFC 6241: Network Configuration Protocol, Section 6.";
           }
           leaf xpath-filter {
             if-feature nc:xpath;
             type yang:xpath1.0;
             description
               "This parameter contains an XPath expression identifying
                the portions of the target datastore to retrieve.

                If the expression returns a node-set, all nodes in the
                node-set are selected by the filter.  Otherwise, if the
                expression does not return a node-set, then the get-data
                operation fails.

                The expression is evaluated in the following XPath
                context:

                  o  The set of namespace declarations are those in
                     scope on the 'xpath-filter' leaf element.

                  o  The set of variable bindings is empty.

                  o  The function library is the core function library,
                     and the XPath functions defined in section 10 in
                     RFC 7950.

                  o  The context node is the root node of the target
                     datastore.";
           }
         }
      leaf apply-result {
        type enumeration {
          enum "partial-fail" {
            description
              "A set of configuration data is not applied.";
          }
         enum "fail" {
             description
             " None of configuration data is applied.";
         }
         enum "sucess" {
             description
             " All configuration data is applied.";
         }
       }
     description
      "Configuration data apply result.";
    }
      list fail-applied-object {
        when "../apply-result = 'partial-fail'";
        key edit-id;
        ordered-by user;
        leaf edit-id {
               type string;
                description
                  "Response status is for the 'edit' list entry
                   with this 'edit-id' value.";
             }
        leaf operation {
             type enumeration {
               enum create {
                 description
                   "The target data node is created using the supplied
                    value, only if it does not already exist.  The
                    'target' leaf identifies the data node to be
                    created, not the parent data node.";
               }
               enum delete {
                 description
                   "Delete the target node, only if the data resource
                    currently exists; otherwise, return an error.";
               }

               enum insert {
                 description
                   "Insert the supplied value into a user-ordered
                    list or leaf-list entry.  The target node must
                    represent a new data resource.  If the 'where'
                    parameter is set to 'before' or 'after', then
                    the 'point' parameter identifies the insertion
                    point for the target node.";
               }
               enum merge {
                 description
                   "The supplied value is merged with the target data
                    node.";
               }
               enum move {
                 description
                   "Move the target node.  Reorder a user-ordered
                    list or leaf-list.  The target node must represent
                    an existing data resource.  If the 'where' parameter
                    is set to 'before' or 'after', then the 'point'
                    parameter identifies the insertion point to move
                    the target node.";
               }
               enum replace {
                 description
                   "The supplied value is used to replace the target
                    data node.";
               }
               enum remove {
                 description
                   "Delete the target node if it currently exists.";
               }
             }
             mandatory true;
             description
               "The datastore operation requested for the associated
                'edit' entry.";
           }
        leaf target {
          type ypatch:target-resource-offset;
          description
            "Topmost node associated with the configuration change.
             A server SHOULD set this object to the node within
             the datastore that is being altered.  A server MAY
             set this object to one of the ancestors of the actual
             node that was changed, or omit this object, if the
             exact node is not known.";
        }
    anydata value {
             description
               "Value used for this edit operation.  The anydata 'value'
                contains the target resource associated with the
                'target' leaf.

                For example, suppose the target node is a YANG container
                named foo:

                    container foo {
                      leaf a { type string; }
                      leaf b { type int32; }
                    }

                The 'value' node contains one instance of foo:

                    &lt;value&gt;
                       &lt;foo xmlns='example-foo-namespace'&gt;
                          &lt;a&gt;some value&lt;/a&gt;
                          &lt;b&gt;42&lt;/b&gt;
                       &lt;/foo&gt;
                    &lt;/value&gt;
                ";
        }
        uses rc:errors {if-feature error-info;}
        description
          "List for fail applied objects that is not applied. ";
      }
    }
  }
 &lt;CODE ENDS&gt;</artwork>
        </figure>
      </section>
    </section>

    <section anchor="security" title="Security Considerations">
      <t>The YANG module defined in this memo is designed to be accessed via
      the NETCONF protocol [RFC6241]. The lowest NETCONF layer is the secure
      transport layer and the mandatory-to-implement secure transport is SSH,
      defined in [RFC6242].</t>

      <t>Some of the readable data nodes in this YANG module may be considered
      sensitive or vulnerable in some network environments. It is thus
      important to control read access (e.g., via get, get-config, or
      notification) to these data nodes. These are the subtrees and data nodes
      and their sensitivity/vulnerability:</t>

      <t>/intent-configuration-update:<list style="none">
          <t>Event type itself indicates that intent based configuration has
          been updated. This event could alert an attacker that a datastore
          may have been altered.</t>
        </list></t>

      <t>/intent-configuration-updated/apply-result:<list style="none">
          <t>Indicates the specific intent based configuration update event
          state change that occurred. A value of 'success' probably indicates
          that intent based configuration has been applied successfully.</t>
        </list></t>
    </section>

    <section title="IANA Considerations">
      <t>This document registers one XML namespace URN in the 'IETF XML
      registry', following the format defined in [RFC3688]: <list style="none">
          <t>URI: urn:ietf:params:xml:ns:yang:ietf-nmda-notifications</t>

          <t>Registrant Contact: The IESG.</t>

          <t>XML: N/A, the requested URI is an XML namespace.</t>
        </list></t>

      <t>This document registers one module name in the 'YANG Module Names'
      registry, defined in [RFC7950]: <list style="none">
          <t>name: ietf-nmda-notifications</t>

          <t>prefix: ndn</t>

          <t>namespace:
          urn:ietf:params:xml:ns:yang:ietf-nmda-notifications</t>

          <t>RFC: xxxx</t>
        </list></t>
    </section>

    <section title="Acknowledgements">
      <t>Thanks to Juergen Schoenwaelder, Alex Clemm,Carey Timothy and Andy
      Berman, Sterne Jason to review this draft and Thank Xiaojian Ding
      provide important input to the initial version of this document.</t>
    </section>

    <section title="Contributors">
      <figure>
        <artwork>   Chong Feng
   Huawei
   Email:frank.fengchong@huawei.com</artwork>
      </figure>
    </section>

    <!---->
  </middle>

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

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

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

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

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

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

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

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

      <?rfc include='reference.RFC.8342.xml'?>

      <?rfc include='reference.RFC.8072.xml'?>

      <?rfc include='reference.I-D.ietf-netmod-nmda-diff'?>
    </references>

    <section title="Changes between revisions">
      <t>v01 - v03<list style="symbols">
          <t>Change notification name into intent-configuration update.</t>

          <t>Change title into NMDA Base event for intent based configuration
          update.</t>

          <t>Clarify the usage of NMDA base event and relation with NMDA diff
          work.</t>
        </list></t>

      <t>v01 - v00<list style="symbols">
          <t>Add application tag support and use additional parameters to
          identify management session.</t>

          <t>Remove apply-intended-start and apply-intended-end two
          notifications since they are not needed based on discussion.</t>
        </list></t>
    </section>
  </back>
</rfc>
