]> git.proxmox.com Git - mirror_frr.git/blame - yang/frr-route-map.yang
Merge pull request #12816 from gpnaveen/stc_rte_err_msg
[mirror_frr.git] / yang / frr-route-map.yang
CommitLineData
41db488c 1// SPDX-License-Identifier: BSD-2-Clause
0f281356
RZ
2module 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 }
1cbba4b0 10
04ef6e75
RZ
11 import frr-filter {
12 prefix filter;
13 }
1cbba4b0 14
0c0e7304
RZ
15 import frr-interface {
16 prefix frr-interface;
17 }
0f281356 18
1cbba4b0
CS
19 organization
20 "FRRouting";
0f281356
RZ
21 contact
22 "FRR Users List: <mailto:frog@lists.frrouting.org>
23 FRR Development List: <mailto:dev@lists.frrouting.org>";
fe3b629a
RW
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.";
0f281356
RZ
51
52 revision 2019-07-01 {
1cbba4b0
CS
53 description
54 "Initial revision";
0f281356
RZ
55 }
56
b702f424
SP
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
bc63ba98
DA
110 identity ipv6-next-hop-list {
111 base rmap-match-type;
112 description
113 "Match an IPv6 next-hop";
114 }
115
82f191a2
DA
116 identity ipv6-next-hop-prefix-list {
117 base rmap-match-type;
118 description
119 "Match an IPv6 next-hop prefix list";
120 }
121
b702f424
SP
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
0f281356 175 typedef route-map-sequence {
0f281356
RZ
176 type uint16 {
177 range "1..65535";
178 }
1cbba4b0 179 description
b702f424 180 "Route map valid sequence numbers";
0f281356
RZ
181 }
182
183 typedef route-map-name {
0f281356 184 type string;
1cbba4b0 185 description
b702f424 186 "Route map name format";
0f281356
RZ
187 }
188
37746447
CS
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
b702f424
SP
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 "
bc63ba98 216 + "derived-from-or-self(../condition, 'ipv6-next-hop-list') or "
82f191a2 217 + "derived-from-or-self(../condition, 'ipv6-next-hop-prefix-list') or "
b702f424
SP
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
0c0e7304
RZ
372 container lib {
373 list route-map {
0c0e7304 374 key "name";
1cbba4b0 375 description
b702f424 376 "Route map instance";
0f281356 377 leaf name {
0f281356 378 type route-map-name;
1cbba4b0 379 description
b702f424 380 "Route map instance name";
3ebeec94
IR
381 }
382 leaf optimization-disabled {
383 type boolean;
384 default false;
385 description "Disables or enables the optimization";
0f281356
RZ
386 }
387
0c0e7304 388 list entry {
0c0e7304 389 key "sequence";
1cbba4b0 390 description
b702f424 391 "Route map entry";
0c0e7304 392 leaf sequence {
0c0e7304 393 type route-map-sequence;
b702f424
SP
394 description
395 "Route map instance priority (low number means higher priority)";
0f281356 396 }
0f281356 397
0c0e7304 398 leaf description {
0c0e7304 399 type string;
b702f424
SP
400 description
401 "Route map description";
0c0e7304 402 }
0f281356 403
0c0e7304 404 leaf action {
0f281356 405 type enumeration {
b702f424
SP
406 enum "permit" {
407 value 0;
0c0e7304
RZ
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.";
0f281356 413 }
b702f424
SP
414 enum "deny" {
415 value 1;
0c0e7304
RZ
416 description
417 "If all conditions are met the prefix/route is denied and
418 route map processing stops.";
0f281356 419 }
0c0e7304 420 }
b702f424
SP
421 mandatory true;
422 description
423 "Route map actions: permit (executes action), deny (quits evaluation)";
0c0e7304
RZ
424 }
425
426 leaf call {
b702f424 427 type route-map-name;
0c0e7304
RZ
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
b702f424 431 return deny";
0c0e7304
RZ
432 }
433
434 leaf exit-policy {
0c0e7304 435 type enumeration {
b702f424 436 enum "permit-or-deny" {
0c0e7304 437 value 0;
0c0e7304 438 description
b702f424 439 "End route map evaluation and return";
0f281356 440 }
b702f424
SP
441 enum "next" {
442 value 1;
0c0e7304 443 description
b702f424
SP
444 "Proceed evaluating next route map entry per sequence";
445 }
446 enum "goto" {
0c0e7304 447 value 2;
b702f424
SP
448 description
449 "Go to route map entry with the provided sequence number";
0f281356
RZ
450 }
451 }
0c0e7304 452 default "permit-or-deny";
b702f424
SP
453 description
454 "What do to after route map successful match, set and call";
0f281356
RZ
455 }
456
0c0e7304
RZ
457 leaf goto-value {
458 when "../exit-policy = 'goto'";
0c0e7304 459 type route-map-sequence;
b702f424
SP
460 mandatory true;
461 description
462 "Sequence number to jump (when using `goto` exit policy)";
0c0e7304
RZ
463 }
464
465 list match-condition {
0c0e7304 466 key "condition";
1cbba4b0 467 description
b702f424 468 "Route map match conditions";
0c0e7304 469 leaf condition {
b702f424
SP
470 type identityref {
471 base rmap-match-type;
0f281356 472 }
0c0e7304 473 description
b702f424 474 "Match condition";
0f281356 475 }
b702f424
SP
476
477 uses rmap-match-condition;
0f281356 478 }
0f281356 479
0c0e7304 480 list set-action {
0c0e7304 481 key "action";
b702f424
SP
482 description
483 "Route map set actions";
0c0e7304 484 leaf action {
b702f424
SP
485 type identityref {
486 base rmap-set-type;
0f281356 487 }
0c0e7304 488 description
b702f424 489 "Action to do when the route map matches";
0f281356 490 }
b702f424
SP
491
492 uses rmap-set-action;
0f281356
RZ
493 }
494 }
0f281356
RZ
495 }
496 }
497}