<?xml version='1.0' encoding='utf-8'?>
<!-- This template is for creating an Internet Draft using xml2rfc,
which is available here: http://xml.resource.org. -->
<!DOCTYPE rfc>
<!-- used by XSLT processors -->
<!-- For a complete list and description of processing instructions (PIs),
please see http://xml.resource.org/authoring/README.html. -->
<rfc
    xmlns:xi="http://www.w3.org/2001/XInclude"
    category="std"
    docName="draft-ietf-rtgwg-vrrp-rfc8347bis-15"
    ipr="trust200902"
    obsoletes="8347"
    updates=""
    submissionType="IETF"
    xml:lang="en"
    tocInclude="true"
    tocDepth="4"
    symRefs="true"
    sortRefs="true"
    consensus="true"
    version="3">
  <front>

    <title abbrev='YANG VRRP'>
      A YANG Data Model for the Virtual Router Redundancy Protocol (VRRP)
    </title>

    <author fullname="Acee Lindem" initials="A." surname="Lindem"  role="editor">
      <organization>Arrcus, Inc.</organization>
      <address>
        <postal>
          <street>301 Midenhall Way</street>
          <city>Cary</city>
          <region>NC</region>
          <code>27513</code>
          <country>United States of America</country>
        </postal>
        <email>acee.ietf@gmail.com</email>
      </address>
    </author>

    <author fullname="Xufeng Liu" initials="X." surname="Liu">
      <organization>Individual</organization>
      <address>
        <postal>
          <country>United States of America</country>
        </postal>
        <email>xufeng.liu.ietf@gmail.com</email>
      </address>
    </author>

    <author fullname="Athanasios Kyparlis" initials="A." surname="Kyparlis">
      <organization>Jabil</organization>
      <address>
        <postal>
          <street>8281 Greensboro Drive, Suite 200</street>
          <city>McLean</city>
          <region>VA</region>
          <code>22102</code>
          <country>United States of America</country>
        </postal>
        <email>Athanasios_Kyparlis@jabil.com</email>
      </address>
    </author>

    <author fullname="Ravi Parikh" initials="R." surname="Parikh">
      <organization>Zoox</organization>
      <address>
        <postal>
          <country>United States of America</country>
        </postal>
        <email>parikh_ravi@ymail.com</email>
      </address>
    </author>

    <author fullname="Mingui Zhang" initials="M." surname="Zhang">
       <organization>China Tower</organization>
       <address>
         <postal>
          <street>9 Dongranbeijie Haidian District</street>
          <city>Beijing</city>
          <country>China</country>
         </postal>
         <email>zhangmg3@chinatowercom.cn</email>
      </address>
    </author>

    <keyword>Network Management</keyword>
    <keyword>Routing</keyword>
    <keyword>YANG</keyword>

<abstract>
 <t>
   This document describes a YANG data model for the Virtual Router Redundancy
   Protocol (VRRP). Both versions 2 and 3 of VRRP are covered.
 </t>
 <t>
   The VRRP terminology has been updated to conform to inclusive language
   guidelines for IETF technologies.
 </t>
 <t>
   This document obsoletes RFC 8347.
 </t>
</abstract>
  </front>

  <middle>

<section title="Introduction">
 <t>
   This document introduces a YANG data model <xref target="RFC7950"/>
   for the Virtual Router Redundancy Protocol
   (VRRP) <xref target="RFC3768"/>, <xref target="RFC9568"/>. VRRP provides
   higher resiliency by specifying an election protocol that dynamically
   assigns responsibility for a virtual router to one of the VRRP routers
   on a LAN.
 </t>

  <t>
   The YANG module specified in this document supports both
   versions 2 and 3 of VRRP. VRRP version 2 (defined
   in <xref target="RFC3768"/>) supports IPv4. VRRP version 3
   (defined in <xref target="RFC9568"/>) supports both IPv4 and IPv6.
 </t>

 <t>
   The VRRP terminology has been updated to conform to inclusive language
   guidelines for IETF technologies.
   This document obsoletes VRRP Version 3 <xref target="RFC8347"/>.
 </t>
 <section anchor="changes" title="Changes from RFC 8347">
   <t>
     The following changes have been made consistent with IETF inclusive
     language guidelines:
   </t>
   <ul spacing="normal">
     <li>
       The typedef "new-master-reason-type" was changed to
       "new-active-reason-type". The associated descriptive text
       was also updated.
     </li>
     <li>
       The enum "not-master" was changed to "not-active".
       The associated descriptive text was also updated.
     </li>
     <li>
       The descriptive text for enum "preempted" was updated.
     </li>
     <li>
       The descriptive text for enum "no-response" was updated.
     </li>
     <li>
       The identity "vrrp-event-master-timeout" was changed to
       "vrrp-event-active-timeout". The associated descriptive text
       was also updated.
     </li>
     <li>
       The identity "vrrp-event-lower-priority-master" was changed to
       "vrrp-event-lower-priority-active". The associated descriptive text
       was also updated.
     </li>
     <li>
       The descriptive text for identity "vrrp-event-higher-priority-backup"
       was updated.
     </li>
     <li>
       The descriptive text for identify "vrrp-event-owner-prempt" was updated.
     </li>
     <li>
       The descriptive text for identity "backup" was updated.
     </li>
     <li>
       The identity "master" was changed to "active".
       The associated descriptive text was also updated.
     </li>
     <li>
       The descriptive text for container "preempt" was updated.
     </li>
     <li>
       The descriptive text for leaf "hold-time" was updated.
     </li>
     <li>
       The descriptive text for leaf "accept-mode" was updated.
     </li>
     <li>
       The leaf "master-down-interval" was changed to
       "active-down-interval". The associated descriptive text was also updated.
     </li>
     <li>
       The leaf "new-master-reason" was changed to "new-active-reason".
       The associated descriptive text was also updated.
     </li>
     <li>
       The leaf "new-master-reason" was changed to "new-active-reason".
       The associated descriptive text was also updated.
     </li>
     <li>
       The leaf "master-transitions" was changed to "active-transitions".
       The associated descriptive text was also updated.
     </li>
     <li>
       The notification "vrrp-new-master-event" was changed to
       "vrrp-new-active-event". The associated descriptive text was also updated.
     </li>
     <li>
       The notification leaf "master-ip-address" was changed to "active-ip-address".
       The associated descriptive text was also updated.
     </li>
     <li>
       The notification leaf "new-master-reason" was changed to
       "new-active-reason". The associated descriptive text was also updated.
     </li>
   </ul>
   <t>
     The following additions have been made to the ietf-vrrp module:
   </t>
   <ul>
     <li>
       The leaf "effective-priority" was add to the grouping
       "grouping vrrp-state-attributes" to reflect the effective priority due
       to the VRRP router owning the address or any local policy adjusting the
       priority.
     </li>
   </ul>

 </section>
<section title="Terminology">
  <t>
    The key words "MUST", "MUST NOT", "REQUIRED", "SHALL",
    "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED",
    "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document
    are to be interpreted as described in BCP 14
    <xref format="default" pageno="false" target="RFC2119"/>
    <xref format="default" pageno="false" target="RFC8174"/> when,
    and only when, they appear in all capitals, as shown here.
  </t>

  <t>
  The following terms are defined in  <xref target="RFC7950"/> and
  are not redefined here:
 </t>

   <ul spacing="normal">
     <li>augment</li>
     <li>data node</li>
   </ul>
</section>

<section title="Tree Diagrams">
 <t>
   A simplified graphical representation of the data model is used in
   this document.  The meaning of the symbols in these diagrams is
   defined in <xref target="RFC8340"/>.
 </t>
</section>

<section 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="table_prefixes"/>.
 </t>
 <table anchor="table_prefixes" align="center">
   <name>Prefixes and Corresponding YANG Modules</name>
   <thead>
     <tr>
       <th align="left">Prefix</th>
       <th align="left">YANG module</th>
       <th align="left">Reference</th>
     </tr>
   </thead>
   <tbody>
     <tr>
       <td align="left">yang</td>
       <td align="left">ietf-yang-types</td>
       <td align="left">
       <xref target="RFC9911" format="default"/></td>
     </tr>
     <tr>
       <td align="left">inet</td>
       <td align="left">ietf-inet-types</td>
       <td align="left">
       <xref target="RFC9911" format="default"/></td>
     </tr>
     <tr>
       <td align="left">if</td>
       <td align="left">ietf-interfaces</td>
       <td align="left">
       <xref target="RFC8343" format="default"/></td>
     </tr>
     <tr>
       <td align="left">ip</td>
       <td align="left">ietf-ip</td>
       <td align="left">
       <xref target="RFC8344" format="default"/></td>
     </tr>
   </tbody>
 </table>

</section>

</section>

<section title="Design of the Data Model">
<section title="Scope of the Model">
 <t>
   The model covers VRRP version 2 <xref target="RFC3768"/> and VRRP
   version 3 <xref target="RFC9568"/>. The model is designed to be implemented
   on a device where VRRP version 2 or 3 is implemented.  With the
   help of a proper management protocol, the defined model can be
   used to:
 </t>
   <ul spacing="normal">
    <li>
      Configure VRRP version 2 or 3.
    </li>
    <li>
      Manage the protocol operational behavior.
    </li>
    <li>
      Retrieve the protocol operational status.
    </li>
    <li>
      Receive the protocol notifications.
    </li>
   </ul>
</section>

<section title="Relationships with the Interface Model and IP Model">
 <t>
   This model augments the interface data model "ietf-interfaces"
   <xref target="RFC8343"/> and the IP management model "ietf-ip"
   <xref target="RFC8344"/>. The augmentation relationships are shown
   as follows:
 </t>

 <figure anchor="fig-1"><artwork>
<![CDATA[module: ietf-interfaces
   +--rw interfaces
      +--rw interface* [name]
            ...
         +--rw ip:ipv4!
         |  +--rw ip:address* [ip]
                  ...
         |  +--rw vrrp:vrrp
         |     +--rw vrrp:vrrp-instance* [vrid]
         |        +--rw vrrp:vrid                            uint8
         |        +--rw vrrp:virtual-ipv4-addresses
                        ...
         +--rw ip:ipv6!
            +--rw ip:address* [ip]
                  ...
            +--rw vrrp:vrrp
               +--rw vrrp:vrrp-instance* [vrid]
                  +--rw vrrp:vrid                            uint8
                  +--rw vrrp:virtual-ipv6-addresses
                        ... ]]>
 </artwork></figure>

 <t>
   In <xref target="fig-1"/>, a tree node without a prefix is from the model
   "ietf-interfaces". A tree node with prefix "ip" is from the model
   "ietf-ip". A tree node with prefix "vrrp" is from the VRRP model
   specified in this document.
 </t>

 <t>
   The "vrrp" container contains a list of "vrrp-instance" nodes,
   which are instantiated under an interface for a specified address
   family (IPv4 or IPv6).
 </t>

 <t>
   Each "vrrp-instance" node represents a VRRP router state machine, as
   described in Section 6.4 of <xref target="RFC9568"/>, providing
   the configuration and state information for the election process of a
   virtual router.  The IP addresses on the augmented interface are
   the real addresses through which the VRRP router operates. The
   IPv4 or IPv6 address or addresses associated with a virtual router
   (described in Section 1 of <xref target="RFC9568"/>) are modeled
   as a list of IPv4 or IPv6 addresses under the "vrrp-instance".
 </t>
</section>

<section title="Protocol Configuration">
 <t>
   The model structure for the protocol configuration is depicted in
   <xref target="fig-2"/>.
 </t>

 <figure anchor="fig-2"><artwork>
<![CDATA[  augment /if:interfaces/if:interface/ip:ipv4:
    +--rw vrrp
       +--rw vrrp-instance* [vrid]
          +--rw vrid                            uint8
          |     ...
          +--rw track
          |  +--rw interfaces
          |  |  +--rw interface* [interface]
          |  |     +--rw interface             if:interface-ref
          |  |           ...
          |  +--rw networks
          |     +--rw network* [prefix]
          |        +--rw prefix                inet:ipv4-prefix
          |              ...
          +--rw virtual-ipv4-addresses
             +--rw virtual-ipv4-address* [ipv4-address]
                +--rw ipv4-address    inet:ipv4-address

  augment /if:interfaces/if:interface/ip:ipv6:
    +--rw vrrp
       +--rw vrrp-instance* [vrid]
          +--rw vrid                            uint8
          |     ...
          +--rw track
          |  +--rw interfaces
          |  |  +--rw interface* [interface]
          |  |     +--rw interface             if:interface-ref
          |  |           ...
          |  +--rw networks
          |     +--rw network* [prefix]
          |        +--rw prefix                inet:ipv6-prefix
          |              ...
          +--rw virtual-ipv6-addresses
             +--rw virtual-ipv6-address* [ipv6-address]
                +--rw ipv6-address    inet:ipv6-address ]]>
 </artwork></figure>

 <t>
   The model allows the following protocol entities to be managed:
 </t>
   <ul spacing="normal">
     <li>
       VRRP instance (version 2 or 3), representing a VRRP router.
     </li>
     <li>
       Virtual IPv4 or IPv6 address associated with a virtual router.
     </li>
     <li>
       Tracking interface, to detect interface connectivity failures.
     </li>
     <li>
       Tracking network, to detect network connectivity failures.
     </li>
   </ul>
</section>

<section title="Protocol States">
 <t>
   The model structure for the protocol states is depicted
   in <xref target="fig-3"/>.
 </t>

 <figure anchor="fig-3"><artwork>
<![CDATA[
module: ietf-vrrp
    +--ro vrrp
       |     // global operational states
       +--ro virtual-routers?   uint32
       +--ro interfaces?        uint32
       +--ro statistics                 // global statistics
          +--ro discontinuity-datetime?   yang:date-and-time
          +--ro checksum-errors?          yang:counter64
          +--ro version-errors?           yang:counter64
          +--ro vrid-errors?              yang:counter64
          +--ro ip-ttl-errors?            yang:counter64

  augment /if:interfaces/if:interface/ip:ipv4:
    +--rw vrrp
       +--rw vrrp-instance* [vrid]
          +--rw vrid                            uint8
          |     ...
          +--rw track
          |  +--rw interfaces
          |  |  +--rw interface* [interface]
          |  |     +--rw interface             if:interface-ref
          |  |           ...
          |  +--rw networks
          |     +--rw network* [prefix]
          |        +--rw prefix                inet:ipv4-prefix
          |              ...
          +--rw virtual-ipv4-addresses
          |  +--rw virtual-ipv4-address* [ipv4-address]
          |     +--rw ipv4-address    inet:ipv4-address
          |
          |     // per-instance operational states
          +--ro state?                         identityref
          +--ro is-owner?                      boolean
          +--ro effective-priority?            uint8
          +--ro last-adv-source?               inet:ip-address
          +--ro up-datetime?                   yang:date-and-time
          +--ro active-down-interval?          uint32
          +--ro skew-time?                     uint32
          +--ro last-event?                    identityref
          +--ro new-active-reason?             new-active-reason-type
          +--ro statistics                // per-instance statistics
             +--ro discontinuity-datetime?    yang:date-and-time
             +--ro active-transitions?        yang:counter32
             +--ro advertisement-rcvd?        yang:counter64
             +--ro advertisement-sent?        yang:counter64
             +--ro interval-errors?           yang:counter64
             |       {validate-interval-errors}?
             +--ro priority-zero-pkts-rcvd?   yang:counter64
             +--ro priority-zero-pkts-sent?   yang:counter64
             +--ro invalid-type-pkts-rcvd?    yang:counter64
             +--ro address-list-errors?       yang:counter64
             |       {validate-address-list-errors}?
             +--ro packet-length-errors?      yang:counter64

  augment /if:interfaces/if:interface/ip:ipv6:
    +--rw vrrp
       +--rw vrrp-instance* [vrid]
          +--rw vrid                            uint8
          +     ...
          +--rw track
          |  +--rw interfaces
          |  |  +--rw interface* [interface]
          |  |     +--rw interface             if:interface-ref
          |  |           ...
          |  +--rw networks
          |     +--rw network* [prefix]
          |        +--rw prefix                inet:ipv6-prefix
          |              ...
          +--rw virtual-ipv6-addresses
          |  +--rw virtual-ipv6-address* [ipv6-address]
          |     +--rw ipv6-address    inet:ipv6-address
          |
          |     // per-instance operational states
          +--ro state?                         identityref
          +--ro is-owner?                      boolean
          +--ro effective-priority?            uint8
          +--ro last-adv-source?               inet:ip-address
          +--ro up-datetime?                   yang:date-and-time
          +--ro active-down-interval?          uint32
          +--ro skew-time?                     uint32
          +--ro last-event?                    identityref
          +--ro new-active-reason?             new-active-reason-type
          +--ro statistics                // per-instance statistics
             +--ro discontinuity-datetime?    yang:date-and-time
             +--ro active-transitions?        yang:counter32
             +--ro advertisement-rcvd?        yang:counter64
             +--ro advertisement-sent?        yang:counter64
             +--ro interval-errors?           yang:counter64
             |       {validate-interval-errors}?
             +--ro priority-zero-pkts-rcvd?   yang:counter64
             +--ro priority-zero-pkts-sent?   yang:counter64
             +--ro invalid-type-pkts-rcvd?    yang:counter64
             +--ro address-list-errors?       yang:counter64
             |       {validate-address-list-errors}?
             +--ro packet-length-errors?      yang:counter64 ]]>
 </artwork></figure>

 <t>
   This model conforms to the Network Management Datastore
   Architecture (NMDA) <xref target="RFC8342"/>.
   The operational state data is combined with the associated
   configuration data in the same hierarchy
   <xref target="I-D.ietf-netmod-rfc8407bis"/>. When protocol states
   are retrieved from the NMDA operational state datastore, the
   returned states cover all "config true" (rw) and "config false"
   (ro) nodes defined in the schema.
 </t>

 <t>
   The model allows the retrieval of protocol states at the following levels:
 </t>

   <ul spacing="normal">
    <li>
      VRRP instance (version 2 or 3), representing a VRRP router.
    </li>
    <li>
      Virtual IPv4 or IPv6 address associated with a virtual router.
    </li>
    <li>
      Tracking interface, to detect interface connectivity failures.
    </li>
    <li>
      Tracking network, to detect network connectivity failures.
    </li>
    <li>
      Global states and statistics summarizing all instances.
    </li>
   </ul>
</section>

<section title="Notifications">
 <t>
   This model defines the following VRRP-specific notifications (<xref target="fig-4"/>):
 </t>

 <figure anchor="fig-4"><artwork>
<![CDATA[notifications:
   +---n vrrp-new-active-event
   |  +--ro active-ip-address    inet:ip-address
   |  +--ro new-active-reason    new-active-reason-type
   +---n vrrp-protocol-error-event
   |  +--ro protocol-error-reason    identityref
   +---n vrrp-virtual-router-error-event
      +--ro interface                      if:interface-ref
      +--ro (ip-version)
      |  +--:(ipv4)
      |  |  +--ro ipv4
      |  |     +--ro vrid    leafref
      |  +--:(ipv6)
      |     +--ro ipv6
      |        +--ro vrid    leafref
      +--ro virtual-router-error-reason    identityref ]]>
 </artwork></figure>

 <t>
   Each notification type is used to indicate a type of VRRP state
   change or error occurrence:
 </t>

 <dl newline="false" spacing="normal" indent="24">
   <dt>"vrrp-new-active-event"</dt>
   <dd>
     <t>
       VRRP new active event, indicating that a new active virtual router has been elected.
     </t>
   </dd>
   <dt>"vrrp-protocol-error-event"</dt>
   <dd>
     <t>
      VRRP protocol error event for a message that fails to reach a VRRP
      instance to be processed.
     </t>
   </dd>
   <dt>"vrrp-virtual-router-error-event"</dt>
   <dd>
     <t>
       VRRP virtual router error event for a message processed on a VRRP
       instance.
     </t>
   </dd>
 </dl>

 <t>
   In addition to the notifications specified above, the mechanisms
   defined in <xref target="RFC8639"/> and
   <xref target="RFC8641"/> can be used for other general notifications.
   These mechanisms currently allow the user to:
 </t>
   <ul spacing="normal">
    <li>
      Subscribe notifications on a per-client basis.
    </li>
    <li>
      Specify subtree filters or XML Path Language (XPath) filters
      so that only contents of interest will be sent.
    </li>
    <li>
      Specify either periodic or on-demand notifications.
    </li>
   </ul>
</section>

</section>

<section title="Tree Structure">
 <t>
   The VRRP YANG data model defined in this document has the
   following tree structure (<xref target="fig-5"/>):
 </t>

 <figure anchor="fig-5"><artwork>
<![CDATA[module: ietf-vrrp
    +--ro vrrp
       +--ro virtual-routers?   uint32
       +--ro interfaces?        uint32
       +--ro statistics
          +--ro discontinuity-datetime?   yang:date-and-time
          +--ro checksum-errors?          yang:counter64
          +--ro version-errors?           yang:counter64
          +--ro vrid-errors?              yang:counter64
          +--ro ip-ttl-errors?            yang:counter64
  augment /if:interfaces/if:interface/ip:ipv4:
    +--rw vrrp
       +--rw vrrp-instance* [vrid]
          +--rw vrid                            uint8
          +--rw version                         identityref
          +--rw log-state-change?               boolean
          +--rw preempt
          |  +--rw enabled?     boolean
          |  +--rw hold-time?   uint16
          +--rw priority?                       uint8
          +--rw accept-mode?                    boolean
          +--rw (advertise-interval-choice)?
          |  +--:(v2)
          |  |  +--rw advertise-interval-sec?         uint8
          |  +--:(v3)
          |     +--rw advertise-interval-centi-sec?   uint16
          +--rw track
          |  +--rw interfaces
          |  |  +--rw interface* [interface]
          |  |     +--rw interface             if:interface-ref
          |  |     +--rw priority-decrement?   uint8
          |  +--rw networks
          |     +--rw network* [prefix]
          |        +--rw prefix                inet:ipv4-prefix
          |        +--rw priority-decrement?   uint8
          +--rw virtual-ipv4-addresses
          |  +--rw virtual-ipv4-address* [ipv4-address]
          |     +--rw ipv4-address    inet:ipv4-address
          +--ro state?                          identityref
          +--ro is-owner?                       boolean
          +--ro effective-priority?             uint8
          +--ro last-adv-source?                inet:ip-address
          +--ro up-datetime?                    yang:date-and-time
          +--ro active-down-interval?           uint32
          +--ro skew-time?                      uint32
          +--ro last-event?                     identityref
          +--ro new-active-reason?
 new-active-reason-type
          +--ro statistics
             +--ro discontinuity-datetime?    yang:date-and-time
             +--ro active-transitions?        yang:counter32
             +--ro advertisement-rcvd?        yang:counter64
             +--ro advertisement-sent?        yang:counter64
             +--ro interval-errors?           yang:counter64
             |       {validate-interval-errors}?
             +--ro priority-zero-pkts-rcvd?   yang:counter64
             +--ro priority-zero-pkts-sent?   yang:counter64
             +--ro invalid-type-pkts-rcvd?    yang:counter64
             +--ro address-list-errors?       yang:counter64
             |       {validate-address-list-errors}?
             +--ro packet-length-errors?      yang:counter64
  augment /if:interfaces/if:interface/ip:ipv6:
    +--rw vrrp
       +--rw vrrp-instance* [vrid]
          +--rw vrid                            uint8
          +--rw version                         identityref
          +--rw log-state-change?               boolean
          +--rw preempt
          |  +--rw enabled?     boolean
          |  +--rw hold-time?   uint16
          +--rw priority?                       uint8
          +--rw accept-mode?                    boolean
          +--rw advertise-interval-centi-sec?   uint16
          +--rw track
          |  +--rw interfaces
          |  |  +--rw interface* [interface]
          |  |     +--rw interface             if:interface-ref
          |  |     +--rw priority-decrement?   uint8
          |  +--rw networks
          |     +--rw network* [prefix]
          |        +--rw prefix                inet:ipv6-prefix
          |        +--rw priority-decrement?   uint8
          +--rw virtual-ipv6-addresses
          |  +--rw virtual-ipv6-address* [ipv6-address]
          |     +--rw ipv6-address    inet:ipv6-address
          +--ro state?                          identityref
          +--ro is-owner?                       boolean
          +--ro effective-priority?             uint8
          +--ro last-adv-source?                inet:ip-address
          +--ro up-datetime?                    yang:date-and-time
          +--ro active-down-interval?           uint32
          +--ro skew-time?                      uint32
          +--ro last-event?                     identityref
          +--ro new-active-reason?
 new-active-reason-type
          +--ro statistics
             +--ro discontinuity-datetime?    yang:date-and-time
             +--ro active-transitions?        yang:counter32
             +--ro advertisement-rcvd?        yang:counter64
             +--ro advertisement-sent?        yang:counter64
             +--ro interval-errors?           yang:counter64
             |       {validate-interval-errors}?
             +--ro priority-zero-pkts-rcvd?   yang:counter64
             +--ro priority-zero-pkts-sent?   yang:counter64
             +--ro invalid-type-pkts-rcvd?    yang:counter64
             +--ro address-list-errors?       yang:counter64
             |       {validate-address-list-errors}?
             +--ro packet-length-errors?      yang:counter64

  notifications:
    +---n vrrp-new-active-event
    |  +--ro active-ip-address    inet:ip-address
    |  +--ro new-active-reason    new-active-reason-type
    +---n vrrp-protocol-error-event
    |  +--ro protocol-error-reason    identityref
    +---n vrrp-virtual-router-error-event
       +--ro interface                      if:interface-ref
       +--ro (ip-version)
       |  +--:(ipv4)
       |  |  +--ro ipv4
       |  |     +--ro vrid    leafref
       |  +--:(ipv6)
       |     +--ro ipv6
       |        +--ro vrid    leafref
       +--ro virtual-router-error-reason    identityref ]]>
 </artwork></figure>
</section>

<section title="YANG Module">
<t>
  This module references
  <xref target="RFC3768"/>,
  <xref target="RFC9568"/>, and
  <xref target="RFC6527"/>.
</t>

<artwork>
  <![CDATA[<CODE BEGINS> file "ietf-vrrp@2026-02-13.yang"
module ietf-vrrp {
  yang-version 1.1;
  namespace "urn:ietf:params:xml:ns:yang:ietf-vrrp";
  prefix vrrp;

  import ietf-inet-types {
    prefix inet;
    reference
      "RFC 9911: Common YANG Data Types, Section 4";
  }
  import ietf-yang-types {
    prefix yang;
    reference
      "RFC 9911: Common YANG Data Types, Section 3";
  }
  import ietf-interfaces {
    prefix if;
    reference
      "RFC 8343: A YANG Data Model for Interface Management";
  }
  import ietf-ip {
    prefix ip;
    reference
      "RFC 8344: A YANG Data Model for IP Management";
  }

  organization
    "IETF Routing Area Working Group (RTGWG)";
  contact
    "WG Web:   <https://datatracker.ietf.org/wg/rtgwg/>
     WG List:  <mailto:rtgwg@ietf.org>

     Editor:   Acee Lindem
               <mailto:acee.ietf@gmail.com>

     Editor:   Xufeng Liu
               <mailto:xufeng.liu.ietf@gmail.com>

     Editor:   Athanasios Kyparlis
               <mailto:Athanasios_Kyparlis@jabil.com>

     Editor:   Ravi Parikh
               <mailto:parikhr@vmware.com>

     Editor:   Mingui Zhang
               <mailto:zhangmingui@huawei.com>";

  description
    "This YANG module defines a model for managing Virtual Router
     Redundancy Protocol (VRRP) versions 2 and 3.

     Copyright (c) 2026 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).

     All revisions of IETF and IANA published modules can be found
     at the YANG Parameters registry group
     (https://www.iana.org/assignments/yang-parameters).

     The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
     NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
     'MAY', and 'OPTIONAL' in this document are to be interpreted as
     described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
     they appear in all capitals, as shown here.

     This version of this YANG module is part of RFC XXXX; see
     the RFC itself for full legal notices.";

  revision 2026-02-13 {
    description
      "This revision includes the following changes:
       - Update some identifiers and descriptions to conform
         to the changes in RFC 9586
       - Add a new effective-priority leaf
       - Update some reference statements";
    reference
      "RFC XXXX: A YANG Data Model for the Virtual Router Redundancy
                 Protocol (VRRP)";
  }
  revision 2018-03-13 {
    description
      "Initial revision.";
    reference
      "RFC 8347: A YANG Data Model for the Virtual Router Redundancy
                 Protocol (VRRP)";
  }

  /*
   * Features
   */

  feature validate-interval-errors {
    description
      "This feature indicates that the system validates that the
       advertisement interval from advertisement packets received
       is the same as the interval configured for the local
       VRRP router.";
  }

  feature validate-address-list-errors {
    description
      "This feature indicates that the system validates that
       the address list from received packets matches the
       locally configured list for the VRRP router.";
  }

  /*
   * Typedefs
   */

  typedef new-active-reason-type {
    type enumeration {
      enum not-active {
        description
          "The virtual router has never transitioned to active
           state.";
      }
      enum priority {
        description
          "Priority was higher.";
      }
      enum preempted {
        description
          "The active virtual router was preempted.";
      }
      enum no-response {
        description
          "Previous active virtual router did not respond.";
      }
    }
    description
      "Indicates why the virtual router has transitioned to
       active state.

       The identifier of this typedef is changed to reflect
       the updated terminology used in RFC 9568.";
  } // new-active-reason-type

  /*
   * Identities
   */
  /* vrrp-event-type identity and its derivatives. */

  identity vrrp-event-type {
    description
      "Indicates the type of a VRRP protocol event.";
  }

  identity vrrp-event-none {
    base vrrp-event-type;
    description
      "Indicates a non-meaningful event.";
  }

  identity vrrp-event-startup {
    base vrrp-event-type;
    description
      "Indicates that a VRRP router has initiated the protocol.";
  }

  identity vrrp-event-shutdown {
    base vrrp-event-type;
    description
      "Indicates that a VRRP router has closed down the protocol.";
  }

  identity vrrp-event-higher-priority-backup {
    base vrrp-event-type;
    description
      "Indicates that a backup router has a higher priority than
       the current active.";
  }

  identity vrrp-event-active-timeout {
    base vrrp-event-type;
    description
      "Indicates that the current active virtual router has not sent
       an advertisement within the limit of active-down-interval.

       The identity is changed to reflect the updated terminology
       used in RFC 9568.";
  }

  identity vrrp-event-interface-up {
    base vrrp-event-type;
    description
      "Indicates that the VRRP-enabled interface has become
       'operational up'.";
  }

  identity vrrp-event-interface-down {
    base vrrp-event-type;
    description
      "Indicates that the VRRP-enabled interface has become
       'operational down'.";
  }

  identity vrrp-event-no-primary-ip-address {
    base vrrp-event-type;
    description
      "Indicates that the primary IP address on the VRRP-enabled
       interface has become unavailable.";
  }

  identity vrrp-event-primary-ip-address {
    base vrrp-event-type;
    description
      "Indicates that the primary IP address on the VRRP-enabled
       interface has become available.";
  }

  identity vrrp-event-no-virtual-ip-addresses {
    base vrrp-event-type;
    description
      "Indicates that there are no virtual IP addresses on the
       virtual router.";
  }

  identity vrrp-event-virtual-ip-addresses {
    base vrrp-event-type;
    description
      "Indicates that there are virtual IP addresses on the
       virtual router.";
  }

  identity vrrp-event-preempt-hold-timeout {
    base vrrp-event-type;
    description
      "Indicates that the configured preemption hold time has
       passed.";
  }

  identity vrrp-event-lower-priority-active {
    base vrrp-event-type;
    description
      "Indicates that there is a lower-priority VRRP active router.

       The identity is changed to reflect the updated terminology
       used in RFC 9568.";
  }

  identity vrrp-event-owner-preempt {
    base vrrp-event-type;
    description
      "Indicates that the owner has preempted another virtual router
       to become the active virtual router.";
  }

  /* vrrp-error-global identity and its derivatives. */

  identity vrrp-error-global {
    description
      "Indicates the type of a VRRP error that occurred
       for a packet before it reaches a VRRP router.";
  }

  identity checksum-error {
    base vrrp-error-global;
    description
      "A packet has been received with an invalid VRRP checksum
       value.";
  }

  identity ip-ttl-error {
    base vrrp-error-global;
    description
      "A packet has been received with IP TTL (Time-To-Live)
       not equal to 255.";
  }

  identity version-error {
    base vrrp-error-global;
    description
      "A packet has been received with an unknown or unsupported
       version number.";
  }

  identity vrid-error {
    base vrrp-error-global;
    description
      "A packet has been received with a Virtual Router Identifier
       (VRID) that is not valid for any virtual router on this
       router.";
  }

  /* vrrp-error-virtual-router identity and its derivatives. */

  identity vrrp-error-virtual-router {
    description
      "Indicates the type of a VRRP error that occurred
       after a packet reaches a VRRP router.";
  }

  identity address-list-error {
    base vrrp-error-virtual-router;
    description
      "A packet has been received with an address list that
       does not match the locally configured address list for
       the virtual router.";
  }

  identity interval-error {
    base vrrp-error-virtual-router;
    description
      "A packet has been received with an advertisement interval
       different than the interval configured for the local
       virtual router.";
  }

  identity packet-length-error {
    base vrrp-error-virtual-router;
    description
      "A packet has been received with a packet length less
       than the length of the VRRP header.";
  }

  /* vrrp-state-type identity and its derivatives. */

  identity vrrp-state-type {
    description
      "Indicates the state of a virtual router.";
  }

  identity initialize {
    base vrrp-state-type;
    description
      "Indicates that the virtual router is waiting
       for a startup event.";
  }

  identity backup {
    base vrrp-state-type;
    description
      "Indicates that the virtual router is monitoring the
       availability of the active virtual router.";
  }

  identity active {
    base vrrp-state-type;
    description
      "Indicates that the virtual router is forwarding
       packets for IP addresses that are associated with
       this virtual router.

       The identity is changed to reflect the updated terminology
       used in RFC 9568.";
  }

  /* vrrp-version identity and its derivatives. */

  identity vrrp-version {
    description
      "The version of VRRP.";
  }

  identity vrrp-v2 {
    base vrrp-version;
    description
      "Indicates version 2 of VRRP.";
  }

  identity vrrp-v3 {
    base vrrp-version;
    description
      "Indicates version 3 of VRRP.";
  }

  /*
   * Groupings
   */

  grouping vrrp-common-attributes {
    description
      "Group of VRRP attributes common to versions 2 and 3.";
    leaf vrid {
      type uint8 {
        range "1..255";
      }
      description
        "Virtual Router ID (i.e., VRID).";
    }
    leaf version {
      type identityref {
        base vrrp:vrrp-version;
      }
      mandatory true;
      description
        "Version 2 or 3 of VRRP.";
    }
    leaf log-state-change {
      type boolean;
      default "false";
      description
        "Generates VRRP state change messages each time the
         VRRP instance changes state (from 'up' to 'down'
         or 'down' to 'up').";
    }
    container preempt {
      description
        "Enables a higher-priority VRRP backup router to preempt a
         lower-priority VRRP active router.";
      leaf enabled {
        type boolean;
        default "true";
        description
          "'true' if preemption is enabled.";
      }
      leaf hold-time {
        type uint16;
        units "seconds";
        default "0";
        description
          "Hold time, in seconds, for which a higher-priority VRRP
           backup router must wait before preempting a lower-priority
           VRRP active router.";
      }
    }
    leaf priority {
      type uint8 {
        range "1..254";
      }
      default "100";
      description
        "Configures the VRRP election priority for the backup
         virtual router.";
    }
    leaf accept-mode {
      when "derived-from-or-self(current()/../version,
            'vrrp:vrrp-v3')" {
        description
          "Applicable only to version 3.";
      }
      type boolean;
      default "false";
      description
        "Controls whether a virtual router in active state will
         accept packets addressed to the address owner's IPvX address
         as its own if it is not the IPvX address owner.  The default
         is 'false'.  Deployments that rely on, for example, pinging
         the address owner's IPvX address may wish to configure
         accept-mode to 'true'.

         Note: IPv6 Neighbor Solicitations and Neighbor
         Advertisements MUST NOT be dropped when accept-mode
         is 'false'.";
    }
  } // vrrp-common-attributes

  grouping vrrp-ipv4-attributes {
    description
      "Group of VRRP attributes for IPv4.";
    uses vrrp-common-attributes;
    choice advertise-interval-choice {
      description
        "The options for the advertisement interval at which VRRPv2
         or VRRPv3 advertisements are sent from the specified
         interface.";
      case v2 {
        when "derived-from-or-self(version, 'vrrp:vrrp-v2')" {
          description
            "Applicable only to version 2.";
        }
        leaf advertise-interval-sec {
          type uint8 {
            range "1..254";
          }
          units "seconds";
          default "1";
          description
            "Configures the interval that VRRPv2 advertisements
             are sent from the specified interface.";
        }
      }
      case v3 {
        when "derived-from-or-self(version, 'vrrp:vrrp-v3')" {
          description
            "Applicable only to version 3.";
        }
        leaf advertise-interval-centi-sec {
          type uint16 {
            range "1..4095";
          }
          units "centiseconds";
          default "100";
          description
            "Configures the interval that VRRPv3 advertisements
             are sent from the specified interface.";
        }
      }
    } // advertise-interval-choice
    container track {
      description
        "Enables the specified VRRP instance to track interfaces
         or networks.";
      container interfaces {
        description
          "Enables the specified VRRPv2 or VRRPv3 instance to track
           interfaces.  Interface tracking prevents traffic loss by
           detecting the availability of interfaces.  The operational
           states of other interfaces are associated with the
           priority of a VRRP router.  When a tracked interface
           becomes unavailable (or 'operational down'), the priority
           of the VRRP router decrements.  When an unavailable
           interface becomes available again, the priority of the
           VRRP router is incremented by the same amount.";
        list interface {
          key "interface";
          description
            "Interface to track.";
          leaf interface {
            type if:interface-ref;
            must '/if:interfaces/if:interface[if:name=current()]/'
               + 'ip:ipv4' {
              description
                "Interface is IPv4.";
            }
            description
              "Interface to track.";
          }
          leaf priority-decrement {
            type uint8 {
              range "1..254";
            }
            default "10";
            description
              "Specifies how much to decrement the priority of the
               VRRP instance if the interface goes down.";
          }
        } // interface
      } // interfaces
      container networks {
        description
          "Enables the VRRPv2 or VRRPv3 router instance to track the
           specified networks through their IPv4 network prefixes.
           Network tracking prevents traffic loss by detecting
           network connectivity failure.  The states of
           connectivity to some networks are associated with the
           priority of a VRRP router.  When connectivity to a
           tracked network represented by its prefix is lost, the
           priority of the VRRP router decrements.  When an
           unavailable network is again reachable, the priority of
           the VRRP router is incremented by the same amount.";
        list network {
          key "prefix";
          description
            "Enables the specified VRRPv2 or VRRPv3 instance to
             track an IPv4 network by specifying the prefix of the
             IPv4 network.";
          leaf prefix {
            type inet:ipv4-prefix;
            description
              "The IPv4 prefix of the network to track.";
          }
          leaf priority-decrement {
            type uint8 {
              range "1..254";
            }
            default "10";
            description
              "Specifies how much to decrement the priority of the
               VRRP router if there is a failure in the IPv4
               network.";
          }
        } // network
      } // networks
    } // track
    container virtual-ipv4-addresses {
      description
        "Configures the virtual IPv4 address for the
         VRRP interface.";
      list virtual-ipv4-address {
        key "ipv4-address";
        max-elements 16;
        description
          "Virtual IPv4 addresses for a single VRRP instance.  For a
           VRRP owner router, the virtual address must match one
           of the IPv4 addresses configured on the interface
           corresponding to the virtual router.";
        leaf ipv4-address {
          type inet:ipv4-address;
          description
            "An IPv4 address associated with a virtual router.";
          reference
            "RFC 9568: Virtual Router Redundancy Protocol (VRRP)
                       Version 3 for IPv4 and IPv6,  Section 1.3";
        }
      } // virtual-ipv4-address
    } // virtual-ipv4-addresses
  } // vrrp-ipv4-attributes

  grouping vrrp-ipv6-attributes {
    description
      "Group of VRRP attributes for IPv6.";
    uses vrrp-common-attributes;
    leaf advertise-interval-centi-sec {
      type uint16 {
        range "1..4095";
      }
      units "centiseconds";
      default "100";
      description
        "Includes the interval that VRRPv3 advertisements
         are sent from the specified interface.";
    }
    container track {
      description
        "Enables the specified VRRP instance to track interfaces
         or networks.";
      container interfaces {
        description
          "Enables the specified VRRPv2 or VRRPv3 instance to track
           interfaces.  Interface tracking prevents traffic loss by
           detecting the availability of interfaces.  The operational
           states of other interfaces are associated with the
           priority of a VRRP router.  When a tracked interface
           becomes unavailable (or 'operational down'), the priority
           of the VRRP router decrements.  When an unavailable
           interface becomes available again, the priority of the
           VRRP router is incremented by the same amount.";
        list interface {
          key "interface";
          description
            "Interface to track.";
          leaf interface {
            type if:interface-ref;
            must '/if:interfaces/if:interface[if:name=current()]/'
               + 'ip:ipv6' {
              description
                "Interface is IPv6.";
            }
            description
              "Interface to track.";
          }
          leaf priority-decrement {
            type uint8 {
              range "1..254";
            }
            default "10";
            description
              "Specifies how much to decrement the priority of the
               VRRP instance if the interface goes down.";
          }
        } // interface
      } // interfaces
      container networks {
        description
          "Enables the VRRPv2 or VRRPv3 router instance to track the
           specified networks through their IPv6 network prefixes.
           Network tracking prevents traffic loss by detecting
           network connectivity failure.  The states of
           connectivity to some networks are associated with the
           priority of a VRRP router.  When connectivity to a
           tracked network represented by its prefix is lost, the
           priority of the VRRP router decrements.  When an
           unavailable network is again reachable, the priority of
           the VRRP router is incremented by the same amount.";
        list network {
          key "prefix";
          description
            "Enables the specified VRRPv2 or VRRPv3 instance to
             track an IPv6 network by specifying the prefix of the
             IPv6 network.";
          leaf prefix {
            type inet:ipv6-prefix;
            description
              "The IPv6 prefix of the network to track.";
          }
          leaf priority-decrement {
            type uint8 {
              range "1..254";
            }
            default "10";
            description
              "Specifies how much to decrement the priority of the
               VRRP router if there is a failure in the IPv6
               network.";
          }
        } // network
      } // networks
    } // track
    container virtual-ipv6-addresses {
      description
        "Configures the virtual IPv6 address for the
         VRRP interface.";
      list virtual-ipv6-address {
        key "ipv6-address";
        max-elements 2;
        description
          "Two IPv6 addresses are allowed.  The first address must
           be a link-local address.  The second address can be a
           link-local or global address.";
        leaf ipv6-address {
          type inet:ipv6-address;
          description
            "An IPv6 address associated with a virtual router.";
          reference
            "RFC 9568: Virtual Router Redundancy Protocol (VRRP)
                       Version 3 for IPv4 and IPv6, Section 1.4";
        }
      } // virtual-ipv6-address
    } // virtual-ipv6-addresses
  } // vrrp-ipv6-attributes

  grouping vrrp-state-attributes {
    description
      "Group of VRRP state attributes.";
    leaf state {
      type identityref {
        base vrrp:vrrp-state-type;
      }
      config false;
      description
        "Operational state.";
    }
    leaf is-owner {
      type boolean;
      config false;
      description
        "Set to 'true' if this virtual router is the owner.";
    }
    leaf effective-priority {
      type uint8 {
        range "1..255";
      }
      config false;
      description
        "The effect priority of the virtual router taking account
         address ownership and any modifications due to
         local policy.";
    }
    leaf last-adv-source {
      type inet:ip-address;
      config false;
      description
        "Last advertised IPv4/IPv6 source address.";
    }
    leaf up-datetime {
      type yang:date-and-time;
      config false;
      description
        "The date and time when this virtual router
         transitioned out of 'init' state.";
    }
    leaf active-down-interval {
      type uint32;
      units "centiseconds";
      config false;
      description
        "Time interval for the backup virtual router to declare
         'active down'.

         The identifier of this leaf is changed to reflect
         the updated terminology used in RFC 9568.";
    }
    leaf skew-time {
      type uint32;
      units "microseconds";
      config false;
      description
        "Calculated based on the priority and advertisement
         interval configuration command parameters.  See RFC 9568.";
    }
    leaf last-event {
      type identityref {
        base vrrp:vrrp-event-type;
      }
      config false;
      description
        "Last reported event.";
    }
    leaf new-active-reason {
      type new-active-reason-type;
      config false;
      description
        "Indicates why the virtual router has transitioned to
         active state.

         The identifier of this leaf is changed to reflect
         the updated terminology used in RFC 9568.";
    }
    container statistics {
      config false;
      description
        "VRRP statistics.";
      leaf discontinuity-datetime {
        type yang:date-and-time;
        description
          "The time on the most recent occasion at which any one or
           more of the VRRP statistics counters suffered a
           discontinuity.  If no such discontinuities have occurred
           since the last re-initialization of the local management
           subsystem, then this node contains the time that the
           local management subsystem re-initialized itself.";
      }
      leaf active-transitions {
        type yang:counter32;
        description
          "The total number of times that this virtual router's
           state has transitioned to 'Active'.

           The identifier of this leaf is changed to reflect
           the updated terminology used in RFC 9568.";
      }
      leaf advertisement-rcvd {
        type yang:counter64;
        description
          "The total number of VRRP advertisements received by
           this virtual router.";
      }
      leaf advertisement-sent {
        type yang:counter64;
        description
          "The total number of VRRP advertisements sent by
           this virtual router.";
      }
      leaf interval-errors {
        if-feature "validate-interval-errors";
        type yang:counter64;
        description
          "The total number of VRRP advertisement packets received
           with an advertisement interval different than the
           interval configured for the local virtual router.";
      }
      leaf priority-zero-pkts-rcvd {
        type yang:counter64;
        description
          "The total number of VRRP packets received by the
           virtual router with a priority of 0.";
      }
      leaf priority-zero-pkts-sent {
        type yang:counter64;
        description
          "The total number of VRRP packets sent by the
           virtual router with a priority of 0.";
      }
      leaf invalid-type-pkts-rcvd {
        type yang:counter64;
        description
          "The number of VRRP packets received by the virtual
           router with an invalid value in the 'type' field.";
      }
      leaf address-list-errors {
        if-feature "validate-address-list-errors";
        type yang:counter64;
        description
          "The total number of packets received with an
           address list that does not match the locally
           configured address list for the virtual router.";
      }
      leaf packet-length-errors {
        type yang:counter64;
        description
          "The total number of packets received with a packet
           length less than the length of the VRRP header.";
      }
    } // statistics
  } // vrrp-state-attributes

  grouping vrrp-global-state-attributes {
    description
      "Group of VRRP global state attributes.";
    leaf virtual-routers {
      type uint32;
      description
        "Number of configured virtual routers.";
    }
    leaf interfaces {
      type uint32;
      description
        "Number of interfaces with VRRP configured.";
    }
    container statistics {
      description
        "VRRP global statistics.";
      leaf discontinuity-datetime {
        type yang:date-and-time;
        description
          "The time on the most recent occasion at which any
           one or more of checksum-errors, version-errors,
           vrid-errors, or ip-ttl-errors suffered a
           discontinuity.

           If no such discontinuities have occurred since the last
           re-initialization of the local management subsystem,
           then this node contains the time that the local management
           subsystem re-initialized itself.";
      }
      leaf checksum-errors {
        type yang:counter64;
        description
          "The total number of VRRP packets received with an invalid
           VRRP checksum value.";
        reference
          "RFC 9568: Virtual Router Redundancy Protocol (VRRP)
           Version 3 for IPv4 and IPv6, Section 5.2.8.";
      }
      leaf version-errors {
        type yang:counter64;
        description
          "The total number of VRRP packets received with an unknown
           or unsupported version number.";
        reference
          "RFC 9568: Virtual Router Redundancy Protocol (VRRP)
           Version 3 for IPv4 and IPv6, Section 5.2.1.";
      }
      leaf vrid-errors {
        type yang:counter64;
        description
          "The total number of VRRP packets received with a VRID that
           is not valid for any virtual router on this router.";
        reference
          "RFC 9568: Virtual Router Redundancy Protocol (VRRP)
                     Version 3 for IPv4 and IPv6, Section 5.2.3.";
      }
      leaf ip-ttl-errors {
        type yang:counter64;
        description
          "The total number of VRRP packets received by the
           virtual router with IP TTL (IPv4) or Hop Limit (IPv6)
           not equal to 255.";
        reference
          "RFC 9568: Virtual Router Redundancy Protocol (VRRP)
                     Version 3 for IPv4 and IPv6,
                     Sections 5.1.1.3 and 5.1.2.3";
      }
    } // statistics
  } // vrrp-global-state-attributes

  /*
   * Configuration data and operational state data nodes
   */

  augment "/if:interfaces/if:interface/ip:ipv4" {
    description
      "Augments IPv4 interface.";
    container vrrp {
      description
        "Configures VRRP version 2 or 3 for IPv4.";
      list vrrp-instance {
        key "vrid";
        description
          "Defines a virtual router, identified by a VRID, within the
           IPv4 address space.";
        uses vrrp-ipv4-attributes;
        uses vrrp-state-attributes;
      }
    }
  } // augments ipv4

  augment "/if:interfaces/if:interface/ip:ipv6" {
    description
      "Augments IPv6 interface.";
    container vrrp {
      description
        "Configures VRRP version 3 for IPv6.";
      list vrrp-instance {
        must "derived-from-or-self(version, 'vrrp-v3')" {
          description
            "IPv6 is only supported by version 3.";
        }
        key "vrid";
        description
          "Defines a virtual router, identified by a VRID, within the
           IPv6 address space.";
        uses vrrp-ipv6-attributes;
        uses vrrp-state-attributes;
      }
    }
  } // augments ipv6

  container vrrp {
    config false;
    description
      "VRRP data at the global level.";
    uses vrrp-global-state-attributes;
  }

  /*
   * Notifications
   */

  notification vrrp-new-active-event {
    description
      "Notification event for the election of a new VRRP
       active router.

       The identifier of the notification is changed to
       reflect the updated terminology used in RFC 9568.";
    leaf active-ip-address {
      type inet:ip-address;
      mandatory true;
      description
        "IPv4 or IPv6 address of the new VRRP active router.

         The identifier of the leaf is changed to
         reflect the updated terminology used in RFC 9568.";
    }
    leaf new-active-reason {
      type new-active-reason-type;
      mandatory true;
      description
        "Indicates why the virtual router has transitioned to
         active state.

         The identifier of the leaf is changed to
         reflect the updated terminology used in RFC 9568.";
    }
  }

  notification vrrp-protocol-error-event {
    description
      "Notification event for a VRRP protocol error.";
    leaf protocol-error-reason {
      type identityref {
        base vrrp:vrrp-error-global;
      }
      mandatory true;
      description
        "Indicates the reason for the protocol error.";
    }
  }

  notification vrrp-virtual-router-error-event {
    description
      "Notification event for an error that happened on a
       virtual router.";
    leaf interface {
      type if:interface-ref;
      mandatory true;
      description
        "Indicates the interface on which the event has occurred.";
    }
    choice ip-version {
      mandatory true;
      description
        "The error may have happened on either an IPv4 virtual
         router or an IPv6 virtual router.  The information
         related to a specific IP version is provided by one of
         the following cases.";
      case ipv4 {
        description
          "IPv4.";
        container ipv4 {
          description
            "Error information for IPv4.";
          leaf vrid {
            type leafref {
              path "/if:interfaces/if:interface"
                 + "[if:name = current()/../../vrrp:interface]/"
                 + "ip:ipv4/vrrp:vrrp/vrrp:vrrp-instance/vrrp:vrid";
            }
            mandatory true;
            description
              "Indicates the virtual router on which the event has
               occurred.";
          }
        }
      }
      case ipv6 {
        description
          "IPv6.";
        container ipv6 {
          description
            "Error information for IPv6.";
          leaf vrid {
            type leafref {
              path "/if:interfaces/if:interface"
                 + "[if:name = current()/../../vrrp:interface]/"
                 + "ip:ipv6/vrrp:vrrp/vrrp:vrrp-instance/vrrp:vrid";
            }
            mandatory true;
            description
              "Indicates the virtual router on which the event has
               occurred.";
          }
        }
      }
    }
    leaf virtual-router-error-reason {
      type identityref {
        base vrrp:vrrp-error-virtual-router;
      }
      mandatory true;
      description
        "Indicates the reason for the virtual router error.";
    }
  }
}
<CODE ENDS> ]]>
</artwork>

</section>

<section title="IANA Considerations">
  <t>
     IANA is requested to update the following registration in the "ns"
     registry within the "IETF XML Registry" group [RFC3688] to
     reference this document:
 </t>
 <artwork name="" type="" align="left" alt=""><![CDATA[
      URI: urn:ietf:params:xml:ns:yang:ietf-vrrp
      Registrant Contact: The IESG.
      XML: N/A, the requested URI is an XML namespace.
      ]]>
 </artwork>
 <t>
   IANA is requested to update the following YANG modue in the "YANG
   Module Names" registry <xref target="RFC6020"/> within the
   "YANG Parameters" registry group to reference this document:
 </t>
 <artwork name="" type="" align="left" alt=""><![CDATA[
      Name: ietf-vrrp
      Maintained by IANA?  N
      Namespace: urn:ietf:params:xml:ns:yang:ietf-vrrp
      Prefix: vrrp
      Reference: RFC XXXX
  ]]>
 </artwork>
</section>

<section title="Operations and Management Considerations">
  <t>
    This document defines  YANG data model <xref target="RFC7950"/>
    for the VRRP protocol <xref target="RFC9568"/>.
    Hence, the entire document can be considered devoted to
    operations and management.
  </t>
  <section title="Migration Path">
  <t>
    The changes to use inclusive language (<xref target="changes"/>) are
    non-backward compatibly based on the rules in <xref target="RFC7950"/>.
    However, there are no existing implementations of the ietf-vrrp YANG module
    based on numerous implementation polls. Hence, it was agreed upon to
    change the YANG data nodes with non-inclusive language in a single
    iteration rather than going through the deprecation, obsoletion, and
    removal cycle.
  </t>
  </section>
</section>
<section title="Security Considerations">
<t>
  This section is modeled after the template described in Section 3.7
  of <xref target="I-D.ietf-netmod-rfc8407bis"/>.
</t>
<t>
   The "ietf-vrrp" YANG module defines a data model that is
   designed to be accessed via YANG-based management protocols, such as
   NETCONF <xref target="RFC6241"/> and RESTCONF <xref target="RFC8040"/>.
   These YANG-based protocols (1) have to use a secure transport layer
   (e.g., SSH <xref target="RFC4252"/>, TLS <xref target="RFC8446"/>, and
   QUIC <xref target="RFC9000"/>) and (2) have to use mutual authentication.
</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>
   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).  All writable data nodes are likely to be reasonably
   sensitive or vulnerable in some network environments.  Write
   operations (e.g., edit-config) and delete operations to these data
   nodes without proper protection or authentication can have a negative
   effect on network operations.  The following subtrees and data nodes
   have particular sensitivities/vulnerabilities:
</t>

 <t>
   /if:interfaces/if:interface/ip:ipv4/vrrp:vrrp/vrrp:vrrp-instance
 </t>

 <t>
   /if:interfaces/if:interface/ip:ipv6/vrrp:vrrp/vrrp:vrrp-instance
 </t>

 <t>
   Unauthorized access to any data node of these subtrees can
   adversely affect the routing subsystem of both the local device and
   the network.  This may lead to network malfunctions, delivery of
   packets to inappropriate destinations, and other problems.
 </t>

<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. Specifically, the following
    subtrees and data nodes have particular sensitivities/
    vulnerabilities:
</t>

 <t>
   /ietf-vrrp:vrrp
 </t>
 <t>
   /if:interfaces/if:interface/ip:ipv4/vrrp:vrrp/vrrp:vrrp-instance
 </t>

 <t>
   /if:interfaces/if:interface/ip:ipv6/vrrp:vrrp/vrrp:vrrp-instance
 </t>

 <t>
   Unauthorized access to any data node of these subtrees can disclose the
   operational state information of VRRP on this device.
 </t>

</section>

<section title="Acknowledgments">
  <t>
    Thanks to Nicola Serafini for his suggestion to add effective-priority to
    the virtual router operational state.
  </t>
  <t>
    Thanks to Med Boucadair for an extensive review and suggested edits.
  </t>
  <t>
    Thanks to Carlos Pignataro for review and comments.
  </t>
  <t>
    Thanks to Yingzhen Qu for review and comments.
  </t>
</section>
</middle>

<back>

<references title="Normative References">
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.2119.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.3768.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6527.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7950.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8174.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8341.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8342.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8343.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8344.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8347.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9911.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9568.xml"/>
</references>

  <references title="Informative References">
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.4252.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6020.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.6241.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.7951.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8040.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8340.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8446.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8639.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.8641.xml"/>
    <xi:include href="https://www.rfc-editor.org/refs/bibxml/reference.RFC.9000.xml"/>
    <xi:include href="https://bib.ietf.org/public/rfc/bibxml3/reference.I-D.ietf-netmod-rfc8407bis.xml"/>
    <reference anchor="IANA_IF_TYPE" target="https://www.iana.org/assignments/iana-if-type/iana-if-type.xhtml">
      <front>
        <title>iana-if-types YANG Module</title>
        <author>
          <organization>IANA</organization>
        </author>
      </front>
    </reference>
  </references>

<section title="Data Tree Example">
 <t>
   This section contains an example of an instance data tree in JSON
   encoding <xref target="RFC7951"/>, containing both configuration and
   state data. (This example includes "iana-if-type", which is
   defined in <xref target="IANA_IF_TYPE"/>.)
 </t>

 <figure anchor="fig-6"><artwork>
              Virtual router IP address: fe80::1
           +-----------------+        +-----------------+
           |                 |        |                 |
           |    Router 1     |        |    Router 2     |
           |                 |        |                 |
           +--------+--------+        +--------+--------+
                    |eth1                      |eth1
                    |fe80::11                  |fe80::12
             -------+--------------------------+-------
                    |                          |
                    |fe80::51                  |fe80::52
           +--------+--------+        +--------+--------+
           |     Host 1      |        |     Host 2      |
           | Default gateway:|        | Default gateway:|
           |     fe80::1     |        |     fe80::1     |
           +-----------------+        +-----------------+
 </artwork></figure>

 <t>
   The configuration instance data for Router 1 in <xref target="fig-6"/>
   could be shown in <xref target="fig-7"/>:
 </t>

 <figure anchor="fig-7"><artwork>
{
  "ietf-interfaces:interfaces": {
    "interface": [
      {
        "name": "eth1",
        "description": "An interface with VRRP enabled.",
        "type": "iana-if-type:ethernetCsmacd",
        "ietf-ip:ipv6": {
          "address": [
            {
              "ip": "2001:db8:0:1::1",
              "prefix-length": 64
            },
            {
              "ip": "fe80::11",
              "prefix-length": 64
            }
          ],
          "forwarding": true,
          "ietf-vrrp:vrrp": {
            "vrrp-instance": [
              {
                "vrid": 1,
                "version": "ietf-vrrp:vrrp-v3",
                "priority": 200,
                "advertise-interval-centi-sec": 50,
                "virtual-ipv6-addresses": {
                  "virtual-ipv6-address": [
                    "ipv6-address": "fe80::1"
                  ]
                }
              }
            ]
          }
        }
      }
    ]
  }
}
 </artwork></figure>

 <t>
   The corresponding operational state data for Router 1
   could be shown in <xref target="fig-8"/>:
 </t>

 <figure anchor="fig-8"><artwork>
{
  "ietf-interfaces:interfaces": {
    "interface": [
      {
        "name": "eth1",
        "description": "An interface with VRRP enabled.",
        "type": "iana-if-type:ethernetCsmacd",
        "phys-address": "00:00:5e:00:53:01",
        "oper-status": "up",
        "statistics": {
          "discontinuity-time": "2016-10-24T17:11:27+02:00"
        },
        "ietf-ip:ipv6": {
          "forwarding": true,
          "mtu": 1500,
          "address": [
            {
              "ip": "2001:db8:0:1::1",
              "prefix-length": 64,
              "origin": "static",
              "status": "preferred"
            },
            {
              "ip": "fe80::11",
              "prefix-length": 64,
              "origin": "static",
              "status": "preferred"
            }
          ]
          "ietf-vrrp:vrrp": {
            "vrrp-instance": [
              {
                "vrid": 1,
                "version": "ietf-vrrp:vrrp-v3",
                "log-state-change": false,
                "preempt": {
                  "enabled": true,
                  "hold-time": 0
                }
                "priority": 200,
                "accept-mode": false,
                "advertise-interval-centi-sec": 50,
                "virtual-ipv6-addresses": {
                  "virtual-ipv6-address": [
                    "ipv6-address": "fe80::1"
                  ]
                },
                "state": "active",
                "is-owner": false,
                "effective-priority": 200,
                "last-adv-source": "fe80::11",
                "up-datetime": "2016-10-24T17:11:27+02:00",
                "active-down-interval": 161,
                "skew-time": 11,
                "last-event": "vrrp-event-interface-up",
                "new-active-reason": "priority",
                "statistics": {
                  "discontinuity-datetime":
                    "2016-10-24T17:11:27+02:00",
                  "active-transitions": 2,
                  "advertisement-rcvd": 20,
                  "advertisement-sent": 12,
                  "interval-errors": 0,
                  "priority-zero-pkts-rcvd": 0,
                  "priority-zero-pkts-sent": 0,
                  "invalid-type-pkts-rcvd": 0,
                  "address-list-errors": 0,
                  "packet-length-errors": 1
                }
              }
            ]
          }
        }
      }
    ]
  }
}

{
  "ietf-vrrp:vrrp": {
    "virtual-routers": 3,
    "interfaces": 2,
    "statistics": {
      "discontinuity-datetime": "2016-10-24T17:11:27+02:00",
      "checksum-errors": 2,
      "version-errors": 0,
      "vrid-errors": 0,
      "ip-ttl-errors": 1
    }
  }
}
 </artwork></figure>

</section>

</back>

</rfc>
