<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE rfc [
  <!ENTITY nbsp    "&#160;">
  <!ENTITY zwsp   "&#8203;">
  <!ENTITY nbhy   "&#8209;">
  <!ENTITY wj     "&#8288;">
]>
<rfc xmlns:xi="http://www.w3.org/2001/XInclude" submissionType="IETF" docName="draft-ssangli-idr-bgp-generic-metric-00" category="std" ipr="trust200902" obsoletes="" updates="" xml:lang="en" symRefs="true" sortRefs="true" tocInclude="true" version="3">
  <!-- xml2rfc v2v3 conversion 3.16.0 -->
  <!-- Generated by id2xml 1.5.0 on 2023-03-06T17:34:20Z -->
	<front>
    <title abbrev="Accumulated Metric in NHC attribute">Accumulated Metric in NHC attribute</title>
    <seriesInfo name="Internet-Draft" value="draft-ssangli-idr-bgp-generic-metric-00"/>
    <author initials="S." surname="Sangli" fullname="Srihari Sangli">
      <organization>Juniper Networks Inc.</organization>
      <address>
        <postal>
          <street>Exora Business Park</street>
          <street>Bangalore, KA  560103</street>
          <street>India</street>
        </postal>
        <email>ssangli@juniper.net</email>
      </address>
    </author>
    <author initials="S." surname="Hegde" fullname="Shraddha Hegde">
      <organization>Juniper Networks Inc.</organization>
      <address>
        <postal>
          <street>Exora Business Park</street>
          <street>Bangalore, KA  560103</street>
          <street>India</street>
        </postal>
        <email>shraddha@juniper.net</email>
      </address>
    </author>
    <author initials="R." surname="Das" fullname="Reshma Das">
      <organization>Juniper Networks Inc.</organization>
      <address>
        <postal>
          <street>1133 Innovation Way</street>
          <street>Sunnyvale, CA  94089</street>
          <street>USA</street>
        </postal>
        <email>dreshma@juniper.net</email>
      </address>
    </author>
    <author initials="B." surname="Decraene" fullname="Bruno Decraene">
      <organization>Orange</organization>
      <address>
        <postal>
          <street>France</street>
        </postal>
        <email>bruno.decraene@orange.com</email>
      </address>
    </author>
    <author initials="B." surname="Wen" fullname="Bin Wen">
      <organization>Comcast</organization>
      <address>
        <postal>
          <street>USA</street>
        </postal>
        <email>bin_wen@comcast.com</email>
      </address>
    </author>
    <author initials="M." surname="Kozak" fullname="Marcin Kozak">
      <organization>Comcast</organization>
      <address>
        <postal>
          <street>USA</street>
        </postal>
        <email>marcin_kozak@comcast.com</email>
      </address>
    </author>
    <author initials="J." surname="Dong" fullname="Jie Dong">
      <organization>Huawei</organization>
      <address>
        <postal>
          <street>China</street>
        </postal>
        <email>jie_dong@huawei.com</email>
      </address>
    </author>
    <author initials="L." surname="Jalil" fullname="Luay Jalil">
      <organization>Verizon</organization>
      <address>
        <postal>
          <street>USA</street>
        </postal>
        <email>luay.jalil@verizon.com</email>
      </address>
    </author>
    <author initials="K." surname="Talaulikar" fullname="Ketan Talaulikar">
      <organization>Cisco</organization>
      <address>
        <postal>
          <street>India</street>
        </postal>
        <email>ketant.ietf@gmail.com</email>
      </address>
    </author>
    <date year="2024" month="July" day="05"/>
    <workgroup>IDR</workgroup>
    <abstract>
   <t>RFC7311 describes mechanism for carrying accumulated IGP cost across BGP
   domains however it limits to IGP-metric only. There is a need to accumulate
   and propagate different types of metrics as it will aid in intent-based
   end-to-end path across BGP domains. This document defines BGP extensions 
   for Generic Metric sub-types that enable different types of metrics to be 
   accumulated and carried in BGP. This is applicable when multiple domains 
   exchange BGP routing information.</t>
    </abstract>
  </front>
  <middle>
  <section anchor="Sec-1" numbered="true" toc="default">
      <name>Introduction</name>
      <t>Large Networks belonging to an enterprise may consist of nodes in the
   order of thousands and may span across multiple IGP domains where
   each domain can run separate IGPs or levels/areas. BGP may be used
   to interconnect such IGP domains, with one or more IGP domains within
   an Autonomous System. The enterprise network can have multiple
   Autonomous Systems and BGP may be employed to provide connectivity
   between these domains. Furthermore, BGP can be used to provide
   routing over many such independent administrative
   domains.</t>

      <t>The traffic types have evolved over years and operators have resorted
   to defining different types of metrics within a IGP domain (ISIS or OSPF)
   for IGP path computation. An operator may want to create an end-to-end 
   path that satisfy certain intent. The intent could be to create
   end-to-end path that minimizes one of the metric-types. These metrics
   can be assigned administratively by an operator. While some are
   described in the base ISIS, OSPF specifications, other metrics 
   are the Traffic Engineering Default Metric defined in
   <xref target="RFC5305"/> and <xref target="RFC3630"/>, Min Unidirectional 
   delay metric defined in <xref target="RFC8570"/> and 
   <xref target="RFC7471"/>. There may be other parameters such as jitter, 
   reliability, fiscal cost, etc. that an operator may incorporate while 
   computing the cost of a link. The procedures mentioned in the above 
   specifications describe the IGP path computation within IGP domains.</t>

      <t>For computing the best path for a BGP route in such a domain, the 
   step(e) of the section 9.1.2.2 of 
   <xref target="RFC4271"/> specifies that the interior cost of a route as 
   determined via the IGP metric value is to be used to break the tie among 
   multiple paths. When multiple domains are interconnected via BGP, protocol 
   extensions for advertising best-external path and/or ADDPATH as described 
   in <xref target="RFC7911"/> are employed to take advantage of network 
   connectivity thus providing alternate paths. For each route that is 
   advertised, the IGP cost of the end-to-end path is accumulated and encoded 
   in the AIGP attribute as described in <xref target="RFC7311"/>. This can be 
   used to compute the AIGP-enhanced interior cost and it will be used in the 
   decision process for selecting the best path as documented in section 2 of 
   <xref target="RFC7311"/> . The <xref target="RFC7311"/> specifies how AIGP 
   attribute can carry the accumulated IGP metric value. However, 
   <xref target="RFC7311"/> describes only one TLV (AIGP TLV)
   in the AIGP attribute to carry the IGP cost. Most of the implementations 
   available today encode IGP-metric metric type in the AIGP TLV. See section 
   <xref target="Sec-18"/> for different interpretations of 
   <xref target="RFC7311"/> that are deployed today.</t>

      <t>With the advent of 5G applications and Network Slicing applications,
   for catering to the various traffic constraints, an operator may wish to 
   provision end-to-end paths across multiple domains satisfying required
   intents. This is also known as intent-based inter-domain routing. The 
   description of the problem space and requirements can be found in 
   [I-D.draft-hr-spring-intentaware-routing-using-color]. The Clasful 
   Transport Planes as described in 
   [I-D.draft-ietf-idr-bgp-classful-transport-planes] and and Color-Based 
   Routing as described in [I-D.draft-ietf-idr-bgp-car] describe how 
   intent-based end-to-end paths can be established. The proposal described 
   in this document can be used in conjunction with such architectures.</t>

      <t>If the type of metric used in a IGP domain differs from the 
   accumulated metric type carried in BGP, the metric values should be 
   synchronized and translated between IGP domain and BGP. The metric-type 
   and metric-value in the AIGP TLV does not support different IGP metric-types
   defined in the IGP-Protocol registry for metric-types. Hence there is a need
   to provide a generic metric TLV template to embed the different types of
   IGP metrics and their values in BGP.</t>

      <t>This document proposes "Accumulated Metric" TLV in the 
   Next-Hop Dependent Capability (NHC) attribute described in 
   <xref target="I-D.ietf-idr-entropy-label"/> to carry the accumulated metric 
   value for end-to-end path, hereby referred as AMetric. The AMetric supports 
   all the metric types defined in the IGP-Parameters metric-type registry. 
   Additionally this document provides procedures for computation and usage 
   of accumulated generic metric value during the BGP best path computation.</t>

      <t><xref target="RFC7311"/> introduces the notion that a set of ASes 
   can be under a common administrative domain. This document borrows the same 
   concept, "AMetric administrative domain" to refer to ASes under a common 
   administration within which an operator wishes to establish any 
   intent-based end-to-end path.</t>
  </section>

  <section anchor="Sec-2" 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"/> <xref target="RFC8174"/> when, and only when, 
   they appear in all capitals, as shown here.</t>
  </section>

  <section anchor="Sec-3" numbered="true" toc="default">
      <name>Multiple types of metrics in a network</name>
   <t>Consider the network as shown in <xref target="ure-wan-network"/>. 
   The network has multiple domains. Each domain runs a separate IGP instance.
   Within each domain iBGP sessions are established between the PE routers. 
   The eBGP sessions are established between the Border Routers across 
   domains.</t>

      <figure anchor="ure-wan-network">
        <name>WAN Network</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
    |   IBGP   |  EBGP  |   IBGP   |  EBGP  |   IBGP   |

    +----------+        +----------+        +----------+
    |          |        |          |        |          |
    |        ASBR1+--+ASBR2      ASBR3+--+ASBR4        |
    |          |        |          |        |          |
 PE1+ Domain1  |        | Domain2  |        |  Domain3 |
    |          |        |          |        |          |
    |        ASBR5+---+ASBR6     ASBR7+--+ASBR8        |
    |          |        |          |        |          |
    +----------+        +----------+        +----------+

    |  ISIS1   |        |   ISIS2  |        |  ISIS3   |
]]></artwork>
      </figure>

      <t>An operator wishes to compute end-to-end path optimized for "delay" 
   metric-type. Each domain will be enabled for computation of the IGP paths
   based on delay metric type. As a result, the intra-domain reachability 
   will be based on delay metric. Such values should also be propagated to
   the adjacent domains for effective end-to-end path computation. However, 
   the AIGP TLV in the AIGP attribute as specified in <xref target="RFC7311"/> 
   supports only the default IGP-metric. As a result, with AIGP TLV, only
   default IGP-metric based end-to-end path can be computed and this will not 
   address the operator requirements.</t>

      <t>The <xref target="I-D.ietf-lsr-flex-algo-bw-con"/> proposes extension
   in ISIS and OSPF, a generic metric type that can embed multiple metric types
   within it. It supports both standard metric-types and user-defined 
   metric-types. This document describes extensions in BGP to support such 
   metric types. To compute the end-to-end path with metric other than default
   IGP-metric cost, the new metric TLV for NHC that this document proposes 
   will enable different types of metrics and their values to be accumulated 
   and propagated across the domains.</t>
  </section>

  <section anchor="Sec-4" numbered="true" toc="default">
    <name>Discontinuity in end-to-end intent</name>
      <t>For determining the end-to-end path for an intent and to derive the 
   accurate cumulative cost, all routers along the path that modify the next 
   hop should participate in cumulating the cost. New applications may 
   require new intents that may result in new metric types to be used in the 
   network. It is quite possible that certain domains may have specific 
   metric types. For example, core network may have latency metric while 
   metro may just have IGP-cost because delay in metro regions may be 
   insignificant. It is quite possible that one or more routers might not 
   understand the new intent and the metric.</t>
     <t>If one or more routers in a domain either border routers or any 
   intra-domain routers that modify the next hop, do not participate in 
   accumulating the cost when they propagate a route, it is impossible for 
   the ingress router to determine the cost of the end-to-end path accurately. 
   This will result in sub-optimal best path selection. Such an end-to-end 
   path is called discontinuous path for that intent. The discontinuity can 
   manifest in different dimensions and <xref target="Sec-12"/> provides 
   detailed explanation.</t>
  </section>

  <section anchor="Sec-5" numbered="true" toc="default">
      <name>Generic Metric Encoding</name>
      <t>This document proposes "Accumulated Metric" TLV (AMetric), in the 
   Next Hop Dependent Capability (NHC) attribute. The format is shown 
   below.</t>
      <figure anchor="AMetric">
        <name>AMetric</name>
       <artwork name="" type="" align="left" alt=""><![CDATA[

   0                 1                   2                   3
   1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |   Accumulated Metric Code   |   Accumulated Metric Length   |
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   |       Accumulated Metric Data...                           
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>

    <dl newline="false" spacing="normal" indent="3">
     <dt/>
      <dd>Accumulated Metric Code (2 octet): Code point to be 
      assigned by IANA</dd>
    </dl>
    <dl newline="false" spacing="normal" indent="3">
     <dt/>
      <dd>Accumulated Metric Length (2 octets): Value 10</dd>
    </dl>
    <dl newline="false" spacing="normal" indent="3">
     <dt/>
      <dd>Accumulated Metric Data (10 octets): 3 sub-fields as shown 
      below:</dd>
    </dl>

      <t>The AMetric data carries the metric type and metric value as 
   defined in the IGP-Protocol registry for metric-types. The format is shown 
   below.</t>

     <figure anchor="AMetric_Data">
       <name>AMetric Data</name>
       <artwork name="" type="" align="left" alt=""><![CDATA[
   0                 1                   2                   3
   1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
   | Metric-type | Metric-flags  | Metric value...
   +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
]]></artwork>

     </figure>
     <ul empty="true" spacing="normal">
       <li>
        <ol spacing="normal" indent="5">
          <li>Metric-type (1 octet): Value of metric-type from IGP-Protocol 
              registry for metric-types.</li>
          <li>Metric-flags (1 octet): Bits defined below.</li>
          <li>metric-value (8 octets): Value range (0 - 0xffffffffffffffff)</li>
        </ol>
       </li>
     </ul>
     <dl newline="false" spacing="normal" indent="3">
       <dt/>
       <dd><t>The metric-flags carry additional information about the 
       accumulated generic metric.</t></dd>
     </dl>
      <figure anchor="AMetric-flags">
        <name>Accumulated Metric flags</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
    7 6 5 4 3 2 1 0
   +-+-+-+-+-+-+-+-+
   |R|R|R|R|R|R|N|D|
   +-+-+-+-+-+-+-+-+
]]></artwork>
      </figure>

      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd><t>Bit D : Represents discontinuity in metric accumulation for the 
               end-to-end path. 1 indicates discontinuous, 0 indicates 
               continuous.</t>
            <t>Bit N : Represents normalization of metric in the local domain. 
               1 indicates metric normalization has been applied. 0 indicates 
               no normalization has been applied.</t>
            <t>Bit R : Reserved for future use. MUST be set to zero when
               originated, and MUST be ignored on receipt.</t>
        </dd>
      </dl>
  </section>

  <section anchor="Sec-6" numbered="true" toc="default">
      <name>Leverage Next Hop Dependent Capability (NHC) Attribute</name>
      <t>The Next Hop Dependent Capability attribute has two important
   characteristics that are relevant for establishing the end-to-end intent 
   path: Transitivity and Scoping.</t>

      <t>Transitivity: The NHC is an optional and transitive attribute 
   hence according to <xref target="RFC4271"/> if this attribute is present 
   in an update message, it will be propagated to all neighbors. Via the 
   AMetric in NHC attribute, the accumulated metric value is propagated to 
   all the routers in the network, thus making the cost computation for the 
   end-to-end intent path possible.</t>
      <t>Scoping: The NHC provides an ability to perform Next Hop scoping.
   The originating router encodes the next hop address in the "Network 
   Address of Next Hop" field in the NHC attribute before advertising the 
   route. If the non-originator router upon learning such a route, does 
   not modify the next hop, it will advertise the route along with 
   capabilities in NHC without modification. On the other hand, if the 
   non-originator router upon learning such a route, modifies the next hop,
   it will perform two actions: Encode the next hop address (it is going to 
   advertise in the update), in "Network Address of Next Hop" field of the 
   NHC attribute; and recompute the capabilities and encode them in the NHC 
   attribute, before advertising the route. With this support, the 
   receiving BGP speaker can make specific decisions for the route by 
   comparing the advertised next hop present in the update message with the 
   "Network Address of Next Hop" field of the NHC attribute. If the next 
   hop in the update message does not match with the "Network Address of 
   Next Hop" field in the NHC attribute, it can be concluded that the 
   advertising router did not understand the NHC attribute and as a result,
   the capabilities have not been updated at the advertising router.</t>
      <t>The above mechanism is leveraged to determine if the end-to-end 
   path for an intent (represented by a metric in AMetric) is 
   discontinuous or not. The  document 
   <xref target="I-D.ietf-idr-entropy-label"/> provides detailed explanation 
   on the NHC procedures.</t>
  </section>

  <section anchor="Sec-7" numbered="true" toc="default"> 
      <name>Comparison between AIGP and AMetric </name>
      <t>The AIGP TLV described in <xref target="RFC7311"/> carries IGP metric 
   type only. The AIGP TLV is encoded in AIGP attribute, an optional and 
   non-transitive attribute. The BGP speaker S may attach AIGP attribute 
   with AIGP TLV in it, to a route R and advertise to its peers. When 
   such a route propagates across domains, the metric value in AIGP TLV is 
   accumulated thus providing end-to-end IGP cost.</t>

      <t>The AMetric is like AIGP TLV. The AMetric can carry not just 
   the IGP metric type but also other types of metrics. The AMetric will be 
   encoded in the NHC attribute. The BGP speaker S may attach NHC attribute 
   with AMetric in it to a route R and advertise R to its peers. When such a 
   route propagates across domain, the metric value will be accumulated. This 
   provides the end-to-end cost for desired intent as represented by one or 
   more metric types.</t>

      <t>The section 3.4 of <xref target="RFC7311"/> describe procedures for 
   creating and modifying the AIGP TLV in the AIGP attribute and these are 
   also applicable for creating and modifying the AMetric in the NHC 
   attribute.</t> 
  </section>

  <section anchor="Sec-8" numbered="true" toc="default">
      <name>Usage of Accumulated Metric (AMetric)</name>

         <section anchor="Sec-8.1" numbered="true" toc="default">
           <name>Generation of Accumulated Metric</name>
           <dl newline="false" spacing="normal" indent="3">
             <dt/>
               <dd>It is recommended that an implementation that supports
             AMetric MUST support a configuration item AMetric_ORIGINATE,
             that enables or disables its creation and inclusion into NHC. The
             default value of AMetric_ORIGINATE MUST be "disabled". If the BGP 
             speaker S is originating route R into BGP, it MAY include NHC 
             attribute to it. When a BGP speaker wishes to generate the 
             AMetric and add it to the NHC attribute, it MUST perform the 
             following procedures:</dd>
           </dl>
           <ul empty="true" spacing="normal">
            <li>
             <ul spacing="normal">
               <li>The procedures for the BGP speaker S to send NHC attribute
             for a route R with next hop N as described in section 2.2 of
             <xref target="I-D.ietf-idr-entropy-label"/> MUST be followed while
             encoding AMetric.</li>
      
               <li>A BGP speaker S MUST NOT add the AMetric to NHC attribute for
             a route R whose path leads outside the AMetric administrative 
             domain. When S as an ASBR, advertises the route to peers inside 
             the AS by setting itself as next hop, it MUST add AMetric to NHC. 
             S MUST NOT add AMetric to NHC for route advertisements to 
             neighboring AS that are not part of AMetric administrative 
             domain.</li>
          
               <li>The BGP speaker S MUST not encode the AMetric in the NHC
             attribute for a route R for which S does not set itself as the 
             next hop.</li>
        
               <li>In section 3.4 of <xref target="RFC7311"/> whenever AIGP
             TLV is referred to, it MUST be treated as AMetric. Whenever AIGP 
             attribute is referred to, it MUST be treated as NHC attribute. 
             The procedures outlined in section 3.4 of
             <xref target="RFC7311"/> MUST be followed for creation of
             AMetric that is encoded in NHC attribute. Similarly, the procedures
             outlined in 3.4 of <xref target="RFC7311"/> MUST be followed for 
             the modifications of AMetric in NHC attribute by the originator and
             non-originator of the route.</li>

               <li>Repeated metric changes may cause large number of BGP 
             updates to be generated and propagated throughout the network. 
             To avoid this, a configurable threshold for the metric is defined.
             If the difference between the new metric-value and the advertised 
             metric-value is less than the configured threshold, the update 
             MAY be suppressed. For each of type of metric used in the domain,
             if the new metric-value encoded in AMetric is above the configured 
             threshold, a new BGP update containing the new set of 
             metric-values SHOULD be advertised.</li>

               <li>Procedures for defining the cost to reach a next hop for
             various metric-types is outside the scope of this document.</li>
             </ul>
            </li>
           </ul>

           <section anchor="Sec-8.1.1" numbered="true" toc="default">
             <name>Originator of route into BGP</name>
               <dl newline="false" spacing="normal" indent="3">
                 <dt/>
                   <dd>In addition to the above, the BGP speaker S MUST 
                 perform the following procedures when it wishes to add
                 AMetric to NHC.</dd>
                 </dl>
                 <ul empty="true" spacing="normal">
                  <li>
                   <ul spacing="normal">
                       <li>The BGP Speaker S MUST encode the type of metric as 
                    specified in the IGP Protocol registry in the metric-type 
                    sub-field. This metric type should represent the intent 
                    required for establishing the end-to-end path.</li>
    
                       <li>The BGP Speaker S MUST encode the value of the 
                   metric or cost to reach the next hop N in the metric-value 
                   sub-field.  The cost may be normalized if required.</li>
  
                       <li>If a domain adopts more than one metric type to 
                   represent an intent, the BGP speaker S may encode more than 
                   one AMetric, each encoding different type of metric as 
                   defined in the IGP Protocol Registry.</li>
  
                       <li>The "D" bit of the metric-flags MUST be set to zero.
                   If the domain internal cost to reach the next hop is 
                   normalized to the type of metric in the metric-type 
                   sub-field, the "N" bit of the metric-flags MUST be set to 
                   1, else it MUST be set to zero.</li>
                  </ul>
                 </li>
                </ul>
           </section>

           <section anchor="Sec-8.1.2" numbered="true" toc="default">
             <name>Non-Originator of route into BGP</name>
               <dl newline="false" spacing="normal" indent="3">
                 <dt/>
                   <dd>The BGP speaker S has received the route R that has NHC 
                 and when it advertises R to its peers, it recreates NHC. Here,
                 S MUST perform the following procedures.</dd>
                 </dl>
                 <ul empty="true" spacing="normal">
                  <li>
                   <ul spacing="normal">
                     <li>The BGP speaker S MUST retain all the received 
                 AMetric and for each of the AMetric received, it MUST perform 
                 following procedures.</li>

                     <li>If the type of the metric used in local domain is same 
                 as the metric-type of the AMetric, the BGP speaker S MUST add 
                 the metric or cost to reach the next hop N to the metric-value
                 sub-field of the AMetric.</li>

                     <li>If the type of the metric used in the local domain is 
                 different from the metric-type of the AMetric, the BGP speaker 
                 S MUST normalize the metric or cost to reach the next hop N 
                 before adding to the metric-value sub-field of the AMetric. 
                 The metric-value sub-field MUST be increased by a non-zero 
                 amount.</li> 

                     <li>If the local domain's internal cost to reach the next 
                 hop is normalized to the type of metric in the metric-type 
                 sub-field, then "N" bit MUST be set to 1. If the BGP speaker 
                 S does not understand the type of metric, then "D" bit MUST 
                 be set to 1.</li>
                 </ul>
                </li>
              </ul>
           </section>
         </section>

         <section anchor="Sec-8.2" numbered="true" toc="default">
           <name>Reception of Accumulated Metric</name>
           <dl newline="false" spacing="normal" indent="3">
             <dt/>
             <dd>When a BGP speaker S receives a BGP update that has a route 
             R to destination prefix P with next hop N, and has the NHC 
             attribute with AMetric, it MUST perform the following 
             procedures:</dd>
           </dl>
           <ul empty="true" spacing="normal">
             <li>
              <ul spacing="normal">
                 <li>A BGP speaker S MUST perform the procedures described in 
               section 2.3 of <xref target="I-D.ietf-idr-entropy-label"/> for 
               processing the NHC attribute.</li>

                 <li>For a given metric-type, if there are more than one
               AMetric in the NHC attribute, first occurrence MUST be 
               processed, and the other occurrences MUST be ignored.</li>

                 <li>There may be more than one AMetric, each carrying 
               different types of metrics. For each AMetric, if the BGP speaker 
               S recognizes the type of the metric encoded in the metric-type 
               sub-field, it MUST process the metric-value and metric-flags 
               sub-fields as per following.</li>

               <li>If the type of the metric used in the local domain (for
               resolving the next hop N) matches with the metric-type of
               AMetric of NHC attribute, then the metric-value sub-field MUST 
               be used in the AIGP-enhanced interior cost computation as 
               specified in <xref target="Sec-9"/>.</li>

                  <li>If the type of the metric used in the local domain (for
                resolving the next hop N) does not match with the metric-type of
                AMetric of the NHC attribute, then the BGP speaker S may 
                normalize the cost of the path used for resolving
                the next hop before using it in the AIGP-enhanced cost 
                computation. A policy may be used to provide the metric 
                normalization.</li>
              </ul>
            </li>
          </ul>
         </section>

    </section>

    <section anchor="Sec-9" numbered="true" toc="default">
      <name>Updates to Decision Procedure</name>
        <t>This section follows the approach as laid out in 
     <xref target="RFC7311"/> to select the best path when the route has 
     NHC attribute with AMetric. The domain that the BGP speaker S belongs to, 
     may support different intent-based paths represented via different types 
     of metric to reach next hop N. The following procedures MUST be followed 
     in addition to the general procedure described in section 4 of 
     <xref target="RFC7311"/>.</t>
        <t>Consider a BGP speaker S receiving a route R with next hop N. The 
     route R is attached with NHC attribute having AMetric. For each AMetric, 
     the BGP speaker S MUST perform following procedures.</t>
        <t>If the metric-type sub-field of AMetric matches with the type of the 
     metric used in the local domain for resolving the next hop N, the 
     AIGP-enhanced interior cost should be computed as below.</t> 
     <dl newline="false" spacing="normal" indent="3">
       <dt/>
       <dd>Let 'm' be the cost to reach the next hop N that is used in the 
       local domain for the path computation as described in 
       <xref target="RFC7311"/> .</dd>
     </dl>
        <t>If the metric-type sub-field of the AMetric does not match with 
     the type of the metric used in the local domain for resolving the next 
     hop N, the cost of the path to reach next hop N may be normalized. The 
     normalized metric value can be zero, maximum metric value or scaled up 
     (multiple of a positive number).</t>
     <dl newline="false" spacing="normal" indent="3">
       <dt/>
       <dd>Let 'm' be the normalized value of the cost to reach the next hop 
       N that is used in the local domain for path computation as described 
       in <xref target="RFC7311"/>.</dd>
     </dl>
        <t>The AIGP-enhanced interior cost computation as described below will
     be used in the decision process as described in 
     <xref target="RFC7311"/>.</t>
     <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>Let 'A' be the value of the value of the metric-value sub-field of
        the AMetric.</dd>
     </dl>
     <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>The AIGP-enhanced interior cost will be 'A+m'.</dd>
     </dl>
        <t>A path with IGP metric-type in AMetric of NHC attribute and a path 
     with IGP metric-type in AIGP TLV of AIGP attribute can be compared. 
     However, a path with AMetric carrying different metric-type and a path 
     with AIGP TLV carrying IGP metric-type cannot be compared. To enable 
     end-to-end path selection based on intent, the path with AMetric in NHC 
     attribute may be chosen over path with AIGP TLV in AIGP attribute. The 
     implementation should allow a local policy to specify these 
     preferences.</t>
        <t>A path with AMetric of metric-type 'a' cannot be compared with a 
     path with AMetric of metric-type 'b'. The path with lower metric-type MAY 
     be chosen as best between two such paths and implemented consistently 
     across AIGP domain.</t>
    </section>

    <section anchor="Sec-10" numbered="true" toc="default">
      <name>Use-case: Different Metrics across Domains</name>
      <figure anchor="ure-different-metric-across-network">
        <name>Different metric across network</name>
        <artwork name="" type="" align="left" alt=""><![CDATA[
                              +--------------+
                              |   Domain2    |
                              |              |
                        ......+ASBR21  ASBR22+.....
                        .     |              |    .
        +------------+  .     |  IGP-metric  |    .  +--------------+
        |   Domain1  |  .     +--------------+    .  |    Domain4   |
        |            |  .                         .  |              |
        |      ASBR11+...                         ...+ASBR41        |
        +PE1         |                               |           PE2+
        |      ASBR12+...                         ...+ASBR42        |
        |            |  .                         .  |              |
        | IGP-metric |  .                         .  | delay-metric |
        +------------+  .                         .  +--------------+
                        .     +--------------+    .
                        .     |    Domain3   |    .
                        .     |              |    .
                        ......+ASBR31  ASBR32+.....
                              |              |
                              | delay-metric |
                              +--------------+
]]></artwork>
      </figure>
        <t>Each domain is a separate Autonomous System.  Within each domain,
     ASBR and PE form iBGP peering and they may employ Route Reflectors. The 
     IGP within each domain uses domain specific metric. Domain3 and Domain4 
     use delay as the metric while Domain1 and Domain2 use default IGP-metric 
     cost. ASBRs across domains form eBGP peering.</t>
        <section anchor="Sec-10.1" numbered="true" toc="default">
          <name>Scenario 1: Find delay-based end-to-end path.</name>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>This is about finding the delay-based end-to-end path from Domain1
        to Domain4. This can be achieved as follows. The advertising router 
        adds the AMetric with metric type 1 that represents delay metric, 
        encoded in NHC attribute. In the above network diagram, ASBR41 (and 
        ASBR42) will advertise prefix PE2-loopback with AMetric with delay as 
        metric-type. The metric-value sub-field of the AMetric will represent 
        the delay cost to reach PE2's loopback end-point from the advertising 
        router as they will do next hop self.</dd>
      </dl>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>In Domain3, when ASRB32 advertises the prefix PE2-loopback within 
        the local domain, it may add cost to the metric-value, the value
        representing the delay introduced by the DMZ link between ASRB32 to
        ASBR42. When ASRBR31 advertises the prefix PE2-loopback, it will
        perform the following procedures.</dd>
      </dl>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>1. Compute the delay d of the path to reach ASBR32 from which it
        has chosen the best path.</dd>
      </dl>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>2. Add the above d value to the metric-value sub-field of the
        AMetric.</dd>
      </dl>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>In Domain2 however, the local metric type is default IGP-metric. 
        The ASBR22 may follow the procedure similar to ASBR32 and add the delay
        value corresponding to the DMZ link between ASBR22 and ASBR41 before
        advertising the path internally in Domain2. When ASBR21 computes the
        AIGP-enhanced interior cost, as mentioned before, it may normalize
        the internal cost to reach ASBR22 and may add the normalized value to 
        the metric-value of AMetric representing delay metric-type. The ASBR21 
        will also update metric-flags sub-field to indicate that metric value 
        has been normalized. In the above network example, the delay cost from 
        ASBR21 to ASBR22 is negligible and hence delay-metric value will be 
        increased nominally with a non-zero value.</dd>
      </dl>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>The procedures for AIGP-enhanced interior cost computation at 
        ASBR11 (and ASBR12) will follow DMZ delay computation procedure 
        described above. PE1 will have two paths to reach PE2-loopback: P1 via 
        ASBR11 (and domain2) and P2 via ASBR12 (and domain3), each having 
        respective AIGP-enhanced interior cost representing end-to-end delay. 
        The local metric type is default IGP-metric and hence PE1 may normalize 
        the internal cost for the AIGP-enhanced interior cost computation.
        The BGP decision process described in <xref target="Sec-9"/> 
        will result in delay optimized end-to-end path for PE2-loopback on PE1 
        that can be used to resolve the service prefixes.</dd>
      </dl>
      </section>
        <section anchor="Sec-10.2" numbered="true" toc="default">
          <name>Scenario 2: Find IGP-metric based end-to-end path leveraging 
       domain-specific path.</name>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>This is about providing best-effort or default IGP-metric based 
        end-to-end path while leveraging the domain-specific delay-based 
        metric for intra-domain path selection. All the ASBR routers will 
        update the AMetric for NHC attribute for the default IGP-metric 
        metric-type, accumulating the cost for end-to-end path. The PE1 
        router will have two paths (from ASBR11 and ASBR12) decorated with 
        different best-effort default IGP-metric cost. The intra-domain path 
        to reach the domain exit can be based on domain-specific metric-type. 
        For example, in Domain3, ASBR31 can select lowest delay path to reach 
        ASBR32. The ASBR and the PE routers may be configured to prefer one 
        metric-type for end-to-end path while another metric-type for 
        intra-domain and such configuration mechanism is outside the scope of 
        this document.</dd>
      </dl>
      </section>
        <section anchor="Sec-10.3" numbered="true" toc="default">
        <name>Scenario 3: Path selection when a router does not understand
        the new metric-type.</name>
      <dl newline="false" spacing="normal" indent="3">
        <dt/>
        <dd>This is about selecting a path which a router does not support
        the new type of metric. The Domain2 implements only default IGP-metric 
        and does not support delay-metric. When ASBR21 receives the route with 
        NHC attribute and AMetric, the metric-type delay-metric is unrecognized.
        The ASBR21 will update the metric-flags, setting the "D" bit to 1 
        indicating that path is discontinuous and accumulation is incomplete. 
        When such a route reaches PE1, the PE1 router will have two paths, one 
        via ASBR11 with "D" bit set and another path from ASBR12 with "D" bit 
        set to zero. The local policy on PE1 can provide guidance on the 
        preference between these two paths.</dd>
      </dl>
      </section>
    </section>

    <section anchor="Sec-11" numbered="true" toc="default">
      <name>Deployment Considerations</name>
        <t>It can be noted that for a path, a domain may normalize the 
     metric-value used to resolve next hop to match with the metric-type 
     present in the AMetric. The idea is to propagate the cost of reaching 
     the prefix through the domain while maintaining the metric-type chosen 
     by the originating router and domain, thereby providing an end-to-end 
     path for the desired intent. Such normalization of metric values to the 
     match with the metric type present in the AMetric(s) can be done via 
     policy. The definition of such policies and how they can be enforced is 
     outside the scope of this document. In topologies where there is a common 
     router between adjacent domains that do iBGP peering, the Border router 
     can provide the normalization.</t>
        <t>In a domain, the cost of a path is derived from the metric of its
     links, summed up typically. It is important to maintain the same behavior
     for inter-domain path. The AIGP-enhanced interior cost should not be 
     allowed to decrease through the metric normalization. When adjacent 
     domains use different metric types, the ASBR that connects two domains 
     is better suited to pass on the metric values by setting itself as next 
     hop.</t>
        <t>All routers of a domain MUST compute the AIGP-enhanced interior cost
     as described above to be used during decision process. Within a domain, 
     if one router R1 applies AIGP-enhanced interior cost while R2
     does not, it may lead to routing loop unless some sort of tunneling
     technology viz. MPLS, SRv6, IP, etc. is adopted to reach the next hop.
     In a network where any tunneling technology is used, one can
     incrementally deploy the generic metric functionality. In a network
     without any tunneling technology, it is recommended that all routers
     MUST support Accumulated Generic-Metric based AIGP-enhanced interior cost
     computation. Additionally, to have consistent BGP best path in the 
     network, all routers should use the accumulated cost during the best path 
     computation. To ease the deployment of this generic metric based
     end-to-end path selection, it is recommended to enable AMetric via 
     configuration and should be disabled by default.</t>
        <t>In certain networks, routes may be redistributed between BGP and 
     IGP, usually controlled via a policy. When a route is propagated across
     domains, a router should use the metric-value in the AMetric of the NHC 
     attribute, optionally modified via the local policy 
     as the IGP cost during route redistribution into IGP. The local policy 
     should apply metric normalization or translation based on metric-type 
     of AMetric and the metric-type adopted in the local domain.</t>
    </section>

    <section anchor="Sec-12" numbered="true" toc="default">
      <name>Manifestations of Discontinuity in end-to-end path</name>
        <t>The network operators would like to avoid the scenarios when the 
     entire network has to be upgraded before enabling the new functionality. 
     New functionality across a network is typically deployed incrementally 
     and one cannot expect that all routers shall be capable of handling new 
     functionality on day-one. However, for determining the end-to-end 
     path for an intent and to derive the accurate cumulative cost, all 
     routers along the path that modify the next hop should participate in 
     accumulating the cost. The discontinuity can manifest in three different 
     forms.</t>
      <ul spacing="normal">
        <li>Type-A discontinuity: The advertising router does not 
        support new attribute. However, the route is propagated to the ingress 
        router and one cannot determine if the accumulation done end-to-end or          not.</li>
        <li>Type-B discontinuity: The advertising router supports the 
        new attribute but does not support TLV that accumulates the end-to-end 
        cost. Similar to the above, the route is propagated to the ingress 
        router and one cannot distinguish if the cumulated value represents 
        the end-to-end cost.</li>
        <li>Type-C discontinuity: The advertising router supports the new
        attribute and the TLV that carries the accumulated cost, however as new 
        metric-types and intent are introduced, the advertising router might 
        not support them. Similar to the above, the route is propagated to the 
        ingress router and one cannot distinguish if the cumulated value 
        represents the end-to-end cost for the intended intent.</li>
      </ul>

      <section anchor="Sec-13" numbered="true" toc="default">
        <name>Handling discontinuous path with AIGP attribute as per 
        <xref target="RFC7311"/></name>
           <t>The AIGP TLV is used for accumulating the metric across domains.
        The AIGP attribute is optional and non-transitive. The accumulated 
        metric is used in best path computation. The AIGP mechanism requires 
        all the routers MUST understand the new attribute so that accumulated
        metric will reach all the routers for consistent best path computation.
        Hence, if an advertising router along the path does not understand 
        the AIGP attribute, the accumulation will not be complete making the
        path discontinuous. The receiving (or ingress) router will not be able
        to compute the end-to-end cost and so the path will not be considered 
        for providing end-to-end intent.</t>
           <t>On the other hand, when the ingress router receives a route with 
        AIGP attribute, the value accumulated in the TLV is guaranteed to 
        reflect the end-to-end cost. Therefore First-Order discontinuity does 
        not exist. The <xref target="RFC7311"/> introduced both AIGP attribute 
        and AIGP TLV together, most of BGP routers support AIGP TLV along with 
        the attribute. Hence Type-B discontinuity is less likely to 
        happen. The <xref target="RFC7311"/> specifies only default IGP-metric 
        in AIGP TLV, hence Type-C discontinuity is not applicable. If
        <xref target="RFC7311"/> was extended to support generic metric
        types, it will suffer from Type-C discontinuity.</t>
      </section>

      <section anchor="Sec-14" numbered="true" toc="default">
        <name>Handling discontinuous path with AMetric of NHC attribute</name>
           <t>The AMetric is part of NHC which is an optional and transitive 
        attribute. The routes with NHC attribute and accumulated metric reaches
        all the routers across the domains and it will result in consistent 
        best path computation. If any advertising router along the path does 
        not understand the NHC attribute, it fails to update the next hop 
        field in NHC attribute. This is the Type-A discontinuity. However, with 
        the NHC procedures, the receiving router will detect this through next 
        hop validation thus providing mechanism to detect the Type-A 
        discontinuity deterministically.</t>
           <t>If the advertising router along the path supports NHC attribute, 
        but does not support AMetric, following NHC procedures, the router 
        will not propagate the accumulated metric. This is the 
        Type-B discontinuity but this will not result non-deterministic 
        behaviour the receiving BGP router will not select 
        the path for desired intent given the lack of AMetric. If the 
        advertising router understands NHC attribute and AMetric, but does not 
        understand the specific metric-type, by following the NHC procedures,
        the router will still propagate NHC attribute and AIGPv2 even though 
        unrecognized metric is not accumulated. This is Type-C discontinuity. 
        The procedures in this document specifies the "D" bit of the 
        unrecognized AIGPv2 to be set to 1 by the advertising router and hence 
        the receiving router deterministically identifies the 
        discontinuity.</t>
      </section>

      <section anchor="Sec-15" numbered="true" toc="default">
      <name>Contiguity Compliance</name>
           <t>Even though NHC attribute is transitive, the AMetric might not 
      be interpreted and/or updated by routers along the path. If all BGP 
      routers that modify the next hop accumulate the cost and propagate the 
      metric, the receiving BGP router will be assured of a correct end-to-end
      path for the intent and the metric. Although the three types of 
      discontinuity can be addressed using a local policy, it is recommended 
      that operators identify such routers and upgrade them to achieve 
      intent-based end-to-end path for optimal results.</t>
      </section>
    </section>

    <section anchor="Sec-16" numbered="true" toc="default">
      <name>Security Considerations</name>
           <t>This document does not introduce any new security considerations
      beyond those already specified in <xref target="RFC4271"/>, 
      <xref target="RFC7311"/> and 
      <xref target="I-D.ietf-idr-entropy-label"/>.</t>
    </section>

    <section anchor="Sec-17" numbered="true" toc="default">
      <name>IANA Considerations</name>
      <t>IANA is requested to assign a code point for AMetric. The metric-type 
      field refers to the IGP-Protocols registry for metric-type defined in 
      <xref target="I-D.ietf-lsr-flex-algo-bw-con"/></t>
    </section>

    <section anchor="Sec-18" numbered="true" toc="default">
      <name>Limitations of <xref target="RFC7311"/></name>
           <t>This section provides an overview of limitations and different 
      interpretations of <xref target="RFC7311"/>. Various vendors have 
      interpreted <xref target="RFC7311"/> differently and encode AIGP TLV 
      or treat AIGP attribute differently. The following lists some of them.</t>
      <ul empty="true" spacing="normal">
        <li>
          <ul spacing="normal">
          <li>The <xref target="RFC7311"/> introduces only one TLV: AIGP TLV. 
        Some vendors propagate the only AIGP TLV and drop other unrecognized 
        TLV if any.</li>
          <li>The <xref target="RFC7311"/> specifies only one type of metric:
        IGP-metric. However, some vendors provide option to encode different 
        types of metrics in AIGP TLV other than default IGP-metric type.</li>
          <li>Some vendors do not propagate AIGP attribute if AIGP TLV is not
        present in it.</li>
          </ul>
        </li>
      </ul>
    </section>

    <section anchor="Sec-19" numbered="true" toc="default">
      <name>Acknowledgements</name>
      <t>The authors would like to thank John Scudder, Jeff Haas, Robert
     Raszuk, Kaliraj Vairavakkalai, and Peng Shaofu for careful review and 
     suggestions.</t>
    </section>
  </middle>
  <back>
    <references>
      <name>References</name>
      <references>
        <name>Normative References</name>
        <?rfc include='reference.RFC.2119'?>
        <?rfc include='reference.RFC.8174'?>
        <?rfc include='reference.RFC.7311'?>
        <?rfc include='reference.I-D.ietf-idr-entropy-label'?>
      </references>
      <references>
        <name>Informative References</name>
        <?rfc include='reference.I-D.ietf-idr-bgp-car'?>        
        <?rfc include='reference.I-D.ietf-idr-bgp-ct'?>
        <?rfc include='reference.I-D.ietf-lsr-flex-algo-bw-con'?>
        <?rfc include='reference.I-D.hr-spring-intentaware-routing-using-color'?>
        <?rfc include='reference.RFC.3630'?>
        <?rfc include='reference.RFC.4271'?>
        <?rfc include='reference.RFC.5305'?>
        <?rfc include='reference.RFC.7471'?>
        <?rfc include='reference.RFC.7911'?>
        <?rfc include='reference.RFC.8570'?>
      </references>
    </references>
  </back>
</rfc>
