<?xml version="1.0" encoding="US-ASCII"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
    <!ENTITY RFC2119 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.2119.xml'>
    <!ENTITY RFC3688 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.3688.xml'>
    <!ENTITY RFC5714 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.5714.xml'>
    <!ENTITY RFC6020 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6020.xml'>
    <!ENTITY RFC6241 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6241.xml'>
    <!ENTITY RFC6242 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6242.xml'>
    <!ENTITY RFC6991 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.6991.xml'>
    <!ENTITY RFC7950 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.7950.xml'>
    <!ENTITY RFC8040 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8040.xml'>
    <!ENTITY RFC8174 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8174.xml'>
    <!ENTITY RFC8340 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8340.xml'>
    <!ENTITY RFC8341 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8341.xml'>
    <!ENTITY RFC8342 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8342.xml'>
    <!ENTITY RFC8343 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8343.xml'>
    <!ENTITY RFC8349 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8349.xml'>
    <!ENTITY RFC8446 PUBLIC ''
      'http://xml.resource.org/public/rfc/bibxml/reference.RFC.8446.xml'>
    ]>
<?xml-stylesheet type='text/xsl' href='rfc2629.xslt' ?>
<?rfc strict="no" ?>
<?rfc toc="yes" ?>
<?rfc symrefs="yes" ?>
<?rfc sortrefs="yes"?>

<?rfc rfcedstyle="yes" ?>
<?rfc subcompact="no" ?>

<rfc category="std" ipr="trust200902" docName="draft-ietf-rtgwg-yang-rib-extend-13" >

<front>
<title abbrev="YANG RIB-EXT">RIB Extension YANG Data Model</title>
   <author initials='A.' surname="Lindem" fullname='Acee Lindem'>
    <organization>LabN</organization>
    <address>
      <postal>
        <street>301 Midenhall Way</street>
        <city>Cary</city> <region>NC</region>
        <country>USA</country>
        <code>27513</code>
       </postal>
       <email>acee@cisco.com</email>
    </address>
    </author>
    <author fullname="Yingzhen Qu" initials="Y" surname="Qu">
      <organization>Futurewei</organization>
      <address>
        <postal>
          <street>2330 Central Expressway</street>
          <city>Santa Clara</city>
          <region>CA</region>
          <code>95050</code>
          <country>USA</country>
        </postal>
        <phone></phone>
        <email>yingzhen.qu@futurewei.com</email>
      </address>
    </author>
  <date/>
  <abstract>
     <t>A Routing Information Base (RIB) is a list of routes and their
        corresponding administrative data and operational state.</t>

     <t>RFC 8349 defines the
     basic building blocks for RIB, and this model augments it to support
     multiple next-hops (aka, paths) for each route as well as additional
     attributes.</t>
  </abstract>
</front>

<middle>
<section title="Introduction">
  <t>This document defines a YANG <xref target="RFC7950"/>
  data model which extends the RIBs defined in ietf-routing YANG module
  <xref target="RFC8349"/> with more route attributes.</t>

<t>A RIB is a collection of routes with attributes controlled and 
  manipulated by control-plane protocols. Each RIB contains only routes
  of one address family <xref target="RFC8349"/>. Within a protocol,
routes are selected based on the metrics in use by that protocol, and
the protocol installs the routes to RIB. RIB selects the preferred routes
by comparing the route-preference (aka, administrative distance) of
the associated protocol.</t>
<t>The module defined in this document extends the RIBs to support more
route attributes, such as multiple next-hops, route metrics, and
administrative tags.</t>
<t> The YANG modules in this document conform to the Network Management
Datastore Architecture (NMDA) [RFC8342].</t>
</section>

<section title="Terminology and Notation">
  <t>The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL
     NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED",
     "MAY", and "OPTIONAL" in this document are to be interpreted as
     described in BCP 14 <xref target="RFC2119"/> <xref target="RFC8174"/>
     when, and only when, they appear in all capitals, as shown here.</t>
  <t>The following terms are defined in <xref target="RFC8342"/>:
    <list style="symbols">
        <t>configuration</t>
        <t>system state</t>
        <t>operational state</t>
      </list></t>

      <t>The following terms are defined in <xref target="RFC7950"/>:
      <list style="symbols">
        <t>action</t>
        <t>augment</t>
        <t>container</t>
        <t>container with presence</t>
        <t>data model</t>
        <t>data node</t>
        <t>leaf</t>
        <t>list</t>
        <t>mandatory node</t>
        <t>module</t>
        <t>schema tree</t>
        <t>RPC (Remote Procedure Call) operation</t>
      </list></t>
      <t>The following terms are defined in <xref target="RFC8349"/> Section 5.2:
      <list style="symbols">
        <t>RIB</t>
      </list></t>
  <section title="Tree Diagrams">
    <t>Tree diagrams used in this document follow the notation defined in  <xref target="RFC8340"/>.</t>
  </section>
  <section anchor="sec.prefixes" title="Prefixes in Data Node Names">
      <t>In this document, names of data nodes, actions, and other
        data model objects are often used without a prefix, as long as
        it is clear from the context in which YANG module each name is
        defined. Otherwise, names are prefixed using the standard prefix
        associated with the corresponding YANG module, as shown in <xref target="tab.prefixes"/>.</t>

        <texttable anchor="tab.prefixes" title="Prefixes and Corresponding YANG Modules">
          <ttcol>Prefix</ttcol>
          <ttcol>YANG module</ttcol>
          <ttcol>Reference</ttcol>
          <c>if</c><c>ietf-interfaces</c><c><xref target="RFC8343"/></c>
          <c>rt</c><c>ietf-routing</c><c><xref target="RFC8349"/></c>
          <c>v4ur</c><c>ietf-ipv4-unicast-routing</c>
          <c><xref target="RFC8349"/></c>
          <c>v6ur</c><c>ietf-ipv6-unicast-routing</c>
          <c><xref target="RFC8349"/></c>
          <c>inet</c><c>ietf-inet-types</c><c><xref target="RFC6991"/></c>
        </texttable>
      </section>
</section>

<section title="Design of the Model">
<t>The YANG module defined in this document augments the ietf-routing YANG model
defined in <xref target="RFC8349"/>, which provides a basis
for routing system data model development. Together with YANG modules defined in
<xref target="RFC8349"/>, a generic RIB YANG model is defined to
implement and monitor a RIB.</t>
<t>The models in <xref target="RFC8349"/> also define the basic
  configuration and operational state for both IPv4 and IPv6 static routes. This document
  provides  augmentations for static routes to support multiple next-hops
  and more next-hop attributes.
</t>

<section title="Tags and Preference">
<t>Individual route tags are supported at both the route and next-hop level.
A preference per next-hop is also supported for selection of the most preferred
reachable static route.</t>
<t>The following tree snapshot shows tag and preference which augment
  static IPv4 unicast routes and IPv6 unicast routes next-hop.</t>
<figure>
<artwork>
  augment /rt:routing/rt:control-plane-protocols
          /rt:control-plane-protocol/rt:static-routes/v4ur:ipv4
          /v4ur:route/v4ur:next-hop/v4ur:next-hop-options
          /v4ur:simple-next-hop:
    +--rw preference?   uint32
    +--rw tag?          uint32
  augment /rt:routing/rt:control-plane-protocols
          /rt:control-plane-protocol/rt:static-routes/v4ur:ipv4
          /v4ur:route/v4ur:next-hop/v4ur:next-hop-options
          /v4ur:next-hop-list/v4ur:next-hop-list/v4ur:next-hop:
    +--rw preference?   uint32
    +--rw tag?          uint32
  augment /rt:routing/rt:control-plane-protocols
          /rt:control-plane-protocol/rt:static-routes/v6ur:ipv6
          /v6ur:route/v6ur:next-hop/v6ur:next-hop-options
          /v6ur:simple-next-hop:
    +--rw preference?   uint32
    +--rw tag?          uint32
  augment /rt:routing/rt:control-plane-protocols
          /rt:control-plane-protocol/rt:static-routes/v6ur:ipv6
          /v6ur:route/v6ur:next-hop/v6ur:next-hop-options
          /v6ur:next-hop-list/v6ur:next-hop-list/v6ur:next-hop:
    +--rw preference?   uint32
    +--rw tag?          uint32
</artwork>
</figure>
</section>
<section title="Repair Path">
<t>The IP Fast Reroute (IPFRR) pre-computes repair
paths by routing protocols <xref target="RFC5714"/>, and the repair
paths are installed in the RIB.</t>
<t>Each route in the RIB is augmented with repair paths if available,
and is shown in the following tree snapshot.</t>
<figure>
<artwork>

  augment /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route
          /rt:next-hop/rt:next-hop-options/rt:simple-next-hop:
    +--ro repair-path
       +--ro outgoing-interface?   if:interface-state-ref
       +--ro next-hop-address?     inet:ip-address
       +--ro metric?               uint32
  augment /rt:routing/rt:ribs/rt:rib/rt:routes/rt:route
          /rt:next-hop/rt:next-hop-options/rt:next-hop-list
          /rt:next-hop-list/rt:next-hop:
    +--ro repair-path
       +--ro outgoing-interface?   if:interface-state-ref
       +--ro next-hop-address?     inet:ip-address
       +--ro metric?               uint32
</artwork>
</figure>
</section>
</section>

<section anchor="rib.tree" title="RIB Model Tree">
 <t> The ietf-routing.yang tree with the augmentations herein is
  included in <xref target="full-tree"/>. The meaning of the symbols
  can be found in <xref target="RFC8340"/>.</t>
</section>

<section title="RIB Extension YANG Model">
<figure>
<artwork><![CDATA[
<CODE BEGINS> file "ietf-rib-extension@2021-10-17.yang"
module ietf-rib-extension {
  yang-version "1.1";
  namespace "urn:ietf:params:xml:ns:yang:ietf-rib-extension";

  prefix rib-ext;

  import ietf-inet-types {
    prefix "inet";
    reference "RFC 6991: Common YANG Data Types";
  }

  import ietf-interfaces {
    prefix "if";
    reference "RFC 8343: A YANG Data Model for Interface
                         Management (NMDA Version)";
  }

  import ietf-routing {
    prefix "rt";
    reference "RFC 8349: A YANG Data Model for Routing
                         Management (NMDA Version)";
  }

  import ietf-ipv4-unicast-routing {
    prefix "v4ur";
    reference "RFC 8349: A YANG Data Model for Routing
                         Management (NMDA Version)";
  }

  import ietf-ipv6-unicast-routing {
    prefix "v6ur";
    reference "RFC 8349: A YANG Data Model for Routing
                         Management (NMDA Version)";
  }

  organization
    "IETF RTGWG - Routing Working Group";

  contact
    "WG Web:   <http://datatracker.ietf.org/group/rtgwg/>
     WG List:  <mailto:rtgwg@ietf.org>

     Author:   Acee Lindem
               <mailto:acee.ietf@gmail.com>
     Author:   Yingzhen Qu
               <mailto:yingzhen.qu@futurewei.com>";

  description
    "This document defines a YANG data model which extends 
     the RIBs defined in ietf-routing YANG module with more 
     route attributes.

     This YANG model conforms to the Network Management
     Datastore Architecture (NDMA) as described in RFC 8342.

     Copyright (c) 2023 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 2023-04-17 {
    description
      "Initial Version";
    reference
      "RFC XXXX: A YANG Data Model for RIB Extensions.";
  }

  /* Groupings */
  grouping rib-statistics {
    description
      "Statistics grouping used for RIB augmentation.";
    container statistics {
      config false;
      description
        "Container for RIB statistics.";
      leaf total-routes {
        type uint32;
        description
          "Total routes in the RIB";
      }
      leaf total-active-routes {
        type uint32;
        description
          "Total active routes in the RIB. An active route is
           preferred over other routes to the same destination
           prefix.";
      }
      leaf total-route-memory {
        type uint64;
        units "bytes";
        description
          "Total memory for all routes in the RIB.";
      }
      list protocol-statistics {
        description "RIB statistics per protocol.";
        leaf protocol {
          type identityref {
            base rt:routing-protocol;
          }
          description "Routing protocol.";
        }
        leaf routes {
          type uint32;
          description
            "Total routes for protocol in the RIB.";
        }
        leaf active-routes {
          type uint32;
          description
            "Total active routes for protocol in the RIB. An active
             route is preferred over other routes to the same
             destination prefix.";
        }
        leaf route-memory {
          type uint64;
          units "bytes";
          description
            "Total memory for all routes for protocol in the RIB.";
        }
      }
    }
  }

  grouping next-hop {
    description
      "Next-hop grouping";
    leaf interface {
      type if:interface-ref;
      description
        "Outgoing interface";
    }
    leaf address {
      type inet:ip-address;
      description
        "IPv4 or IPv6 Address of the next-hop.";
    }
  }

  grouping attributes {
    description
      "Common attributes applicable to all routes.";
    leaf metric {
      type uint32;
      description
        "The metric is a numeric value indicating the cost
         of the route from the perspective of the routing
         protocol installing the route. In general, routes with
         a lower metric installed by the same routing protocol
         are lower cost to reach and are preferable to routes
         with a higher metric. However, metrics from different
         routing protocols are not directly comparable.";
    }
    leaf-list tag {
      type uint32;
      description
        "A tag is a 32-bit opaque value associated with the
         route that can be used for policy decisions such as
         advertisement and filtering of the route.";
    }
    leaf application-tag {
      type uint32;
      description
        "The application-specific tag is an additional tag that
         can be used by applications that require semantics and/or
         policy different from that of the tag. For example,
         the tag is usually automatically advertised in OSPF
         AS-External Link State Advertisements (LSAs) while this
         application-specific tag is not advertised implicitly.";
    }
  }
  grouping repair-path {
    description
      "Grouping for IP Fast Reroute repair path.";
    container repair-path {
      description
        "IP Fast Reroute next-hop repair path.";
      leaf outgoing-interface {
        type if:interface-state-ref;
        description
          "Name of the outgoing interface.";
      }
      leaf next-hop-address {
        type inet:ip-address;
        description
          "IP address of the next hop.";
      }
      leaf metric {
        type uint32;
        description
          "The metric for the repair path. While the IP Fast
           Reroute re-route repair is local and the metric is
           not advertised externally, the metric for repair path
           is useful for troubleshooting purposes.";
      }
      reference
        "RFC 5714: IP Fast Reroute Framework.";
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
    + "rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/"
    + "v4ur:route/v4ur:next-hop/v4ur:next-hop-options/"
    + "v4ur:simple-next-hop"
  {
    description
      "Augment 'simple-next-hop' case in IPv4 unicast route.";
    leaf preference {
      type uint32;
      default "1";
      description
        "The preference is used to select among multiple static
         routes. Routes with a lower preference next-hop are
         preferred and equal preference routes result in
         Equal-Cost-Multi-Path (ECMP) static routes.";
    }
    leaf tag {
      type uint32;
      default "0";
      description
        "The tag is a 32-bit opaque value associated with the
         route that can be used for policy decisions such as
         advertisement and filtering of the route.";
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
    + "rt:control-plane-protocol/rt:static-routes/v4ur:ipv4/"
    + "v4ur:route/v4ur:next-hop/v4ur:next-hop-options/"
    + "v4ur:next-hop-list/v4ur:next-hop-list/v4ur:next-hop"
  {
    description
      "Augment static route configuration 'next-hop-list'.";

    leaf preference {
      type uint32;
      default "1";
      description
        "The preference is used to select among multiple static
         routes. Routes with a lower preference next-hop are
         preferred and equal preference routes result in
         Equal-Cost-Multi-Path (ECMP) static routes.";
    }
    leaf tag {
      type uint32;
      default "0";
      description
        "The tag is a 32-bit opaque value associated with the
         route that can be used for policy decisions such as
         advertisement and filtering of the route.";
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
    + "rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/"
    + "v6ur:route/v6ur:next-hop/v6ur:next-hop-options/"
    + "v6ur:simple-next-hop"
  {
    description
      "Augment 'simple-next-hop' case in IPv6 unicast route.";
    leaf preference {
      type uint32;
      default "1";
      description
        "The preference is used to select among multiple static
         routes. Routes with a lower preference next-hop are
         preferred and equal preference routes result in
         Equal-Cost-Multi-Path (ECMP) static routes.";
    }
    leaf tag {
      type uint32;
      default "0";
      description
        "The tag is a 32-bit opaque value associated with the
         route that can be used for policy decisions such as
         advertisement and filtering of the route.";
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
    + "rt:control-plane-protocol/rt:static-routes/v6ur:ipv6/"
    + "v6ur:route/v6ur:next-hop/v6ur:next-hop-options/"
    + "v6ur:next-hop-list/v6ur:next-hop-list/v6ur:next-hop"
  {
    description
      "Augment static route configuration 'next-hop-list'.";

    leaf preference {
      type uint32;
      default "1";
      description
        "The preference is used to select among multiple static
         routes. Routes with a lower preference next-hop are
         preferred and equal preference routes result in
         Equal-Cost-Multi-Path (ECMP) static routes.";
    }
    leaf tag {
      type uint32;
      default "0";
      description
        "The tag is a 32-bit opaque value associated with the
         route that can be used for policy decisions such as
         advertisement and filtering of the route.";
    }
  }

  augment "/rt:routing/rt:ribs/rt:rib"
  {
    description
      "Augment a RIB with statistics.";
    uses rib-statistics;
  }

  augment "/rt:routing/rt:ribs/rt:rib/"
    + "rt:routes/rt:route"
  {
    description
      "Augment a route in RIB with attributes.";
    uses attributes;
  }

  augment "/rt:routing/rt:ribs/rt:rib/"
    + "rt:routes/rt:route/rt:next-hop/rt:next-hop-options/"
    + "rt:simple-next-hop"
  {
    description
      "Augment simple-next-hop with repair-path.";
    uses repair-path;
  }

  augment "/rt:routing/rt:ribs/rt:rib/"
    + "rt:routes/rt:route/rt:next-hop/rt:next-hop-options/"
    + "rt:next-hop-list/rt:next-hop-list/rt:next-hop"
  {
    description
      "Augment the multiple next hops with repair path.";
    uses repair-path;
  }
}
<CODE ENDS>
]]></artwork>
</figure>
</section>

<section title="Security Considerations">
    <t>The YANG module specified in this document defines a schema for
       data that is designed to be accessed via network
       management protocols such as NETCONF <xref target="RFC6241"/> or
       RESTCONF <xref target="RFC8040"/>. The lowest NETCONF layer is the secure transport
       layer, and the mandatory-to-implement secure transport is Secure Shell (SSH)
       <xref target="RFC6242"/>. The lowest RESTCONF layer is HTTPS, and the
       mandatory-to-implement secure transport is TLS <xref target="RFC8446"/>.</t>

   <t>The NETCONF access control model <xref target="RFC8341"/> provides the
      means to restrict access for particular NETCONF or RESTCONF users to a
      pre-configured subset of all available NETCONF or RESTCONF protocol
      operations and content.</t>

   <t>There are a number of data nodes defined in ietf-rib-extensions.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="empty">
      <t>/v4ur:next-hop-options/v4ur:simple-next-hop/rib-ext:preference</t>
      <t>/v4ur:next-hop-options/v4ur:simple-next-hop/rib-ext:tag</t>
      <t>/v4ur:next-hop-options/v4ur:next-hop-list/v4ur:next-hop-list
      /v4ur:next-hop/rib-ext:preference</t>
      <t>/v4ur:next-hop-options/v4ur:next-hop-list/v4ur:next-hop-list
      /v4ur:next-hop/rib-ext:tag</t>
      <t>/v6ur:next-hop-options/v6ur:simple-next-hop/rib-ext:preference</t>
      <t>/v6ur:next-hop-options/v6ur:simple-next-hop/rib-ext:tag</t>
      <t>/v6ur:next-hop-options/v6ur:next-hop-list/v6ur:next-hop-list
      /v6ur:next-hop/rib-ext:preference</t>
      <t>/v6ur:next-hop-options/v6ur:next-hop-list/v6ur:next-hop-list
      /v6ur:next-hop/rib-ext:tag</t> 
      <t>For these augmentations to ietf-routing.yang, the ability to delete, add, and modify IPv4 and
      IPv6 static route preference and tag would allow traffic to be misrouted.</t></list></t>

   <t>Some of the readable data nodes in the ietf-rib-extensions.yang module may be
      considered sensitive or vulnerable in some network environments. It is thus
      important to control read access (e.g., via get, get-config, or notification)
      to these data nodes. These are the subtrees and data nodes and
      their sensitivity/vulnerability:
      <list style="empty">
      <t>/rt:routing/rt:ribs/rt:rib/rib-ext:statistics</t>
      <t>/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rib-ext:metric</t>
      <t>/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route/rib-ext:tag</t>
      <t>/rt:routing/rt:ribs/rt:rib/rt:routes/rt:route
      /rib-ext:application-tag</t>
      <t>/rt:route/rt:next-hop/rt:next-hop-options/rt:simple-next-hop
      /rib-ext:repair-path</t>
      <t>/rt:routes/rt:route/rt:next-hop/rt:next-hop-options
      /rt:next-hop-list/rt:next-hop-list/rt:next-hop/rib-ext:repair-path</t>
      <t>The exposure of the Routing Information Base (RIB) will
      expose the routing topology of the network. This may be undesirable
      due to the fact that exposure may facilitate other attacks. Additionally,
      network operators may consider their topologies to be sensitive confidential
      data.</t></list></t>
   <t>All the security considerations for <xref target="RFC8349"/> writable and
      readable data nodes apply to the augmentations described herein.</t>
</section>

<section title="IANA Considerations">
<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:
   <figure>
   <artwork>
   URI: urn:ietf:params:xml:ns:yang:ietf-rib-extension
   Registrant Contact: The IESG.
   XML: N/A, the requested URI is an XML namespace.
   </artwork>
   </figure>
 </t>

   <t>This document registers a YANG module in the YANG Module Names
   registry <xref target="RFC6020"/>.
   <figure>
   <artwork>
   name: ietf-rib-extension
   namespace: urn:ietf:params:xml:ns:yang:ietf-rib-extension
   prefix: rib-ext
   reference: RFC XXXX
   </artwork>
   </figure>
   </t>
</section>

</middle>

<?rfc needLines="20"?>
<back>
<references title="Normative References">
&RFC2119;
&RFC3688;
&RFC6020;
&RFC6241;
&RFC6242;
&RFC6991;
&RFC7950;
&RFC8040;
&RFC8174;
&RFC8341;
&RFC8342;
&RFC8343;
&RFC8349;
&RFC8446;
</references>

<references title="Informative References">
&RFC5714;
&RFC8340;
</references>
<section anchor="full-tree" title="Combined Tree Diagram">
<t>This appendix includes the combined ietf-routing.yang, ietf-ipv4-unicast-routing.yang,
ietf-ipv6-unicast-routing.yang and ietf-rib-extensions.yang tree diagram.</t>
<figure>
<artwork>
module: ietf-routing
+--rw routing
  +--rw router-id?                 yang:dotted-quad {router-id}?
  +--ro interfaces
  |  +--ro interface*   if:interface-ref
  +--rw control-plane-protocols
  |  +--rw control-plane-protocol* [type name]
  |     +--rw type             identityref
  |     +--rw name             string
  |     +--rw description?     string
  |     +--rw static-routes
  |        +--rw v4ur:ipv4
  |        |  +--rw v4ur:route* [destination-prefix]
  |        |     +--rw v4ur:destination-prefix    inet:ipv4-prefix
  |        |     +--rw v4ur:description?          string
  |        |     +--rw v4ur:next-hop
  |        |        +--rw (v4ur:next-hop-options)
  |        |           +--:(v4ur:simple-next-hop)
  |        |           |  +--rw v4ur:outgoing-interface?
  |        |           |  |   if:interface-ref
  |        |           |  +--rw v4ur:next-hop-address?
  |        |           |  |   inet:ipv4-address
  |        |           |  +--rw rib-ext:preference?        uint32
  |        |           |  +--rw rib-ext:tag?               uint32
  |        |           +--:(v4ur:special-next-hop)
  |        |           |  +--rw v4ur:special-next-hop?     enumeration
  |        |           +--:(v4ur:next-hop-list)
  |        |              +--rw v4ur:next-hop-list
  |        |                 +--rw v4ur:next-hop* [index]
  |        |                    +--rw v4ur:index                 string
  |        |                    +--rw v4ur:outgoing-interface?
  |        |                    |   if:interface-ref
  |        |                    +--rw v4ur:next-hop-address?
  |        |                    |   inet:ipv4-address
  |        |                    +--rw rib-ext:preference?        uint32
  |        |                    +--rw rib-ext:tag?               uint32
  |        +--rw v6ur:ipv6
  |           +--rw v6ur:route* [destination-prefix]
  |              +--rw v6ur:destination-prefix    inet:ipv6-prefix
  |              +--rw v6ur:description?          string
  |              +--rw v6ur:next-hop
  |                 +--rw (v6ur:next-hop-options)
  |                    +--:(v6ur:simple-next-hop)
  |                    |  +--rw v6ur:outgoing-interface?
  |                    |  |   if:interface-ref
  |                    |  +--rw v6ur:next-hop-address?
  |                    |  |   inet:ipv6-address
  |                    |  +--rw rib-ext:preference?        uint32
  |                    |  +--rw rib-ext:tag?               uint32
  |                    +--:(v6ur:special-next-hop)
  |                    |  +--rw v6ur:special-next-hop?     enumeration
  |                    +--:(v6ur:next-hop-list)
  |                       +--rw v6ur:next-hop-list
  |                          +--rw v6ur:next-hop* [index]
  |                             +--rw v6ur:index                 string
  |                             +--rw v6ur:outgoing-interface?
  |                             |   if:interface-ref
  |                             +--rw v6ur:next-hop-address?
  |                             |   inet:ipv6-address
  |                             +--rw rib-ext:preference?        uint32
  |                             +--rw rib-ext:tag?               uint32
  +--rw ribs
     +--rw rib* [name]
        +--rw name                            string
        +--rw address-family                  identityref
        +--ro default-rib?                    boolean {multiple-ribs}?
        +--ro routes
        |  +--ro route* []
        |     +--ro route-preference?          route-preference
        |     +--ro next-hop
        |     |  +--ro (next-hop-options)
        |     |     +--:(simple-next-hop)
        |     |     |  +--ro outgoing-interface?      if:interface-ref
        |     |     |  +--ro v4ur:next-hop-address?   inet:ipv4-address
        |     |     |  +--ro v6ur:next-hop-address?   inet:ipv6-address
        |     |     |  +--ro rib-ext:repair-path
        |     |     |     +--ro rib-ext:outgoing-interface?
        |     |     |     |   if:interface-state-ref
        |     |     |     +--ro rib-ext:next-hop-address?
        |     |     |     |   inet:ip-address
        |     |     |     +--ro rib-ext:metric?               uint32
        |     |     +--:(special-next-hop)
        |     |     |  +--ro special-next-hop?        enumeration
        |     |     +--:(next-hop-list)
        |     |        +--ro next-hop-list
        |     |           +--ro next-hop* []
        |     |              +--ro outgoing-interface?
        |     |              |   if:interface-ref
        |     |              +--ro v4ur:address?
        |     |              |   inet:ipv4-address
        |     |              +--ro v6ur:address?
        |     |              |   inet:ipv6-address
        |     |              +--ro rib-ext:repair-path
        |     |                 +--ro rib-ext:outgoing-interface?
        |     |                 |   if:interface-state-ref
        |     |                 +--ro rib-ext:next-hop-address?
        |     |                 |   inet:ip-address
        |     |                 +--ro rib-ext:metric?            uint32
        |     +--ro source-protocol            identityref
        |     +--ro active?                    empty
        |     +--ro last-updated?              yang:date-and-time
        |     +--ro v4ur:destination-prefix?   inet:ipv4-prefix
        |     +--ro v6ur:destination-prefix?   inet:ipv6-prefix
        |     +--ro rib-ext:metric?            uint32
        |     +--ro rib-ext:tag*               uint32
        |     +--ro rib-ext:application-tag?   uint32
        +---x active-route
        |  +---w input
        |  |  +---w v4ur:destination-address?   inet:ipv4-address
        |  |  +---w v6ur:destination-address?   inet:ipv6-address
        |  +--ro output
        |     +--ro route
        |        +--ro next-hop
        |        |  +--ro (next-hop-options)
        |        |     +--:(simple-next-hop)
        |        |     |  +--ro outgoing-interface?    if:interface-ref
        |        |     |  +--ro v4ur:next-hop-address? inet:ipv4-address
        |        |     |  +--ro v6ur:next-hop-address? inet:ipv6-address
        |        |     +--:(special-next-hop)
        |        |     |  +--ro special-next-hop?        enumeration
        |        |     +--:(next-hop-list)
        |        |        +--ro next-hop-list
        |        |           +--ro next-hop* []
        |        |              +--ro outgoing-interface?
        |        |              |   if:interface-ref
        |        |              +--ro v4ur:next-hop-address?
        |        |              |   inet:ipv4-address
        |        |              +--ro v6ur:next-hop-address?
        |        |              |   inet:ipv6-address
        |        +--ro source-protocol            identityref
        |        +--ro active?                    empty
        |        +--ro last-updated?              yang:date-and-time
        |        +--ro v4ur:destination-prefix?   inet:ipv4-prefix
        |        +--ro v6ur:destination-prefix?   inet:ipv6-prefix
        +--rw description?                      string
        +--ro rib-ext:statistics
           +--ro rib-ext:total-routes?              uint32
           +--ro rib-ext:total-active-routes?       uint32
           +--ro rib-ext:total-route-memory?        uint64
           +--ro rib-ext:protocol-statistics* []
              +--ro rib-ext:protocol?             identityref
              +--ro rib-ext:routes?    uint32
              +--ro rib-ext:active-routes?   uint32
              +--ro rib-ext:route-memory?    uint64

</artwork>
</figure>
</section>
<section anchor="examples" title="ietf-rib-extension.yang example">
<t>The following is an XML example using the RIB extension module
  and RFC 8349.</t>
  <figure>
  <artwork><![CDATA[
<routing xmlns="urn:ietf:params:xml:ns:yang:ietf-routing">
  <control-plane-protocols>
    <control-plane-protocol>
      <type>static</type>
      <name>static-routing-protocol</name>
      <static-routes>
        <ipv4 xmlns="urn:ietf:params:xml:ns:yang:\
          ietf-ipv4-unicast-routing">
          <route>
            <destination-prefix>0.0.0.0/0</destination-prefix>
            <next-hop>
              <next-hop-address>192.0.2.2</next-hop-address>
              <preference xmlns="urn:ietf:params:xml:ns:yang:\
                ietf-rib-extension">30</preference>
              <tag xmlns="urn:ietf:params:xml:ns:yang:\
                ietf-rib-extension">99</tag>
            </next-hop>
          </route>
        </ipv4>
        <ipv6 xmlns="urn:ietf:params:xml:ns:yang:\
          ietf-ipv6-unicast-routing">
          <route>
            <destination-prefix>::/0</destination-prefix>
            <next-hop>
              <next-hop-address>2001:db8:aaaa::1111</next-hop-address>
              <preference xmlns="urn:ietf:params:xml:ns:yang:\
                ietf-rib-extension">30</preference>
              <tag xmlns="urn:ietf:params:xml:ns:yang:\
                ietf-rib-extension">66</tag>
            </next-hop>
          </route>
        </ipv6>
      </static-routes>
    </control-plane-protocol>
  </control-plane-protocols>
  <ribs>
    <rib>
      <name>ipv4-master</name>
      <address-family xmlns:v4ur="urn:ietf:params:xml:ns:yang:\
        ietf-ipv4-unicast-routing">v4ur:ipv4-unicast</address-family>
      <default-rib>true</default-rib>
      <routes>
        <route>
          <destination-prefix xmlns="urn:ietf:params:xml:ns:yang:\
            ietf-ipv4-unicast-routing">0.0.0.0/0</destination-prefix>
          <next-hop>
            <next-hop-address xmlns="urn:ietf:params:xml:ns:yang:\
              ietf-ipv4-unicast-routing">192.0.2.2</next-hop-address>
          </next-hop>
          <route-preference>5</route-preference>
          <source-protocol>static</source-protocol>
          <last-updated>2015-10-24T18:02:45+02:00</last-updated>
        </route>
        <route>
          <destination-prefix xmlns="urn:ietf:params:xml:ns:yang:\
            ietf-ipv4-unicast-routing">198.51.100.0/24\
          </destination-prefix>
          <next-hop>
            <next-hop-address xmlns="urn:ietf:params:xml:ns:yang:\
              ietf-ipv4-unicast-routing">192.0.2.2</next-hop-address>
            <repair-path xmlns="urn:ietf:params:xml:ns:yang:\
              ietf-rib-extension">
              <next-hop-address>203.0.113.1</next-hop-address>
              <metric>200</metric>
            </repair-path>
          </next-hop>
          <route-preference>110</route-preference>
          <source-protocol xmlns:ospf="urn:ietf:params:xml:ns:yang:\
            ietf-ospf">ospf:ospf</source-protocol>
          <last-updated>2015-10-24T18:02:45+02:00</last-updated>
        </route>
      </routes>
    </rib>
    <rib>
      <name>ipv6-master</name>
      <address-family xmlns:v6ur="urn:ietf:params:xml:ns:yang:\
        ietf-ipv6-unicast-routing">v6ur:ipv6-unicast</address-family>
      <default-rib>true</default-rib>
      <routes>
        <route>
          <destination-prefix xmlns="urn:ietf:params:xml:ns:yang:\
            ietf-ipv6-unicast-routing">0::/0</destination-prefix>
          <next-hop>
            <next-hop-address xmlns="urn:ietf:params:xml:ns:yang:\
              ietf-ipv6-unicast-routing">2001:db8:aaaa::1111\
            </next-hop-address>
          </next-hop>
          <route-preference>5</route-preference>
          <source-protocol>static</source-protocol>
          <last-updated>2015-10-24T18:02:45+02:00</last-updated>
        </route>
        <route>
          <destination-prefix xmlns="urn:ietf:params:xml:ns:yang:\
            ietf-ipv6-unicast-routing">2001:db8:bbbb::/64\
          </destination-prefix>
          <next-hop>
            <next-hop-address xmlns="urn:ietf:params:xml:ns:yang:\
              ietf-ipv6-unicast-routing">2001:db8:aaaa::1111\
            </next-hop-address>
            <repair-path xmlns="urn:ietf:params:xml:ns:yang:\
              ietf-rib-extension">
              <next-hop-address>2001:db8:cccc::2222</next-hop-address>
              <metric>200</metric>
            </repair-path>
          </next-hop>
          <route-preference>110</route-preference>
          <source-protocol xmlns:ospf="urn:ietf:params:xml:ns:yang:\
            ietf-ospf">ospf:ospf</source-protocol>
          <last-updated>2015-10-24T18:02:45+02:00</last-updated>
        </route>
      </routes>
    </rib>
  </ribs>
</routing>
 ]]>
  </artwork>
</figure>
  <t>The following is the same example using JSON format.</t>
    <figure>
  <artwork><![CDATA[
{
  "ietf-routing:routing": {
    "control-plane-protocols": {
      "control-plane-protocol": [
        {
          "type": "static",
          "name": "static-routing-protocol",
          "static-routes": {
            "ietf-ipv4-unicast-routing:ipv4": {
              "route": [
                {
                  "destination-prefix": "0.0.0.0/0",
                  "next-hop": {
                    "next-hop-address": "192.0.2.2",
                    "ietf-rib-extension:preference": 30,
                    "ietf-rib-extension:tag": 99
                  }
                }
              ]
            },
            "ietf-ipv6-unicast-routing:ipv6": {
              "route": [
                {
                  "destination-prefix": "::/0",
                  "next-hop": {
                    "next-hop-address": "2001:db8:aaaa::1111",
                    "ietf-rib-extension:preference": 30,
                    "ietf-rib-extension:tag": 66
                  }
                }
              ]
            }
          }
        }
      ]
    },
    "ribs": {
      "rib": [
        {
          "name": "ipv4-master",
          "address-family": "ietf-ipv4-unicast-routing:ipv4-unicast",
          "default-rib": true,
          "routes": {
            "route": [
              {
                "next-hop": {
                  "ietf-ipv4-unicast-routing:next-hop-address": \
                  "192.0.2.2"
                },
                "route-preference": 5,
                "source-protocol": "static",
                "last-updated": "2015-10-24T18:02:45+02:00",
                "ietf-ipv4-unicast-routing:destination-prefix": \
                "0.0.0.0/0"
              },
              {
                "next-hop": {
                  "ietf-rib-extension:repair-path": {
                    "next-hop-address": "203.0.113.1",
                    "metric": 200
                  },
                  "ietf-ipv4-unicast-routing:next-hop-address": \
                  "192.0.2.2"
                },
                "route-preference": 110,
                "source-protocol": "ietf-ospf:ospf",
                "last-updated": "2015-10-24T18:02:45+02:00",
                "ietf-ipv4-unicast-routing:destination-prefix": \
                "198.51.100.0/24"
              }
            ]
          }
        },
        {
          "name": "ipv6-master",
          "address-family": "ietf-ipv6-unicast-routing:ipv6-unicast",
          "default-rib": true,
          "routes": {
            "route": [
              {
                "next-hop": {
                  "ietf-ipv6-unicast-routing:next-hop-address": \
                  "2001:db8:aaaa::1111"
                },
                "route-preference": 5,
                "source-protocol": "static",
                "last-updated": "2015-10-24T18:02:45+02:00",
                "ietf-ipv6-unicast-routing:destination-prefix": "::/0"
              },
              {
                "next-hop": {
                  "ietf-rib-extension:repair-path": {
                    "next-hop-address": "2001:db8:cccc::2222",
                    "metric": 200
                  },
                  "ietf-ipv6-unicast-routing:next-hop-address": \
                  "2001:db8:aaaa::1111"
                },
                "route-preference": 110,
                "source-protocol": "ietf-ospf:ospf",
                "last-updated": "2015-10-24T18:02:45+02:00",
                "ietf-ipv6-unicast-routing:destination-prefix": \
                "2001:db8:bbbb::/64"
              }
            ]
          }
        }
      ]
    }
  }
}
     ]]>
  </artwork>
</figure>
</section>
<?rfc needLines="100"?>
<section title="Acknowledgments">
  <t>The RFC text was produced using Marshall Rose's xml2rfc tool.</t>
  <t>The authors wish to thank Les Ginsberg, Krishna Deevi, and Suyoung Yoon
     for their helpful comments and suggestions.</t>
  <t>The authors wish to thank Tom Petch, Rob Wilton and Chris Hopps for
     their reviews and comments.</t>
</section>
</back>
</rfc>
