]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-route-map.yang
Merge pull request #13276 from pguibert6WIND/explicit_null_complement
[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-tag {
164 base rmap-set-type;
165 description
166 "Set tag";
167 }
168
169 identity set-sr-te-color {
170 base rmap-set-type;
171 description
172 "Set Color of the SR-TE";
173 }
174
175 typedef route-map-sequence {
176 type uint16 {
177 range "1..65535";
178 }
179 description
180 "Route map valid sequence numbers";
181 }
182
183 typedef route-map-name {
184 type string;
185 description
186 "Route map name format";
187 }
188
189 typedef route-map-ref {
190 type leafref {
191 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
192 require-instance false;
193 }
194 description
195 "Reference to a route-map.";
196 }
197
198 grouping rmap-match-condition {
199 container rmap-match-condition {
200 choice match-condition {
201 description
202 "Value to match (interpretation depends on condition type)";
203 case interface {
204 when "derived-from-or-self(../condition, 'interface')";
205 leaf interface {
206 type frr-interface:interface-ref;
207 }
208 }
209
210 case list-name {
211 when "derived-from-or-self(../condition, 'ipv4-address-list') or "
212 + "derived-from-or-self(../condition, 'ipv4-prefix-list') or "
213 + "derived-from-or-self(../condition, 'ipv4-next-hop-list') or "
214 + "derived-from-or-self(../condition, 'ipv4-next-hop-prefix-list') or "
215 + "derived-from-or-self(../condition, 'ipv6-address-list') or "
216 + "derived-from-or-self(../condition, 'ipv6-next-hop-list') or "
217 + "derived-from-or-self(../condition, 'ipv6-next-hop-prefix-list') or "
218 + "derived-from-or-self(../condition, 'ipv6-prefix-list')";
219 leaf list-name {
220 type filter:access-list-name;
221 }
222 }
223
224 case ipv4-next-hop-type {
225 when "derived-from-or-self(../condition, 'ipv4-next-hop-type')";
226 leaf ipv4-next-hop-type {
227 type enumeration {
228 enum "blackhole" {
229 value 0;
230 }
231 }
232 }
233 }
234
235 case ipv6-next-hop-type {
236 when "derived-from-or-self(../condition, 'ipv6-next-hop-type')";
237 leaf ipv6-next-hop-type {
238 type enumeration {
239 enum "blackhole" {
240 value 0;
241 }
242 }
243 }
244 }
245
246 case match-metric {
247 when "derived-from-or-self(../condition, 'match-metric')";
248 leaf metric {
249 type uint32 {
250 range "1..4294967295";
251 }
252 }
253 }
254
255 case match-tag {
256 when "derived-from-or-self(../condition, 'match-tag')";
257 leaf tag {
258 type uint32 {
259 range "1..4294967295";
260 }
261 }
262 }
263 }
264 }
265 }
266
267 grouping rmap-set-action {
268 container rmap-set-action {
269 choice set-action {
270 description
271 "Value to set (interpretation depends on action-type)";
272 case ipv4-address {
273 when "derived-from-or-self(../action, 'ipv4-next-hop')";
274 leaf ipv4-address {
275 type inet:ipv4-address;
276 description
277 "IPv4 address";
278 }
279 }
280
281 case ipv6-address {
282 when "derived-from-or-self(../action, 'ipv6-next-hop')";
283 leaf ipv6-address {
284 type inet:ipv6-address;
285 description
286 "IPv6 address";
287 }
288 }
289
290 case set-metric {
291 when "derived-from-or-self(../action, 'set-metric')";
292 choice metric-value {
293 description
294 "Metric to set or use";
295 case value {
296 leaf value {
297 type uint32 {
298 range "0..4294967295";
299 }
300 description
301 "Use the following metric value";
302 }
303 }
304
305 case add-metric {
306 leaf add-metric {
307 description "Add value to metric.";
308 type uint32 {
309 range "0..4294967295";
310 }
311 }
312 }
313
314 case subtract-metric {
315 leaf subtract-metric {
316 description "Subtract value from metric.";
317 type uint32 {
318 range "0..4294967295";
319 }
320 }
321 }
322
323 case use-round-trip-time {
324 leaf use-round-trip-time {
325 type boolean;
326 description
327 "Use the round trip time as metric";
328 }
329 }
330
331 case add-round-trip-time {
332 leaf add-round-trip-time {
333 type boolean;
334 description
335 "Add round trip time to metric";
336 }
337 }
338
339 case subtract-round-trip-time {
340 leaf subtract-round-trip-time {
341 type boolean;
342 description
343 "Subtract round trip time to metric";
344 }
345 }
346 }
347 }
348
349 case set-tag {
350 when "derived-from-or-self(../action, 'set-tag')";
351 leaf tag {
352 type uint32 {
353 range "0..4294967295";
354 }
355 description
356 "Tag value";
357 }
358 }
359
360 case set-sr-te-color {
361 when "derived-from-or-self(../action, 'set-sr-te-color')";
362 leaf policy {
363 type string;
364 description
365 "Color of the SR-TE Policies to match with";
366 }
367 }
368 }
369 }
370 }
371
372 container lib {
373 list route-map {
374 key "name";
375 description
376 "Route map instance";
377 leaf name {
378 type route-map-name;
379 description
380 "Route map instance name";
381 }
382 leaf optimization-disabled {
383 type boolean;
384 default false;
385 description "Disables or enables the optimization";
386 }
387
388 list entry {
389 key "sequence";
390 description
391 "Route map entry";
392 leaf sequence {
393 type route-map-sequence;
394 description
395 "Route map instance priority (low number means higher priority)";
396 }
397
398 leaf description {
399 type string;
400 description
401 "Route map description";
402 }
403
404 leaf action {
405 type enumeration {
406 enum "permit" {
407 value 0;
408 description
409 "Executes configured action and permits the prefix/route
410 if the conditions matched. An alternative exit action can
411 be configured to continue processing the route map list
412 or jump to process another route map.";
413 }
414 enum "deny" {
415 value 1;
416 description
417 "If all conditions are met the prefix/route is denied and
418 route map processing stops.";
419 }
420 }
421 mandatory true;
422 description
423 "Route map actions: permit (executes action), deny (quits evaluation)";
424 }
425
426 leaf call {
427 type route-map-name;
428 description
429 "Call another route map before calling `exit-policy`. If the
430 called route map returns deny then this route map will also
431 return deny";
432 }
433
434 leaf exit-policy {
435 type enumeration {
436 enum "permit-or-deny" {
437 value 0;
438 description
439 "End route map evaluation and return";
440 }
441 enum "next" {
442 value 1;
443 description
444 "Proceed evaluating next route map entry per sequence";
445 }
446 enum "goto" {
447 value 2;
448 description
449 "Go to route map entry with the provided sequence number";
450 }
451 }
452 default "permit-or-deny";
453 description
454 "What do to after route map successful match, set and call";
455 }
456
457 leaf goto-value {
458 when "../exit-policy = 'goto'";
459 type route-map-sequence;
460 mandatory true;
461 description
462 "Sequence number to jump (when using `goto` exit policy)";
463 }
464
465 list match-condition {
466 key "condition";
467 description
468 "Route map match conditions";
469 leaf condition {
470 type identityref {
471 base rmap-match-type;
472 }
473 description
474 "Match condition";
475 }
476
477 uses rmap-match-condition;
478 }
479
480 list set-action {
481 key "action";
482 description
483 "Route map set actions";
484 leaf action {
485 type identityref {
486 base rmap-set-type;
487 }
488 description
489 "Action to do when the route map matches";
490 }
491
492 uses rmap-set-action;
493 }
494 }
495 }
496 }
497 }