]> git.proxmox.com Git - mirror_frr.git/blame - yang/frr-route-map.yang
Merge pull request #7303 from mobash-rasool/pim-fixes
[mirror_frr.git] / yang / frr-route-map.yang
CommitLineData
0f281356
RZ
1module frr-route-map {
2 yang-version 1.1;
3 namespace "http://frrouting.org/yang/route-map";
4 prefix frr-route-map;
5
6 import ietf-inet-types {
7 prefix inet;
8 }
1cbba4b0 9
04ef6e75
RZ
10 import frr-filter {
11 prefix filter;
12 }
1cbba4b0 13
0c0e7304
RZ
14 import frr-interface {
15 prefix frr-interface;
16 }
0f281356 17
1cbba4b0
CS
18 organization
19 "FRRouting";
0f281356
RZ
20 contact
21 "FRR Users List: <mailto:frog@lists.frrouting.org>
22 FRR Development List: <mailto:dev@lists.frrouting.org>";
fe3b629a
RW
23 description
24 "This module defines route map settings
25
26 Copyright 2020 FRRouting
27
28 Redistribution and use in source and binary forms, with or without
29 modification, are permitted provided that the following conditions
30 are met:
31
32 1. Redistributions of source code must retain the above copyright notice,
33 this list of conditions and the following disclaimer.
34
35 2. Redistributions in binary form must reproduce the above copyright
36 notice, this list of conditions and the following disclaimer in the
37 documentation and/or other materials provided with the distribution.
38
39 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
40 \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
41 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
42 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
43 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
46 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
47 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
48 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
49 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
0f281356
RZ
50
51 revision 2019-07-01 {
1cbba4b0
CS
52 description
53 "Initial revision";
0f281356
RZ
54 }
55
56 /*
57 * Types.
58 */
59 typedef route-map-sequence {
0f281356
RZ
60 type uint16 {
61 range "1..65535";
62 }
1cbba4b0 63 description
15435a3c 64 "Route map valid sequence numbers.";
0f281356
RZ
65 }
66
67 typedef route-map-name {
0f281356 68 type string;
1cbba4b0 69 description
15435a3c 70 "Route map name format.";
0f281356
RZ
71 }
72
37746447
CS
73 typedef route-map-ref {
74 type leafref {
75 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
76 require-instance false;
77 }
78 description
79 "Reference to a route-map.";
80 }
81
0f281356
RZ
82 /*
83 * Operational data.
84 */
0c0e7304
RZ
85 container lib {
86 list route-map {
0c0e7304 87 key "name";
1cbba4b0 88 description
15435a3c 89 "Route map instance.";
0f281356 90 leaf name {
0f281356 91 type route-map-name;
1cbba4b0 92 description
15435a3c 93 "Route map instance name.";
0f281356
RZ
94 }
95
0c0e7304 96 list entry {
0c0e7304 97 key "sequence";
1cbba4b0 98 description
15435a3c 99 "Route map entry.";
0c0e7304
RZ
100 leaf sequence {
101 description
15435a3c 102 "Route map instance priority (low number means higher priority).";
0c0e7304 103 type route-map-sequence;
0f281356 104 }
0f281356 105
0c0e7304 106 leaf description {
15435a3c 107 description "Route map description.";
0c0e7304
RZ
108 type string;
109 }
0f281356 110
0c0e7304
RZ
111 leaf action {
112 description
15435a3c 113 "Route map actions: permit (executes action), deny (quits evaluation).";
0c0e7304 114 mandatory true;
0f281356 115 type enumeration {
0c0e7304
RZ
116 enum permit {
117 description
118 "Executes configured action and permits the prefix/route
119 if the conditions matched. An alternative exit action can
120 be configured to continue processing the route map list
121 or jump to process another route map.";
0f281356
RZ
122 value 0;
123 }
0c0e7304
RZ
124 enum deny {
125 description
126 "If all conditions are met the prefix/route is denied and
127 route map processing stops.";
0f281356
RZ
128 value 1;
129 }
0c0e7304
RZ
130 }
131 }
132
133 leaf call {
134 description
135 "Call another route map before calling `exit-policy`. If the
136 called route map returns deny then this route map will also
15435a3c 137 return deny.";
0c0e7304
RZ
138 type route-map-name;
139 }
140
141 leaf exit-policy {
15435a3c 142 description "What do to after route map successful match, set and call.";
0c0e7304
RZ
143 type enumeration {
144 enum permit-or-deny {
15435a3c 145 description "End route map evaluation and return.";
0c0e7304 146 value 0;
0f281356 147 }
0c0e7304
RZ
148 enum next {
149 description
15435a3c 150 "Proceed evaluating next route map entry per sequence.";
0c0e7304 151 value 1;
0f281356 152 }
0c0e7304
RZ
153 enum goto {
154 description
15435a3c 155 "Go to route map entry with the provided sequence number.";
0c0e7304 156 value 2;
0f281356
RZ
157 }
158 }
0c0e7304 159 default "permit-or-deny";
0f281356
RZ
160 }
161
0c0e7304
RZ
162 leaf goto-value {
163 when "../exit-policy = 'goto'";
0f281356 164 description
15435a3c 165 "Sequence number to jump (when using `goto` exit policy).";
0c0e7304
RZ
166 mandatory true;
167 type route-map-sequence;
168 }
169
170 list match-condition {
0c0e7304 171 key "condition";
1cbba4b0 172 description
15435a3c 173 "Route map match conditions.";
0c0e7304 174 leaf condition {
15435a3c 175 description "Match condition.";
0c0e7304
RZ
176 type enumeration {
177 enum interface {
15435a3c 178 description "Match interface.";
0c0e7304
RZ
179 value 0;
180 }
181 enum ipv4-address-list {
15435a3c 182 description "Match an IPv4 access-list.";
0c0e7304
RZ
183 value 1;
184 }
185 enum ipv4-prefix-list {
15435a3c 186 description "Match an IPv4 prefix-list.";
0c0e7304
RZ
187 value 2;
188 }
189 enum ipv4-next-hop-list {
15435a3c 190 description "Match an IPv4 next-hop.";
0c0e7304
RZ
191 value 3;
192 }
193 enum ipv4-next-hop-prefix-list {
15435a3c 194 description "Match an IPv4 next-hop prefix list.";
0c0e7304
RZ
195 value 4;
196 }
197 enum ipv4-next-hop-type {
15435a3c 198 description "Match an IPv4 next-hop type.";
0c0e7304
RZ
199 value 5;
200 }
201 enum ipv6-address-list {
15435a3c 202 description "Match an IPv6 access-list.";
0c0e7304
RZ
203 value 6;
204 }
205 enum ipv6-prefix-list {
15435a3c 206 description "Match an IPv6 prefix-list.";
0c0e7304
RZ
207 value 7;
208 }
209 enum ipv6-next-hop-type {
15435a3c 210 description "Match an IPv6 next-hop type.";
0c0e7304
RZ
211 value 8;
212 }
213 enum metric {
15435a3c 214 description "Match a route metric.";
0c0e7304
RZ
215 value 9;
216 }
217 enum tag {
15435a3c 218 description "Match a route tag.";
0c0e7304
RZ
219 value 10;
220 }
bc77245f
RZ
221 /* zebra specific conditions. */
222 enum ipv4-prefix-length {
15435a3c 223 description "Match IPv4 prefix length.";
0c0e7304
RZ
224 value 100;
225 }
bc77245f 226 enum ipv6-prefix-length {
15435a3c 227 description "Match IPv6 prefix length.";
bc77245f
RZ
228 value 101;
229 }
230 enum ipv4-next-hop-prefix-length {
15435a3c 231 description "Match next-hop prefix length.";
bc77245f
RZ
232 value 102;
233 }
234 enum source-protocol {
15435a3c 235 description "Match source protocol.";
bc77245f
RZ
236 value 103;
237 }
238 enum source-instance {
15435a3c 239 description "Match source protocol instance.";
bc77245f
RZ
240 value 104;
241 }
0f281356
RZ
242 }
243 }
0c0e7304
RZ
244
245 choice condition-value {
246 description
15435a3c 247 "Value to match (interpretation depends on condition type).";
0c0e7304
RZ
248 mandatory true;
249 case interface {
250 when "./condition = 'interface'";
251 leaf interface {
240b7826 252 type frr-interface:interface-ref;
0c0e7304 253 }
0f281356 254 }
1cbba4b0 255
0c0e7304
RZ
256 case list-name {
257 when "./condition = 'ipv4-address-list' or
258 ./condition = 'ipv4-prefix-list' or
259 ./condition = 'ipv4-next-hop-list' or
260 ./condition = 'ipv4-next-hop-prefix-list' or
261 ./condition = 'ipv6-address-list' or
262 ./condition = 'ipv6-prefix-list'";
263 leaf list-name {
264 type filter:access-list-name;
0f281356
RZ
265 }
266 }
1cbba4b0 267
0c0e7304
RZ
268 case ipv4-next-hop-type {
269 when "./condition = 'ipv4-next-hop-type'";
270 leaf ipv4-next-hop-type {
271 type enumeration {
272 enum blackhole {
273 value 0;
274 }
0f281356
RZ
275 }
276 }
277 }
1cbba4b0 278
0c0e7304
RZ
279 case ipv6-next-hop-type {
280 when "./condition = 'ipv6-next-hop-type'";
281 leaf ipv6-next-hop-type {
282 type enumeration {
283 enum blackhole {
284 value 0;
285 }
0f281356
RZ
286 }
287 }
288 }
1cbba4b0 289
0c0e7304
RZ
290 case metric {
291 when "./condition = 'metric'";
292 leaf metric {
293 type uint32 {
294 range "1..4294967295";
295 }
0f281356
RZ
296 }
297 }
1cbba4b0 298
0c0e7304
RZ
299 case tag {
300 when "./condition = 'tag'";
301 leaf tag {
302 type uint32 {
303 range "1..4294967295";
304 }
0f281356
RZ
305 }
306 }
307 }
308 }
0f281356 309
0c0e7304 310 list set-action {
15435a3c 311 description "Route map set actions.";
0f281356 312
0c0e7304 313 key "action";
0f281356 314
0c0e7304 315 leaf action {
15435a3c 316 description "Action to do when the route map matches.";
0c0e7304
RZ
317 type enumeration {
318 enum ipv4-next-hop {
15435a3c 319 description "Set IPv4 address of the next hop.";
0c0e7304
RZ
320 value 0;
321 }
322 enum ipv6-next-hop {
15435a3c 323 description "Set IPv6 address of the next hop.";
0c0e7304
RZ
324 value 1;
325 }
326 enum metric {
15435a3c 327 description "Set prefix/route metric.";
0c0e7304
RZ
328 value 2;
329 }
330 enum tag {
15435a3c 331 description "Set tag.";
0c0e7304
RZ
332 value 3;
333 }
bc77245f
RZ
334 /* zebra specific conditions. */
335 enum source {
15435a3c 336 description "Set source address for route.";
0c0e7304
RZ
337 value 100;
338 }
0f281356
RZ
339 }
340 }
0f281356 341
0c0e7304
RZ
342 choice action-value {
343 description
15435a3c 344 "Value to set (interpretation depends on action-type).";
0c0e7304
RZ
345 case ipv4-address {
346 when "./action = 'ipv4-next-hop'";
347 leaf ipv4-address {
15435a3c 348 description "IPv4 address.";
0c0e7304
RZ
349 type inet:ipv4-address;
350 }
0f281356 351 }
1cbba4b0 352
0c0e7304
RZ
353 case ipv6-address {
354 when "./action = 'ipv6-next-hop'";
355 leaf ipv6-address {
15435a3c 356 description "IPv6 address.";
0c0e7304
RZ
357 type inet:ipv6-address;
358 }
0f281356 359 }
1cbba4b0 360
0c0e7304
RZ
361 case metric {
362 when "./action = 'metric'";
363 choice metric-value {
15435a3c 364 description "Metric to set or use.";
0c0e7304
RZ
365 case value {
366 leaf value {
15435a3c 367 description "Use the following metric value.";
0c0e7304
RZ
368 type uint32 {
369 range "0..4294967295";
370 }
0f281356
RZ
371 }
372 }
1cbba4b0 373
0c0e7304
RZ
374 case add-metric {
375 leaf add-metric {
add39cde
RW
376 description "Add value to metric.";
377 type uint32 {
378 range "0..4294967295";
379 }
0c0e7304 380 }
0f281356 381 }
1cbba4b0 382
0c0e7304
RZ
383 case subtract-metric {
384 leaf subtract-metric {
add39cde
RW
385 description "Subtract value from metric.";
386 type uint32 {
387 range "0..4294967295";
388 }
0c0e7304 389 }
0f281356 390 }
1cbba4b0 391
0c0e7304
RZ
392 case use-round-trip-time {
393 leaf use-round-trip-time {
15435a3c 394 description "Use the round trip time as metric.";
0c0e7304
RZ
395 type boolean;
396 }
0f281356 397 }
1cbba4b0 398
0c0e7304
RZ
399 case add-round-trip-time {
400 leaf add-round-trip-time {
15435a3c 401 description "Add round trip time to metric.";
0c0e7304
RZ
402 type boolean;
403 }
0f281356 404 }
1cbba4b0 405
0c0e7304
RZ
406 case subtract-round-trip-time {
407 leaf subtract-round-trip-time {
15435a3c 408 description "Subtract round trip time to metric.";
0c0e7304
RZ
409 type boolean;
410 }
0f281356
RZ
411 }
412 }
413 }
1cbba4b0 414
0c0e7304
RZ
415 case tag {
416 when "./action = 'tag'";
417 leaf tag {
15435a3c 418 description "Tag value.";
0c0e7304
RZ
419 type uint32 {
420 range "0..4294967295";
421 }
0f281356
RZ
422 }
423 }
424 }
425 }
426 }
0f281356
RZ
427 }
428 }
429}