<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd">
<?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"?>
<rfc category="std" docName="draft-ietf-nvo3-yang-cfg-06" ipr="trust200902">
  <front>
      <title abbrev="NVO3 YANG">Base YANG Data Model for NVO3 Protocols</title>
	  
   <author fullname="Ran Chen" initials="R." surname="Chen">
      <organization>ZTE Corporation</organization>
      <address>
        <postal>
          <street/>
          <!-- Reorder these if your country does things differently -->

         <city>Nanjing</city>
          <region/>
          <code/>
          <country>China</country>
        </postal>
        <email>chen.ran@zte.com.cn</email>
        <!-- uri and facsimile elements may also be added -->
     </address>
    </author>

	<author fullname="Kunding Zhao" initials="K." surname="Zhao">
      <organization>Huawei Technologies</organization>
      <address>
        <postal>
         <street/>
          <city>Beijing</city>
          <region/>
          <code/>
          <country>China</country>
        </postal>
        <email>zhaokun.ding@huawei.com</email>
      </address>
     </author>
    
<author fullname="Fengwei Qin" initials="F." surname="Qin">
      <organization>China Mobile</organization>
      <address>
        <postal>
          <street/>
          <!-- Reorder these if your country does things differently -->
         <city>Beijing</city>
          <region/>
          <code/>
          <country>China</country>
        </postal>
        <email>qinfengwei@chinamobile.com</email>
      </address>
    </author>
	
<author fullname="Reshad Rahman" initials="R." surname="Rahman">
      <organization>Juniper networks</organization>
      <address>
        <postal>
         <street/>
          <city></city>
          <region/>
          <code/>
          <country></country>
        </postal>
        <email>reshad@yahoo.com</email>
      </address>
    </author>
	
<author fullname="Bing Liu" initials="B." surname="Liu">
      <organization>Huawei Technologies</organization>
      <address>
        <postal>
         <street/>
          <city></city>
          <region/>
          <code/>
          <country></country>
        </postal>
        <email>remy.liubing@huawei.com</email>
      </address>
    </author>
    <date year="2025"/>
    <!-- If the month and year are both specified and are the current ones, xml2rfc will fill 
        in the current day for you. If only the current year is specified, xml2rfc will fill 
	 in the current day and month for you. If the year is not the current one, it is 
	 necessary to specify at least a month (xml2rfc assumes day="1" if not specified for the 
	 purpose of calculating the expiry date).  With drafts it is normally sufficient to 
	 specify just the year. -->

   <!-- Meta-data Declarations -->

   <area>Routing</area>
    <workgroup>NVO3 Working Group</workgroup>
    <!-- WG name at the upperleft corner of the doc,
        IETF is fine for individual submissions.  
	 If this element is not present, the default is "Network Working Group",
        which is used by the RFC Editor as a nod to the history of the IETF. -->

   <keyword>Internet Draft</keyword>
    <!-- Keywords will be incorporated into HTML output
        files in a meta tag but they have no effect on text or nroff
        output. If you submit your draft to the RFC Editor, the
        keywords will be used for the search engine. -->
   
   <abstract>
	   <t>This document describes the base YANG data model that can be used by operators to configure and manage Network Virtualization Overlay protocols.  The model is focused on the common configuration requirement of various encapsulation options, such as VXLAN, NVGRE, GENEVE and VXLAN-GPE. Using this model as a starting point, incremental work can be done to satisfy the requirement of a specific encapsulation. The model is based on YANG 1.1, which is defined in RFC 7950 and conforms to the Network Management Datastore Architecture (NMDA).</t>
    </abstract>
  </front>
  <middle>
  
    <section numbered="true" toc="default">
      <name>Introduction</name>
	 <t>Network Virtualization Overlays (NVO3), such as VXLAN <xref target="RFC7348"/>, NVGRE <xref target="RFC7637"/>, GENEVE <xref target="RFC8926"/> and VXLAN-GPE <xref target="I-D.ietf-nvo3-vxlan-gpe"/>, enable network virtualization for data center networks environment that assumes an IP-based underlay.</t>
	 <t>YANG <xref target="RFC7950"/> is a data modeling language that was introduced to model the configuration and operational state of a device managed using network management protocols such as the Network Configuration Protocol (NETCONF) <xref target="RFC6241"/> or RESTCONF <xref target="RFC8040"/>. YANG is now also being used as a component of other management interfaces, such as command-line interfaces (CLIs).</t>
	 <t>This document specifies a YANG data model that can be used to configure and manage NVO3 protocols. The model covers the configuration of NVO3 instances as well as their operation states, which are the basic common requirements of the different tunnel encapsulations.  Thus it is called "the base model for NVO3" in this document. The model is based on YANG 1.1, which is defined in RFC 7950 and conforms to the Network Management Datastore Architecture (NMDA) as described in <xref target="RFC8342"/>.</t>
	  <section numbered="true" toc="default">
        <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" format="default"/> <xref target="RFC8174" format="default"/>
        when, and only when, they appear in all capitals, as shown here.</t>
      </section>
	 <section numbered="true" toc="default">
      <name>Terminology</name>
	  <t>The terminology for describing YANG data models is found in <xref target="RFC7950"/>.</t>
	  <t>The following abbreviations are used in this document and the defined model:</t>
        <dl>
		 <dt>>BUM:</dt>
          <dd>Broadcast, Unknown Unicast, Multicast traffic
        <xref target="RFC9469" format="default"></xref>
          </dd>
		   <dt>Geneve:</dt>
          <dd>Generic Network Virtualization Encapsulation. An NVO3 encapsulation defined in <xref target="RFC8926" format="default"></xref>
          </dd>
          <dt>NVO3:</dt>
          <dd>Network Virtualization Overlays Layer 3
        <xref target="RFC8014" format="default" ></xref> 
          </dd>
          <dt>NVE:</dt>
          <dd>Network Virtualization Edge
        <xref target="RFC7365" format="default"></xref>
          </dd>
		    <dt>VAP:</dt>
          <dd>Virtual Access Points
        <xref target="RFC7365" format="default"></xref>
          </dd>
		   <dt>VNI:</dt>
          <dd>Virtual Network Instance<xref target="RFC7365" format="default"></xref>
          </dd>
	  </dl>
      </section> 
	  <section numbered="true" toc="default">
      <name>Tree Diagrams</name>
	   <t>Tree diagrams used in this document follow the notation defined in
      <xref target="RFC8340" format="default"></xref>.
        </t>
	  </section>
	  <section numbered="true" toc="default">
      <name>Prefixes in Data Node Names</name>
	   <t>In this document, names of data nodes, actions, and other data model
      objects are often used without a prefix, as long as the context clearly
      indicates the YANG module in which each name is defined.  Otherwise,
      names are prefixed using the standard prefix associated with the
      corresponding YANG module, as shown in <xref target="table_prefixes" format="default" sectionFormat="of" derivedContent="Table 1"/>.</t>
	  <table anchor="table_prefixes" align="center" pn="table-1">
          <name slugifiedName="name-prefixes-and-corresponding-">Prefixes and Corresponding YANG Modules</name>
          <thead>
            <tr>
              <th align="left" colspan="1" rowspan="1">Prefix</th>
              <th align="left" colspan="1" rowspan="1">YANG Module</th>
              <th align="left" colspan="1" rowspan="1">Reference</th>
            </tr>
          </thead>
          <tbody>
            <tr>
              <td align="left" colspan="1" rowspan="1">yang</td>
              <td align="left" colspan="1" rowspan="1">ietf-yang-types</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="RFC6991" format="default" sectionFormat="of" derivedContent="RFC6991"/></td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">inet</td>
              <td align="left" colspan="1" rowspan="1">ietf-inet-types</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="RFC6991" format="default" sectionFormat="of" derivedContent="RFC6991"/></td>
            </tr>
			 <tr>
              <td align="left" colspan="1" rowspan="1">rt</td>
              <td align="left" colspan="1" rowspan="1">ietf-routing</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="RFC8349" format="default" sectionFormat="of" derivedContent="RFC8349"/></td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">if</td>
              <td align="left" colspan="1" rowspan="1">ietf-interfaces</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="RFC8343" format="default" sectionFormat="of" derivedContent="RFC8343"/></td>
            </tr>
            <tr>
              <td align="left" colspan="1" rowspan="1">ni</td>
              <td align="left" colspan="1" rowspan="1">ietf-network-instance</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="RFC8529" format="default" sectionFormat="of" derivedContent="RFC8529"/></td>
            </tr>
			 <tr>
              <td align="left" colspan="1" rowspan="1">l2vpn</td>
              <td align="left" colspan="1" rowspan="1">ietf-l2vpn</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="I-D.ietf-bess-l2vpn-yang" format="default" sectionFormat="of" derivedContent="I-D.ietf-bess-l2vpn-yang"/></td>
            </tr>
			 <tr>
              <td align="left" colspan="1" rowspan="1">l3vpn</td>
              <td align="left" colspan="1" rowspan="1">ietf-l3vpn</td>
              <td align="left" colspan="1" rowspan="1">
                <xref target="I-D.ietf-bess-l3vpn-yang" format="default" sectionFormat="of" derivedContent="I-D.ietf-bess-l3vpn-yang"/></td>
            </tr>
          </tbody>
        </table>
	  </section>
	 </section>
   <section numbered="true" toc="default">
   <name> The YANG Data Model for NVO3</name>
   <t> The NVO3 base YANG model defined in this document is used to configure the NVEs. It is divided into three containers. The first container contains the configuration of the virtual network instances, e.g. the VNI, the NVE that the instance is mounted, the peer NVEs which can be determined dynamically via a control plane or given statically, and the statistical states of the instance. The other two containers are separately the statistical states of the peer NVEs and the tunnels.</t>
   <section numbered="true" toc="default">
   <name>Mapping to the NVO3 architecture</name>
   <t>The NVO3 base YANG model is defined according to the NVO3 architecture <xref target="RFC8014"/>.  As shown in Figure 1, the reference model of the NVE defined in <xref target="RFC8014"/>, multiple instances can be mounted under a NVE.  The key of the instance is VNI.  The source NVE of the instance is the NVE configured by the base YANG.  An instance can have several peer NVEs.  A NVO3 tunnel can be determined by the VNI, the source NVE and the peer NVE.  The tunnel can be built statically by manually indicate the addresses of the peer NVEs, or dynamically via a control plane, e.g.  EVPN <xref target="RFC8365"/>.  An enabler is defined in this document to choose from these two modes.</t>
   <artwork>
             +-----------------------------------------+
             |       Data-Center Network (IP)          |
             +-----------------------------------------+
                     |                          |
                     |      Tunnel Overlay      |
        +------------+---------+      +---------+------------+
        | +----------+-------+ |      | +-------+----------+ |
        | |  Overlay Module  | |      | |  Overlay Module  | |
        | +---------+--------+ |      | +---------+--------+ |
        |           |          |      |           |          |
   NVE1 |           |          |      |           |          |NVE2
        |  +--------+-------+  |      |  +--------+-------+  |
        |  | VNI1      VNI2 |  |      |  | VNI1      VNI2 |  |
        |  +-+----------+---+  |      |  +-+-----------+--+  |
        |    | VAP1     | VAP2 |      |    | VAP1      | VAP2|
        +----+----------+------+      +----+-----------+-----+
             |          |                   |           |
             |          |                   |           |
             |          |                   |          /|
      -------+----------+-------------------+---------/-+-------
             |          |     Tenant        |        /  |
        TSI1 |TSI2      | TSI3            TSI1  TSI2/   TSI3
           +---+ +---+ +---+             +---+ +---+   +---+
           |TS1| |TS2| |TS3|             |TS4| |TS5|   |TS6|
           +---+ +---+ +---+             +---+ +---+   +---+
   </artwork>
 </section>
	<section numbered="true" toc="default">
   <name>Configuration and Operational State</name>
   <section numbered="true" toc="default">
   <name>Configuration</name>
   	<section numbered="true" toc="default">
   <name>NVE as an interface</name>
   <t>A NVE in the NVO3 base YANG is defined via augmenting the IETF interface YANG.  If anycast gateway is enabled, the source VTEP address is the address of the anycast gateway, and a bypass address is used to uniquely identify the NVE.  Otherwise, the source VTEP address is the NVE interface's own IP address.</t>
   </section>
   	<section numbered="true" toc="default">
   <name>Virtual Network Instance</name>
   <t>A Virtual Network Instance ('VNI') is a specific VN instance on an NVE <xref target="RFC7365"/>. At each NVE, a Tenant System is connect to VNIs through Virtual Access Points (VAP).  VAPs can be physical ports or virtual ports identified by the bridge domain Identifier ('bdId'). The mapping between VNI and bdId is managed by the operator.</t>
   <t>As defined in <xref target="RFC9135"/>, a tenant can have multiple bridge domains, and each domain has its own VNI.</t>
   <t>Thus these VNIs are used as L2VPN. Besides, a dedicated VNI can be used for routing between the bridge domains, i.e. used as L3VPN.  The mapping relationship between VNI and L2VPN (respectively, L3VPN) is given by augmenting the IETF YANG of L2VPN (respectively L3VPN).</t>
   </section>
   	<section numbered="true" toc="default">
   <name>BUM Mode</name>
   <t>An NVE SHOULD support either ingress replication, or multicast proxy, or point to multipoint tunnels on a per-VNI basis. It is possible that both modes be used simultaneously in one NVO3 network by different NVEs.</t>
   <t>If ingress replication is used, the receiver addresses are listed in 'peers'.  If multicast proxy <xref target="RFC8293"/> is used, the proxy's address is given in "flood-proxy".  If the choice is point to multipoint tunnels, the multicast address is given as 'multiAddr'.</t>
    </section>
	</section>
	<section numbered="true" toc="default">
   <name>Statistics</name>
   <t> Operators can determine whether a NVE should gather statistic values on a per-VNI basis.  An enabler is contained in the 'static' list as 'statistic-enable' leaf.  If the gathering for a VNI is enabled, the statistical information about the local NVEs, the remote NVEs, the flows and the MAC addresses will be collected by the NVEs in this VNI.</t>
    </section>
    </section>
   <section numbered="true" toc="default">
   <name> Module Structure</name>
   <t>The ietf-nvo3-base YANG module augments the routing container in the ietf-routing model <xref target="RFC8349"/> with a NVO3 container and defines base NVO3 YANG data model and operational state. This module is augmented by modules supporting different data planes.</t>
  <artwork>
module: ietf-nvo3-base
  +--rw nvo3
  |  +--rw vni-instances
  |     +--rw vni-instance*[vni-id]
  |        +--rw vni-id               uint32
  |        +--rw vni-mode?            vni-mode
  |        +--rw source-nve           if:interface-ref
  |        +--rw protocol-bgp?        boolean
  |        +--ro status?              vni-status-type
  |        +--rw static-ipv4-peers
  |        |  +--rw static-peer*[peer-ip]
  |        |     +--rw peer-ip       inet:ipv4-address-no-zone
  |        |     +--rw out-vni-id?   uint32
  |        +--rw static-ipv6-peers
  |        |  +--rw static-ipv6-peer*[peer-ip]
  |        |     +--rw peer-ip       inet:ipv6-address-no-zone
  |        |     +--rw out-vni-id?   uint32
  |        +--rw flood-proxys
  |        |  +--rw flood-proxy*[peer-ip]
  |        |     +--rw peer-ip    inet:ip-address-no-zone
  |        +--rw mcast-groups
  |        |  +--rw mcast-group*[mcast-ip]
  |        |     +--rw mcast-ip    inet:ip-address-no-zone
  |        +--rw statistic
  |           +--rw enable?   boolean
  |           +--ro info
  |              +--ro send-bits-rate?           uint64
  |              +--ro send-pkts-rate?           uint64
  |              +--ro send-unicast-pkts?        uint64
  |              +--ro send-multicast-pkts?      uint64
  |              +--ro send-broadcast-pkts?      uint64
  |              +--ro send-total-bytes?         uint64
  |              +--ro send-total-pkts?          uint64
  |              +--ro receive-bits-rate?        uint64
  |              +--ro receive-pkts-rate?        uint64
  |              +--ro receive-unicast-pkts?     uint64
  |              +--ro receive-multicast-pkts?   uint64
  |              +--ro receive-broadcast-pkts?   uint64
  |              +--ro receive-total-bytes?      uint64
  |              +--ro receive-total-pkts?       uint64
  |              +--ro drop-unicast-pkts?        uint64
  |              +--ro drop-multicast-pkts?      uint64
  |              +--ro drop-broadcast-pkts?      uint64
  +--ro vni-peer-infos
  |  +--ro peers
  |     +--ro peer*[vni-id source-ip peer-ip]
  |        +--ro vni-id        uint32
  |        +--ro source-ip     inet:ip-address-no-zone
  |        +--ro peer-ip       inet:ip-address-no-zone
  |        +--ro type?         tunnel-type
  |        +--ro out-vni-id?   uint32
  +--ro tunnel-infos
     +--ro tunnel-info*[tunnel-id]
        +--ro tunnel-id    uint32
        +--ro source-ip?   inet:ip-address-no-zone
        +--ro peer-ip?     inet:ip-address-no-zone
        +--ro status?      tunnel-status
        +--ro type?        tunnel-type
        +--ro up-time?     string
        +--ro vrf-name? ->/ni:network-instances/network-instance/name  

augment /if:interfaces/if:interface:
    +--rw nvo3-nve
       +--rw nve-ip?            inet:ipv4-address-no-zone
       +--rw nve-ipv6?          inet:ipv6-address-no-zone
       +--rw bypass-nve-ip?     inet:ipv4-address-no-zone
       +--rw bypass-nve-ipv6?   inet:ipv6-address-no-zone
       +--rw statistics
       +--rw statistic* [vni-id peer-ip direction]
          +--rw vni-id       uint32
          +--rw peer-ip      inet:ip-address-no-zone
          +--rw direction    direction-type
          +--ro info
             +--ro send-bits-rate?           uint64
             +--ro send-pkts-rate?           uint64
             +--ro send-unicast-pkts?        uint64
             +--ro send-multicast-pkts?      uint64
             +--ro send-broadcast-pkts?      uint64
             +--ro send-total-bytes?         uint64
             +--ro send-total-pkts?          uint64
             +--ro receive-bits-rate?        uint64
             +--ro receive-pkts-rate?        uint64
             +--ro receive-unicast-pkts?     uint64
             +--ro receive-multicast-pkts?   uint64
             +--ro receive-broadcast-pkts?   uint64
             +--ro receive-total-bytes?      uint64
             +--ro receive-total-pkts?       uint64
             +--ro drop-unicast-pkts?        uint64
             +--ro drop-multicast-pkts?      uint64
             +--ro drop-broadcast-pkts?      uint64

  augment /ni:network-instances/ni:network-instance
  /ni:ni-type/l3vpn:l3vpn/l3vpn:l3vpn:
    +--rw vnis
       +--rw vni*[vni-id]
          +--rw vni-id    uint32

  augment /ni:network-instances/ni:network-instance
  /ni:ni-type/l2vpn:l2vpn:
    +--rw vnis
       +--rw vni*[vni-id]
          +--rw vni-id                uint32
          +--rw split-horizon-mode?   vni-bind-type
             +--rw split-group?       string

  rpcs:
    +---x reset-vni-instance-statistic
    |  +---w input
    |     +---w vni-id    uint32
    +---x reset-vni-peer-statistic
       +---w input
          +---w vni-id       uint32
          +---w peer-ip      inet:ip-address-no-zone
          +---w direction    direction-type
       
</artwork>
 </section>
  
   <section numbered="true" toc="default">
   <name>YANG Module</name>
   <figure>
 <artwork>
<![CDATA[<CODE BEGINS> file "ietf-nvo3-base@2023-10-16.yang"
module ietf-nvo3-base {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-nvo3-base";
  prefix "nvo3";

  import ietf-network-instance {
    prefix "ni";
  }

  import ietf-interfaces {
    prefix "if";
  }

  import ietf-inet-types {
    prefix "inet";
  }

  import ietf-l2vpn {
    prefix "l2vpn";
  }

  import ietf-bgp-l3vpn {
    prefix "l3vpn";
  }

  import iana-if-type {
    prefix ianaift;
  }

  organization
    "IETF NVO3(Network Virtualization Overlays) Working Group"; 
  contact
    "WG Web:   &lt;https://datatracker.ietf.org/wg/nvo3&gt;
     WG List:  &lt;mailto:nvo3@ietf.org&gt;

     WG Chair: Matthew Bocci
                   &lt;mailto:matthew.bocci@nokia.com&gt;

     WG Chair: Sam Aldrin
                   &lt;mailto:aldrin.ietf@gmail.com&gt;


     Editor:  Ran Chen
                   &lt;mailto:chen.ran@zte.com.cn&gt;
     Editor:  Kunding Zhao
                   &lt;mailto:zhaokun.ding@huawei.com&gt;
     Editor:  Fengwei Qin
                   &lt;mailto:qinfengwei@chinamobile.com&gt;
     Editor:  Reshad Rahman
                   &lt;mailto:reshad@yahoo.com&gt;
     Editor:  Bing Liu 
                   &lt;mailto:remy.liubing@huawei.com&gt;
    ";
  description
        "This model is focused on the common configuration
        requirement of various encapsulation options, 
        such as VXLAN, NVGRE, GENEVE and VXLAN-GPE.
    
        Copyright (c) 2025 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 9719
        (https://www.rfc-editor.org/info/rfc9719); 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 2025-10-16 {
      description
        "initial version.";
      reference
        "RFC XXXX: Base YANG Data Model for NVO3 Protocols";
    }
  typedef vni-status-type {
    type enumeration {
      enum "up" {
        description
          "The state is up.";
      }
      enum "down" {
        description
          "The state is down.";
      }
    }
    description
      "The state for VNI.";
  }

  typedef tunnel-status {
    type enumeration {
      enum "up" {
        description
          "The tunnel is up.";
}
      enum "down" {
        description
          "The tunnel is down.";
      }
    }
    description
      "The status of NVO3 Tunnel.";
  }
  typedef tunnel-type {
    type enumeration {
      enum "dynamic" {
        description
          "The tunnel is dynamic.";
      }
      enum "static" {
        description
          "The tunnel is static.";
      }
      enum "invalid" {
        description
          "The tunnel is invalid.";
      }
    }
    description
      "The type of NVO3 Tunnel.";
  }

  typedef direction-type {
    type enumeration {
      enum "inbound" {
        description
          "Inbound.";
      }
      enum "outbound" {
        description
          "Outbound.";
      }
      enum "bidirection" {
        description
          "Bidirection.";
      }
    }
    description
      "Bound direction.";
  }
  typedef vni-bind-type {
    type enumeration {
      enum "hub-mode" {
        description
          "Hub mode. The vni instance can't communicate 
		  with other hub mode vni instances.";
      }
      enum "spoke-mode" {
        description
          "Spoke mode.";
      }
      enum "split-group-mode" {
        description
          "Split group mode.";
      }
    }
    description
      "The binding type of VNI.";
  }

  typedef vni-mode {
    type enumeration {
      enum "local" {
        description
          "Local mode.";
      }
      enum "global" {
        description
          "Global mode.";
      }
    }
    description
      "The mode of VNI.";
  }

  grouping nvo3-traffic-statistics {
    description
      "NVO3 tunnel traffic statistics collection.";
    leaf send-bits-rate {
      type uint64;
      units bit/s;
      description
        "Number of send bits per second.";
    }
    leaf send-pkts-rate {
      type uint64;
      units pps;
      description
        "Number of send packets per second.";
    }
    leaf send-unicast-pkts {
      type uint64;
      units packet;
      description
        "Number of send unicast packets.";
    }
    leaf send-multicast-pkts {
      type uint64;
      units packet;
      description
        "Number of send multicast packets.";
    }
    leaf send-broadcast-pkts {
      type uint64;
      units packet;
      description
        "Number of send broadcast packets.";
    }
    leaf send-total-bytes {
      type uint64;
      units Byte;
      description
        "Total number of send bytes.";
    }
    leaf send-total-pkts {
      type uint64;
      units packet;
      description
        "Total number of send packets.";
    }
    leaf receive-bits-rate {
      type uint64;
      units bit/s;
      description
        "Number of receive bits per second.";
    }
    leaf receive-pkts-rate {
      type uint64;
      units pps;
      description
        "Number of receive packets per second.";
    }
    leaf receive-unicast-pkts {
      type uint64;
      units packet;
      description
        "Number of receive unicast packets.";
    }
    leaf receive-multicast-pkts {
      type uint64;
      units packet;
      description
        "Number of receive multicast packets.";
    }
    leaf receive-broadcast-pkts {
      type uint64;
      units packet;
      description
        "Number of receive broadcast packets.";
    }
    leaf receive-total-bytes {
      type uint64;
      units Byte;
      description
        "Total number of receive bytes.";
    }
    leaf receive-total-pkts {
      type uint64;
      units packet;
      description
        "Total number of receive packets.";
    }
    leaf drop-unicast-pkts {
      type uint64;
      units packet;
      description
        "Number of discarded unicast packets.";
    }
    leaf drop-multicast-pkts {
      type uint64;
      units packet;
      description
        "Number of discarded multicast packets.";
    }
    leaf drop-broadcast-pkts {
      type uint64;
      units packet;
      description
        "Number of discarded broadcast packets.";
    }
  }

  container nvo3 {
    description
      "Management of NVO3.";
    container vni-instances {
      description
        "List of virtual network instances.";
      list vni-instance {
        key "vni-id";
        description
          "Configure the information of VNI.";
        leaf vni-id {
          type uint32 {
            range "1..16777215";
          }
          description
            "The id of VNI.";
        }
        leaf vni-mode {
          type vni-mode;
          default "local";
          description
            "The mode of VNI.";
        }
        leaf source-nve {
          type if:interface-ref;
          must "(/if:interfaces/if:interface
		  [if:name=current()]/if:type='Nve')";
          mandatory true;
          description
            "The name of the local NVE.";
        }
        leaf protocol-bgp {
          type boolean;
          default "false";
          description
            "Learn remote NVEs in the same VNI via BGP.";
        }
        leaf status {
          type vni-status-type;
          config false;
          description
            "The status of the VNI.";
        }
        container static-ipv4-peers {
          description
            "List of remote NVE address created by users in a VNI.";
          list static-peer {
            key "peer-ip";
            description
              "Configure remote NVE address in a same VNI.";
            leaf peer-ip {
              type inet:ipv4-address-no-zone;
              description
                "The address of the remote NVE.";
            }
            leaf out-vni-id {
              type uint32 {
                range "1..16777215";
              }
              description
                "The ID of VNI for outbound. 
				Do not support separate deletion.";
            }
          }
        }
        container static-ipv6-peers {
          description
            "List of remote NVE IPv6 address created by users 
			in a VNI.";
          list static-ipv6-peer {
            key "peer-ip";
            description
              "Configure remote NVE IPv6 address in a same VNI.";
            leaf peer-ip {
              type inet:ipv6-address-no-zone;
              description
                "The IPv6 address of the remote NVE.";
            }
            leaf out-vni-id {
              type uint32 {
                range "1..16777215";
              }
              description
                "The ID of VNI for outbound. Do not support separate 
				deletion.";
            }
          }
        }
        container flood-proxys {
          description
            "List of flood proxys for the VNI.";
          list flood-proxy {
            key "peer-ip";
            description
              "Configure flood proxys for the VNI.";
            leaf peer-ip {
              type inet:ip-address-no-zone;
              description
                "The address of flood proxy.";
            }
          }
        }
        container mcast-groups {
          description
            "List of multicast address for the VNI.";
          list mcast-group {
            key "mcast-ip";
            description
              "Configure multicast address in a same VNI.";
            leaf mcast-ip {
              type inet:ip-address-no-zone;
              description
                "The mcast address of NVO3.";
            }
          }
        }
        container statistic {
          description
            "Configure VNI traffic statistics.";
          leaf enable {
            type boolean;
            default "false";
            description
              "Enable/disable VNI traffic statistics.";
          }
          container info {
            when "../enable='true'";
            config false;
            description
              "The information of vni instance traffic statistics.";
            uses nvo3-traffic-statistics;
          }
        }
      }
    }
  }
  container vni-peer-infos {
      config false;
      description
        "List of remote NVE addresses.";
      container peers {
        config false;
        description
          "Operational data of remote NVE address in a VNI.";
        list peer {
          key "vni-id source-ip peer-ip";
          config false;
          description
            "Operational data of remote NVE addresses in a VNI.";
          leaf vni-id {
            type uint32 {
              range "1..16777215";
            }   
            config false;
            description
              "The ID of VNI.";
          }
          leaf source-ip {
            type inet:ip-address-no-zone;
            config false;
            description
              "Local NVE address, as NVO3 tunnel source point.";
          }
          leaf peer-ip {
            type inet:ip-address-no-zone;
            config false;
            description
              "Remote NVE address, as NVO3 tunnel end point.";
          }
          leaf type {
            type tunnel-type;
            config false;
            description
              "Tunnel type.";
          }
          leaf out-vni-id {
            type uint32 {
              range "1..16777215";
            }
            config false;
            description
              "The ID of VNI for outbound.";
          }
        }
      }
    }

  container tunnel-infos {
    config false;
    description
      "List of NVO3 tunnel information.";
    list tunnel-info {
      key "tunnel-id";
      config false;
      description
        "Operational data of NVO3 tunnel information.";
      leaf tunnel-id {
        type uint32 {
          range "1..4294967295";
        }
        config false;
        description
          "The ID of NVO3 tunnel.";
      }
      leaf source-ip {
        type inet:ip-address-no-zone;
        config false;
        description
          "Local NVE address, as NVO3 tunnel source point.";
      }
      leaf peer-ip {
        type inet:ip-address-no-zone;
        config false;
        description
          "Remote NVE address, as NVO3 tunnel end point.";
      }
      leaf status {
        type tunnel-status;
        config false;
        description
          "Tunnel status.";
      }
      leaf type {
        type tunnel-type;
        config false;
        description
          "Tunnel type.";
      }
      leaf up-time {
        type string {
          length "1..10";
        }
        config false;
        description
          "The continuous time as NVO3 tunnel is reachable.";
      }
      leaf vrf-name {
        type leafref {
          path "/ni:network-instances/ni:network-instance/ni:name";
        }
        default "_public_";
        config false;
        description
          "The name of VPN instance.";
      }
    }
  }

  identity Nve {
    base ianaift:iana-interface-type;
    description "A new interface type to be registered to IANA";
  }

  augment "/if:interfaces/if:interface" {
    when "(/if:interfaces/if:interface/if:type = 'nvo3:Nve')";
    description
      "Augment the interface, NVE as an interface.";
    container nvo3-nve {
      description
        "Local NVE.";
      leaf nve-ip {
        type inet:ipv4-address-no-zone;
        description
          "The address of local NVE.";
      }
      leaf nve-ipv6 {
        type inet:ipv6-address-no-zone;
        description
          "The IPv6 address of the local NVE.";
      }
      leaf bypass-nve-ip {
        type inet:ipv4-address-no-zone;
        description
          "The address of local NVE as bypass.";
      }
      leaf bypass-nve-ipv6 {
        type inet:ipv6-address-no-zone;
        description
          "The IPv6 address of local NVE as bypass.";
      }
      container statistics {
        description
          "List of NVO3 tunnel statistics.";
        list statistic {
          key "vni-id peer-ip direction";
          description
            "Configure NVO3 tunnel statistics information.";
          leaf vni-id {
            type uint32 {
              range "1..16777215";
            }
            description
              "The ID of the VNI.";
          }
          leaf peer-ip {
            type inet:ip-address-no-zone;
            description
              "The address of remote NVE.";
          }
          leaf direction {
            type direction-type;
            description
              "Traffic statistics direction for the tunnel.";
          }
          container info {
            config false;
            description
              "The information of tunnel traffic statistics.";
            uses nvo3-traffic-statistics;
          }
        }
      }
    }
  }

  augment "/ni:network-instances/ni:network-instance/ni:ni-type" +
          "/l3vpn:l3vpn/l3vpn:l3vpn" {
    description "Augment for l3vpn instance";
    container vnis {
      description "Vni list for l3vpn.";
      list vni {
        key "vni-id";
        description
          "Vni for current l3vpn instance.";
        leaf vni-id {
          type uint32 {
            range "1..16777215";
          }
          description
            "The ID of the VNI.";
        }
      }
    }
  }

  augment "/ni:network-instances/ni:network-instance/ni:ni-type" +
          "/l2vpn:l2vpn" {
    description "Augment for l2vpn instance.";
    container vnis {
      description "Vni list for l2vpn.";
      list vni {
        key "vni-id";
        description
          "Vni for current l2vpn instance.";
        leaf vni-id {
          type uint32 {
            range "1..16777215";
          }
          description
            "The ID of the VNI.";
        }
        container split-horizon {
          description "Configure NVO3 split-horizon information.";
          leaf split-horizon-mode {
            type vni-bind-type;
            default "hub-mode";
            description
              "Split horizon mode.";
          }
          leaf split-group {
            when "(../split-horizon-mode='split-group-mode')";
            type string {
              length "1..31";
            }
            description
              "Split group name.";
          }
        }
      }
    }
  }

  rpc reset-vni-instance-statistic {
    description
      "Clear traffic statistics about the VNI.";
    input {
      leaf vni-id {
        type uint32 {
          range "1..16777215";
        }
        mandatory true;
        description
          "The ID of the VNI.";
      }
    }
  }
  rpc reset-vni-peer-statistic {
    description
      "Clear traffic statistics about the VXLAN tunnel.";
    input {
      leaf vni-id {
        type uint32 {
          range "1..16777215";
        }
        mandatory true;
        description
          "The ID of the VNI.";
      }
      leaf peer-ip {
        type inet:ip-address-no-zone;
        mandatory true;
        description
          "The address of the remote NVE.";
      }
      leaf direction{
        type direction-type;
        mandatory true;
        description
          "Traffic statistics direction for the tunnel.";
      }
    }
  }
}
  <code end>
 ]]></artwork>
        </figure>
  </section>
   </section>
	<section anchor="Security" numbered="true" toc="default">
      <name>Security Considerations</name>
     <t>This document raises no new security issues.</t>
    </section>
	
   <section anchor="IANA" numbered="true" toc="default">
      <name>IANA Considerations</name>
	<t>This document registers a URI in the IETF XML registry <xref target="RFC3688"/>. Following the format in <xref target="RFC3688"/>, the following registration is requested to be made:</t>
	<artwork>
    URI: urn:ietf:params:xml:ns:yang:ietf-nvo3-base
    Registrant Contact: The IESG.
    XML: N/A, the requested URI is an XML namespace.
	</artwork>
	<t>This document requests to register a YANG module in the YANG Module Names registry <xref target="RFC7950"/>.</t>
    <artwork>
    Name: ietf-nvo3-base
    Namespace: urn:ietf:params:xml:ns:yang:ietf-nvo3-base
    Maintained by IANA: N
    Prefix: nvo3
    Reference: RFC XXXX
	</artwork>
	 </section>
	
	<section anchor="Acknowledgements" numbered="true" toc="default">
    <name>Acknowledgements</name>
    <t>The authors would like to thank Haibo Wang, Yuan Gao, Guannan Shi, Gang Yan, Mingui Zhang, Yubao Wang, Ruixue Wang and Sijun Weng many others for their helpful comments and suggestions.</t>
    </section>
  </middle>
  <back>
 <references title="References">
 <references title="Normative References">
      <?rfc include='reference.RFC.2119'?>
      <?rfc include='reference.RFC.3688'?>
      <?rfc include='reference.RFC.6241'?>
	  <?rfc include='reference.RFC.6991'?>
	  <?rfc include='reference.RFC.7950'?>
	  <?rfc include='reference.RFC.8040'?>
      <?rfc include='reference.RFC.8174'?>
      <?rfc include='reference.RFC.8340'?>
      <?rfc include='reference.RFC.8349'?>
      <?rfc include='reference.RFC.8365'?>
      <?rfc include='reference.RFC.8342'?>
	  <?rfc include='reference.RFC.8343'?>
      <?rfc include='reference.RFC.8529'?>
      <?rfc include='reference.RFC.9135'?>
      <?rfc include='reference.I-D.ietf-bess-l2vpn-yang'?>
      <?rfc include='reference.I-D.ietf-bess-l3vpn-yang'?>
    </references>
   <references title="Informative References">
   <?rfc include='reference.RFC.7365'?>
   <?rfc include='reference.RFC.7348'?>
   <?rfc include='reference.RFC.7637'?>
   <?rfc include='reference.RFC.8014'?>
   <?rfc include='reference.RFC.8293'?>
   <?rfc include='reference.RFC.8926'?>
   <?rfc include='reference.RFC.9469'?>
   <?rfc include='reference.I-D.ietf-nvo3-vxlan-gpe'?>
    </references>
 </references>
 </back>
</rfc>
