]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-route-map.yang
bgpd: Refactor subgroup_announce_table() to reuse an existing helpers
[mirror_frr.git] / yang / frr-route-map.yang
1 // SPDX-License-Identifier: BSD-2-Clause
2 module frr-route-map {
3 yang-version 1.1;
4 namespace "http://frrouting.org/yang/route-map";
5 prefix frr-route-map;
6
7 import ietf-inet-types {
8 prefix inet;
9 }
10
11 import frr-filter {
12 prefix filter;
13 }
14
15 import frr-interface {
16 prefix frr-interface;
17 }
18
19 organization
20 "FRRouting";
21 contact
22 "FRR Users List: <mailto:frog@lists.frrouting.org>
23 FRR Development List: <mailto:dev@lists.frrouting.org>";
24 description
25 "This module defines route map settings
26
27 Copyright 2020 FRRouting
28
29 Redistribution and use in source and binary forms, with or without
30 modification, are permitted provided that the following conditions
31 are met:
32
33 1. Redistributions of source code must retain the above copyright notice,
34 this list of conditions and the following disclaimer.
35
36 2. Redistributions in binary form must reproduce the above copyright
37 notice, this list of conditions and the following disclaimer in the
38 documentation and/or other materials provided with the distribution.
39
40 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
41 \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
42 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
43 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
44 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
46 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
47 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
48 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
49 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
50 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
51
52 revision 2019-07-01 {
53 description
54 "Initial revision";
55 }
56
57 identity rmap-match-type {
58 description
59 "Base route-map match-condition";
60 }
61
62 identity interface {
63 base rmap-match-type;
64 description
65 "Match interface";
66 }
67
68 identity ipv4-address-list {
69 base rmap-match-type;
70 description
71 "Match an IPv4 access-list";
72 }
73
74 identity ipv4-prefix-list {
75 base rmap-match-type;
76 description
77 "Match an IPv4 prefix-list";
78 }
79
80 identity ipv4-next-hop-list {
81 base rmap-match-type;
82 description
83 "Match an IPv4 next-hop";
84 }
85
86 identity ipv4-next-hop-prefix-list {
87 base rmap-match-type;
88 description
89 "Match an IPv4 next-hop prefix list";
90 }
91
92 identity ipv4-next-hop-type {
93 base rmap-match-type;
94 description
95 "Match an IPv4 next-hop type";
96 }
97
98 identity ipv6-address-list {
99 base rmap-match-type;
100 description
101 "Match an IPv6 access-list";
102 }
103
104 identity ipv6-prefix-list {
105 base rmap-match-type;
106 description
107 "Match an IPv6 prefix-list";
108 }
109
110 identity ipv6-next-hop-list {
111 base rmap-match-type;
112 description
113 "Match an IPv6 next-hop";
114 }
115
116 identity ipv6-next-hop-prefix-list {
117 base rmap-match-type;
118 description
119 "Match an IPv6 next-hop prefix list";
120 }
121
122 identity ipv6-next-hop-type {
123 base rmap-match-type;
124 description
125 "Match an IPv6 next-hop type";
126 }
127
128 identity match-metric {
129 base rmap-match-type;
130 description
131 "Match a route metric";
132 }
133
134 identity match-tag {
135 base rmap-match-type;
136 description
137 "Match a route tag";
138 }
139
140 identity rmap-set-type {
141 description
142 "Base route-map set-action";
143 }
144
145 identity ipv4-next-hop {
146 base rmap-set-type;
147 description
148 "Set IPv4 address of the next hop";
149 }
150
151 identity ipv6-next-hop {
152 base rmap-set-type;
153 description
154 "Set IPv6 address of the next hop";
155 }
156
157 identity set-metric {
158 base rmap-set-type;
159 description
160 "Set prefix/route metric";
161 }
162
163 identity set-min-metric {
164 base rmap-set-type;
165 description
166 "Set minimum prefix/route metric";
167 }
168
169 identity set-max-metric {
170 base rmap-set-type;
171 description
172 "Set maximum prefix/route metric";
173 }
174
175 identity set-tag {
176 base rmap-set-type;
177 description
178 "Set tag";
179 }
180
181 identity set-sr-te-color {
182 base rmap-set-type;
183 description
184 "Set Color of the SR-TE";
185 }
186
187 typedef route-map-sequence {
188 type uint16 {
189 range "1..65535";
190 }
191 description
192 "Route map valid sequence numbers";
193 }
194
195 typedef route-map-name {
196 type string;
197 description
198 "Route map name format";
199 }
200
201 typedef route-map-ref {
202 type leafref {
203 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
204 require-instance false;
205 }
206 description
207 "Reference to a route-map.";
208 }
209
210 grouping rmap-match-condition {
211 container rmap-match-condition {
212 choice match-condition {
213 description
214 "Value to match (interpretation depends on condition type)";
215 case interface {
216 when "derived-from-or-self(../condition, 'interface')";
217 leaf interface {
218 type frr-interface:interface-ref;
219 }
220 }
221
222 case list-name {
223 when "derived-from-or-self(../condition, 'ipv4-address-list') or "
224 + "derived-from-or-self(../condition, 'ipv4-prefix-list') or "
225 + "derived-from-or-self(../condition, 'ipv4-next-hop-list') or "
226 + "derived-from-or-self(../condition, 'ipv4-next-hop-prefix-list') or "
227 + "derived-from-or-self(../condition, 'ipv6-address-list') or "
228 + "derived-from-or-self(../condition, 'ipv6-next-hop-list') or "
229 + "derived-from-or-self(../condition, 'ipv6-next-hop-prefix-list') or "
230 + "derived-from-or-self(../condition, 'ipv6-prefix-list')";
231 leaf list-name {
232 type filter:access-list-name;
233 }
234 }
235
236 case ipv4-next-hop-type {
237 when "derived-from-or-self(../condition, 'ipv4-next-hop-type')";
238 leaf ipv4-next-hop-type {
239 type enumeration {
240 enum "blackhole" {
241 value 0;
242 }
243 }
244 }
245 }
246
247 case ipv6-next-hop-type {
248 when "derived-from-or-self(../condition, 'ipv6-next-hop-type')";
249 leaf ipv6-next-hop-type {
250 type enumeration {
251 enum "blackhole" {
252 value 0;
253 }
254 }
255 }
256 }
257
258 case match-metric {
259 when "derived-from-or-self(../condition, 'match-metric')";
260 leaf metric {
261 type uint32 {
262 range "1..4294967295";
263 }
264 }
265 }
266
267 case match-tag {
268 when "derived-from-or-self(../condition, 'match-tag')";
269 leaf tag {
270 type uint32 {
271 range "1..4294967295";
272 }
273 }
274 }
275 }
276 }
277 }
278
279 grouping rmap-set-action {
280 container rmap-set-action {
281 choice set-action {
282 description
283 "Value to set (interpretation depends on action-type)";
284 case ipv4-address {
285 when "derived-from-or-self(../action, 'ipv4-next-hop')";
286 leaf ipv4-address {
287 type inet:ipv4-address;
288 description
289 "IPv4 address";
290 }
291 }
292
293 case ipv6-address {
294 when "derived-from-or-self(../action, 'ipv6-next-hop')";
295 leaf ipv6-address {
296 type inet:ipv6-address;
297 description
298 "IPv6 address";
299 }
300 }
301
302 case set-metric {
303 when "derived-from-or-self(../action, 'set-metric')";
304 choice metric-value {
305 description
306 "Metric to set or use";
307 case value {
308 leaf value {
309 type uint32 {
310 range "0..4294967295";
311 }
312 description
313 "Use the following metric value";
314 }
315 }
316
317 case add-metric {
318 leaf add-metric {
319 description "Add value to metric.";
320 type uint32 {
321 range "0..4294967295";
322 }
323 }
324 }
325
326 case subtract-metric {
327 leaf subtract-metric {
328 description "Subtract value from metric.";
329 type uint32 {
330 range "0..4294967295";
331 }
332 }
333 }
334
335 case use-round-trip-time {
336 leaf use-round-trip-time {
337 type boolean;
338 description
339 "Use the round trip time as metric";
340 }
341 }
342
343 case add-round-trip-time {
344 leaf add-round-trip-time {
345 type boolean;
346 description
347 "Add round trip time to metric";
348 }
349 }
350
351 case subtract-round-trip-time {
352 leaf subtract-round-trip-time {
353 type boolean;
354 description
355 "Subtract round trip time to metric";
356 }
357 }
358 }
359 }
360
361 case set-min-metric {
362 when "derived-from-or-self(../action, 'set-min-metric')";
363 choice minimun-metric-value {
364 description
365 "Mimimum metric to set or use";
366 case min-metric {
367 leaf min-metric {
368 type uint32 {
369 range "0..4294967295";
370 }
371 description
372 "Use the following mimumn metric value";
373 }
374 }
375 }
376 }
377
378 case set-max-metric {
379 when "derived-from-or-self(../action, 'set-max-metric')";
380 choice maximum-metric-value {
381 description
382 "Maximum metric to set or use";
383 case max-metric {
384 leaf max-metric {
385 type uint32 {
386 range "0..4294967295";
387 }
388 description
389 "Use the following maximum metric value";
390 }
391 }
392 }
393 }
394 case set-tag {
395 when "derived-from-or-self(../action, 'set-tag')";
396 leaf tag {
397 type uint32 {
398 range "0..4294967295";
399 }
400 description
401 "Tag value";
402 }
403 }
404
405 case set-sr-te-color {
406 when "derived-from-or-self(../action, 'set-sr-te-color')";
407 leaf policy {
408 type string;
409 description
410 "Color of the SR-TE Policies to match with";
411 }
412 }
413 }
414 }
415 }
416
417 container lib {
418 list route-map {
419 key "name";
420 description
421 "Route map instance";
422 leaf name {
423 type route-map-name;
424 description
425 "Route map instance name";
426 }
427 leaf optimization-disabled {
428 type boolean;
429 default false;
430 description "Disables or enables the optimization";
431 }
432
433 list entry {
434 key "sequence";
435 description
436 "Route map entry";
437 leaf sequence {
438 type route-map-sequence;
439 description
440 "Route map instance priority (low number means higher priority)";
441 }
442
443 leaf description {
444 type string;
445 description
446 "Route map description";
447 }
448
449 leaf action {
450 type enumeration {
451 enum "permit" {
452 value 0;
453 description
454 "Executes configured action and permits the prefix/route
455 if the conditions matched. An alternative exit action can
456 be configured to continue processing the route map list
457 or jump to process another route map.";
458 }
459 enum "deny" {
460 value 1;
461 description
462 "If all conditions are met the prefix/route is denied and
463 route map processing stops.";
464 }
465 }
466 mandatory true;
467 description
468 "Route map actions: permit (executes action), deny (quits evaluation)";
469 }
470
471 leaf call {
472 type route-map-name;
473 description
474 "Call another route map before calling `exit-policy`. If the
475 called route map returns deny then this route map will also
476 return deny";
477 }
478
479 leaf exit-policy {
480 type enumeration {
481 enum "permit-or-deny" {
482 value 0;
483 description
484 "End route map evaluation and return";
485 }
486 enum "next" {
487 value 1;
488 description
489 "Proceed evaluating next route map entry per sequence";
490 }
491 enum "goto" {
492 value 2;
493 description
494 "Go to route map entry with the provided sequence number";
495 }
496 }
497 default "permit-or-deny";
498 description
499 "What do to after route map successful match, set and call";
500 }
501
502 leaf goto-value {
503 when "../exit-policy = 'goto'";
504 type route-map-sequence;
505 mandatory true;
506 description
507 "Sequence number to jump (when using `goto` exit policy)";
508 }
509
510 list match-condition {
511 key "condition";
512 description
513 "Route map match conditions";
514 leaf condition {
515 type identityref {
516 base rmap-match-type;
517 }
518 description
519 "Match condition";
520 }
521
522 uses rmap-match-condition;
523 }
524
525 list set-action {
526 key "action";
527 description
528 "Route map set actions";
529 leaf action {
530 type identityref {
531 base rmap-set-type;
532 }
533 description
534 "Action to do when the route map matches";
535 }
536
537 uses rmap-set-action;
538 }
539 }
540 }
541 }
542 }