module ietf-vrrp {
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:
WG List:
WG Chair: Jeff Tantsura
WG Chair: Chris Bowers
Editor: Xufeng Liu
Editor: Athanasios Kyparlis
Editor: Ravi Parikh
Editor: Acee Lindem
Editor: Mingui Zhang
";
description
"This YANG module defines a model for managing Virtual Router
Redundancy Protocol (VRRP) version 2 and version 3.";
revision 2016-12-01 {
description "Initial revision";
reference
"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
*/
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 {
base vrrp-state-type;
description
"Indicates that the virtual router is forwarding
packets for IP addresses that are associated with
this virtual router.";
}
/*
* 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 {
description "VRRP version 3.";
}
}
description "Version 2 or version 3 of VRRP.";
}
leaf log-state-change {
type boolean;
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 hold-time {
type uint16;
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 {
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.";
}
}
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'" {
description "Applicable only to version 2.";
}
leaf advertise-interval-sec {
type uint8 {
range 1..254;
}
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'" {
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;
}
description
"Specifies how much to decrement the priority of the
VRRP instance if the interface goes down.";
}
} // track-interface
} // track-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";
description
"Enables the specified Virtual Router Redundancy
Protocol version 2 (VRRP) or version 3 (VRRPv3)
instance to track an interface.";
leaf network {
type inet:ipv4-prefix;
description
"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;
}
description
"Specifies how much to decrement the priority of the
VRRP instance if the interface goes down.";
}
} // track-interface
} // track-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";
description
"Enables the specified Virtual Router Redundancy
Protocol version 2 (VRRP) or version 3 (VRRPv3)
instance to track an interface.";
leaf network {
type inet:ipv6-prefix;
description
"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;
}
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 {
type yang:date-and-time;
description
"The 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;
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 {
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.";
}
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.";
}
} // 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'" {
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 {
type inet:ipv4-address;
description
"IPv4 or IPv6 address of the new master.";
}
leaf new-master-reason {
type new-master-reason-type;
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 {
description
"A packet has been received with IP TTL (Time-To-Live)
not equal to 255.";
}
}
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;
description
"Indicates the interface for which statistics area
to be cleared.";
}
leaf ip-version {
type enumeration {
enum 4 {
description "IPv4";
}
enum 6 {
description "IPv6";
}
}
description "Indicates the IP version.";
}
leaf vrid-v4 {
type leafref {
path "/if:interfaces/if:interface"
+ "[if:name = current()/../interface]/ip:ipv4/vrrp/"
+ "vrrp-instance/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/"
+ "vrrp-instance/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 {
description
"A packet has been received with a packet length less
than the length of the VRRP header.";
}
}
description
"Indicates the reason for the virtual router error.";
}
}
}