<?xml version="1.0" encoding="US-ASCII"?>
<!-- edited with XMLSPY v5 rel. 3 U (http://www.xmlspy.com)
     by Daniel M Kohn (private) -->
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY rfc2119 PUBLIC "" "http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml">
]>
<rfc category="std" docName="draft-www-bess-yang-vpn-service-pm-05"
     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="Network and VPN Service PM YANG">A YANG Model for Network
    and VPN Service Performance Monitoring</title>

    <author fullname="Qin Wu" initials="Q." role="editor" 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="Mohamed Boucadair" initials="M." role="editor"
            surname="Boucadair">
      <organization>Orange</organization>

      <address>
        <postal>
          <street>Rennes 35000</street>

          <country>France</country>
        </postal>

        <email>mohamed.boucadair@orange.com</email>
      </address>
    </author>

    <author fullname="Bin Wen" initials="B" surname="Wen">
      <organization>Comcast</organization>

      <address>
        <email>bin_wen@comcast.com</email>
      </address>
    </author>

    <author fullname="Change Liu" initials="C" surname="Liu">
      <organization>China Unicom</organization>

      <address>
        <email>liuc131@chinaunicom.cn</email>
      </address>
    </author>

    <author fullname="Honglei Xu" initials="H." surname="Xu">
      <organization>China Telecom</organization>

      <address>
        <email>xuhl.bri@chinatelecom.cn</email>
      </address>
    </author>

    <date year="2020"/>

    <area>RTG Area</area>

    <workgroup>BESS Working Group</workgroup>

    <keyword>RFC</keyword>

    <keyword>Request for Comments</keyword>

    <keyword>I-D</keyword>

    <keyword>Internet-Draft</keyword>

    <keyword>VPN Performance Measurement Telemetry</keyword>

    <abstract>
      <t>The data model defined in RFC8345 introduces vertical layering
      relationships between networks that can be augmented to cover
      network/service topologies. This document defines a YANG model for both
      Network Performance Monitoring and VPN Service Performance Monitoring
      that can be used to monitor and manage network performance on the
      topology at higher layer or the service topology between VPN sites.</t>

      <t>This model is designed as an augmentation to the network topology
      YANG data model defined in RFC8345.</t>
    </abstract>
  </front>

  <middle>
    <section anchor="intro" title="Introduction">
      <t><xref target="RFC8345"/> defines a YANG data model for
      network/service topologies and inventories. The service topology
      described in <xref target="RFC8345"/> includes the virtual topology for
      a service layer above Layer 1 (L1), Layer 2 (L2), and Layer 3 (L3). This
      service topology has the generic topology elements of node, link, and
      terminating point. One typical example of a service topology is
      described in Figure 3 of <xref target="RFC8345"/>: two VPN service
      topologies instantiated over a common L3 topology. Each VPN service
      topology is mapped onto a subset of nodes from the common L3
      topology.</t>

      <t>Three types of VPN service topologies are supported in <xref
      target="RFC8299"/>: "any to any", "hub and spoke", and "hub and spoke
      disjoint". These VPN topology types can be used to describe how VPN
      sites communicate with each other.</t>

      <t>This document defines a YANG Model for both Network Performance
      Monitoring and VPN Service Performance Monitoring (see Section 2.2.4 of
      <xref target="RFC4176"/>) that can be used to monitor and manage network
      Performance on the topology at higher layer or the service topology
      between VPN sites.</t>

      <t>The model is designed as an augmentation to the network topology YANG
      data model defined in <xref target="RFC8345"/>.</t>
    </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>

      <t>Tree diagrams used in this document follow the notation defined in
      <xref target="RFC8340"/>.</t>
    </section>

    <section title="Network and VPN Service Assurance Module">
      <t>The module defined in this document is a Network and VPN Service
      assurance module that can be used to monitor and manage the network
      performance on the topology at higher layer or the service topology
      between VPN sites and it is an augmentation to the "ietf-network" and
      "ietf-network-topology" YANG data model <xref target="RFC8345"/>.</t>

      <t>The performance monitoring data is augmented to service topology as
      shown in <xref target="aug"/>.</t>

      <figure align="center" anchor="aug" title="Module Augmentation">
        <artwork>+----------------------+          +-----------------------+
|ietf-network          |          |Network and VPN Service|
|ietf-network-topology |&lt;---------|Performance Monitoring |
+----------------------+ augments |        Model          |
                                  +-----------------------+
</artwork>
      </figure>
    </section>

    <section anchor="layering"
             title="Layering Relationship Between Multiple Layers of Topology">
      <t>The data model defined in <xref target="RFC8345"/> can describe
      vertical layering relationships between networks. That model can be
      augmented to cover network/service topologies.</t>

      <t><xref target="fig1"/> illustrates an example of a topology mapping
      between the VPN service topology and an underlying network:</t>

      <figure anchor="fig1"
              title="Example of topology mapping between VPN Service Topo and Underlying network">
        <artwork>                VPN-SVC 1           VPN-SVC 2
                   /                     \
      VPN-Service-topology 1     VPN-Service-topology-2
          /     |      \            /     |      \
     Site-1A Site-1B Site1-C    Site-2A Site-2B Site-2C    Top-Down
       |          |       |       |         |     |     Service Topology
       CE         CE     CE      CE        CE     CE
       |          |       |       |         |     |
       PE         PE     PE      PE        PE     PE
   ====|==========|=======|=======|=========|=====|======================
       +-------+  |        \    /           /     |
    Bottom-up  |  |         \ /           /       |
    Network    |  |         /\           /        |
    topology   |  |       /    \        |         |
               |  |      |       |      |         |
           node1 node2 node3   node4   node5    node6</artwork>
      </figure>

      <t>As shown in <xref target="fig1"/>, two VPN services topologies are
      both built on top of one common underlying physical network:<list
          style="symbols">
          <t>VPN-SVC 1: supporting "hub-spoke" communications for Customer 1
          connecting the customer's access at 3 sites. Site-1A, Site-1B, and
          Site-1C are connected to PEs that are mapped to nodes 1, 2, and 3 in
          the underlying physical network. <vspace blankLines="1"/>Site-1 A
          plays the role of hub while Site-2 B and C plays the role of
          spoke.</t>

          <t>VPN-SVC 2: supporting "hub-spoke disjoint" communications for
          Customer 2 connecting the customer's access at 3 sites. Site-2A,
          Site-2B, and Site-2C are connected to PEs that are mapped to nodes
          4, 5, and 6 in the underlying physical network. <vspace
          blankLines="1"/>Site-2 A and B play the role of hub while Site-2 C
          plays the role of spoke.</t>
        </list></t>

      <t/>
    </section>

    <section title="Some Model Usage Guidelines">
      <t>An SP must be able to manage the capabilities and characteristics of
      the network/VPN services when Network connection is established or VPN
      sites are setup to communicate with each other.</t>

      <section title="Performance Monitoring Data Source">
        <t>As described in <xref target="layering"/>, once the mapping between
        the VPN Service topology and the underlying physical network has been
        setup, the performance monitoring data per link in the underlying
        network can be collected using network performance measurement method
        such as MPLS Loss and Delay Measurement <xref target="RFC6374"/>.</t>

        <t>The performance monitoring information reflecting the quality of
        the Network or VPN service such as end to end network performance data
        between source node and destination node in the network or between VPN
        sites can be aggregated or calculated using, for example, PCEP
        solution [RFC8233] [RFC7471] [RFC7810] [RFC8571] or LMAP
        [RFC8194].</t>

        <t>The information can be fed into data source such as the management
        system or network devices. The measurement interval and report
        interval associated with these performance data usually depends on
        configuration parameters.</t>
      </section>

      <section title="Retrieval via Pub/Sub Mechanism">
        <t>Some applications such as service-assurance applications, which
        must maintain a continuous view of operational data and state, can use
        subscription model <xref target="I-D.ietf-netconf-yang-push"/> to
        subscribe to the specific Network performance data or VPN service
        performance data they are interested in, at the data source.</t>

        <t>The data source can then use the Network and VPN service assurance
        model defined in this document and the YANG Push model <xref
        target="I-D.ietf-netconf-yang-push"/> to distribute specific telemetry
        data to target recipients.</t>
      </section>

      <section title="On demand Retrieval via RPC Model">
        <t>To obtain a snapshot of a large amount of performance data from a
        network element (including network controllers), service-assurance
        applications may use polling-based methods such as RPC model to fetch
        performance data on demand.</t>
      </section>
    </section>

    <section title="Data Model Sructure">
      <t>This document defines the YANG module "ietf-network-vpn-pm", which
      has the tree structure described in the following sub-sections.</t>

      <section title="Network Level">
        <t><figure anchor="ntree"
            title="Network Level View of the hierarchies">
            <artwork>   module: ietf-network-vpn-pm
     augment /nw:networks/nw:network/nw:network-types:
       +--rw network-technology-type*   identityref
     augment /nw:networks/nw:network:
       +--rw vpn-attributes
       |  +--rw vpn-topo?                  identityref
       +--rw vpn-summary-statistics
       |  +--rw ipv4
       |  |  +--rw total-routes?              uint32
       |  |  +--rw total-active-routes?       uint32
       |  +--rw ipv6
       |     +--rw total-routes?              uint32
       |     +--rw total-active-routes?       uint32</artwork>
          </figure></t>

        <t>For VPN service performance monitoring, this model defines only the
        following minimal set of Network level network topology
        attributes:<list style="symbols">
            <t>"network-technology-type": Indicates the network technology
            type such as L3VPN, L2VPN, ISIS, or OSPF. If the
            "network-technology-type" is "VPN type" (e.g.,L3VPN, L2VPN), the
            "vpn-topo" MUST be set.</t>

            <t>"vpn-topo": The type of VPN service topology, this model
            supports "any-to-any", "Hub and Spoke" (where Hubs can exchange
            traffic), and "Hub and Spoke disjoint" (where Hubs cannot exchange
            traffic).</t>

            <t>"vpn-summary-statistics": VPN summary statistics, IPv4
            statistics, and IPv6 statistics have been specified
            separately.</t>
          </list></t>

        <t>For network performance monitoring, the attributes of "Network
        Level" that defined in [RFC8345] do not need to be extended.</t>
      </section>

      <section title="Node Level">
        <t><figure anchor="nodetree"
            title="Node Level View of the hierarchies">
            <artwork>augment /nw:networks/nw:network/nw:node:
    +--rw node-attributes
    |  +--rw node-type?   identityref
    |  +--rw site-id?     string
    |  +--rw site-role?   Identityref</artwork>
          </figure></t>

        <t>The Network and VPN service performance monitoring model defines
        only the following minimal set of Node level network topology
        attributes and constraints:<list style="symbols">
            <t>"node-type" (Attribute): Indicates the type of the node, such
            as PE or ASBR. This "node-type" can be used to report performance
            metric between any two nodes each with specific node-type.</t>

            <t>"site-id" (Constraint): Uniquely identifies the site within the
            overall network infrastructure.</t>

            <t>"site-role" (Constraint): Defines the role of the site in a
            particular VPN topology.</t>
          </list></t>
      </section>

      <section title="Link and Termination Point Level">
        <t><figure anchor="ltree"
            title="Link and Termination point Level View of the hierarchies">
            <artwork>  augment /nw:networks/nw:network/nt:link:
    +--rw link-type?                        identityref
    +--rw low-percentile                    percentile
    +--rw high-percentile                   percentile
    +--rw middle-percentile                 percentile
    +--ro reference-time                    yang:date-and-time
    +--ro measurement-interval              uint32
    +--ro link-telemetry-attributes
       +--ro loss-statistics
       |  +--ro packet-loss-count?          uint32
       |  +--ro loss-ratio?                 percentage
       |  +--ro packet-reorder-count?       uint32
       |  +--ro packets-out-of-seq-count?   uint32
       |  +--ro packets-dup-count?          uint32
       +--ro delay-statistics
       |  +--ro direction?                 identityref
       |  +--ro unit-value                 identityref
       |  +--ro min-delay-value?           yang:gauge64
       |  +--ro max-delay-value?           yang:gauge64
       |  +--ro high-delay-percentile?     yang:gauge64
       |  +--ro middle-delay-percentile?   yang:gauge64
       |  +--ro low-delay-percentile?      yang:gauge64
       +--ro jitter-statistics
          +--ro unit-value                 identityref
          +--ro min-jitter-value?          yang:gauge64
          +--ro max-jitter-value?          yang:gauge64
          +--ro low-jitter-percentile?     yang:gauge64
          +--ro high-jitter-percentile?    yang:gauge64
          +--ro middle-jitter-percentile?  yang:gauge64
  augment /nw:networks/nw:network/nw:node/nt:termination-point:
    +--ro tp-telemetry-attributes
       +--ro in-octets?           uint32
       +--ro out-octets?          uint32
       +--ro inbound-unicast?     uint32
       +--ro inbound-nunicast?    uint32
       +--ro inbound-discards?    uint32
       +--ro inbound-errors?      uint32
       +--ro in-unknown-protocol?     uint32
       +--ro outbound-unicast?    uint32
       +--ro outbound-nunicast?   uint32
       +--ro outbound-discards?   uint32
       +--ro outbound-errors?     uint32
       +--ro outbound-qlen?       uint32</artwork>
          </figure></t>

        <t>The Network and VPN service performance monitoring model defines
        only the following minimal set of Link level network topology
        attributes:<list style="symbols">
            <t>"link-type" (Attribute): Indicates the type of the link, such
            as GRE or IP-in-IP.</t>

            <t>"low-percentile": Indicates low percentile to report. Setting
            low-percentile into 0.00 indicates the client is not intererested
            in receiving low percentile.</t>

            <t>"middle-percentile": Indicates middle percentile to report.
            Setting middle-percentile into 0.00 indicates the client is not
            intererested in receiving middle percentile.</t>

            <t>"high-percentile": Indicates high percentile to report. Setting
            low-percentile into 0.00 indicates the client is not intererested
            in receiving high percentile.</t>

            <t>Loss Statistics: A set of loss statistics attributes that are
            used to measure end to end loss between VPN sites or between any
            two network nodes.</t>

            <t>Delay Statistics: A set of delay statistics attributes that are
            used to measure end to end latency between VPN sites or between
            any two network nodes..</t>

            <t>Jitter Statistics: A set of IP Packet Delay Variation <xref
            target="RFC3393"/> statistics attributes that are used to measure
            end to end jitter between VPN sites or between any two network
            nodes..</t>
          </list></t>

        <t>The Network and VPN service performance monitoring defines the
        following minimal set of Termination point level network topology
        attributes: <list style="symbols">
            <t>Inbound statistics: A set of inbound statistics attributes that
            are used to measure the inbound statistics of the termination
            point, such as "the total number of octets received on the
            termination point", "The number of inbound packets which were
            chosen to be discarded", "The number of inbound packets that
            contained errors", etc.</t>

            <t>Outbound statistics: A set of outbound statistics attributes
            that are used to measure the outbound statistics of the
            termination point, such as "the total number of octets transmitted
            out of the termination point", "The number of outbound packets
            which were chosen to be discarded", "The number of outbound
            packets that contained errors", etc.</t>
          </list></t>
      </section>
    </section>

    <section title="Example of I2RS Pub/Sub Retrieval">
      <t>This example shows the way for a client to subscribe for the
      Performance monitoring information between node A and node B in the L3
      network topology built on top of the underlying network . The
      performance monitoring parameter that the client is interested in is end
      to end loss attribute.</t>

      <figure>
        <artwork>    &lt;rpc netconf:message-id="101"
       xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"&gt;
       &lt;establish-subscription
          xmlns="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications"&gt;
          &lt;stream-subtree-filter&gt;
             &lt;networks xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topo"&gt;
                &lt;network&gt;
                 &lt;network-id&gt;l3-network&lt;/network-id&gt;
                 &lt;network-technology-type xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
                 L3VPN
                 &lt;/network-technology-type&gt;
                  &lt;node&gt;
                   &lt;node-id&gt;A&lt;/node-id&gt;
                   &lt;node-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
                    &lt;node-type&gt;pe&lt;/node-type&gt;
                   &lt;/node-attribtues&gt;
                   &lt;termination-point xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology"&gt;
                    &lt;tp-id&gt;1-0-1&lt;/tp-id&gt;
                   &lt;tp-telemetry-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
                     &lt;in-octets&gt;100&lt;/in-octets&gt;
                     &lt;out-octets&gt;150&lt;/out-octets&gt;
                    &lt;/tp-telemetry-attributes&gt;
                   &lt;/termination-point&gt;   
                  &lt;/node&gt;
                  &lt;node&gt;
                   &lt;node-id&gt;B&lt;/node-id&gt;
                   &lt;node-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
                    &lt;node-type&gt;pe&lt;/node-type&gt;
                   &lt;/node-attribtues&gt;
                   &lt;termination-point xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology"&gt;
                    &lt;tp-id&gt;2-0-1&lt;/tp-id&gt;
                   &lt;tp-telemetry-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
                     &lt;in-octets&gt;150&lt;/in-octets&gt;
                     &lt;out-octets&gt;100&lt;/out-octets&gt;
                    &lt;/tp-telemetry-attributes&gt;
                   &lt;/termination-point&gt;   
                  &lt;/node&gt;
                  &lt;link xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology"&gt;
                   &lt;link-id&gt;A-B&lt;/link-id&gt;
                   &lt;source&gt;
                    &lt;source-node&gt;A&lt;/source-node&gt;
                   &lt;/source&gt;
                   &lt;destination&gt;
                    &lt;dest-node&gt;B&lt;/dest-node&gt;
                   &lt;/destination&gt;
                    &lt;link-type&gt;mpls-te&lt;/link-type&gt;
                    &lt;link-telemetry-attributes
                     xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
                     &lt;loss-statistics&gt;
                      &lt;packet-loss-count&gt;100&lt;/packet-loss-count&gt;
                     &lt;/loss-statistics&gt;
                    &lt;/link-telemetry-attributes&gt;
                   &lt;/link&gt;
                &lt;/network&gt;
             &lt;/networks&gt;
          &lt;/stream-subtree-filter&gt;
          &lt;period xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push:1.0"&gt;500&lt;/period&gt;
       &lt;/establish-subscription&gt;
    &lt;/rpc&gt;</artwork>
      </figure>
    </section>

    <section title="Example of RPC-based Retrieval">
      <t>This example shows the way for the client to use RPC model to fetch
      performance data on demand, e.g., the client requests
      "packet-loss-count" between PE1 in site 1 and PE2 in site 2 belonging to
      the same VPN1.</t>

      <figure>
        <artwork>    &lt;rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
        message-id="1"&gt;
     &lt;report xmlns="urn:ietf:params:xml:ns:yang:example-service-pm-report"&gt;
      &lt;networks xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topo"&gt;
        &lt;network&gt;
         &lt;network-id&gt;vpn1&lt;/network-id&gt;
         &lt;node&gt;
          &lt;node-id&gt;A&lt;/node-id&gt;
          &lt;node-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
          &lt;node-type&gt;pe&lt;/node-type&gt;
          &lt;/node-attribtues&gt;
          &lt;termination-point xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology"&gt;
           &lt;tp-id&gt;1-0-1&lt;/tp-id&gt;
           &lt;tp-telemetry-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
            &lt;in-octets&gt;100&lt;/in-octets&gt;
            &lt;out-octets&gt;150&lt;/out-octets&gt;
           &lt;/tp-telemetry-attributes&gt;
          &lt;/termination-point&gt;  
         &lt;/node&gt;
         &lt;node&gt;
          &lt;node-id&gt;B&lt;/node-id&gt;
          &lt;node-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
          &lt;node-type&gt;pe&lt;/node-type&gt;
          &lt;/node-attribtues&gt;
          &lt;termination-point xmlns="urn:ietf:params:xml:ns:yang:ietf-network-topology"&gt;
           &lt;tp-id&gt;2-0-1&lt;/tp-id&gt;
           &lt;tp-telemetry-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm"&gt;
            &lt;in-octets&gt;150&lt;/in-octets&gt;
            &lt;out-octets&gt;100&lt;/out-octets&gt;
           &lt;/tp-telemetry-attributes&gt;
          &lt;/termination-point&gt;  
         &lt;/node&gt;
         &lt;link-id&gt;A-B&lt;/link-id&gt;
          &lt;source&gt;
           &lt;source-node&gt;A&lt;/source-node&gt;
          &lt;/source&gt;
          &lt;destination&gt;
           &lt;dest-node&gt;B&lt;/dest-node&gt;
          &lt;/destination&gt;
           &lt;link-type&gt;mpls-te&lt;/link-type&gt;
          &lt;telemetry-attributes xmlns="urn:ietf:params:xml:ns:yang:ietf-network-pm"&gt;
           &lt;loss-statistics&gt;
            &lt;packet-loss-count&gt;120&lt;/packet-loss-count&gt;
           &lt;/loss-statistics&gt;
          &lt;/telemetry-attributes&gt;
         &lt;/link&gt;
       &lt;/network&gt;
     &lt;/report&gt;
   &lt;/rpc&gt;</artwork>
      </figure>
    </section>

    <section title="Network and VPN Service Assurance YANG Module">
      <t>This module uses types defined in <xref target="RFC8345"/>, <xref
      target="RFC8299"/> and <xref target="RFC8532"/>.</t>

      <figure>
        <artwork>&lt;CODE BEGINS&gt; file "ietf-network-vpn-pm@2020-04-17.yang"
module ietf-network-vpn-pm {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm";
  prefix nvp;

  import ietf-yang-types {
        prefix yang;
   reference "RFC 6991: Common YANG Types.";
  }
  import ietf-network {
    prefix nw;
    reference
      "Section 6.1 of RFC 8345: A YANG Data Model for Network
       Topologies";
  }
  import ietf-network-topology {
    prefix nt;
    reference
      "Section 6.2 of RFC 8345: A YANG Data Model for Network
       Topologies";
  }
  import ietf-l3vpn-svc {
    prefix l3vpn-svc;
    reference
      "RFC 8299: YANG Data Model for L3VPN Service Delivery";
  }
  import ietf-lime-time-types {
    prefix lime;
    reference
      "RFC 8532: Generic YANG Data Model for the Management of
       Operations, Administration, and Maintenance (OAM) Protocols
       That Use Connectionless Communications";
  }
  organization
    "IETF BESS Working Group";
  contact
    "Editor: Qin Wu
             &lt;bill.wu@huawei.com&gt;
     Editor: Mohamed Boucadair 
             &lt;mohamed.boucadair@orange.com&gt;";
  description
    "This module defines a model for the VPN Service Performance 
     monitoring.

     Copyright (c) 2020 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
     (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-04-17 {
    description
      "Initial revision.";
    reference
      "RFC XXXX: A YANG Model for Network and VPN Service Performance 
                 Monitoring";
  }

  identity network-type {
    description
      "Base type for Overlay network topology.";
  }

  identity l3vpn {
    base network-type;
    description
      "Identity for layer3 VPN network type.";
  }

  identity l2vpn {
    base network-type;
    description
      "Identity for layer2 VPN network type.";
  }
  
  identity ospf {
    base network-type;
    description
      "Identity for OSPF network type.";
  }
  
  identity isis {
    base network-type;
    description
      "Identity for ISIS network type.";
  }
  identity node-type {
    description
      "Base identity for node type";
  }

  identity pe {
    base node-type;
    description
      "Identity for PE type";
  }

  identity ce {
    base node-type;
    description
      "Identity for CE type";
  }

  identity asbr {
    base node-type;
    description
      "Identity for ASBR type";
  }

  identity p {
    base node-type;
    description
      "Identity for P type";
  }

  identity link-type {
    description
      "Base identity for link type, e.g.,GRE, MPLS TE, VXLAN.";
  }
  identity gre {
    base link-type;
    description
      "Base identity for GRE Tunnel.";
  }
  identity VXLAN {
    base link-type;
    description
      "Base identity for VXLAN Tunnel.";
  }
  identity ip-in-ip {
    base link-type;
    description
      "Base identity for IP in IP Tunnel.";
  }
  identity direction {
    description
      "Base Identity for measurement direction including
       one way measurement and two way measurement.";
  }

  identity one-way {
    base direction;
    description
      "Identity for one way measurement.";
  }

  identity two-way {
    base direction;
    description
      "Identity for two way measurement.";
  }
  typedef percentage {
    type decimal64 {
      fraction-digits 5;
      range "0..100";
    }
    description
      "Percentage.";
  }
  typedef percentile {
    type decimal64 {
      fraction-digits 2;
    }
    description
      "The nth percentile of a set of data is the
       value at which n percent of the data is below it.";
  }
     grouping vpn-summary-statistics {
       description 
         "VPN Statistics grouping used for network topology 
          augmentation.";
       container vpn-summary-statistics {
         description "Container for VPN summary statistics.";
         container ipv4 {
         leaf total-routes {
           type uint32;
           description
             "Total routes in the RIB from all protocols.";
         }
         leaf total-active-routes {
           type uint32;
           description
             "Total active routes in the RIB.";
         }
          description
           "IPv4-specific parameters.";
   }
   container ipv6 {
         leaf total-routes {
           type uint32;
           description
             "Total routes in the RIB from all protocols.";
         }
         leaf total-active-routes {
           type uint32;
           description
             "Total active routes in the RIB.";
         }
          description
           "IPv6-specific parameters.";
         }
    }
}
 
  grouping link-error-statistics {
    description
      "Grouping for per link error statistics.";
    container loss-statistics {
      description
        "Per link loss statistics.";

      leaf packet-loss-count {
        type uint32 {
          range "0..4294967295";
        }
        default "0";
        description
          "Total received packet drops count.
           The value of count will be set to zero (0)
           on creation and will thereafter increase
           monotonically until it reaches a maximum value
           of 2^32-1 (4294967295 decimal), when it wraps
           around and starts increasing again from zero.";
      }
      leaf loss-ratio {
        type percentage;
        description
          "Loss ratio of the packets. Express as percentage
           of packets lost with respect to packets sent.";
      }
      leaf packet-reorder-count {
        type uint32 {
          range "0..4294967295";
        }
        default "0";
        description
          "Total received packet reordered count.
           The value of count will be set to zero (0)
           on creation and will thereafter increase
           monotonically until it reaches a maximum value
           of 2^32-1 (4294967295 decimal), when it wraps
           around and starts increasing again from zero.";
      }
      leaf packets-out-of-seq-count {
        type uint32 {
          range "0..4294967295";
        }
        description
          "Total received out of sequence count.
           The value of count will be set to zero (0)
           on creation and will thereafter increase
           monotonically until it reaches a maximum value
           of 2^32-1 (4294967295 decimal), when it wraps
           around and starts increasing again from zero..";
      }
      leaf packets-dup-count {
        type uint32 {
          range "0..4294967295";
        }
        description
          "Total received packet duplicates count.
           The value of count will be set to zero (0)
           on creation and will thereafter increase
           monotonically until it reaches a maximum value
           of 2^32-1 (4294967295 decimal), when it wraps
           around and starts increasing again from zero.";
      }
    }
  }

  grouping link-delay-statistics {
    description
      "Grouping for per link delay statistics";
    container delay-statistics {
      description
        "Link delay summarised information. By default,
         one way measurement protocol (e.g., OWAMP) is used
         to measure delay.";
      leaf direction {
        type identityref {
          base direction;
        }
        default "one-way";
        description
          "Define measurement direction including one way
           measurement and two way measurement.";
      }
      leaf unit-value {
        type identityref {
          base lime:time-unit-type;
        }
        default "lime:milliseconds";
        description
          "Time units, where the options are s, ms, ns, etc.";
      }
      leaf min-delay-value {
        type yang:gauge64;
        description
          "Minimum delay value observed.";
      }
      leaf max-delay-value {
        type yang:gauge64;
        description
          "Maximum delay value observed.";
      }
      leaf low-delay-percentile {
        type yang:gauge64;
        description
          "Low percentile of the delay observed with 
           specific measurement method.";
      }
      leaf middle-delay-percentile {
        type yang:gauge64;
        description
          "Middle percentile of the delay observed with 
           specific measurement method.";
      }
      leaf high-delay-percentile {
        type yang:gauge64;
        description
          "High percentile of the delay observed with 
           specific measurement method.";
      }
    }
  }

  grouping link-jitter-statistics {
    description
      "Grouping for per link jitter statistics";
    container jitter-statistics {
      description
        "Link jitter summarised information. By default,
         jitter is measured using IP Packet Delay Variation
         (IPDV).";

      leaf unit-value {
        type identityref {
          base lime:time-unit-type;
        }
        default "lime:milliseconds";
        description
          "Time units, where the options are s, ms, ns, etc.";
      }
      leaf min-jitter-value {
        type yang:gauge64;
        description
          "Minimum jitter value observed.";
      }
      leaf max-jitter-value {
        type yang:gauge64;
        description
          "Maximum jitter value observed.";
      }
      leaf low-jitter-percentile {
        type yang:gauge64;
        description
          "Low percentile of the jitter observed.";
      }
      leaf middle-jitter-percentile {
        type yang:gauge64;
        description
          "Middle percentile of the jitter observed.";
      }
      leaf high-jitter-percentile {
        type yang:gauge64;
        description
          "High percentile of the jitter observed.";
      }
    }
  }

  grouping tp-svc-telemetry {
    leaf in-octets {
      type uint32;
      description
        "The total number of octets received on the
         interface, including framing characters.";
    }
    leaf inbound-unicast {
      type uint32;
      description
        "Inbound unicast packets were received, and delivered
         to a higher layer during the last period.";
    }
    leaf inbound-nunicast {
      type uint32;
      description
        "The number of non-unicast (i.e., subnetwork-
         broadcast or subnetwork-multicast) packets
         delivered to a higher-layer protocol.";
    }
    leaf inbound-discards {
      type uint32;
      description
        "The number of inbound packets which were chosen
         to be discarded even though no errors had been
         detected to prevent their being deliverable to a
         higher-layer protocol.";
    }
    leaf inbound-errors {
      type uint32;
      description
        "The number of inbound packets that contained
         errors preventing them from being deliverable to a
         higher-layer protocol.";
    }
    leaf outbound-errors {
      type uint32;
      description
        "The number of outbound packets that contained
         errors preventing them from being deliverable to a
         higher-layer protocol.";
    }
    leaf in-unknown-protocol {
      type uint32;
      description
        "The number of packets received via the interface
         which were discarded because of an unknown or
         unsupported protocol.";
    }
    leaf out-octets {
      type uint32;
      description
        "The total number of octets transmitted out of the
         interface, including framing characters.";
    }
    leaf outbound-unicast {
      type uint32;
      description
        "The total number of packets that higher-level
         protocols requested be transmitted to a
         subnetwork-unicast address, including those that
         were discarded or not sent.";
    }
    leaf outbound-nunicast {
      type uint32;
      description
        "The total number of packets that higher-level
         protocols requested be transmitted to a non-
         unicast (i.e., a subnetwork-broadcast or
         subnetwork-multicast) address, including those
         that were discarded or not sent.";
    }
    leaf outbound-discards {
      type uint32;
      description
        "The number of outbound packets which were chosen
         to be discarded even though no errors had been
         detected to prevent their being transmitted.  One
         possible reason for discarding such a packet could
         be to free up buffer space.";
    }
    leaf outbound-qlen {
      type uint32;
      description
        " Length of the queue of the interface from where
          the packet is forwarded out.  The queue depth could
           be the current number of memory buffers used by the
          queue and a packet can consume one or more memory buffers
          thus constituting device-level information.";
    }
    description
      "Grouping for interface service telemetry.";
  }

  augment "/nw:networks/nw:network/nw:network-types" {
    description
      "Augment the network-types with service topologyies types";
    leaf-list network-technology-type {
      type identityref {
        base network-type;
      }
      description
        "Identify the network technology type, e.g., L3VPN, 
         L2VPN, ISIS, OSPF.";
    }
  }
  augment "/nw:networks/nw:network" {
    description
      "Augment the network with service topology attributes";
    container vpn-topo-attributes {
      leaf vpn-topology {
        type identityref {
          base l3vpn-svc:vpn-topology;
        }
        description
          "VPN service topology, e.g., hub-spoke, any-to-any,
           hub-spoke-disjoint";
      }
      description
        "Container for vpn topology attributes.";
    }
    uses vpn-summary-statistics;
  }
  augment "/nw:networks/nw:network/nw:node" {
    description
      "Augment the network node with overlay topology attributes";
    container node-attributes {
      leaf node-type {
        type identityref {
          base node-type;
        }
        description
          "Node type, e.g., PE, P, ASBR.";
      }
      leaf site-id {
        type string;
        description
          "Associated vpn site";
      }
      leaf site-role {
        type identityref {
          base l3vpn-svc:site-role;
        }
        default "l3vpn-svc:any-to-any-role";
        description
          "Role of the site in the VPN.";
      }
      description
        "Container for overlay topology attributes.";
    }
  }
  augment "/nw:networks/nw:network/nt:link" {
    description
      "Augment the network topology link with overlay topology attributes";
     leaf link-type {
        type identityref {
          base link-type;
        }
        description
          "Link type, e.g., GRE,VXLAN, IP in IP.";
      }
     leaf low-percentile {
       type percentile;
       default 10.00;
       description
         "Low percentile to report.Setting low-percentile into 0.00 indicates 
          the client is not intererested in receiving low percentile.";
     }
     leaf middle-percentile {
       type percentile;
       default 50.00;
       description
         "Middle percentile to report.Setting middle-percentile into 0.00 indicates 
         the client is not intererested in receiving middle percentile.";
     }
     leaf high-percentile {
       type percentile;
       default 90.00;
       description
         "High percentile to report.";
     }
      leaf reference-time {
       type yang:date-and-time;
       description
         "The time that the current Measurement Interval started.Setting high-percentile 
         into 0.00 indicates the client is not intererested in receiving high percentile.";
       }
     leaf measurement-interval {
       type uint32;
           units "seconds";
           default 60;
           description
             "Interval to calculate performance metric.";
     }
    container link-telemetry-attributes {
      config false;
      uses link-error-statistics;
      uses link-delay-statistics;
      uses link-jitter-statistics;
      description
        "Container for service telemetry attributes.";
    }
  }
  augment "/nw:networks/nw:network/nw:node/nt:termination-point" {
    description
      "Augment the network topology termination point with vpn service attributes";
    container tp-telemetry-attributes {
      config false;
      uses tp-svc-telemetry;
      description
        "Container for termination point service telemetry attributes.";
    }
  }
}
&lt;CODE ENDS&gt;</artwork>
      </figure>
    </section>

    <section title="Security Considerations">
      <t>The YANG modules defined in this document MAY be accessed via the
      RESTCONF protocol [RFC8040] or NETCONF protocol ([RFC6241]). The lowest
      RESTCONF or NETCONF layer requires that the transport-layer protocol
      provides both data integrity and confidentiality, see Section 2 in
      [RFC8040] and [RFC6241]. The lowest NETCONF layer is the secure
      transport layer, and the mandatory-to-implement secure transport is
      Secure Shell (SSH)[RFC6242] . The lowest RESTCONF layer is HTTPS, and
      the mandatory-to-implement secure transport is TLS [RFC5246].</t>

      <t>The NETCONF access control model [RFC6536] 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: <list style="symbols">
          <t>/nw:networks/nw:network/svc-topo:svc-telemetry-attributes</t>

          <t>/nw:networks/nw:network/nw:node/svc-topo:node-attributes</t>
        </list></t>
    </section>

    <section title="IANA Considerations">
      <t>This document requests IANA to register the following URI in the "ns"
      subregistry within the "IETF XML Registry" <xref target="RFC3688"/>:</t>

      <figure>
        <artwork>   URI: urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm
   Registrant Contact: The IESG.
   XML: N/A, the requested URI is an XML namespace.
</artwork>
      </figure>

      <t>This document requests IANA to register the following YANG module in
      the "YANG Module Names" subregistry <xref target="RFC6020"/> within the
      "YANG Parameters" registry.</t>

      <figure>
        <artwork>   Name:         ietf-network-vpn-pm
   Namespace:    urn:ietf:params:xml:ns:yang:ietf-network-vpn-pm
   Maintained by IANA: N
   Prefix:       nvp
   Reference:    RFC XXXX
</artwork>
      </figure>
    </section>

    <section title="Contributors">
      <figure>
        <artwork>   Michale Wang
   Huawei
   Email:wangzitao@huawei.com

   Roni Even
   Huawei
   Email: ron.even.tlv@gmail.com </artwork>
      </figure>
    </section>
  </middle>

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

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

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

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

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

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

      <?rfc include="reference.RFC.6370"?>

      <?rfc include="reference.RFC.6374"?>

      <?rfc include="reference.RFC.6536"?>

      <?rfc include="reference.RFC.7923"?>

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

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

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

      <?rfc include="reference.RFC.8340"?>

      <?rfc include="reference.RFC.8345"?>

      <?rfc include='reference.RFC.8532'?>
    </references>

    <references title="Informative References">
      <?rfc include='reference.I-D.ietf-netconf-yang-push'?>

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

      <?rfc include="reference.RFC.7471"?>

      <?rfc include="reference.RFC.7810"?>

      <?rfc include="reference.RFC.8233"?>

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

      <?rfc include="reference.RFC.8571"?>
    </references>
  </back>
</rfc>
