<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="3"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<!-- If further character entities are required then they should be added to the DOCTYPE above.
     Use of an external entity file is not recommended. -->
<rfc category="info"
     docName="draft-netana-nmop-message-broker-telemetry-message-00"
     ipr="trust200902" obsoletes="" submissionType="IETF" updates=""
     version="3" xml:lang="en" xmlns:xi="http://www.w3.org/2001/XInclude"
     xmlns:ns2="http://www.w3.org/2000/svg"
     xmlns:ns="http://www.w3.org/1999/xlink">
  <front>
    <title
    abbrev="Telmetery Message">Extensible YANG Model for Network Telemetry
     Notifications</title>

    <seriesInfo name="Internet-Draft"
                value="draft-netana-nmop-message-broker-telemetry-message-00"/>

    <author fullname="Ahmed Elhassany" initials="A" surname="Elhassany">
      <organization>Swisscom</organization>

      <address>
        <postal>
          <street>Binzring 17</street>

          <city>Zuerich 8045</city>

          <region/>

          <code/>

          <country>Switzerland</country>
        </postal>

        <phone/>

        <email>ahmed.elhassany@swisscom.com</email>

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

    <author fullname="Thomas Graf" initials="T." surname="Graf">
      <organization>Swisscom</organization>

      <address>
        <postal>
          <street>Binzring 17</street>

          <city>Zuerich 8045</city>

          <region/>

          <code/>

          <country>Switzerland</country>
        </postal>

        <phone/>

        <email>thomas.graf@swisscom.com</email>

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

    <date day="01" month="March" year="2025"/>

    <area>General</area>

    <workgroup>NMOP</workgroup>

    <keyword>keyword</keyword>

    <abstract>
      <t>This document defines an extensible message schema in YANG to
	  be used at the data collection for transforming Network Telemetry
	  notifications into external systems such as message brokers.
	  The extensible message schema enables a data collection to add
	  metadata for the provenance of the operational network data.</t>
    </abstract>
  </front>

  <middle>
    <section>
      <name>Introduction</name>

      <t>Nowadays network operators are using machine and human
	  readable <xref target="RFC7950">YANG</xref> to model their
	  configurations and obtain YANG modelled operational data from
	  their networks.</t>
	  
	  <t>Network operators organize their data in a <xref
      target="Deh22">Data Mesh</xref> where a message broker such as
	  <xref target="Kaf11">Apache Kafka</xref> or <xref
	  target="Rab07">RabbitMQ</xref> facilitates the exchange of
	  messages among data processing components.</t>
	  
	  <t>Today, subscribing to a YANG datastore, publishing a YANG
	  modeled notifications message from the network and viewing the
	  data in a time series database, manual labor is needed to perform
	  data transformation to make a message broker and its data
	  processing components with YANG notifications interoperable.</t>

	  <t>Even though YANG is intented to ease data management, this
	  promise has not yet been fulfilled for <xref target="RFC9232">
	  Network Telemetry</xref>.</t>

      <t><xref target="I-D.ietf-nmop-yang-message-broker-integration">An
      Architecture for YANG-Push to Message Broker Integration</xref>
	  defined an architecture for integrating YANG-Push with
	  message brokers for a Data Mesh architecture. How the 
	  notification messages at a YANG-Push receiver is being transformed
	  to the message broker is being described in Section <xref
	  section="4.5" sectionFormat="of"
	  target="I-D.ietf-nmop-yang-message-broker-integration"/>, however 
	  the produced message format left unspecified.</t>
	  
	  <t>The message could be published as it was received from the
	  network to their organization's message broker. However, this
	  approach is insufficient for correct human and automated
	  understanding of the data generated by the network. This
	  insufficiency stems from not presenting a holistic picture
      along with the data generated by the network. In particular, when
	  a data consumer in the data mesh consumes a YANG message from
	  their organization's message broker, they cannot answer simple
	  questions such as:</t>
	  
	  <ul>
	    <li>Which network operating system collected the data?</li>

	    <li>To which network platform belongs the network node?</li>	  

	    <li>What is the subscribed xpath, sub-tree filter and its
		schema reference?</li>	
		
		<li>When did the data collection received the data?</li>
		
		<li>What additional metadata is necessary for a consumer to make
		sense of the data?</li>
	  </ul>

      <t>This document defines a standard YANG envelope message to carry
      with the collected Network Telemetry notifications the provenance
	  and metadata information for a YANG data exchanged in message
	  brokers for a Data Mesh architecture.</t>

      <section>
        <name>Requirements Language</name>

        <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 terms "subscriber", "publisher", and "receiver" are used as
          defined in <xref target="RFC8639"/>.</t>
        
        <t>In addition, this document reuses the terms defined in
		<xref target="I-D.netana-netconf-notif-envelope"/> for the use
		in message broker enviroment:</t>

        <t>Notification Metadata: Additional data describing the context
		of a notification that is sent in each message, e.g. which node
		generated the messsage or at which time the notification was
		published.</t>

        <t>Notification Envelope: YANG structure encapsulating the
		payload of a notification, allowing the inclusion of metadata.
		</t>
      </section>
    </section>

    <section>
      <name>YANG Module</name>

      <t>The extensible YANG module for Network Telemetry notifications
	  defines an envelope message schema which adds four metadata
      categories to the collected Network Telemetry notifications.</t>

        <dl>
          <dt>Network Node Provenance:</dt>

          <dd>Is the provenance information about the network node that
		  published YANG notifications to the receiver. This category
		  adds metadata such as the node name, address, and software
		  version to the message.</dd>
        </dl>

        <dl>
          <dt>Data Collection Provenance:</dt>

          <dd>Is the provenance information about the data collection.
		  The data type is the same as the first category but specific
		  to the collector node.</dd>
        </dl>

        <dl>
          <dt>Data Collection Protocol Provenance:</dt>

          <dd>Is the session information about the session between the
		  collector and the network node. This category adds fields such
		  as the session protocol and the time the event was generated
		  in the network node. Moreover, this document defines an
		  extension specific to YANG-Push that includes YANG-Push
		  subscription information.</dd>
        </dl>

        <dl>
          <dt>Network Operator Provenance:</dt>

          <dd>Is the operator specific metadata. Some operators enrich
		  the collected data with specific information. For instance:
		  type of the network node (MPLS provider or provider
		  edge node) or which operational unit the node is operated by.
		  For this purpose the document defines a generic metadata map
		  with key/values that can be used freely by the network
		  operator.</dd>
        </dl>

      <figure title="ietf-telemetry-message tree">
        <artwork><![CDATA[
module: ietf-telemetry-message
  +--ro message
     +--ro timestamp           yang:date-and-time
     +--ro session-protocol    telemetry-session-protocol-type
     +--ro node
     |  +--ro address             inet:host
     |  +--ro port                inet:port-number
     |  +--ro platform-name?      string
     |  +--ro vendor?             string
     |  +--ro vendor-pen?         uint32
     |  +--ro software-version?   string
     |  +--ro software-flavor?    string
     |  +--ro os-version?         string
     |  +--ro os-type?            string
     +--ro collector
     |  +--ro address             inet:host
     |  +--ro port                inet:port-number
     |  +--ro platform-name?      string
     |  +--ro vendor?             string
     |  +--ro vendor-pen?         uint32
     |  +--ro software-version?   string
     |  +--ro software-flavor?    string
     |  +--ro os-version?         string
     |  +--ro os-type?            string
     +--ro session-metadata
     |  +--ro event-time    yang:date-and-time
     +--ro metadata
     |  +--ro labels* [name]
     |     +--ro name       string
     |     +--ro (value)
     |        +--:(string-value)
     |        |  +--ro (string-value)?
     |        |     +--:(string-value)
     |        |        +--ro string-value?   string
     |        +--:(anydata-value)
     |           +--ro (anydata-value)?
     |              +--:(anydata-value)
     |                 +--ro anydata-value?   anydata
     +--ro payload?            anydata
        ]]></artwork>
      </figure>

<figure title="ietf-yang-push-telemetry-message tree">
  <artwork>
<![CDATA[
module: ietf-yang-push-telemetry-message

  augment /tm:message/tm:session-metadata:
    +--ro yang-push-subscription
       +--ro id                                   sn:subscription-id
       +--ro filters
       |  +--ro stream-filter* [name]
       |     +--ro name                         string
       |     +---u sn:stream-filter-elements
       +---u ypr:yang-push-module-version-list
]]>
  </artwork>
</figure>

<figure>
  <name>Telemetry message YANG Module</name>
  <sourcecode markers="true"
    name="ietf-yang-push-telemetry-message@2024-02-20.yang" type="yang"><![CDATA[
module ietf-telemetry-message {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:telemetry-message";
  prefix tm;

  import ietf-yang-types {
    prefix yang;
  }
  import ietf-inet-types {
    prefix inet;
  }
  import ietf-subscribed-notifications {
    prefix sn;
    reference
      "RFC 8639: Subscription to YANG Notifications";
  }

  organization
    "IETF Draft";
  contact
    "Author:    Ahmed Elhassany
                &lt;mailto:ahmed.elhassany@swisscom.com&gt;";
  description
    "This YANG modules defines a model for a telemetry collector to send
     collected YANG data from the network.

     Copyright (c) 2024 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 XXXX; see the RFC
     itself for full legal notices.";

  revision 2024-02-20 {
    description
      "Initial revision.";
    reference
      "RFC XXXX";
  }

  typedef telemetry-message-event-type {
    type enumeration {
      enum "log" {
        description
          "Collector is reporting the event as it arrived from
            the network element";
      }
      enum "update" {
        description
          "Collector has updated an entry inside its local cache.
            This could be triggered by an event from the network for
            instance interface operational status changed or an internal 
            event in the collector, such as a timer triggered to referesh
            old enteries";
      }
      enum "delete" {
        description
          "Collector has deleted an entry from its local cache";
      }
    }
    description
      "Type of event reported by the collector";
  }

  typedef telemetry-session-protocol-type {
    type enumeration {
      enum "netconf" {
        description
          "NETCONF RFC8640";
      }
      enum "restconf" {
        description
          "RESTCONF RFC8650";
      }
      enum "https" {
        description
          "HTTPS draft-ietf-netconf-https-notif";
      }
      enum "udp-notif" {
        description
          "UDP draft-ietf-netconf-udp-notif";
      }
    }
    description
      "Session protocol used to deliver the messaget to the collector";
  }

  grouping node-information {
    description
      "Idenitfy a network node by its hostname/IP Address and port number.";
    leaf address {
      type inet:host;
      mandatory true;
      description
        "Node address";
    }
    leaf port {
      type inet:port-number;
      mandatory true;
      description
        "Node port number";
    }
    leaf platform-name {
      type string;
      description
        "Model of the platform from which data is collected.";
    }
    leaf vendor {
      type string;
      description
        "Organization that implements that platform.";
    }
    leaf vendor-pen {
      type uint32;
      description
        "Vendor''s registered Private Enterprise Number as
         described in RFC9371";
    }
    leaf software-version {
      type string;
      description
        "Name of the version of software. With respect to most network
          device appliances, this will be the operating system version.
          But for other YANG module implementation, this would be a
          version of appliance software. Ultimately, this should
          correspond to a version string that will be recognizable by
          the consumers of the platform.";
    }
    leaf software-flavor {
      type string;
      description
        "A variation of a specific version where YANG model support
          may be different.  Depending on the vendor, this could be a
          license, additional software component, or a feature set.";
    }
    leaf os-version {
      type string;
      description
        "Version of the operating system using this module. This is
          primarily useful if the software implementing the module is
          an application that requires a specific operating system
          version.";
    }
    leaf os-type {
      type string;
      description
        "Type of the operating system using this module. This is
          primarily useful if the software implementing the module is
          an application that requires a specific operating system
          type.";
    }
  }

  container message {
    config false;
    leaf timestamp {
      type yang:date-and-time;
      mandatory true;
      description
        "Timestamp when the collector received the message from the network
          element or an update or delete event is triggered";
    }
    leaf session-protocol {
      type telemetry-session-protocol-type;
      mandatory true;
      description
        "Protocol used to send the message from network node to
          the collector";
    }
    container node {
      description
        "Address of network element sent the message";
      uses node-information;
    }
    container collector {
      description
        "Address of the telemetry collector";
      uses node-information;
    }
    container session-metadata {
      leaf event-time {
        type yang:date-and-time;
        mandatory true;
        description
          "NETCONF eventTime. Redefined in here since NETCONF header is XML
            not YANG";
      }
    }
    container metadata {
      description
        "Collector added metadata.";
      list labels {
        key "name";
        description
          "arbiterary labels assinged by the collector";
        leaf name {
          type string {
            length "1..max";
          }
          description
            "label name";
        }
        choice value {
          mandatory true;
          choice string-value {
            leaf string-value {
              type string;
            }
          }
          choice anydata-value {
            anydata anydata-value {
              description
                "anydata yang";
            }
          }
        }
      }
    }
    anydata payload {
      description
        "message received from network element";
    }
  }
}

        </sourcecode>
      </figure>

    <figure>
  <name>Telemetry message YANG Module</name>
  <sourcecode
    markers="true"
    name="ietf-yang-push-telemetry-message@2024-02-20.yang"
    type="yang">
module ietf-yang-push-telemetry-message {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:yang-push-telemetry-message";
  prefix yptm;

  import ietf-subscribed-notifications {
    prefix sn;
    reference
      "RFC 8639: Subscription to YANG Notifications";
  }
  import ietf-telemetry-message {
    prefix tm;
    reference
      "XXX";
  }
  import ietf-yang-push-revision {
    prefix ypr;
    reference
      "XXX";
  }

  organization
    "IETF Draft";
  contact
    "Author:    Ahmed Elhassany
                &lt;mailto:ahmed.elhassany@swisscom.com&gt;";
  description
    "Augments the ietf-telemetry-message with YANG Push specific
     fields.

     Copyright (c) 2024 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 XXXX; see the RFC
     itself for full legal notices.";

  revision 2024-02-20 {
    description
      "Initial revision.";
    reference
      "RFC XXXX";
  }

  augment "/tm:message/tm:session-metadata" {
    container yang-push-subscription {
      config false;
      leaf id {
        type sn:subscription-id;
        mandatory true;
        description
          "This references the affected subscription.";
      }
      container filters {
        description
          "Contains a list of configurable filters that can be applied to
            subscriptions.  This facilitates the reuse of complex filters
            once defined.";
        list stream-filter {
          key "name";
          description
            "A list of preconfigured filters that can be applied to
              subscriptions.";
          leaf name {
            type string;
            description
              "A name to differentiate between filters.";
          }
          uses sn:stream-filter-elements;
        }
      }
      uses ypr:yang-push-module-version-list;
    }
  }
}
  ]]></sourcecode>
  </figure>
    </section>

    <section anchor="IANA">
      <name>IANA Considerations</name>

      <t>TODO</t>
    </section>

    <section anchor="Security">
      <name>Security Considerations</name>

      <t>TODO</t>
    </section>
  </middle>

  <back>
    <references>
      <name>References</name>

      <references>
        <name>Normative References</name>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.7950.xml"/>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8639.xml"/>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.9232.xml"/>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-nmop-yang-message-broker-integration.xml"/>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.netana-netconf-notif-envelope.xml"/>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.8174.xml"/>

        <xi:include href="https://bib.ietf.org/public/rfc/bibxml/reference.RFC.2119.xml"/>
      </references>

      <references>
        <name>Informative References</name>

        <reference anchor="Deh22"
                   target="https://www.oreilly.com/library/view/data-mesh/9781492092384/">
          <front>
            <title>Data Mesh</title>

            <author fullname="Zhamak Dehghani" initials="Z."
                    surname="Dehghani"/>

            <date month="March" year="2022"/>
          </front>

          <seriesInfo name="ISBN" value="9781492092391"/>

          <refcontent>O'Reilly Media</refcontent>
        </reference>

        <reference anchor="Rab07" target="https://rabbitmq.com/">
          <front>
            <title>RabbitMQ</title>

            <author fullname="VMware"/>

            <date month="February" year="2007"/>
          </front>

          <refcontent>Mozilla Public License</refcontent>
        </reference>

        <reference anchor="Kaf11" target="https://kafka.apache.org/">
          <front>
            <title>Apache Kafka</title>

            <author fullname="Neha Narkhede" initials="N." surname="Narkhede"/>

            <date month="January" year="2011"/>
          </front>

          <refcontent>Apache Software Foundation</refcontent>
        </reference>
      </references>
    </references>

    <section anchor="Acknowledgements" numbered="false">
      <name>Acknowledgements</name>

      <t>TODO</t>
    </section>
  </back>
</rfc>
