<?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" category="std"
docName="draft-ietf-lsr-yang-isis-reverse-metric-06" number="9194" ipr="trust200902" obsoletes="" updates="" submissionType="IETF" consensus="true" tocInclude="true" xml:lang="en" symRefs="true" sortRefs="true" version="3">

<front>
  <title abbrev="YANG Module for IS-IS Reverse Metric">A YANG Module for IS-IS Reverse Metric</title>
  <seriesInfo name="RFC" value="9194"/>

  <author initials='C.' surname='Hopps' fullname='Christian Hopps'>
   <organization>LabN Consulting, L.L.C.</organization>
   <address>
   <email>chopps@chopps.org</email>
   </address>
  </author>

<date month="October" year="2022"/>
<area>rtg</area>
<workgroup>lsr</workgroup>

<abstract>
<t>This document defines a YANG module for managing the reverse metric
extension to the Intermediate System to Intermediate System (IS-IS) 
intra-domain routing information exchange protocol.
</t>
</abstract>
</front>
<middle>

<section numbered="true" toc="default">
<name>Introduction</name>
<t>This document defines a YANG module for managing the reverse metric
extension to IS-IS <xref target="RFC8500"/> <xref target="ISO-10589"/>. Please refer to <xref target="RFC8500"/> for the
description and definition of the functionality managed by this
module.</t>

<t>The YANG data model described in this document conforms to the
Network Management Datastore Architecture defined in <xref target="RFC8342"/>.</t>

</section>

<section numbered="true" toc="default">
<name>YANG Management</name>
<section numbered="true" toc="default">
<name>YANG Tree</name>
<t>The following is the YANG tree diagram <xref target="RFC8340"/> for the IS-IS
reverse metric extension additions.</t>

<sourcecode name="" type="yangtree"><![CDATA[
module: ietf-isis-reverse-metric
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/isis:isis:
    +--rw reverse-metric
       +--rw enable-receive?   boolean
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/isis:isis/isis:interfaces
            /isis:interface:
    +--rw reverse-metric
       +--rw metric?              isis:wide-metric
       +--rw flags
       |  +--rw whole-lan?           boolean
       |  +--rw allow-unreachable?   boolean
       +--rw exclude-te-metric?   boolean
       +--rw level-1
       |  +--rw metric?              isis:wide-metric
       |  +--rw flags
       |  |  +--rw whole-lan?           boolean
       |  |  +--rw allow-unreachable?   boolean
       |  +--rw exclude-te-metric?   boolean
       +--rw level-2
          +--rw metric?              isis:wide-metric
          +--rw flags
          |  +--rw whole-lan?           boolean
          |  +--rw allow-unreachable?   boolean
          +--rw exclude-te-metric?   boolean
  augment /rt:routing/rt:control-plane-protocols
            /rt:control-plane-protocol/isis:isis/isis:interfaces
            /isis:interface/isis:adjacencies/isis:adjacency:
    +--ro reverse-metric
       +--ro metric?      isis:wide-metric
       +--ro flags
       |  +--ro whole-lan?           boolean
       |  +--ro allow-unreachable?   boolean
       +--ro te-metric?   uint32
]]></sourcecode>

</section>

<section numbered="true" toc="default">
<name>YANG Module</name>
<t>The following is the YANG module for managing the IS-IS reverse
metric functionality defined in <xref target="RFC8500"/>. It imports modules from  <xref target="RFC8349"/> and <xref target="RFC9130"/>.</t>

<t>This YANG module uses the same per-level hierarchical configuration
structure as that defined in the augmented base module.</t>
<sourcecode name="ietf-isis-reverse-metric@2022-10-19.yang" type="yang" markers="true"><![CDATA[
module ietf-isis-reverse-metric {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-isis-reverse-metric";
  prefix isis-rmetric;

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

  organization
    "IETF LSR Working Group (LSR)";

  contact
    "WG Web:  <https://datatracker.ietf.org/wg/lsr/>
     WG List: <mailto:lsr@ietf.org>

     Author:  Christian Hopps
              <mailto:chopps@chopps.org>";

  description
    "This module defines the configuration and operational state
     for managing the IS-IS reverse metric functionality
     (RFC 8500).

     Copyright (c) 2022 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 9194; see the
     RFC itself for full legal notices.";
  reference
    "RFC 8500: IS-IS Routing with Reverse Metric";

  revision 2022-10-19 {
    description
      "Initial revision.";
    reference
      "RFC 9194: A YANG Module for IS-IS Reverse Metric";
  }

  grouping reverse-metric-data {
    description
      "IS-IS reverse metric data.";
    leaf metric {
      type isis:wide-metric;
      description
        "The reverse metric value.";
      reference
        "RFC 8500: IS-IS Routing with Reverse Metric, Section 2";
    }
    container flags {
      description
        "The reverse metric flag values.";
      leaf whole-lan {
        type boolean;
        description
          "The 'Whole LAN' bit (W bit) (RFC 8500).  If true, then
           a Designated Intermediate System (DIS) processing this
           reverse metric will add the metric value to all the
           nodes it advertises in the pseudonode Link State
           Protocol Data Unit (LSP) for this interface.
           Otherwise, it will only increment the metric for the
           advertising node in the pseudonode LSP for this
           interface.";
        reference
          "RFC 8500: IS-IS Routing with Reverse Metric,
                     Section 2";
      }
      leaf allow-unreachable {
        type boolean;
        description
          "The 'Unreachable' bit (U bit) (RFC 8500).  If true, it
           allows the neighbor to increment the overall metric up
           to 2^24-1 rather than the lesser maximum of 2^24-2.
           If the metric is then set by the neighbor to 2^24-1,
           it will cause traffic to stop using, rather than avoid
           using, the interface.";
        reference
          "RFC 8500: IS-IS Routing with Reverse Metric,
                     Section 2";
      }
    }
  }

  grouping reverse-metric-if-config-data {
    description
      "IS-IS reverse metric config data.";
    uses reverse-metric-data;
    leaf exclude-te-metric {
      type boolean;
      default "false";
      description
        "If true and there is a TE metric defined for this
         interface, then do not send the Traffic Engineering
         Metric sub-TLV in the Reverse Metric TLV.";

      reference
        "RFC 8500: IS-IS Routing with Reverse Metric, Section 2";
    }
  }

  grouping tlv16-reverse-metric {
    description
      "IS-IS Reverse Metric TLV data.";
    uses reverse-metric-data;
    leaf te-metric {
      type uint32;
      description
        "The TE metric value from the sub-TLV, if present.";
      reference
        "RFC 8500: IS-IS Routing with Reverse Metric, Section 2";
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/"
        + "isis:isis" {
    when "derived-from-or-self(../rt:type, 'isis:isis')" {
      description
        "This augment is only valid when the routing protocol
         instance type is 'isis'.";
    }

    description
      "The reverse metric configuration for an IS-IS instance.";

    container reverse-metric {
      description
        "Global reverse metric configuration.";
      leaf enable-receive {
        type boolean;
        default "false";
        description
          "Enables handling of reverse metric announcements from
           neighbors.  By default, reverse metric handling is
           disabled and must be explicitly enabled through this
           configuration.";
      }
    }
  }

  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/"
        + "isis:isis/isis:interfaces/isis:interface" {
    when "derived-from-or-self(../../../rt:type, 'isis:isis')" {
      description
        "This augment is only valid when the routing protocol
         instance type is 'isis'.";
    }

    description
      "The reverse metric configuration for an interface.";

    container reverse-metric {
      description
        "Announces a reverse metric to neighbors.  The
         configuration is hierarchical and follows the same
         behavior as that defined for per-level values in the
         augmented base module.

         Reverse metric operation is enabled by the configuration
         of a 'reverse-metric' metric value either at the top
         level or under a level-specific container node.  If a
         'reverse-metric' metric value is only specified under a
         level-specific container node, then operation is only
         enabled at the specified level.

         As the reverse metric is advertised in IS-IS Hello
         Protocol Data Units (IIH PDUs), level-specific
         configuration is only available for broadcast interface
         types.";
      uses reverse-metric-if-config-data {
        refine "flags/whole-lan" {
          default "false";
        }
        refine "flags/allow-unreachable" {
          default "false";
        }
      }
      container level-1 {
        when '../../isis:interface-type = "broadcast"';
        description
          "Announces a reverse metric to level-1 neighbors.";
        uses reverse-metric-if-config-data;
      }
      container level-2 {
        when '../../isis:interface-type = "broadcast"';
        description
          "Announces a reverse metric to level-2 neighbors.";
        uses reverse-metric-if-config-data;
      }
    }
  }
  augment "/rt:routing/rt:control-plane-protocols/"
        + "rt:control-plane-protocol/"
        + "isis:isis/isis:interfaces/isis:interface/"
        + "isis:adjacencies/isis:adjacency" {
    when "derived-from-or-self(../../../../../rt:type,
                               'isis:isis')" {
      description
        "This augment is only valid when the routing protocol
         instance type is 'isis'.";
    }

    description
      "The reverse metric state advertised by an adjacency.";
    container reverse-metric {
      description
        "IS-IS Reverse Metric TLV data.";
      uses tlv16-reverse-metric;
    }
  }
}
]]></sourcecode>

</section>

</section>

<section numbered="true" toc="default">
<name>IANA Considerations</name>
<section numbered="true" toc="default">
<name>Updates to the IETF XML Registry</name>
<t>This document registers a URI in the "IETF XML Registry" <xref target="RFC3688"/>.
Following the format in <xref target="RFC3688"/>, the following registration has been
made:</t>
<dl spacing="compact">
<dt>URI:</dt><dd>urn:ietf:params:xml:ns:yang:ietf-isis-reverse-metric</dd>
<dt>Registrant Contact:</dt><dd>The IESG.</dd>
<dt>XML:</dt><dd>N/A; the requested URI is an XML namespace.</dd>
</dl>

</section>

<section numbered="true" toc="default">
<name>Updates to the YANG Module Names Registry</name>
<t>This document registers one YANG module in the "YANG Module Names"
registry <xref target="RFC6020"/>. Following the format in <xref target="RFC6020"/>, the following
registration has been made:</t>

<dl spacing="compact">
<dt>Name:</dt><dd>ietf-isis-reverse-metric</dd>
<dt>Maintained by IANA?</dt><dd>N</dd>
<dt>Namespace:</dt><dd>urn:ietf:params:xml:ns:yang:ietf-isis-reverse-metric</dd>
<dt>Prefix:</dt><dd>isis-rmetric</dd>
<dt>Reference:</dt><dd>RFC 9194</dd>
</dl>

</section>

</section>

<section numbered="true" toc="default">
<name>Security Considerations</name>
<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 Network Configuration Access Control Model (NACM) <xref target="RFC8341"/>
provides the means to restrict access for particular NETCONF or RESTCONF users
to a preconfigured subset of all available NETCONF or RESTCONF protocol
operations and content.</t>
<t>The YANG module defined in this document can enable, disable, and
modify the behavior of metrics used by routing. For the security
implications regarding these types of changes, consult <xref target="RFC8500"/> --
which defines the functionality -- as well as <xref target="RFC9130"/>.</t>
<t>There are a number of data nodes defined in this YANG module that are
writable/creatable/deletable (i.e., config true, which is the 
default). These data nodes may be considered sensitive or vulnerable 
in some network environments. Write operations (e.g., edit-config) 
to these data nodes without proper protection can have a negative effect 
on network operations.  These YANG nodes correspond directly to the 
functionality provided in RFC 8500, and the security considerations of the 
functionality are described in RFC 8500. 
These are the subtrees and data nodes:</t>
<artwork type="ascii-art"><![CDATA[
Under "/rt:routing/rt:control-plane-protocols/" +
      "rt:control-plane-protocol/isis:isis"

  - /isis-rmetric:reverse-metric/isis-rmetric:enable-receive
]]></artwork>

<artwork type="ascii-art"><![CDATA[
Under "/rt:routing/rt:control-plane-protocols/" +
      "rt:control-plane-protocol/isis:isis/" +
      "isis:interfaces/isis:interface/" +
      "isis-rmetric:reverse-metric"

  - /isis-rmetric:metric
  - /isis-rmetric:flags/isis-rmetric:whole-lan
  - /isis-rmetric:flags/isis-rmetric:allow-unreachable
  - /isis-rmetric:exclude-te-metric
]]></artwork>

<artwork type="ascii-art"><![CDATA[
Under "/rt:routing/rt:control-plane-protocols/" +
      "rt:control-plane-protocol/isis:isis/" +
      "isis:interfaces/isis:interface/" +
      "isis-rmetric:reverse-metric/" +
      "isis-rmetric:level-1/"

  - /isis-rmetric:metric
  - /isis-rmetric:flags/isis-rmetric:whole-lan
  - /isis-rmetric:flags/isis-rmetric:allow-unreachable
  - /isis-rmetric:exclude-te-metric
]]></artwork>

<artwork type="ascii-art"><![CDATA[
Under "/rt:routing/rt:control-plane-protocols/" +
      "rt:control-plane-protocol/isis:isis/" +
      "isis:interfaces/isis:interface/" +
      "isis-rmetric:reverse-metric/" +
      "isis-rmetric:level-2/"

  - /isis-rmetric:metric
  - /isis-rmetric:flags/isis-rmetric:whole-lan
  - /isis-rmetric:flags/isis-rmetric:allow-unreachable
  - /isis-rmetric:exclude-te-metric
]]></artwork>
<t>Some of the readable data nodes in this 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 YANG nodes correspond 
directly to the functionality provided in RFC 8500, and the security 
considerations of the functionality are described in RFC 8500. 
These are the subtrees and data nodes:</t>
<artwork type="ascii-art"><![CDATA[
Under "/rt:routing/rt:control-plane-protocols/" +
      "rt:control-plane-protocol/isis:isis/" +
      "isis:interfaces/isis:interface/" +
      "isis:adjacencies/isis:adjacency/" +
      "isis-rmetric:reverse-metric"

  - /isis-rmetric:metric
  - /isis-rmetric:flags/isis-rmetric:whole-lan
  - /isis-rmetric:flags/isis-rmetric:allow-unreachable
  - /isis-rmetric:te-metric
]]></artwork>
</section>

</middle>
<back>
<references>
<name>Normative References</name>
  <reference anchor="ISO-10589" target="https://www.iso.org/standard/30932.html">
    <front>
      <title>Intermediate System to Intermediate System intra-
         domain routeing information exchange protocol for use in
         conjunction with the protocol for providing the
         connectionless-mode network service (ISO 8473)</title>
      <author><organization>ISO</organization></author>
      <date year="2002"/>
    </front>
    <refcontent>International Standard 10589: 2002, Second Edition</refcontent>
  </reference>

<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.3688.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6020.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6241.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.6242.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8040.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8340.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8341.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8342.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8349.xml"/>
<xi:include href="https://xml2rfc.ietf.org/public/rfc/bibxml/reference.RFC.8446.xml"/>

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

<!-- draft-ietf-isis-yang-isis-cfg (RFC-to-be 9130 / AUTH48-DONE) -->
<reference anchor='RFC9130' target="https://www.rfc-editor.org/info/rfc9130">
<front>
<title>YANG Data Model for the IS-IS Protocol</title>
<author initials='S' surname='Litkowski' fullname='Stephane Litkowski' role="editor">
    <organization />
</author>
<author initials='D' surname='Yeung' fullname='Derek Yeung'>
    <organization />
</author>
<author initials='A' surname='Lindem' fullname='Acee Lindem'>
    <organization />
</author>
<author initials='J' surname='Zhang' fullname='Jeffrey Zhang'>
    <organization />
</author>
<author initials='L' surname='Lhotka' fullname='Ladislav Lhotka'>
    <organization />
</author>
<date month='October' year='2022' />
</front>
<seriesInfo name="RFC" value="9130"/>
<seriesInfo name="DOI" value="10.17487/RFC9130"/>
</reference>

    <reference anchor="W3C.REC-xml-20081126" target="https://www.w3.org/TR/2008/REC-xml-20081126" quoteTitle="true" derivedAnchor="W3C.REC-xml-20081126">
          <front>
            <title>Extensible Markup Language (XML) 1.0 (Fifth Edition)</title>
            <author initials="T." surname="Bray" fullname="Tim Bray">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="J." surname="Paoli" fullname="Jean Paoli">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="M." surname="Sperberg-McQueen" fullname="Michael Sperberg-McQueen">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="E." surname="Maler" fullname="Eve Maler">
              <organization showOnFrontPage="true"/>
            </author>
            <author initials="F." surname="Yergeau" fullname="Francois Yergeau">
              <organization showOnFrontPage="true"/>
            </author>
            <date month="November" year="2008"/>
          </front>
          <refcontent>World Wide Web Consortium Recommendation REC-xml-20081126</refcontent>
        </reference>
</references>

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

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

<section numbered="true" toc="default">
<name>Examples</name>
<section numbered="true" toc="default">
<name>Enablement Example Using XML YANG Instance Data</name>
<t>Below is an example of XML <xref target="W3C.REC-xml-20081126"/> YANG instance data <xref target="RFC8342"/> to enable reverse metric processing.
</t>

<figure>
<name>Example XML Data to Enable Reverse Metric Processing</name>
<sourcecode type="xml"><![CDATA[
<rt:routing
    xmlns:rt="urn:ietf:params:xml:ns:yang:ietf-routing"
    xmlns:isis="urn:ietf:params:xml:ns:yang:ietf-isis"
    xmlns:isis-rmetric=
    "urn:ietf:params:xml:ns:yang:ietf-isis-reverse-metric">
  <rt:control-plane-protocols>
    <rt:control-plane-protocol>
      <rt:type>isis:isis</rt:type>
      <rt:name>default</rt:name>
      <isis:isis>
        <isis:area-address>00</isis:area-address>
        <isis-rmetric:reverse-metric>
     <isis-rmetric:enable-receive>true</isis-rmetric:enable-receive>
        </isis-rmetric:reverse-metric>
      </isis:isis>
    </rt:control-plane-protocol>
  </rt:control-plane-protocols>
</rt:routing>
]]></sourcecode></figure>

</section>

<section numbered="true" toc="default">
<name>Usage Example Using XML YANG Instance Data</name>
<t>Below is an example of XML YANG instance data <xref target="RFC8342"/> for the
"ietf-isis-reverse-metric" module.</t>

<figure>
<name>Example XML Data for the &quot;ietf-isis-reverse-metric&quot; Module</name>
<sourcecode type="xml"><![CDATA[
<if:interfaces
    xmlns:if="urn:ietf:params:xml:ns:yang:ietf-interfaces"
    xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">
  <if:interface>
    <if:name>eth0</if:name>
    <if:type>ianaift:ethernetCsmacd</if:type>
  </if:interface>
</if:interfaces>
<rt:routing
    xmlns:rt="urn:ietf:params:xml:ns:yang:ietf-routing"
    xmlns:isis="urn:ietf:params:xml:ns:yang:ietf-isis"
    xmlns:isis-rmetric=
    "urn:ietf:params:xml:ns:yang:ietf-isis-reverse-metric">
  <rt:control-plane-protocols>
    <rt:control-plane-protocol>
      <rt:type>isis:isis</rt:type>
      <rt:name>default</rt:name>
      <isis:isis>
        <isis:area-address>00</isis:area-address>
        <isis:interfaces>
          <isis:interface>
            <isis:name>eth0</isis:name>
            <isis-rmetric:reverse-metric>
              <isis-rmetric:metric>
                65535
              </isis-rmetric:metric>
            </isis-rmetric:reverse-metric>
          </isis:interface>
        </isis:interfaces>
      </isis:isis>
    </rt:control-plane-protocol>
  </rt:control-plane-protocols>
</rt:routing>
]]></sourcecode></figure>

</section>

<section numbered="true" toc="default">
<name>Usage Example Using JSON YANG Instance Data</name>
<t>Below is an example of JSON YANG instance data <xref target="RFC7951"/> for the
"ietf-isis-reverse-metric" module.</t>

<figure>
<name>Example JSON Data for the Level-1-Only Reverse Metric</name>
<sourcecode type="json"><![CDATA[
{
  "ietf-interfaces:interfaces": {
    "interface": [
      {
        "name": "eth0",
        "type": "iana-if-type:ethernetCsmacd"
      }
    ]
  },
  "ietf-routing:routing": {
    "control-plane-protocols": {
      "control-plane-protocol": [
        {
          "type": "ietf-isis:isis",
          "name": "default",
          "ietf-isis:isis": {
            "area-address": [
              "00"
            ],
            "interfaces": {
              "interface": [
                {
                  "name": "eth0",
                  "ietf-isis-reverse-metric:reverse-metric": {
                    "level-1": {
                      "metric": 65535,
                      "exclude-te-metric": true
                    }
                  }
                }
              ]
            }
          }
        }
      ]
    }
  }
}
]]></sourcecode></figure>

</section>

</section>
  </back>
</rfc>
