Network Working Group                                        X. Liu, Editor Ed.
Internet-Draft                                               A. Kyparlis
Intended status: Standards Track                    Kuatro Technologies                                   Jabil
Expires: June 1, September 11, 2017                                    R. Parikh
                                                                  VMware
                                                               A. Lindem
                                                           Cisco Systems
                                                                M. Zhang
                                                     Huawei Technologies
                                                       December 1, 2016
                                                          March 10, 2017

    A YANG Data Model for Virtual Router Redundancy Protocol (VRRP)
                       draft-ietf-rtgwg-yang-vrrp-01
                     draft-ietf-rtgwg-yang-vrrp-02

Abstract

   This document describes a data model for Virtual Router Redundancy
   Protocol (VRRP).  Both version 2 and version 3 of VRRP are covered.

Status of this This Memo

   This Internet-Draft is submitted in full conformance with the
   provisions of BCP 78 and BCP 79.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups. (IETF).  Note that other groups may also distribute
   working documents as Internet-Drafts.  The list of current Internet-
   Drafts.
   Drafts is at http://datatracker.ietf.org/drafts/current/.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html

   This Internet-Draft will expire on June 1, September 11, 2017.

Copyright Notice

   Copyright (c) 2016 2017 IETF Trust and the persons identified as the
   document authors.  All rights reserved.

   This document is subject to BCP 78 and the IETF Trust's Legal
   Provisions Relating to IETF Documents
   (http://trustee.ietf.org/license-info) in effect on the date of
   publication of this document.  Please review these documents
   carefully, as they describe your rights and restrictions with respect
   to this document.  Code Components extracted from this document must
   include Simplified BSD License text as described in Section 4.e of
   the Trust Legal Provisions and are provided without warranty as
   described in the Simplified BSD License.

Table of Contents

   1. Introduction...................................................2  Introduction  . . . . . . . . . . . . . . . . . . . . . . . .   2
     1.1. Terminology...............................................2  Terminology . . . . . . . . . . . . . . . . . . . . . . .   2
     1.2.  Tree Diagrams . . . . . . . . . . . . . . . . . . . . . .   3
     1.3.  Prefixes in Data Node Names . . . . . . . . . . . . . . .   3
   2. VRRP YANG model overview.......................................3  Design of the Data Model  . . . . . . . . . . . . . . . . . .   4
     2.1.  Scope of the Model  . . . . . . . . . . . . . . . . . . .   4
     2.2.  Relations with Interface Model and IP Model . . . . . . .   4
     2.3.  Protocol Configuration  . . . . . . . . . . . . . . . . .   5
     2.4.  Protocol States . . . . . . . . . . . . . . . . . . . . .   6
     2.5.  Notifications . . . . . . . . . . . . . . . . . . . . . .   7
   3. VRRP YANG module...............................................7  Tree Structure  . . . . . . . . . . . . . . . . . . . . . . .   8
   4. IANA Considerations...........................................29  YANG Module . . . . . . . . . . . . . . . . . . . . . . . . .  11
   5. Security Considerations.......................................29  IANA Considerations . . . . . . . . . . . . . . . . . . . . .  33
   6. References....................................................30
      6.1.  Security Considerations . . . . . . . . . . . . . . . . . . .  34
   7.  References  . . . . . . . . . . . . . . . . . . . . . . . . .  34
     7.1.  Normative References.....................................30
      6.2. References  . . . . . . . . . . . . . . . . . .  34
     7.2.  Informative References...................................30 References  . . . . . . . . . . . . . . . . .  35
   Appendix A.  Data Tree Example  . . . . . . . . . . . . . . . . .  37
   Authors' Addresses  . . . . . . . . . . . . . . . . . . . . . . .  39

1.  Introduction

   This document introduces a YANG [RFC6020] [RFC6020][RFC7950] data model for
   Virtual Router Redundancy Protocol (VRRP) [RFC3768][RFC5798].  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.

   This YANG model supports both version 2 and version 3 of VRRP.  VRRP
   version 2 defined in [RFC3768] supports IPv4.  VRRP version 3 defined
   in [RFC5798] supports both IPv4 and IPv6.

1.1.  Terminology

   The keywords "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, [RFC2119].

   The following terms are defined in [RFC6020] [RFC7950] and are not redefined
   here:

   o  augment

   o  data model

   o  data node

2. VRRP YANG

1.2.  Tree Diagrams

   A simplified graphical representation of the data model overview

   This document defines is used in
   this document.  The meaning of the symbols in these diagrams is as
   follows:

   o  Brackets "[" and "]" enclose list keys.

   o  Curly braces "{" and "}" contain names of optional features that
      make the corresponding node conditional.

   o  Abbreviations before data node names: "rw" means configuration
      (read-write), and "ro" means state data (read-only).

   o  Symbols after data node names: "?" means an optional node, "!"
      means a presence container, and "*" denotes a list and leaf-list.

   o  Parentheses enclose choice and case nodes, and case nodes are also
      marked with a colon (":").

   o  Ellipsis ("...") stands for contents of subtrees that are not
      shown.

1.3.  Prefixes in Data Node Names

   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 "ietf-vrrp", which has each name is defined.  Otherwise,
   names are prefixed using the
   following structure:

   module: ietf-vrrp
   augment /if:interfaces/if:interface/ip:ipv4:
      +--rw vrrp
         +--rw vrrp-instance* [vrid]
            +--rw vrid                            uint8
            +--rw version?                        enumeration
            +--rw log-state-change?               boolean
            +--rw preempt! standard prefix associated with the
   corresponding YANG module, as shown in Table 1.

                 +--------+-----------------+-----------+
                 |  +--rw hold-time?   uint16
            +--rw priority?                       uint8
            +--rw accept-mode?                    boolean
            +--rw (advertise-interval-choice)? Prefix |  +--:(v2) YANG module     | Reference |  +--rw advertise-interval-sec?         uint8
                 +--------+-----------------+-----------+
                 |  +--:(v3) yang   |     +--rw advertise-interval-centi-sec?   uint16
            +--rw track ietf-yang-types |  +--rw interfaces [RFC6991] |
                 |  +--rw interface* [interface] inet   | ietf-inet-types |     +--rw interface             if:interface-ref [RFC6991] |
                 |     +--rw priority-decrement?   uint8 if     |  +--rw networks ietf-interfaces |     +--rw network* [network] [RFC7223] |
                 | ip     | ietf-ip         | [RFC7277] |
                 +--------+-----------------+-----------+

             Table 1: Prefixes and Corresponding YANG Modules

2.  Design of the Data Model

2.1.  Scope of the Model

   The model covers VRRP version 2 [RFC3768] and VRRP version 3
   [RFC5798] protocols.  The model is designed to be implemented on a
   device where VRRP version 2 or version 3 is implemented.  With the
   help of a proper management protocol, the defined model can be used
   to:

   o  Configure the VRRP version 2 or version 3 protocol.

   o  Manage the protocol operational behavior.

   o  Retrieve the protocol operational status.

   o  Receive the protocol notifications.

2.2.  Relations with Interface Model and IP Model

   This model augments the interface data model "ietf-interfaces"
   [RFC7223] and IP management model "ietf-ip" [RFC7277].  The
   augmentation relations are shown as follows:

         ietf-interfaces   ietf-ip         ietf-vrrp
      =========================================================
      +--rw network               inet:ipv4-prefix interfaces
      |  +--rw priority-decrement? interface*
      |     +--------------rw ipv4
      |     |              +---------------rw vrrp
      |     |                              +--rw vrrp-instance*
      |     +--------------rw ipv6
      |                    +---------------rw vrrp
      |                                    +--rw vrrp-instance*
      +--ro interfaces-state
         +--ro interface*
         |  +--------------ro ipv4
         |  |              +---------------ro vrrp
         |  |                              +--ro vrrp-instance*
         |  +--------------ro ipv6
         |                 +---------------ro vrrp
         |                                 +--ro vrrp-instance*
         +---------------------------------ro vrrp-global

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

2.3.  Protocol Configuration

   The model structure for the protocol configuration is as shown below:

   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 version?                        enumeration
            +--rw log-state-change?               boolean
            +--rw preempt!
            |  +--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* [network] [prefix]
            |        +--rw network prefix                inet:ipv6-prefix
            |        +--rw priority-decrement?   uint8              ...
            +--rw virtual-ipv6-addresses
               +--rw virtual-ipv6-address* [ipv6-address]
                  +--rw ipv6-address    inet:ipv6-address

   The model allows to configure the following protocol entities:

   o  VRRP instance (version 2 or version 3).

   o  Virtual IPv4 or IPv6 address.

   o  Tracking interface.

   o  Tracking network.

2.4.  Protocol States

   The model structure for the protocol states is as shown below:

   augment /if:interfaces-state/if:interface/ip:ipv4:
      +--ro vrrp
         +--ro vrrp-instance* [vrid]
            +--ro vrid                            uint8
            |     ...
            +--ro version?                        enumeration
            +--ro log-state-change?               boolean
            +--ro preempt!
            |  +--ro hold-time?   uint16
            +--ro priority?                       uint8
            +--ro accept-mode?                    boolean
            +--ro (advertise-interval-choice)?
            |  +--:(v2)
            |  |  +--ro advertise-interval-sec?         uint8
            |  +--:(v3)
            |     +--ro advertise-interval-centi-sec?   uint16
            +--ro track track
            |  +--ro interfaces
            |  |  +--ro interface* [interface]
            |  |     +--ro interface             if:interface-ref
            |  |     +--ro priority-decrement?   uint8           ...
            |  +--ro networks
            |     +--ro network* [network] [prefix]
            |        +--ro network prefix                inet:ipv4-prefix
            |        +--ro priority-decrement?   uint8              ...
            +--ro virtual-ipv4-addresses
            |  +--ro virtual-ipv4-address* [ipv4-address]
            |     +--ro ipv4-address    inet:ipv4-address
            |
            +--ro state?                          identityref
            +--ro is-owner?                       boolean
            +--ro last-adv-source?                inet:ip-address
            +--ro up-time?                        yang:date-and-time
            +--ro master-down-interval?           uint32
            +--ro skew-time?                      uint32
            +--ro last-event?                     string
            +--ro new-master-reason?              new-master-reason-type <per instance operational states>
            +--ro statistics
               +--ro discontinuity-time?        yang:date-and-time
               +--ro master-transitions?        yang:counter32
               +--ro advertisement-recv?        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 <per instance statistics>

   augment /if:interfaces-state/if:interface/ip:ipv6:
      +--ro vrrp
         +--ro vrrp-instance* [vrid]
            +--ro vrid                            uint8
            +--ro version?                        enumeration
            +--ro log-state-change?               boolean
            +--ro preempt!
            |  +--ro hold-time?   uint16
            +--ro priority?                       uint8
            +--ro accept-mode?                    boolean
            +--ro advertise-interval-centi-sec?   uint16
            +     ...
            +--ro track
            |  +--ro interfaces
            |  |  +--ro interface* [interface]
            |  |     +--ro interface             if:interface-ref
            |  |     +--ro priority-decrement?   uint8           ...
            |  +--ro networks
            |     +--ro network* [network] [prefix]
            |        +--ro network prefix                inet:ipv6-prefix
            |        +--ro priority-decrement?   uint8              ...
            +--ro virtual-ipv6-addresses
            |  +--ro virtual-ipv6-address* [ipv6-address]
            |     +--ro ipv6-address    inet:ipv6-address
            |
            +--ro state?                          identityref
            +--ro is-owner?                       boolean
            +--ro last-adv-source?                inet:ip-address
            +--ro up-time?                        yang:date-and-time
            +--ro master-down-interval?           uint32
            +--ro skew-time?                      uint32
            +--ro last-event?                     string
            +--ro new-master-reason?              new-master-reason-type <per instance operational states>
            +--ro statistics
               +--ro discontinuity-time?        yang:date-and-time
               +--ro master-transitions?        yang:counter32
               +--ro advertisement-recv?        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 <per instance statistics>

   augment /if:interfaces-state:
      +--ro vrrp-global
         +--ro virtual-routers?                        uint32
         +--ro interfaces?                             uint32
         +--ro checksum-errors?                        yang:counter64
         +--ro version-errors?                         yang:counter64
         +--ro vrid-errors?                            yang:counter64 <global operational states>
         +--ro ip-ttl-errors?                          yang:counter64 statistics
            +--ro global-statistics-discontinuity-time?   yang:date-and-
   time <global statistics>

   The model allows to retrieve protocol states at the following levels:

   o  VRRP instance (version 2 or version 3).

   o  Virtual IPv4 or IPv6 address.

   o  Tracking interface.

   o  Tracking network.

   o  Global states and statistics summarizing all instances.

2.5.  Notifications

   This model defines the following VRRP specific notifications:
      +---n vrrp-new-master-event
      |  +--ro master-ipaddr?       inet:ipv4-address
      |  +--ro new-master-reason?   new-master-reason-type
      +---n vrrp-protocol-error-event
      |  +--ro protocol-error-reason?   enumeration
      +---n vrrp-virtual-router-error-event
         +--ro interface?                     if:interface-ref
         +--ro ip-version?                    enumeration
         +--ro vrid-v4?                       leafref
         +--ro vrid-v6?                       leafref
         +--ro virtual-router-error-reason?   enumeration

3.

   o  VRRP YANG module

   <CODE BEGINS> file "ietf-vrrp@2016-12-01.yang"
   module new master event.

   o  VRRP protocol error event for a message that fails to reach a VRRP
      instance to be processed.

   o  VRRP virtual router error event for a message processed on a VRRP
      instance.

   In addition to the notifications specified above, the mechanism
   defined in [I-D.ietf-netconf-yang-push] and
   [I-D.ietf-netconf-rfc5277bis] can be used for other general
   notifications.  This mechanism currently allows the user to:

   o  Subscribe notifications on a per client basis.

   o  Specify subtree filters or xpath filters so that only interested
      contents will be sent.

   o  Specify either periodic or on-demand notifications.

3.  Tree Structure

   This document defines the YANG module "ietf-vrrp", which has the
   following tree structure:

   module: ietf-vrrp {
     namespace "urn:ietf:params:xml:ns:yang:ietf-vrrp";
   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 "vrrp";

     import ietf-inet-types {                inet:ipv4-prefix
            |        +--rw priority-decrement?   uint8
            +--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 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";                inet:ipv6-prefix
            |        +--rw priority-decrement?   uint8
            +--rw virtual-ipv6-addresses
               +--rw virtual-ipv6-address* [ipv6-address]
                  +--rw ipv6-address    inet:ipv6-address
   augment /if:interfaces-state/if:interface/ip:ipv4:
      +--ro vrrp
         +--ro vrrp-instance* [vrid]
            +--ro vrid                            uint8
            +--ro version                         identityref
            +--ro log-state-change?               boolean
            +--ro preempt
            |  +--ro enabled?     boolean
            |  +--ro hold-time?   uint16
            +--ro priority?                       uint8
            +--ro accept-mode?                    boolean
            +--ro (advertise-interval-choice)?
            |  +--:(v2)
            |  |  +--ro advertise-interval-sec?         uint8
            |  +--:(v3)
            |     +--ro advertise-interval-centi-sec?   uint16
            +--ro track
            |  +--ro interfaces
            |  |  +--ro interface* [interface]
            |  |     +--ro interface             if:interface-ref
            |  |     +--ro priority-decrement?   uint8
            |  +--ro networks
            |     +--ro network* [prefix]
            |        +--ro prefix                inet:ipv4-prefix
            |        +--ro priority-decrement?   uint8
            +--ro virtual-ipv4-addresses
            |  +--ro virtual-ipv4-address* [ipv4-address]
            |     +--ro ipv4-address    inet:ipv4-address
            +--ro state?                          identityref
            +--ro is-owner?                       boolean
            +--ro last-adv-source?                inet:ip-address
            +--ro up-datetime?                    yang:date-and-time
            +--ro master-down-interval?           uint32
            +--ro skew-time?                      uint32
            +--ro last-event?                     identityref
            +--ro new-master-reason?              new-master-reason-type
            +--ro statistics
               +--ro discontinuity-datetime?    yang:date-and-time
               +--ro master-transitions?        yang:counter32
               +--ro advertisement-recv?        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-state/if:interface/ip:ipv6:
      +--ro vrrp
         +--ro vrrp-instance* [vrid]
            +--ro vrid                            uint8
            +--ro version                         identityref
            +--ro log-state-change?               boolean
            +--ro preempt
            |  +--ro enabled?     boolean
            |  +--ro hold-time?   uint16
            +--ro priority?                       uint8
            +--ro accept-mode?                    boolean
            +--ro advertise-interval-centi-sec?   uint16
            +--ro track
            |  +--ro interfaces
            |  |  +--ro interface* [interface]
            |  |     +--ro interface             if:interface-ref
            |  |     +--ro priority-decrement?   uint8
            |  +--ro networks
            |     +--ro network* [prefix]
            |        +--ro prefix                inet:ipv6-prefix
            |        +--ro priority-decrement?   uint8
            +--ro virtual-ipv6-addresses
            |  +--ro virtual-ipv6-address* [ipv6-address]
            |     +--ro ipv6-address    inet:ipv6-address
            +--ro state?                          identityref
            +--ro is-owner?                       boolean
            +--ro last-adv-source?                inet:ip-address
            +--ro up-datetime?                    yang:date-and-time
            +--ro master-down-interval?           uint32
            +--ro skew-time?                      uint32
            +--ro last-event?                     identityref
            +--ro new-master-reason?              new-master-reason-type
            +--ro statistics
               +--ro discontinuity-datetime?    yang:date-and-time
               +--ro master-transitions?        yang:counter32
               +--ro advertisement-recv?        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-state:
      +--ro vrrp-global
         +--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
   notifications:
      +---n vrrp-new-master-event
      |  +--ro master-ip-address    inet:ip-address
      |  +--ro new-master-reason    new-master-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                     enumeration
         +--ro vrid-v4?                       leafref
         +--ro vrid-v6?                       leafref
         +--ro virtual-router-error-reason    identityref

4.  YANG Module

   <CODE BEGINS> file "ietf-vrrp@2017-02-21.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";

     }

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

     import ietf-interfaces {
       prefix "if";
     }

     import ietf-ip {
       prefix "ip";
     }

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

        WG Chair: Jeff Tantsura
                  <mailto:jefftant.ietf@gmail.com>

        WG Chair: Chris Bowers
                  <mailto:cbowers@juniper.net>

        Editor:   Xufeng Liu
                  <mailto:Xufeng_Liu@jabil.com>

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

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

        Editor:   Acee Lindem
                  <mailto:acee@cisco.com>

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

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

     revision 2017-02-21 {
       description "Initial revision";
       reference
         "RFC XXXX: A YANG Data Model for Virtual Router Redundancy
          Protocol (VRRP).
          RFC 2787: Definitions of Managed Objects for the Virtual
          Router Redundancy Protocol.
          RFC 3768: Virtual Router Redundancy Protocol (VRRP).
          RFC 5798: Virtual Router Redundancy Protocol (VRRP) Version 3.
          RFC 6527: Definitions of Managed Objects for the Virtual
          Router Redundancy Protocol Version 3 (VRRPv3).";
     }

     /*
      * 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 one 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-master-reason-type {
       type enumeration {
         enum not-master {
           description
             "The virtual router has never transitioned to master
              state,";
         }
         enum priority {
           description "Priority was higher.";
         }
         enum preempted {
           description "The master was preempted.";
         }
         enum master-no-response {
           description "Previous master did not respond.";

         }
       }
       description
         "The reason for the virtual router to transition to master
          state.";
     } // new-master-reason-type

     /*
      * Identities
      */

     /* vrrp-event-type identity and its derivatives. */
     identity vrrp-event-type {
       description
         "The type to indicate 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 master.";
     }
     identity vrrp-event-master-timeout {
       base vrrp-event-type;
       description
         "Indicates that the current master has not sent an
          advertisement within the limit of master-down-interval.";
     }
     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.";
     }

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

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

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

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

        WG Chair: Jeff Tantsura
                  <mailto:jefftant.ietf@gmail.com>

        WG Chair: Chris Bowers
                  <mailto:cbowers@juniper.net>

        Editor:   Xufeng Liu
                  <mailto:xliu@kuatrotech.com>

        Editor:   Athanasios Kyparlis
                  <mailto:akyparlis@kuatrotech.com>

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

        Editor:   Acee Lindem
                  <mailto:acee@cisco.com>

        Editor:   Mingui Zhang
                  <mailto:zhangmingui@huawei.com>";
     identity vrrp-event-lower-priority-master {
       base vrrp-event-type;
       description
       "This YANG module defines
         "Indicates that there is a model for managing Virtual Router
        Redundancy Protocol (VRRP) version 2 lower priority VRRP master.";
     }
     identity vrrp-event-owner-preempt {
       base vrrp-event-type;
       description
         "Indicates that the owner has preempted another router to
          become the master.";
     }
     /* vrrp-error-global identity and version 3.";

     revision 2016-12-01 its derivatives. */
     identity vrrp-error-global {
       description "Initial revision";
       reference
         "RFC 2787: Definitions of Managed Objects for
         "The type to indicate the Virtual
          Router Redundancy Protocol.
          RFC 3768: Virtual Router Redundancy Protocol (VRRP).
          RFC 5798: Virtual Router Redundancy Protocol (VRRP) Version 3.
          RFC 6527: Definitions type of Managed Objects a VRRP error that occurs
          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 VRID that is not valid
          for the Virtual
          Router Redundancy Protocol Version 3 (VRRPv3)."; any virtual router on this router.";
     }

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

     feature validate-interval-errors
     identity vrrp-error-virtual-router {
       description
         "This feature indicates that
         "The type to indicate the system validates type of a VRRP error that
          the advertisement interval from advertisement packets
          received is the same as the one configured for the local occurs
          after a packet reaches a VRRP router.";
     }

     feature validate-address-list-errors
     identity address-list-error {
       base vrrp-error-virtual-router;
       description
         "This feature indicates that the system validates that
          the
         "A packet has been received with an address list from received packets matches that
          does not match the locally configured address list for
          the VRRP virtual router.";
     }

     /*
      * Typedefs
      */

     typedef new-master-reason-type {
       type enumeration {
         enum not-master
     identity interval-error {
       base vrrp-error-virtual-router;
       description
             "The virtual router
         "A packet has never transitioned to master
              state,";
         }
         enum priority {
           description "Priority was higher.";
         }
         enum preempted {
           description "The master was preempted."; been received with an advertisement
          interval different than the one configured for the local
          virtual router";
     }
         enum master-no-response
     identity packet-length-error {
       base vrrp-error-virtual-router;
       description "Previous master did not respond.";
         }
       }
       description
         "The reason for
         "A packet has been received with a packet length less
          than the virtual router to transition to master
          state."; length of the VRRP header.";
     } // new-master-reason-type

     /*
      * Identities vrrp-state-type identity and its derivatives. */
     identity vrrp-state-type {
       description
         "The type to indicate 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 master router.";
     }
     identity master master {
       base vrrp-state-type;
       description
         "Indicates that the virtual router is forwarding
          packets for IP addresses that are associated with
          this virtual router.";
     }

     /* vrrp-version identity and its derivatives. */
     identity vrrp-version {
       description
         "The version of the VRRP protocol.";
     }
     identity vrrp-v2 {
       base vrrp-version;
       description
         "Indicates version 2 of the VRRP protocol.";
     }
     identity vrrp-v3 {
       base vrrp-state-type; vrrp-version;
       description
         "Indicates that version 3 of the virtual router is forwarding
          packets for IP addresses that are associated with
          this virtual router."; VRRP protocol.";
     }

     /*
      * Groupings
      */

     grouping vrrp-common-attributes {
       description
         "Group of VRRP attributes common to version 2 and version 3";

       leaf vrid {
         type uint8 {
           range 1..255;
         }
         description "Virtual router ID.";
       }

       leaf version {
         type enumeration {
           enum 2 {
             description "VRRP version 2.";
           }
           enum 3 identityref {
             description "VRRP version 3.";
           }
           base vrrp:vrrp-version;
         }
         mandatory "true";
         description "Version 2 or version 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 {
         presence "Present if preempt is enabled.";
         description
           "Enables a higher priority Virtual Router Redundancy
            Protocol (VRRP) backup router to preempt a lower priority
            VRRP master.";
         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 master.";
         }
       }

       leaf priority {
         type uint8 {
           range 1..254;
         }
         default 100;
         description
           "Configures the Virtual Router Redundancy Protocol (VRRP)
            election priority for the backup virtual router.";
       }
     } // vrrp-common-attributes

     grouping vrrp-v3-attributes {
       description
         "Group of VRRP version 3 attributes.";

       leaf accept-mode {
         when "derived-from-or-self(current()/../version, 'vrrp-v3')" {
           description "Applicable only to version 3.";
         }
         type boolean;
         default false;
         description
           "Controls whether a virtual router in Master 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;

       uses vrrp-v3-attributes {
         when "version = 3" {
           description "Applicable only to version 3.";
         }
       }

       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 "version = '2'" "derived-from-or-self(version, '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 Virtual Router
                Redundancy Protocol Version 2 (VRRPv2) advertisements
                are sent from the specified interface.";
           }
         }

         case v3 {
           when "version = '3'" "derived-from-or-self(version, '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 Virtual Router
                Redundancy Protocol version 3 (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 Virtual Router Redundancy Protocol
              version 2 (VRRP) or version 3 (VRRPv3) instance to track
              an interface.";

           list interface {
             key "interface";
             description
               "Interface to track.";

             leaf interface {
               type if:interface-ref;
               must "/if:interfaces/if:interface[if:name=.]/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.";
             }
           } // track-interface interface
         } // track-interfaces interfaces

         container networks {
           description
             "Enables the backup Virtual Router Redundancy Protocol
              version 2 (VRRP) or version 3 (VRRPv3) router to track a
              specified network through the IP network prefix of that
              network.";
           list network {
             key "network"; "prefix";
             description
               "Enables the specified Virtual Router Redundancy
                Protocol version 2 (VRRP) or version 3 (VRRPv3)
                instance to track an interface."; IP network.";

             leaf network prefix {
               type inet:ipv4-prefix;
               description
                 "Network
                 "The 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
                  backup VRRP router if there is a failure in the IP
                  network.";
             }
           } // track-network
         } // track-networks
       } // track

       container virtual-ipv4-addresses {
         description
           "Configures the virtual IP address for the Virtual Router
            Redundancy Protocol (VRRP) interface.";

         list virtual-ipv4-address {
           key "ipv4-address";
           max-elements 16;
           description
             "Virtual IP addresses for a single VRRP instance. For a
              VRRP owner router, the virtual address must match one
              of the IP addresses configured on the interface
              corresponding to the virtual router.";

           leaf ipv4-address {
             type inet:ipv4-address;
             description
               "Virtual IPv4 address.";
           }
         } // virtual-ipv4-address
       } // virtual-ipv4-addresses
     } // grouping vrrp-ipv4-attributes

     grouping vrrp-ipv6-attributes {
       description
         "Group of VRRP attributes for IPv6.";

       uses vrrp-common-attributes;

       uses vrrp-v3-attributes {
         when "version = 3" {
           description "Uses VRRP version 3 attributes.";
         }
       } // uses vrrp-v3-attributes

       leaf advertise-interval-centi-sec {
         type uint16 {
           range 1..4095;
         }
         units centiseconds;
         default 100;
         description
           "Configures the interval that Virtual Router
            Redundancy Protocol version 3 (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 Virtual Router Redundancy Protocol
              version 2 (VRRP) or version 3 (VRRPv3) instance to track
              an interface.";
           list interface {
             key "interface";
             description
               "Interface to track.";

             leaf interface {
               type if:interface-ref;
               must "/if:interfaces/if:interface[if:name=.]/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.";
             }
           } // track-interface interface
         } // track-interfaces interfaces

         container networks {
           description
             "Enables the backup Virtual Router Redundancy Protocol
              version 2 (VRRP) or version 3 (VRRPv3) router to track a
              specified network through the IP network prefix of that
              network.";
           list network {
             key "network"; "prefix";
             description
               "Enables the specified Virtual Router Redundancy
                Protocol version 2 (VRRP) or version 3 (VRRPv3)
                instance to track an interface."; IP network.";

             leaf network prefix {
               type inet:ipv6-prefix;
               description
                 "Network
                 "The 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
                  backup VRRP router if there is a failure in the IP
                  network.";
             }
           } // track-network
         } // track-networks
       } // track

       container virtual-ipv6-addresses {
         description
           "Configures the virtual IP address for the Virtual Router
            Redundancy Protocol (VRRP) interface.";
         list virtual-ipv6-address {
           key "ipv6-address";
           max-elements 2;
           description
             "Two IPv6 addresses are allowed. The first one must be
              a link-local address and the second one can be a
              link-local or global address.";

           leaf ipv6-address {
             type inet:ipv6-address;
             description
               "Virtual IPv6 address.";
           }
         } // virtual-ipv6-address
       } // virtual-ipv6-addresses
     } // grouping vrrp-ipv6-attributes

     grouping vrrp-state-attributes {
       description
         "Group of VRRP state attributes.";

       leaf state {
         type identityref {
           base vrrp-state-type; vrrp:vrrp-state-type;
         }
         description
           "Operational state.";
       }

       leaf is-owner {
         type boolean;
         description
           "Set to true if this virtual router is owner.";
       }

       leaf last-adv-source {
         type inet:ip-address;
         description
           "Last advertised IPv4/IPv6 source address";
       }

       leaf up-time up-datetime {
         type yang:date-and-time;
         description
           "The date and time when this virtual router
            transitioned out of init state.";
       }

       leaf master-down-interval {
         type uint32;
         units centiseconds;
         description
           "Time interval for backup virtual router to declare
            Master down.";
       }

       leaf skew-time {
         type uint32;
         units microseconds;
         description
           "Calculated based on the priority and advertisement
            interval configuration command parameters. See RFC 3768.";
       }

       leaf last-event {
         type string; identityref {
           base vrrp:vrrp-event-type;
         }
         description
           "Last reported event.";
       }

       leaf new-master-reason {
         type new-master-reason-type;
         description
           "Indicates the reason for the virtual router to transition
            to master state.";
       }

       container statistics {
         description
           "VRRP statistics.";

         leaf discontinuity-time discontinuity-datetime {
           type yang:date-and-time;
           description
             "The time on the most recent occasion at which any one or
              more of the VRRP statistic 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 master-transitions {
           type yang:counter32;
           description
             "The total number of times that this virtual router's
              state has transitioned to master";
         }

         leaf advertisement-recv {
           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 one 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.";
         }
       } // container statistics
     } // grouping 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 interface 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 one of
              checksum-errors, version-errors, vrid-errors, and
              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 5798, 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 5798, 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 5798, 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 (Time-To-Live) not equal
              to 255.";
           reference "RFC 5798, Sections 5.1.1.3 and 5.1.2.3.";
       }

       leaf global-statistics-discontinuity-time {
           type yang:date-and-time;
           description
             "The time on the most recent occasion at which one of
              router-checksum-errors, router-version-errors,
              router-vrid-errors, and ip-ttl-errors suffered a
              discontinuity.

              If no such discontinuities have occurred since the last
              re-initialization of the local management subsystem,
              then this object will be 0."; "RFC 5798, Sections 5.1.1.3 and 5.1.2.3.";
         }
       } // statistics
     } // vrrp-global-state-attributes

     /*
      * Configuration data nodes
      */

     augment "/if:interfaces/if:interface/ip:ipv4" {
       description "Augment IPv4 interface.";

       container vrrp {
         description
           "Configures the Virtual Router Redundancy Protocol (VRRP)
            version 2 or version 3 for IPv4.";

         list vrrp-instance {
           key vrid;
           description
             "Defines a virtual router, identified by a virtual router
              identifier (VRID), within IPv4 address space.";

           uses vrrp-ipv4-attributes;
         }
       }
     } // augment ipv4

     augment "/if:interfaces/if:interface/ip:ipv6" {
       description "Augment IPv6 interface.";

       container vrrp {
         description
           "Configures the Virtual Router Redundancy Protocol (VRRP)
            version 3 for IPv6.";

         list vrrp-instance {
           must "version = '3'" "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 virtual router
              identifier (VRID), within IPv6 address space.";

           uses vrrp-ipv6-attributes;
         } // list vrrp-instance
       } // container vrrp
     } // augment ipv6

     /*
      * Operational state data nodes
      */

     augment "/if:interfaces-state/if:interface/ip:ipv4" {
       description "Augment IPv4 interface state.";

       container vrrp {
         description
           "State information for Virtual Router Redundancy Protocol
            (VRRP) version 2 for IPv4.";

         list vrrp-instance {
           key vrid;
           description
             "States of a virtual router, identified by a virtual router
              identifier (VRID), within IPv4 address space.";

           uses vrrp-ipv4-attributes;
           uses vrrp-state-attributes;
         } // list vrrp-instance
       }
     }

     augment "/if:interfaces-state/if:interface/ip:ipv6" {
       description "Augment IPv6 interface state.";

       container vrrp {
         description
           "State information of the Virtual Router Redundancy Protocol
            (VRRP) version 2 or version 3 for IPv6.";

         list vrrp-instance {
           key vrid;
           description
             "States of a virtual router, identified by a virtual router
              identifier (VRID), within IPv6 address space.";

           uses vrrp-ipv6-attributes;
           uses vrrp-state-attributes;
         } // list vrrp-instance
       }
     }

     augment "/if:interfaces-state" {
       description "Specify VRRP state data at the global level.";

       container vrrp-global {
         description
           "State information of the Virtual Router Redundancy Protocol
            (VRRP) at the global level";

         uses vrrp-global-state-attributes;
       }
     }

     /*
      * Notifications
      */

     notification vrrp-new-master-event {
       description
         "Notification event for a change of VRRP new master.";
       leaf master-ipaddr master-ip-address {
         type inet:ipv4-address; inet:ip-address;
         mandatory "true";
         description
           "IPv4 or IPv6 address of the new master.";
       }
       leaf new-master-reason {
         type new-master-reason-type;
         mandatory "true";
         description
           "Indicates the reason for the virtual router to transition
            to master state.";
       }
     }

     notification vrrp-protocol-error-event {
       description
         "Notification event for a VRRP protocol error.";

       leaf protocol-error-reason {
         type enumeration {
           enum checksum-error {
             description
               "A packet has been received with an invalid VRRP checksum
                value.";
           }
           enum version-error {
             description
               "A packet has been received with an unknown or
                unsupported version number.";
           }
           enum vrid-error {
             description
               "A packet has been received with a VRID that is not valid
                for any virtual router on this router.";
           }
           enum ip-ttl-error identityref {
             description
               "A packet has been received with IP TTL (Time-To-Live)
                not equal to 255.";
           }
           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 happened on a virtual
          router.";
       leaf interface {
         type if:interface-ref;
         mandatory "true";
         description
           "Indicates the interface for which statistics area
            to be cleared.";
       }
       leaf ip-version {
         type enumeration {
           enum 4 {
             description "IPv4";
           }
           enum 6 {
             description "IPv6";
           }
         }
         mandatory "true";
         description "Indicates the IP version.";
       }
       leaf vrid-v4 {
         type leafref {
           path "/if:interfaces/if:interface"
             + "[if:name = current()/../interface]/ip:ipv4/vrrp/" current()/../vrrp:interface]/ip:ipv4/"
             + "vrrp-instance/vrid"; "vrrp:vrrp/vrrp:vrrp-instance/vrrp:vrid";
         }
         description
           "Indicates the virtual router on which the event has
            occurred.";
       }

       leaf vrid-v6 {
         type leafref {
           path "/if:interfaces/if:interface"
             + "[if:name = current()/../interface]/ip:ipv6/vrrp/" current()/../vrrp:interface]/ip:ipv6/"
             + "vrrp-instance/vrid"; "vrrp:vrrp/vrrp:vrrp-instance/vrrp:vrid";
         }
         description
           "Indicates the virtual router on which the event has
            occurred.";
         }
       leaf virtual-router-error-reason {
         type enumeration {
           enum interval-error {
             description
               "A packet has been received with an advertisement
                interval different than the one configured for the local
                virtual router";
           }
           enum address-list-error {
             description
               "A packet has been received with an address list that
                does not match the locally configured address list for
                the virtual router.";
           }
           enum packet-length-error identityref {
             description
               "A packet has been received with a packet length less
                than the length of the VRRP header.";
           }
           base vrrp:vrrp-error-virtual-router;
         }
         mandatory "true";
         description
           "Indicates the reason for the virtual router error.";
       }
     }
   }
   <CODE ENDS>

4.

5.  IANA Considerations

   RFC Ed.: In this section, replace all occurrences of 'XXXX' with the
   actual RFC number (and remove this note).

   This document registers the following namespace URIs in the IETF XML
   registry [RFC3688]:

   --------------------------------------------------------------------
   URI: urn:ietf:params:xml:ns:yang:ietf-vrrp
   Registrant Contact: The IESG.
   XML: N/A, the requested URI is an XML namespace.
   --------------------------------------------------------------------

   This document registers the following YANG modules in the YANG Module
   Names registry [RFC6020]: [RFC7950]:

   --------------------------------------------------------------------
   name:         ietf-vrrp
   namespace:    urn:ietf:params:xml:ns:yang:ietf-vrrp
   prefix:       vrrp
   reference:    RFC XXXX
   --------------------------------------------------------------------

5.

6.  Security Considerations

   The configuration, state, action and notification action data defined in this document
   are designed to be accessed via the NETCONF a management protocol with a secure
   transport layer, such as NETCONF [RFC6241].  The data-model by itself does not create any security
   implications. The security considerations for NETCONF access
   control model [RFC6536] provides the means to restrict access for
   particular NETCONF users to a preconfigured subset of all available
   NETCONF protocol operations and content.

   A number of configuration data nodes defined in this document are applicable. The NETCONF
   writable/creatable/deletable (i.e., "config true" in YANG terms,
   which is the default).  These data nodes may be considered sensitive
   or vulnerable in some network environments.  Write operations to
   these data nodes, such as "edit-config" in NETCONF, can have negative
   effects on the network if the protocol used for sending operations are not properly
   protected.  The vulnerable "config true" parameters and subtrees are
   the following:

   /if:interfaces/if:interface/ip:ipv4/vrrp:vrrp/vrrp:vrrp-instance

   /if:interfaces/if:interface/ip:ipv6/vrrp:vrrp/vrrp:vrrp-instance

   Unauthorized access to any node of these can adversely affect the
   routing subsystem of both the local device and the data
   supports authentication network.  This may
   lead to network malfunctions, delivery of packets to inappropriate
   destinations, and encryption.

6. other problems.

7.  References

6.1.

7.1.  Normative References

   [RFC2119]  Bradner, S., "Key words for use in RFCs to Indicate
              Requirement Levels", BCP 14, RFC 2119,
              DOI 10.17487/RFC2119, March 1997,
              <http://www.rfc-editor.org/info/rfc2119>.

   [RFC3688]  Mealling, M., "The IETF XML Registry", BCP 81, RFC 3688,
              DOI 10.17487/RFC3688, January 2004,
              <http://www.rfc-editor.org/info/rfc3688>.

   [RFC3768]  Hinden, R., Ed., "Virtual Router Redundancy Protocol
              (VRRP)", RFC 3768, DOI 10.17487/RFC3768, April 2004,
              <http://www.rfc-editor.org/info/rfc3768>.

   [RFC5798]  Nadas, S., Ed., "Virtual Router Redundancy Protocol (VRRP)
              Version 3 for IPv4 and IPv6", RFC 5798,
              DOI 10.17487/RFC5798, March 2010,
              <http://www.rfc-editor.org/info/rfc5798>.

   [RFC6020]  Bjorklund, M., Ed., "YANG - A Data Modeling Language for
              the Network Configuration Protocol (NETCONF)", RFC 6020,
              DOI 10.17487/RFC6020, October 2010.

   [RFC6021] Schoenwaelder, J., "Common YANG Data Types", RFC 6021,
             October 2010. 2010,
              <http://www.rfc-editor.org/info/rfc6020>.

   [RFC6241]  Enns, R., Ed., Bjorklund, M., Ed., Schoenwaelder, J., Ed.,
              and A. Bierman, Ed., "Network Configuration Protocol
              (NETCONF)", RFC 6241, DOI 10.17487/RFC6241, June
             2011.

   [RFC2234] Crocker, D. and Overell, P.(Editors), "Augmented BNF for
             Syntax Specifications: ABNF", 2011,
              <http://www.rfc-editor.org/info/rfc6241>.

   [RFC6991]  Schoenwaelder, J., Ed., "Common YANG Data Types",
              RFC 2234, Internet Mail
             Consortium and Demon Internet Ltd., November 1997.

   [RFC2338] Knight, S., Weaver, D., Whipple, D., Hinden, R., Mitzel,
             D., Hunt, P., Higginson, P., Shand, 6991, DOI 10.17487/RFC6991, July 2013,
              <http://www.rfc-editor.org/info/rfc6991>.

   [RFC7223]  Bjorklund, M., and A. Lindem,
             "Virtual Router Redundancy Protocol", RFC 2338, April 1998.

   [RFC2787] Jewell, B. and D. Chuang, "Definitions of Managed Objects "A YANG Data Model for the Virtual Router Redundancy Protocol", Interface
              Management", RFC 2787,
             March 2000.

   [RFC5798] Nadas, S., Ed., "Virtual Router Redundancy Protocol (VRRP)
             Version 3 7223, DOI 10.17487/RFC7223, May 2014,
              <http://www.rfc-editor.org/info/rfc7223>.

   [RFC7277]  Bjorklund, M., "A YANG Data Model for IPv4 and IPv6", IP Management",
              RFC 5798, March 2010.

   [RFC6527] Tata, K., 7277, DOI 10.17487/RFC7277, June 2014,
              <http://www.rfc-editor.org/info/rfc7277>.

   [RFC7950]  Bjorklund, M., Ed., "Definitions of Managed Objects for the
             Virtual Router Redundancy Protocol Version 3 (VRRPv3)", "The YANG 1.1 Data Modeling Language",
              RFC
             6527, 7950, DOI 10.17487/RFC7950, August 2016,
              <http://www.rfc-editor.org/info/rfc7950>.

   [I-D.ietf-netconf-rfc5277bis]
              Clemm, A., Prieto, A., Voit, E., Nilsen-Nygaard, E.,
              Tripathy, A., Chisholm, S., and H. Trevino, "Subscribing
              to Event Notifications", draft-ietf-netconf-rfc5277bis-01
              (work in progress), October 2016.

   [I-D.ietf-netconf-yang-push]
              Clemm, A., Voit, E., Prieto, A., Tripathy, A., Nilsen-
              Nygaard, E., Bierman, A., and B. Lengyel, "Subscribing to
              YANG datastore push updates", draft-ietf-netconf-yang-
              push-05 (work in progress), March 2012.

6.2. 2017.

7.2.  Informative References

   [RFC6087]  Bierman, A., "Guidelines for Authors and Reviewers of YANG
              Data Model Documents", RFC 6087, DOI 10.17487/RFC6087,
              January 2011. 2011, <http://www.rfc-editor.org/info/rfc6087>.

   [RFC6536]  Bierman, A. and M. Bjorklund, "Network Configuration
              Protocol (NETCONF) Access Control Model", RFC 6536,
              DOI 10.17487/RFC6536, March 2012,
              <http://www.rfc-editor.org/info/rfc6536>.

   [RFC7951]  Lhotka, L., "JSON Encoding of Data Modeled with YANG",
              RFC 7951, DOI 10.17487/RFC7951, August 2016,
              <http://www.rfc-editor.org/info/rfc7951>.

Appendix A.  Data Tree Example

   This section contains an example of an instance data tree in the JSON
   encoding [RFC7951], containing both configuration and state data.

                 Virtual router IP address: 10.0.0.1
              +-----------------+        +-----------------+
              |                 |        |                 |
              | Router 1.1.1.1  |        | Router 1.1.1.2  |
              |                 |        |                 |
              +--------+--------+        +--------+--------+
                       |eth0                      |eth0
                       |10.0.1.1                  |10.0.2.1
                -------+--------------------------+-------
                       |                          |
                       |10.0.2.1                  |10.0.2.2
              +--------+--------+        +--------+--------+
              |     Host 1      |        |     Host 2      |
              | Default gateway:|        | Default gateway:|
              |     10.0.0.1    |        |     10.0.0.1    |
              +-----------------+        +-----------------+

   The instance data tree for Router 1.1.1.1 in the above figure could
   be as follows:

   {
     "ietf-interfaces:interfaces": {
       "interface": [
         {
           "name": "eth1",
           "type": "iana-if-type:ethernetCsmacd",
           "description": "An interface with VRRP enabled.",
           "ietf-ip:ipv4": {
             "address": [
               {
                 "ip": "10.0.1.1",
                 "prefix-length": 24
               }
             ],
             "forwarding": true,
             "ietf-vrrp:vrrp": {
               "vrrp-instance": [
                 {
                   "vrid": 1,
                   "version": "vrrp-v3",
                   "priority": 200,
                   "advertise-interval-centi-sec": 50,
                   "virtual-ipv4-addresses": {
                     "virtual-ipv4-address": [
                       "ipv4-address": "10.0.0.1"
                     ]
                   }
                 }
               ]
             }
           }
         }
       ]
     },
     "ietf-interfaces:interfaces-state": {
       "interface": [
         {
           "name": "eth1",
           "type": "iana-if-type:ethernetCsmacd",
           "phys-address": "00:0C:42:E5:B1:E9",
           "oper-status": "up",
           "statistics": {
             "discontinuity-time": "2016-10-24T17:11:27+02:00"
           },
           "ietf-ip:ipv4": {
             "forwarding": true,
             "mtu": 1500,
             "address": [
               {
                 "ip": "10.0.1.1",
                 "prefix-length": 24
               }
             ]
             "ietf-vrrp:vrrp": {
               "vrrp-instance": [
                 {
                   "vrid": 1,
                   "version": "vrrp-v3",
                   "log-state-change": false,
                   "preempt": {
                     "enabled": true,
                     "hold-time": 0
                   }
                   "priority": 200,
                   "accept-mode": false,
                   "advertise-interval-centi-sec": 50,
                   "virtual-ipv4-addresses": {
                     "virtual-ipv4-address": [
                       "ipv4-address": "10.0.0.1"
                     ]
                   },
                   "state": "master",
                   "is-owner": false,
                   "last-adv-source": "10.1.1.1",
                   "up-datetime": "2016-10-24T17:11:27+02:00",
                   "master-down-interval": 161,
                   "skew-time": 11,
                   "last-event": "vrrp-event-interface-up",
                   "new-master-reason": "priority",
                   "statistics": {
                     "discontinuity-datetime":
                       "2016-10-24T17:11:27+02:00",
                     "master-transitions": 2,
                     "advertisement-recv": 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
                   }
                 }
               ]
             }
           }
         }
       ],
       "vrrp-global": {
         "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
         }
       }
     }
   }

Authors' Addresses
   Xufeng Liu (Editor)
   Kuatro Technologies (editor)
   Jabil
   8281 Greensboro Drive, Suite 200
   McLean,
   McLean  VA 22102
   USA

   Email: xliu@kuatrotech.com

   EMail: Xufeng_Liu@jabil.com

   Athanasios Kyparlis
   Kuatro Technologies
   Jabil
   8281 Greensboro Drive, Suite 200
   McLean,
   McLean  VA 22102
   USA

   Email: akyparlis@kuatrotech.com

   EMail: Athanasios_Kyparlis@jabil.com

   Ravi Parikh
   VMware
   3425 Hillview Avenue
   Palo Alto, Alto  CA 94304
   USA

   Email:

   EMail: parikhr@vmware.com

   Acee Lindem
   Cisco Systems
   301 Midenhall Way
   Cary,
   Cary  NC 27513
   USA

   Email:

   EMail: acee@cisco.com

   Mingui Zhang
   Huawei Technologies
   No. 156 Beiqing Rd. Haidian District
   Beijing  100095
   P.R. China

   Email:

   EMail: zhangmingui@huawei.com