<?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-ranade-netmod-yang-push-extension-00"
     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="Extensions to Yang Push">Extensions to Yang Push</title>

    <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 day="01" month="Feb" year="2019"/>
    <area>OPS Area</area>

    <workgroup>NETMOD Working Group</workgroup>

    <keyword>None.</keyword>
    <abstract>
      <t>This document defines extensions to the yang push subscription
      mechanism, which can provide more granularity in tracking configuration
      changes in datastores.</t>
    </abstract>
    


    
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t> The subscription mechanism defined in yang-push draft 
      <xref target="I-D.ietf-netconf-yang-push"/> supports a subscription mechanism 
      where datastore and its datanodes can be provided as targets. However 
      there are a few scenarios where a subscription to datanodes may not be
      sufficient.
      
      <list style="symbols">
        <t>An application on the client may want to track ONLY the 
        configuration changes in a particular module. If a module contains 
        "config true" mixed with "config false" nodes, setting up such a filter
        at multiple levels will be cumbersome.</t>
        
        <t>An application on the client may want to track the configuration 
        (other than intended) which the device applied. Yang-push subscription
        does not provide such control.</t>
      </list>      
      </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 <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="RFC8342"/>
        and are not redefined here:</t>

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

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

    <!-- intro -->
    


    <section anchor="extensions" title="Yang Push Subscription Extensions">

      <t>There are two new filter nodes added to the Yang push subscription 
      mechanism. They are listed below.
      
        <list style="symbols">
          <t>config-filter</t>
          <t>with-origin</t>
        </list>
      </t>
      
      <section title="Config Filter">
        <t>This is a filter for nodes with the given value for their 'config' 
        property.  When this leaf is set to 'true', only 'config true' nodes 
        are selected and, when set to 'false', only 'config false' nodes are 
        selected.  If this leaf is not present, this filter is not applied.</t>
      </section>

      <section title="Origin Metadata Attribute">
        <t>This document defines the "with-origin" parameter, which if present,
        requests that the server includes "origin" metadata
        annotations as defined in <xref target="RFC8342"/> in notifications 
        which are part of this subscription. This parameter is only valid 
        for the operational  state datastore and any datastores with identities
        derived from the  "operational" identity.  Otherwise, if an invalid 
        datastore is specified then a suitable error is returned.
        </t>

        <t>Data in the operational state datastore can come from multiple
        sources.  The server should return the most accurate value for the
        "origin" metadata annotation as possible, indicating the source of
        the operational value, as specified in 
        <eref target="https://tools.ietf.org/html/rfc8342#section-5.3.4">Section 5.3.4 of RFC8342</eref></t>
        
        

        <t>When encoding the origin metadata annotation for a hierarchy of
        returned nodes, the annotation may be omitted for a child node when
        the value matches that of the parent node, as described in the
        "ietf-origin" YANG module <xref target="RFC8342"/>.</t>
        
        <t>The "with-origin" parameter is optional to support. It is identified
        with the feature "origin".</t>
      </section>
    </section>

    <!-- summary -->

    <section anchor="examples-usage" title="Examples of usage">
      <t>In this example, the following fictional module is used:</t>
      <figure>
        <artwork>module example-interface {
  yang-version 1.1;
  namespace urn:example:interface;
  prefix int;

  import ietf-inet-types {
    prefix inet;
  }
 
  container interface {
    leaf name{
      type string;
    }
  
    leaf speed{
      type string;
      config false;
    }   
  }
}</artwork>      
      </figure>
      
      <t>A subscription on the "config true" nodes of the operational state 
      datastore. This subscription also requests to get the origin of the 
      datanodes as part of Yang-push notifications.
      This is considering that the NETCONF protocol was used for this 
      subscription.
      </t>     

      <figure>
        <artwork>
&lt;rpc xmlns="urn:ietf:params:xml:ns:netconf:1.0"&gt;  
  &lt;establish-subscription \
        xmlns="urn:ietf:params:xml:ns:netconf:1.0" \
        xmlns:yp="urn:ietf:params:xml:ns:netconf:1.0" \
        xmlns:ypext="urn:ietf:params:xml:ns:netconf:1.0"&gt;
    &lt;yp:datastore&gt;operational&lt;/yp:datastore&gt;
    &lt;ypext:config-filter&gt;true&lt;/ypext:config-filter&gt;
    &lt;ypext:with-origin/&gt;
  &lt;/establish-subscription&gt;
&lt;/rpc&gt;        
        </artwork>      
      </figure>
      
      <t>The operator has configured an interface ("eth1"), the system has 
        recognised an interface ("eth0") which was plugged in recently. The below
        NETCONF notification is an example for a yang-push notification when 
        the device applies the "eth0" configuration.
        </t>
        
      <figure>
        <artwork>
&lt;notification \
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"&gt; 
  &lt;eventTime&gt;2019-01-25T08:00:11.22Z&lt;/eventTime&gt; 
  &lt;push-change-update 
        xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push" \
        xmlns:or="urn:ietf:params:xml:ns:yang:ietf-origin" &gt;
    &lt;id&gt;10&lt;/id&gt;
    &lt;datastore-changes&gt;
      &lt;yang-patch&gt;
        &lt;patch-id&gt;1&lt;/patch-id&gt;
        &lt;edit&gt;
          &lt;edit-id&gt;edit1&lt;/edit-id&gt;
          &lt;operation&gt;create&lt;/operation&gt;
          &lt;target&gt;/example-interface:interface&lt;/target&gt;
          &lt;value&gt;
            &lt;interface xmlns="urn:example:interface" \
                  or:origin="or:system"&gt;
              &lt;name&gt;eth0&lt;/name&gt;
            &lt;/interface&gt;
          &lt;/value&gt;  
        &lt;/edit&gt;
    &lt;/yang-patch&gt;
  &lt;/push-change-update&gt;
&lt;/notification&gt;        
        </artwork>      
      </figure>        
        
    </section>
    
    <section title="YANG Module">
      <figure>
        <artwork>
    &lt;CODE BEGINS&gt; file "ietf-yang-push-ext@2019-02-01.yang"
    module ietf-yang-push-ext {
      yang-version 1.1;
      namespace "urn:ietf:params:xml:ns:yang:ietf-yang-push-ext";
      prefix ypext;
   
      import ietf-subscribed-notifications {
        prefix sn;
      }

      import ietf-yang-push {
        prefix yp;
      }
      
      import ietf-datastores {
        prefix ds;
        reference "RFC 8342: Network Management Datastore Architecture.";
      }      
      
      import ietf-origin {
        prefix or;
        reference "RFC 8342: Network Management Datastore Architecture.";
      }      
    
      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;
         WG Chair: Kent Watsen
                   &lt;mailto:kwatsen@juniper.net&gt;

         Editor:   Rohit Ranade
                   &lt;mailto:rohitrranade@huawei.com&gt;";

      description
        "This module defines extensions to subscription mechanism 
        to yang-push on operational state datastore.

        Copyright (c) 2019 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 2019-02-01 {
        description
          "Initial revision.";
        reference "RFCXXXX";
      }
      
      feature origin {
        description
          "Indicates that the server supports the 'origin' annotation.";
        reference
          "RFC 8342: Network Management Datastore Architecture";
      }      
     
      grouping subscription-filter-extension{
        description
          "This grouping describes the extensions to subscription
           conditions.";   
        leaf config-filter {
          type boolean;
          description
            "Filter for nodes with the given value for their 'config'
             property.  When this leaf is set to 'true', only 'config
             true' nodes are selected and, when set to 'false', only
             'config false' nodes are selected.  If this leaf is not
             present, this filter is not applied.";
        }

        leaf with-origin {
          when 'derived-from-or-self(../yp:datastore, "ds:operational")';
          if-feature origin;
          type empty;
          description
            "If this parameter is present, the server will return
             the 'origin' annotation for the nodes that has one.";
        }     
      }

      augment "/sn:establish-subscription/sn:input/sn:target/ +
                  yp:datastore" {
        description
          "This augmentation adds the filter extensions for the 
           subscription to RPC input.";
        uses subscription-filter-extension;
      }
    }
    &lt;CODE ENDS&gt;</artwork>
      </figure>
    </section>

    <section title="IANA Considerations">
      <t>This document registers one URI in the IETF XML Registry <xref target="RFC3688"/>.
      The following registration has been made: <list style="none">
          <t>URI: urn:ietf:params:xml:ns:yang:ietf-yang-push-oper-ext</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 YANG module in the YANG Module Names
      Registry [RFC6020]. The following registration has been made: <list
          style="none">
          <t>name: ietf-yang-push-oper-ext</t>

          <t>namespace: urn:ietf:params:xml:ns:yang:ietf-yang-push-oper-ext</t>

          <t>prefix: ypext</t>

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

    <section anchor="security" title="Security Considerations">
      <t>TBD.</t>
    </section>

    <!---->
  </middle>

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

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

      <?rfc include="reference.I-D.ietf-netconf-yang-push"?>

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

    </references>
  </back>
</rfc>
