summaryrefslogtreecommitdiffstats
path: root/yang/frr-vrrpd.yang
blob: 200eaeb0b542faf1dae75055542c4c2fc091834c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
module frr-vrrpd {
  yang-version 1.1;
  namespace "http://frrouting.org/yang/vrrpd";
  prefix frr-vrrpd;

  import ietf-inet-types {
    prefix inet;
  }

  import ietf-yang-types {
    prefix yang;
  }

  import frr-interface {
    prefix frr-interface;
  }

  organization
    "FRRouting";
  contact
    "FRR Users List:       <mailto:frog@lists.frrouting.org>
     FRR Development List: <mailto:dev@lists.frrouting.org>";
  description
    "This module defines a model for managing FRR vrrpd daemon.

     Copyright 2020 FRRouting

     Redistribution and use in source and binary forms, with or without
     modification, are permitted provided that the following conditions
     are met:

     1. Redistributions of source code must retain the above copyright notice,
     this list of conditions and the following disclaimer.

     2. Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.

     THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
     A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
     HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
     SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
     LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
     OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";

  revision 2019-09-09 {
    description
      "Initial revision.";
  }

  grouping ip-vrrp-config {
    description
      "Configuration data for VRRP on IP interfaces";
    leaf virtual-router-id {
      type uint8 {
        range "1..255";
      }
      description
        "Set the virtual router id for use by the VRRP group. This
         usually also determines the virtual MAC address that is
         generated for the VRRP group";
    }

    leaf version {
      type enumeration {
        enum "2" {
          value 2;
          description
            "VRRP version 2.";
        }
        enum "3" {
          value 3;
          description
            "VRRP version 3.";
        }
      }
      default "3";
    }

    leaf priority {
      type uint8 {
        range "1..254";
      }
      default "100";
      description
        "Specifies the sending VRRP interface's priority
         for the virtual router. Higher values equal higher
         priority";
    }

    leaf preempt {
      type boolean;
      default "true";
      description
        "When set to true, enables preemption by a higher
         priority backup router of a lower priority master router";
    }

    leaf accept-mode {
      type boolean;
      default "true";
      description
        "Configure whether packets destined for
         virtual addresses are accepted even when the virtual
         address is not owned by the router interface";
    }

    leaf advertisement-interval {
      type uint16 {
        range "1..4095";
      }
      units "centiseconds";
      default "100";
      description
        "Sets the interval between successive VRRP
         advertisements -- RFC 5798 defines this as a 12-bit
         value expressed as 0.1 seconds, with default 100, i.e.,
         1 second. Several implementation express this in units of
         seconds";
    }

    leaf shutdown {
      type boolean;
      default "false";
      description
        "Administrative shutdown for this VRRP group.";
    }
  }

  grouping ip-vrrp-state {
    description
      "Grouping for operational state data for a virtual router";
    leaf current-priority {
      type uint8;
      config false;
      description
        "Operational value of the priority for the
         interface in the VRRP group.";
    }

    leaf vrrp-interface {
      type frr-interface:interface-ref;
      config false;
      description
        "The interface used to transmit VRRP traffic.";
    }

    leaf source-address {
      type inet:ip-address;
      config false;
      description
        "The source IP address used for VRRP advertisements.";
    }

    leaf state {
      type enumeration {
        enum "Initialize" {
          description
            "State when virtual router is waiting for a Startup event.";
        }
        enum "Master" {
          description
            "State when virtual router is functioning as the forwarding router
             for the virtual addresses.";
        }
        enum "Backup" {
          description
            "State when virtual router is monitoring the availability and state
             of the Master router.";
        }
      }
      config false;
    }

    leaf master-advertisement-interval {
      type uint16 {
        range "0..4095";
      }
      units "centiseconds";
      config false;
      description
        "Advertisement interval contained in advertisements received from the Master.";
    }

    leaf skew-time {
      type uint16;
      units "centiseconds";
      config false;
      description
        "Time to skew Master_Down_Interval.";
    }

    container counter {
      config false;
      leaf state-transition {
        type yang:zero-based-counter32;
        description
          "Number of state transitions the virtual router has experienced.";
      }

      container tx {
        leaf advertisement {
          type yang:zero-based-counter32;
          description
            "Number of sent VRRP advertisements.";
        }
      }

      container rx {
        leaf advertisement {
          type yang:zero-based-counter32;
          description
            "Number of received VRRP advertisements.";
        }
      }
    }
  }

  grouping ip-vrrp-top {
    description
      "Top-level grouping for Virtual Router Redundancy Protocol";
    container vrrp {
      description
        "Enclosing container for VRRP groups handled by this
         IP interface";
      reference
        "RFC 5798 - Virtual Router Redundancy Protocol
         (VRRP) Version 3 for IPv4 and IPv6";
      list vrrp-group {
        key "virtual-router-id";
        description
          "List of VRRP groups, keyed by virtual router id";
        uses ip-vrrp-config;

        container v4 {
          leaf-list virtual-address {
            type inet:ipv4-address;
            description
              "Configure one or more IPv4 virtual addresses for the
               VRRP group";
          }

          uses ip-vrrp-state {
            augment "counter/tx" {
              leaf gratuitous-arp {
                type yang:zero-based-counter32;
                description
                  "Number of sent gratuitous ARP requests.";
              }
            }
          }
        }

        container v6 {
          when "../version = 3";
          leaf-list virtual-address {
            type inet:ipv6-address;
            description
              "Configure one or more IPv6 virtual addresses for the
               VRRP group";
          }

          uses ip-vrrp-state {
            augment "counter/tx" {
              leaf neighbor-advertisement {
                type yang:zero-based-counter32;
                description
                  "Number of sent unsolicited Neighbor Advertisements.";
              }
            }
          }
        }
      }
    }
  }

  augment "/frr-interface:lib/frr-interface:interface" {
    uses ip-vrrp-top;
  }
}