<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<rfc category="std" docName="draft-ietf-netconf-https-notif-05"
     ipr="trust200902">
  <?rfc toc="yes"?>

  <front>
    <title abbrev="HTTPS Configured Subscription">An HTTPS-based Transport for
    Configured Subscriptions</title>

    <author fullname="Mahesh Jethanandani" initials="M.J."
            surname="Jethanandani">
      <organization>Kloud Services</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <code/>

          <country/>
        </postal>

        <phone/>

        <facsimile/>

        <email>mjethanandani@gmail.com</email>

        <uri/>
      </address>
    </author>

    <author fullname="Kent Watsen" initials="K.W." surname="Watsen">
      <organization>Watsen Networks</organization>

      <address>
        <postal>
          <street/>

          <city/>

          <region/>

          <country>USA</country>
        </postal>

        <email>kent+ietf@watsen.net</email>
      </address>
    </author>

    <date day="23" month="October" year="2020"/>

    <area>Routing</area>

    <workgroup>NETCONF</workgroup>

    <keyword>http</keyword>

    <keyword>yang</keyword>

    <keyword>notification</keyword>

    <abstract>
      <t>This document defines a YANG data module for configuring HTTPS based
      configured subscription, as defined in RFC 8639. The use of HTTPS
      maximizes transport-level interoperability, while allowing for encoding
      selection from text, e.g. XML or JSON, to binary.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t><xref target="RFC8639">Subscription to YANG Notifications</xref>
      defines a YANG data module for configuring subscribed notifications. It
      defines a "subscriptions" container that contains a list of receivers,
      but it defers the configuration and management of those receivers to
      other documents. This document defines two <xref target="RFC7950">YANG
      1.1 </xref> data modules, one for augmenting the <xref
      target="RFC8639">Subscription to YANG Notifications</xref> to add a
      transport type, and another for configuring and managing HTTPS based
      receivers for the notifications.</t>

      <t>The first module allows for different transports to be configured for
      the same receiver instance. The second module describes how to enable
      the transmission of YANG modeled notifications, in the configured
      encoding (i.e., XML, JSON) over HTTPS. Notifications are delivered in
      the form of a HTTPS POST. The use of HTTPS maximizes transport-level
      interoperability, while the encoding selection pivots between
      implementation simplicity (XML, JSON) and throughput (text versus
      binary).</t>

      <t>Configured subscriptions enable a server, acting as a publisher of
      notifications, to proactively push notifications to external receivers
      without the receivers needing to first connect to the server, as is the
      case with dynamic subscriptions.</t>

      <section title="Applicability Statement">
        <t>While the YANG modules have been defined as an augmentation of
        <xref target="RFC8639">Subscription to YANG Notifications</xref>, the
        notification method defined in this document MAY be used outside of
        <xref target="RFC8639">Subscription to YANG Notifications</xref> by
        using some of the definitions from this module along with the grouping
        defined in <xref
        target="I-D.ietf-netconf-http-client-server">Groupings for HTTP
        Clients and Servers</xref>. For an example on how that can be done,
        see Section 8.2.</t>
      </section>

      <section title="Note to RFC Editor">
        <t>This document uses several placeholder values throughout the
        document. Please replace them as follows and remove this section
        before publication.</t>

        <t>RFC XXXX, where XXXX is the number assigned to this document at the
        time of publication.</t>

        <t>2020-10-21 with the actual date of the publication of this
        document.</t>
      </section>

      <section title="Abbreviations">
        <texttable>
          <ttcol>Acronym</ttcol>

          <ttcol>Expansion</ttcol>

          <c>HTTP</c>

          <c>Hyper Text Transport Protocol</c>

          <c>HTTPS</c>

          <c>Hyper Text Transport Protocol Secure</c>

          <c>TCP</c>

          <c>Transmission Control Protocol</c>

          <c>TLS</c>

          <c>Transport Layer Security</c>
        </texttable>
      </section>

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

        <section title="Subscribed Notifications">
          <t>The following terms are defined in <xref
          target="RFC8639">Subscription to YANG Notifications</xref>.</t>

          <t><list style="symbols">
              <t>Subscribed Notifications</t>
            </list></t>
        </section>
      </section>

      <section title="Receiver and Publisher Interaction">
        <t>The interaction between the receiver and the publisher can be of
        type "pipelining" or send multiple notifications as part of a
        "bundled-message", as defined in <xref
        target="I-D.ietf-netconf-notification-messages">Notification Message
        Headers and Bundles</xref></t>

        <section title="Pipelining of messages">
          <t>In the case of "pipelining", the flow of messages would look
          something like this. This example shows the flow assuming that
          Subscribed Notifications is used and therefore a
          &lt;subscription-started&gt; notification is sent before sending the
          first notification. The example would be the same for when
          Subscribed Notification is not used by removing the first POST
          message for &lt;susbscription-started&gt;.</t>

          <t><figure>
              <artwork><![CDATA[       -------------                               --------------
       | Publisher |                               | Receiver   |
       -------------                               --------------

       Establish TCP             ------>

       Establish TLS             ------>

       Send HTTPS POST message
       with <subscription-       ------>
       started> notification

                                                  Send 200 (OK) for
                                 <------          <subscription-started>

       Send HTTPS POST message 
       with YANG defined         ------>
       notification #1

       Send HTTPS POST message
       with YANG defined         ------>
       notification #2
                                                 Send 204 (No Content)
                                 <------         for notification #1
 
                                                 Send 204 (No Content)
                                 <------         for notification #2

       Send HTTPS POST message
       with YANG defined         ------->
       notification #3

                                                 Send 204 (No Content)
                                 <------         for notification #3]]></artwork>
            </figure></t>

          <t>The content of the exchange would look something like this.</t>

          <figure>
            <artwork><![CDATA[Request:

    POST /some/path HTTP/1.1
    Host: my-receiver.my-domain.com
    Content-Type: application/yang-data+xml

    <notification
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
      <eventTime>2019-03-22T12:35:00Z</eventTime>
      <foo xmlns="https://example.com/my-foobar-module">
        ...
      </foo>
    </notification>

    <notification
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
      <eventTime>2019-03-22T12:35:00Z</eventTime>
      <bar xmlns="https://example.com/my-foobar-module">
        ...
      </bar>
    </notification>

    <notification
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
      <eventTime>2019-03-22T12:35:01Z</eventTime>
      <baz xmlns="https://example.com/my-foobar-module">
        ...
      </baz>
    </notification>


Response:

      HTTP/1.1 204 No Content
      Date: Fri, 03 Mar 2019 12:35:00 GMT
      Server: my-receiver.my-domain.com


      HTTP/1.1 204 No Content
      Date: Fri, 03 Mar 2019 12:35:00 GMT
      Server: my-receiver.my-domain.com

      HTTP/1.1 204 No Content
      Date: Fri, 03 Mar 2019 12:35:01 GMT
      Server: my-receiver.my-domain.com]]></artwork>
          </figure>
        </section>
      </section>
    </section>

    <section title="Learning Receiver Capabilities">
      <section title="Introduction">
        <t>To learn the capabilities of the receiver, the publisher can issue
        a HTTPS GET request with Accept-Type set to
        application/ietf-https-notif-cap+xml or
        application/ietf-https-notif-cap+json, with latter as the mandatory to
        implement, and the default in case the type is not specified. If the
        receiver supports capabilities such as binary encoding of data, it can
        return that as a capability in a response. Please note that, when used
        in conjunction with <xref target="RFC8639">Subscription to YANG
        Notifications</xref>, dynamic discovery of the receiver&rsquo;s
        supported encoding is considered only when the
        "/subscriptions/subscription/encoding&rdquo; leaf is not configured,
        per the &ldquo;encoding&rdquo; leaf&rsquo;s description statement.</t>
      </section>

      <section title="Example">
        <t>The publisher can send the following request to learn the receiver
        capabilities. The Accept-Type states its preferred order for
        Content-Type that it wants to receive starting with XML, and if not
        supported, to use JSON encoding. Currently, there is only one
        capability of binary encoding defined.</t>

        <t><figure>
            <artwork><![CDATA[GET / HTTP/1.1
Host: example.com
Accept-Type: application/ietf-https-notif-cap+xml, application/ietf-https-notif-cap+json]]></artwork>
          </figure></t>

        <t>In case the receiver supports the first Accept-Type, its response
        should look like this:</t>

        <t><figure>
            <artwork><![CDATA[HTTP/1.1 200 OK
Date: Wed, 26 Feb 2020 20:33:30 GMT
Server: example-server
Cache-Control: no-cache
Content-Type: application/ietf-https-notif-cap+xml
Content-Length: nnn

<receiver-capabilities>
  <receiver-capability>
    <urn:ietf:params:https-config:capability:binary-encoding:1.0>
  </receiver-capability>
</receiver-capabilities>]]></artwork>
          </figure></t>
      </section>
    </section>

    <section title="The &quot;ietf-sub-notif-recv-list&quot; Module">
      <section title="Data Model Overview">
        <t>This YANG module augments ietf-subscribed-notifications module to
        define a choice of transport types that other modules such as the
        ietf-https-notif module can use to define a transport specific
        receiver.</t>

        <t><figure>
            <artwork><![CDATA[

module: ietf-sub-notif-recv-list
  augment /sn:subscriptions:
    +--rw receiver-instances
       +--rw receiver-instance* [name]
          +--rw name    string
          +--rw (transport-type)
  augment /sn:subscriptions/sn:subscription/sn:receivers/sn:receiver:
    +--rw receiver-instance-ref?   leafref

]]></artwork>
          </figure></t>
      </section>

      <section title="YANG Module">
        <t><figure>
            <artwork><![CDATA[
<CODE BEGINS> file "ietf-sub-notif-recv-list@2020-10-21.yang"
module ietf-sub-notif-recv-list {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-sub-notif-recv-list";
  prefix "snrl";

  import ietf-subscribed-notifications {
    prefix sn;

    reference
      "I-D.ietf-netconf-subscribed-notifications";
  }

  organization
    "IETF NETCONF Working Group";

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

     Authors: Mahesh Jethanandani (mjethanandani at gmail dot com)
              Kent Watsen (kent plus ietf at watsen dot net)";
  description
    "YANG module for augmenting Subscribed Notifications to add
     a transport type.

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

     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 "2020-10-21" {
    description
      "Initial Version.";
    reference
      "RFC XXXX, YANG Data Module for HTTPS Notifications.";
  }

  augment "/sn:subscriptions" {
    container receiver-instances {
      description
	"A container for all instances of receivers.";

      list receiver-instance {
	key "name";

	leaf name {
	  type string;
	  description
	    "An arbitrary but unique name for this receiver instance.";
	}
	
	choice transport-type {
	  mandatory true;
	  description
	    "Choice of different types of transports used to send
             notifications.";
	}
	description
	  "A list of all receiver instances.";
      }
    }
    description
      "Augment the subscriptions container to define the transport
       type.";
  }

  augment "/sn:subscriptions/sn:subscription/sn:receivers/sn:receiver" {
    leaf receiver-instance-ref {
      type leafref {
        path "/sn:subscriptions/snrl:receiver-instances/" +
             "snrl:receiver-instance/snrl:name";
      }
      description
        "Reference to a receiver instance.";
    }
    description
      "Augment the subscriptions container to define an optional
       reference to a receiver instance.";
  }

}
<CODE ENDS>

]]></artwork>
          </figure></t>
      </section>
    </section>

    <section anchor="overview" title="The &quot;ietf-https-notif&quot; Module">
      <section anchor="overview.protocol" title="Data Model Overview">
        <t>This YANG module is a definition of a set of receivers that are
        interested in the notifications published by the publisher. The module
        contains the TCP, TLS and HTTPS parameters that are needed to
        communicate with the receiver. The module augments the
        ietf-sub-notif-recv-list module to define a transport specific
        receiver. As mentioned earlier, it uses POST method to deliver the
        notification. The attribute 'path' defines the path for the resource
        on the receiver, as defined by 'path-absolute' in <xref
        target="RFC3986">URI Generic Syntax</xref>. The user-id used by <xref
        target="RFC8341">Network Configuration Access Control Model</xref>, is
        that of the receiver and is derived from the certificate presented by
        the receiver as part of 'receiver-identity'.</t>

        <t>An abridged tree diagram representing the module is shown
        below.</t>

        <figure>
          <artwork><![CDATA[

module: ietf-https-notif
  augment /sn:subscriptions/snrl:receiver-instances
            /snrl:receiver-instance/snrl:transport-type:
    +--:(https)
       +--rw https-receiver
          +--rw (transport)
          |  +--:(tcp) {tcp-supported,not httpc:tcp-supported}?
          |  |     ...
          |  +--:(tls) {tls-supported}?
          |        ...
          +--rw receiver-identity
             +--rw cert-maps
                   ...

]]></artwork>
        </figure>
      </section>

      <section title="YANG module">
        <t>The YANG module imports <xref target="RFC6991">Common YANG Data
        Types</xref>, <xref target="RFC7407">A YANG Data Model for SNMP
        Configuration</xref>, <xref target="RFC7951">JSON Encoding of Data
        Modeled with YANG</xref>, and <xref target="RFC8639">Subscription to
        YANG Notifications</xref>.</t>

        <t>The YANG module is shown below.</t>

        <figure>
          <artwork><![CDATA[
<CODE BEGINS> file "ietf-https-notif@2020-10-21.yang"
module ietf-https-notif {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-https-notif";
  prefix "hn";

  import ietf-subscribed-notifications {
    prefix sn;
    reference
      "I-D.ietf-netconf-subscribed-notifications";
  }

  import ietf-http-client {
    prefix httpc;

    reference
      "I-D.ietf-netconf-http-client-server";
  }

  import ietf-sub-notif-recv-list {
    prefix snrl;

    reference
      "RFC XXXX, YANG Data Module for HTTPS Notifications.";
  }

  import ietf-x509-cert-to-name {
    prefix x509c2n;

    reference
      "RFC 7407: YANG Data Model for SNMP Configuration.";
  }
  
  organization
    "IETF NETCONF Working Group";

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

     Authors: Mahesh Jethanandani (mjethanandani at gmail dot com)
              Kent Watsen (kent plus ietf at watsen dot net)";
  description
    "YANG module for configuring HTTPS base configuration.

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

     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 "2020-10-21" {
    description
      "Initial Version.";
    reference
      "RFC XXXX, YANG Data Module for HTTPS Notifications.";
  }

  identity https {
    base sn:transport;
    description
      "HTTPS transport for notifications.";
  }

  augment "/sn:subscriptions/snrl:receiver-instances/" +
          "snrl:receiver-instance/snrl:transport-type" {
    case https {
      container https-receiver {
	description
	  "HTTPS receiver for notification";

	uses httpc:http-client-stack-grouping {
	  refine "transport/tcp" {
	    // create the logical impossibility of enabling "tcp"
	    // transport
	    if-feature "not httpc:tcp-supported";
	  }
	  augment "transport/tls/tls/http-client-parameters" {
	    leaf path {
	      type string;
	      description
		"Relative URI to the target resource.";
	    }
	    description
	      "Augmentation to add a path to the target resource.";
	  }
	}

        container receiver-identity {
          description
            "Specifies mechanism for identifying the receiver.
             The publisher MUST NOT include any content in a
             notification that the user is not authorized to view.";

          container cert-maps {
            uses x509c2n:cert-to-name;
            description
              "The cert-maps container is used by a TLS-based HTTP
               server to map the HTTPS client's presented X.509
               certificate to a 'local' username. If no matching and
               valid cert-to-name list entry is found, the publisher
               MUST close the connection, and MUST NOT
               not send any notifications over it.";
            reference
              "RFC 7407: A YANG Data Model for SNMP Configuration.";
          }
	}
      }
    }
    description
      "Augment the transport-type choice to define this transport.";
  }
}
<CODE ENDS>

]]></artwork>
        </figure>
      </section>
    </section>

    <section title="Security Considerations">
      <t>The YANG module specified in this document defines a schema for data
      that is designed to be accessed via network management protocols such as
      <xref target="RFC6241">NETCONF</xref> or <xref
      target="RFC8040">RESTCONF</xref>. The lowest NETCONF layer is the secure
      transport layer, and the mandatory-to-implement secure transport is
      <xref target="RFC6242">Secure Shell (SSH)</xref>. The lowest RESTCONF
      layer is HTTPS, and the mandatory-to-implement secure transport is <xref
      target="RFC8446">TLS</xref>. The <xref target="RFC8341">NETCONF Access
      Control Model (NACM) </xref> provides the means to restrict access for
      particular NETCONF or RESTCONF users to a preconfigured subset of all
      available NETCONF or RESTCONF protocol operations and content.</t>

      <t>There are a number of data nodes defined in this YANG module that are
      writable/creatable/deletable (i.e., config true, which is the default).
      These data nodes may be considered sensitive or vulnerable in some
      network environments. Write operations (e.g., edit-config) to these data
      nodes without proper protection can have a negative effect on network
      operations. These are the subtrees and data nodes and their
      sensitivity/vulnerability:</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>Some of the RPC operations in this YANG module may be considered
      sensitive or vulnerable in some network environments. It is thus
      important to control access to these operations. These are the
      operations and their sensitivity/vulnerability:</t>
    </section>

    <section title="Encoding Event Notifications">
      <t>Notifications are encoded as defined in <xref
      target="RFC8040">RESTCONF </xref> Section 6.4. The examples in that
      section apply for sending notifications over the "https-notif" based
      transport.</t>

      <t>An example of YANG-Push in JSON would look something like this:</t>

      <t><figure>
          <artwork><![CDATA[      data: {
      data:   "ietf-restconf:notification" : {
      data:     "eventTime" : "2017-10-25T08:00:11.22Z",
      data:     "ietf-yang-push:push-update" : {
      data:       "id" : 1011,
      data:       "datastore-contents" : {
      data:         "ietf-interfaces:interfaces" : {
      data:           "interface": [
      data:             {
      data:               "name": "eth0",
      data:               "oper-status": "up"
      data:             }
      data:           ],
      data:         },
      data:         "eventClass" : "state",
      data:         "reportingEntity": {
      data:           "card": "Ethernet0"
      data:         }
      data:         "severity" : "minor"
      data:       }
      data:     }
      data:   }
      data: }]]></artwork>
        </figure></t>

      <t>An example of YANG-Push in XML would look something like this:</t>

      <figure>
        <artwork><![CDATA[     data: <notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
     data:  <eventTime>2017-10-25T08:00:11.22Z</eventTime>
     data:  <push-update xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push">
     data:   <id>1011</id>
     data:   <datastore-contents>
     data:     <interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
     data:      <interface>
     data:       <name>eth0</name>
     data:        <oper-status>up</oper-status>
     data:       </interface>
     data:      </interfaces>
     data:      <eventClass>state</eventClass>
     data:      <reportingEntity>
     data:       <card>Ethernet0</card>
     data:      </reportingEntity>
     data:      <serverity>minor</serverity>
     data:    </datastore-contents>
     data:   </push-update>
     data:  </notification>
]]></artwork>
      </figure>
    </section>

    <section title="IANA Considerations">
      <t>This document registers two URI, two YANG module and two Media
      Types.</t>

      <section title="URI Registration">
        <t>in the <xref target="RFC3688">IETF XML registry</xref>. Following
        the format in RFC 3688, the following registration is requested to be
        made: <figure>
            <artwork><![CDATA[URI: urn:ietf:params:xml:ns:yang:ietf-http-notif
URI: urn:ietf:params:xml:ns:yang:ietf-sub-notif-recv-list]]></artwork>
          </figure></t>

        <t>Registrant Contact: The IESG. XML: N/A, the requested URI is an XML
        namespace.</t>
      </section>

      <section title="YANG Module Name Registration">
        <t>This document registers one YANG module in the YANG Module Names
        registry <xref target="RFC6020">YANG</xref>.</t>

        <t><figure>
            <artwork><![CDATA[name: ietf-https-notif
namespace: urn:ietf:params:xml:ns:yang:ietf-https-notif
prefix: hn
reference: RFC XXXX

name: ietf-sub-recv-list
namespace: urn:ietf:params:xml:ns:yang:ietf-sub-notif-recv-list
prefix: snrl
reference: RFC XXXX
]]></artwork>
          </figure></t>
      </section>

      <section title="Media Types">
        <section title="Media Type &quot;application/ietf-https-notif-cap+xml">
          <t><figure>
              <artwork><![CDATA[Type name: application

Subtype name: ietf-https-notif-cap+xml

Required parameters: None

Optional parameters: None

Encoding considerations:
    8-bit Each conceptual YANG data node is encoded according to the XML
    Encoding Rules and Canonical Format for the specific YANG data node
    type defined in YANG 1.1 [RFC7950].

Security considerations:
    Security considerations related to the generation and consumption of
    RESTCONF messages are discussed in Section NN of RFC XXXX.

    Additional security considerations are specific to the semantics of
    particular YANG data models. Each YANG module is expected to specify
    security considerations for the YANG data defined in that module.

Interoperability considerations: N/A

Published specification: RFC XXXX

Applications that use this media type:
    Instance document data parsers used within a protocol or automation
    tool that utilize YANG-defined data structures.

Fragment identifier considerations:
    Fragment identifiers for this type are not defined. All YANG data
    nodes are accessible as resources using the path in the request URI.

Additional information:

    Deprecated alias names for this type: N/A
    Magic number(s): N/A
    File extension(s): None
    Macintosh file type code(s): "TEXT"

Person & email address to contact for further information:
    See Author's Address section of RFC XXXX.

Intended usage: COMMON

Restrictions on usage: N/A

Author: See Author's Address section of RFC XXXX

Change controller:
    Internet Engineering Task Force (mailto:iesg@ietf.org)

Provisional registration? (standards tree only): no]]></artwork>
            </figure></t>
        </section>

        <section title="Media Type &quot;application/ietf-https-notif-cap+json">
          <t><figure>
              <artwork><![CDATA[Type name: application

Subtype name: ietf-https-notif-cap+json

Required parameters: None

Optional parameters: None

Encoding considerations:
    8-bit Each conceptual YANG data node is encoded according to the XML
    Encoding Rules and Canonical Format for the specific YANG data node
    type defined in JSON Encoding of Data Modeled with YANG [RFC7951].

Security considerations:
    Security considerations related to the generation and consumption of
    RESTCONF messages are discussed in Section NN of RFC XXXX.

    Additional security considerations are specific to the semantics of
    particular YANG data models. Each YANG module is expected to specify
    security considerations for the YANG data defined in that module.

Interoperability considerations: N/A

Published specification: RFC XXXX

Applications that use this media type:
    Instance document data parsers used within a protocol or automation
    tool that utilize YANG-defined data structures.

Fragment identifier considerations:
    Fragment identifiers for this type are not defined. All YANG data
    nodes are accessible as resources using the path in the request URI.

Additional information:

    Deprecated alias names for this type: N/A
    Magic number(s): N/A
    File extension(s): None
    Macintosh file type code(s): "TEXT"

Person & email address to contact for further information:
    See Author's Address section of RFC XXXX.

Intended usage: COMMON

Restrictions on usage: N/A

Author: See Author's Address section of RFC XXXX

Change controller:
    Internet Engineering Task Force (mailto:iesg@ietf.org)

Provisional registration? (standards tree only): no]]></artwork>
            </figure></t>
        </section>
      </section>
    </section>

    <section title="Examples">
      <t>This section shows some examples in how the module can be used.</t>

      <section title="Subscribed Notification based Configuration">
        <t>This example shows how a HTTPS client can be configured to send
        notifications to a receiver at address 192.0.2.1, port 443, a 'path',
        with server certificates, and the corresponding trust store that is
        used to authenticate a connection.</t>

        <t><figure>
            <artwork><![CDATA[
[note: '\' line wrapping for formatting only]

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <subscriptions
      xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notificatio\
ns">
    <receiver-instances
	xmlns="urn:ietf:params:xml:ns:yang:ietf-sub-notif-recv-list">
      <receiver-instance>
	<name>foo</name>
	<https-receiver
	    xmlns="urn:ietf:params:xml:ns:yang:ietf-https-notif"
	    xmlns:x509c2n="urn:ietf:params:xml:ns:yang:ietf-x509-cert-to-na\
me">
	  <tls>
	    <tcp-client-parameters>
	      <remote-address>my-receiver.my-domain.com</remote-address>
	      <remote-port>443</remote-port>
	    </tcp-client-parameters>
	    <tls-client-parameters>
	      <server-authentication>
		<ca-certs>
		  <local-definition>
		    <certificate>
		      <name>Server Cert Issuer #1</name>
		      <cert-data>base64encodedvalue==</cert-data>
		    </certificate>
		  </local-definition>
		</ca-certs>
	      </server-authentication>
	    </tls-client-parameters>
	    <http-client-parameters>
              <client-identity>
		<basic>
		  <user-id>my-name</user-id>
		  <password>my-password</password>
		</basic>
              </client-identity>
              <path>/some/path</path>
	    </http-client-parameters>
	  </tls>
	  <receiver-identity>
            <cert-maps>
	      <cert-to-name>
		<id>1</id>
		<fingerprint>11:0A:05:11:00</fingerprint>
		<map-type>x509c2n:san-any</map-type>
	      </cert-to-name>
            </cert-maps>
	  </receiver-identity>
	</https-receiver>
      </receiver-instance>
    </receiver-instances>
    <subscription>
      <id>6666</id>
      <transport xmlns:hn="urn:ietf:params:xml:ns:yang:ietf-https-no\
tif">
	hn:https
      </transport>
      <stream-subtree-filter>foo</stream-subtree-filter>
      <stream>some-stream</stream>
      <receivers>
	<receiver>
	  <name>my-receiver</name>
	  <receiver-instance-ref
	      xmlns="urn:ietf:params:xml:ns:yang:ietf-sub-notif-recv-list">\
foo</receiver-instance-ref>
	</receiver>
      </receivers>
    </subscription>
  </subscriptions>
  
  <truststore xmlns="urn:ietf:params:xml:ns:yang:ietf-truststore">
    <certificate-bags>
      <certificate-bag>
	<name>explicitly-trusted-server-ca-certs</name>
	<description>
          Trust anchors (i.e. CA certs) that are used to authenticat\
e
          server connections.  Servers are authenticated if their
          certificate has a chain of trust to one of these CA
          certificates.
	</description>
	<certificate>
          <name>ca.example.com</name>
          <cert-data>base64encodedvalue==</cert-data>
	</certificate>
	<certificate>
          <name>Fred Flintstone</name>
          <cert-data>base64encodedvalue==</cert-data>
	</certificate>
      </certificate-bag>
    </certificate-bags>
  </truststore>
</config>

]]></artwork>
          </figure></t>
      </section>

      <section title="Non Subscribed Notification based Configuration">
        <t>In the case that it is desired to use HTTPS notif outside of
        Subscribed Notifications, there would have to be a module to define
        the configuration for where and how to send the notification, such as
        the following:</t>

        <t><figure>
            <artwork><![CDATA[
[note: '\' line wrapping for formatting only]

module example-custom-module {
  yang-version 1.1;
  namespace "http://example.com/example-custom-module";
  prefix "custom";

  import ietf-http-client {
    prefix httpc;
    reference
      "I-D.ietf-netconf-http-client-server";
  }

  organization
    "Example, Inc.";

  contact
    "Support at example.com";
  
  description
    "Example of module not using Subscribed Notifications module.";
  
  revision "2020-10-21" {
    description
      "Initial Version.";
    reference
      "RFC XXXX, YANG Data Module for HTTPS Notifications.";
  }

  container example-module {
    description
      "Example of using HTTPS notif without having to
       implement Subscribed Notifications.";

    container https-receivers {
      description
	"A container of all HTTPS notif receivers.";

      list https-receiver {
	key "name";

	leaf name {
	  type string;
	  description
	    "A unique name for the https notif receiver.";
	}
	
	uses httpc:http-client-stack-grouping {
	  refine "transport/tcp" {
	    // create the logical impossibility of enabling "tcp"
	    // transport
	    if-feature "not httpc:tcp-supported";
	  }
	  augment "transport/tls/tls/http-client-parameters" {
	    leaf path {
	      type string;
	      description
		"Relative URI to the target resource.";
	    }
	    description
	      "Augmentation to add a path to the target resource.";
	  }
	}
	description
	  "Just include the grouping from ietf-http-client to 
           realize the 'HTTPS stack'.";
      }
    }
  }
}

]]></artwork>
          </figure></t>

        <t>This example shows how a HTTPS client can be configured to send
        notifications to a receiver at address 192.0.2.1, port 443, a 'path',
        with server certificates, and the corresponding trust store that is
        used to authenticate a connection.</t>

        <t><figure>
            <artwork><![CDATA[
[note: '\' line wrapping for formatting only]

<?xml version="1.0" encoding="UTF-8"?>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
  <example-module
      xmlns="http://example.com/example-custom-module">
    <https-receivers>
      <https-receiver>
	<name>foo</name>
	<tls>
	  <tcp-client-parameters>
	    <remote-address>my-receiver.my-domain.com</remote-address>
	    <remote-port>443</remote-port>
	  </tcp-client-parameters>
	  <tls-client-parameters>
	    <server-authentication>
	      <ca-certs>
		<local-definition>
		  <certificate>
		    <name>Server Cert Issuer #1</name>
		    <cert-data>base64encodedvalue==</cert-data>
		  </certificate>
		</local-definition>
	      </ca-certs>
	    </server-authentication>
	  </tls-client-parameters>
	  <http-client-parameters>
            <client-identity>
	      <basic>
		<user-id>my-name</user-id>
		<password>my-password</password>
	      </basic>
            </client-identity>
            <path>/some/path</path>
	  </http-client-parameters>
	</tls>
      </https-receiver>
    </https-receivers>
  </example-module>
  
  <truststore xmlns="urn:ietf:params:xml:ns:yang:ietf-truststore">
    <certificate-bags>
      <certificate-bag>
	<name>explicitly-trusted-server-ca-certs</name>
	<description>
          Trust anchors (i.e. CA certs) that are used to authenticat\
e
          server connections.  Servers are authenticated if their
          certificate has a chain of trust to one of these CA
          certificates.
	</description>
	<certificate>
          <name>ca.example.com</name>
          <cert-data>base64encodedvalue==</cert-data>
	</certificate>
	<certificate>
          <name>Fred Flintstone</name>
          <cert-data>base64encodedvalue==</cert-data>
	</certificate>
      </certificate-bag>
    </certificate-bags>
  </truststore>
</config>

]]></artwork>
          </figure></t>
      </section>

      <section title="Bundled Message">
        <t>In the case of "bundled-message" as defined in <xref
        target="I-D.ietf-netconf-notification-messages">Notification Message
        Headers and Bundles</xref>, something that this module supports, the
        flow of messages would look something like this.</t>

        <t><figure>
            <artwork><![CDATA[       -------------                               --------------
       | Publisher |                               | Receiver   |
       -------------                               --------------
       Establish TCP             ------>
       Establish TLS             ------>
       Send HTTPS POST message
       with YANG defined         ------>
       notification #1
       Send HTTPS POST message
       with YANG defined         ------>
       notification #2
                                                   Send 204 (No Content)
                                 <------           for notification #1

                                                   Send 204 (No Content)
                                 <------           for notification #2
       Send HTTPS POST message
       with YANG defined         ------->
       notification #3
                                                   Send 204 (No Content)
                                 <------           for notification #3]]></artwork>
          </figure></t>

        <t>The content of the exchange would look something like this.</t>

        <figure>
          <artwork><![CDATA[Request:
    POST /some/path HTTP/1.1
    Host: my-receiver.my-domain.com
    Content-Type: application/yang-data+xml
    <notification
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
      <eventTime>2019-03-22T12:35:00Z</eventTime>
      <foo xmlns="https://example.com/my-foobar-module">
        ...
      </foo>
    </notification>
    <notification
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
      <eventTime>2019-03-22T12:35:00Z</eventTime>
      <bar xmlns="https://example.com/my-foobar-module">
        ...
      </bar>
    </notification>
    <notification
      xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0">
      <eventTime>2019-03-22T12:35:01Z</eventTime>
      <baz xmlns="https://example.com/my-foobar-module">
        ...
      </baz>
    </notification>
Response:
      HTTP/1.1 204 No Content
      Date: Fri, 03 Mar 2019 12:35:00 GMT
      Server: my-receiver.my-domain.com
      HTTP/1.1 204 No Content
      Date: Fri, 03 Mar 2019 12:35:00 GMT
      Server: my-receiver.my-domain.com
      HTTP/1.1 204 No Content
      Date: Fri, 03 Mar 2019 12:35:01 GMT
      Server: my-receiver.my-domain.com]]></artwork>
        </figure>
      </section>
    </section>

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

    <section title="Acknowledgements">
      <t/>
    </section>
  </middle>

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

      <?rfc include='reference.RFC.3688'?>

      <?rfc include='reference.RFC.3986'?>

      <?rfc include='reference.RFC.6020'?>

      <?rfc include='reference.RFC.6241'?>

      <?rfc include='reference.RFC.6242'?>

      <?rfc include='reference.RFC.6991'?>

      <?rfc include='reference.RFC.7407'?>

      <?rfc include='reference.RFC.7950'?>

      <?rfc include='reference.RFC.7951'?>

      <?rfc include='reference.RFC.8040'?>

      <?rfc include='reference.RFC.8174'?>

      <?rfc include='reference.RFC.8341'?>

      <?rfc include='reference.RFC.8446'?>

      <?rfc include='reference.RFC.8639'?>

      <?rfc include='reference.I-D.ietf-netconf-notification-messages'
?>

      <?rfc include='reference.I-D.ietf-netconf-http-client-server'?>
    </references>
  </back>
</rfc>
