]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-route-map.yang
Merge pull request #9456 from proelbtn/fix-running-config
[mirror_frr.git] / yang / frr-route-map.yang
1 module 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 }
9
10 import frr-filter {
11 prefix filter;
12 }
13
14 import frr-interface {
15 prefix frr-interface;
16 }
17
18 organization
19 "FRRouting";
20 contact
21 "FRR Users List: <mailto:frog@lists.frrouting.org>
22 FRR Development List: <mailto:dev@lists.frrouting.org>";
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.";
50
51 revision 2019-07-01 {
52 description
53 "Initial revision";
54 }
55
56 identity rmap-match-type {
57 description
58 "Base route-map match-condition";
59 }
60
61 identity interface {
62 base rmap-match-type;
63 description
64 "Match interface";
65 }
66
67 identity ipv4-address-list {
68 base rmap-match-type;
69 description
70 "Match an IPv4 access-list";
71 }
72
73 identity ipv4-prefix-list {
74 base rmap-match-type;
75 description
76 "Match an IPv4 prefix-list";
77 }
78
79 identity ipv4-next-hop-list {
80 base rmap-match-type;
81 description
82 "Match an IPv4 next-hop";
83 }
84
85 identity ipv4-next-hop-prefix-list {
86 base rmap-match-type;
87 description
88 "Match an IPv4 next-hop prefix list";
89 }
90
91 identity ipv4-next-hop-type {
92 base rmap-match-type;
93 description
94 "Match an IPv4 next-hop type";
95 }
96
97 identity ipv6-address-list {
98 base rmap-match-type;
99 description
100 "Match an IPv6 access-list";
101 }
102
103 identity ipv6-prefix-list {
104 base rmap-match-type;
105 description
106 "Match an IPv6 prefix-list";
107 }
108
109 identity ipv6-next-hop-type {
110 base rmap-match-type;
111 description
112 "Match an IPv6 next-hop type";
113 }
114
115 identity match-metric {
116 base rmap-match-type;
117 description
118 "Match a route metric";
119 }
120
121 identity match-tag {
122 base rmap-match-type;
123 description
124 "Match a route tag";
125 }
126
127 identity rmap-set-type {
128 description
129 "Base route-map set-action";
130 }
131
132 identity ipv4-next-hop {
133 base rmap-set-type;
134 description
135 "Set IPv4 address of the next hop";
136 }
137
138 identity ipv6-next-hop {
139 base rmap-set-type;
140 description
141 "Set IPv6 address of the next hop";
142 }
143
144 identity set-metric {
145 base rmap-set-type;
146 description
147 "Set prefix/route metric";
148 }
149
150 identity set-tag {
151 base rmap-set-type;
152 description
153 "Set tag";
154 }
155
156 identity set-sr-te-color {
157 base rmap-set-type;
158 description
159 "Set Color of the SR-TE";
160 }
161
162 typedef route-map-sequence {
163 type uint16 {
164 range "1..65535";
165 }
166 description
167 "Route map valid sequence numbers";
168 }
169
170 typedef route-map-name {
171 type string;
172 description
173 "Route map name format";
174 }
175
176 typedef route-map-ref {
177 type leafref {
178 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
179 require-instance false;
180 }
181 description
182 "Reference to a route-map.";
183 }
184
185 grouping rmap-match-condition {
186 container rmap-match-condition {
187 choice match-condition {
188 description
189 "Value to match (interpretation depends on condition type)";
190 case interface {
191 when "derived-from-or-self(../condition, 'interface')";
192 leaf interface {
193 type frr-interface:interface-ref;
194 }
195 }
196
197 case list-name {
198 when "derived-from-or-self(../condition, 'ipv4-address-list') or "
199 + "derived-from-or-self(../condition, 'ipv4-prefix-list') or "
200 + "derived-from-or-self(../condition, 'ipv4-next-hop-list') or "
201 + "derived-from-or-self(../condition, 'ipv4-next-hop-prefix-list') or "
202 + "derived-from-or-self(../condition, 'ipv6-address-list') or "
203 + "derived-from-or-self(../condition, 'ipv6-prefix-list')";
204 leaf list-name {
205 type filter:access-list-name;
206 }
207 }
208
209 case ipv4-next-hop-type {
210 when "derived-from-or-self(../condition, 'ipv4-next-hop-type')";
211 leaf ipv4-next-hop-type {
212 type enumeration {
213 enum "blackhole" {
214 value 0;
215 }
216 }
217 }
218 }
219
220 case ipv6-next-hop-type {
221 when "derived-from-or-self(../condition, 'ipv6-next-hop-type')";
222 leaf ipv6-next-hop-type {
223 type enumeration {
224 enum "blackhole" {
225 value 0;
226 }
227 }
228 }
229 }
230
231 case match-metric {
232 when "derived-from-or-self(../condition, 'match-metric')";
233 leaf metric {
234 type uint32 {
235 range "1..4294967295";
236 }
237 }
238 }
239
240 case match-tag {
241 when "derived-from-or-self(../condition, 'match-tag')";
242 leaf tag {
243 type uint32 {
244 range "1..4294967295";
245 }
246 }
247 }
248 }
249 }
250 }
251
252 grouping rmap-set-action {
253 container rmap-set-action {
254 choice set-action {
255 description
256 "Value to set (interpretation depends on action-type)";
257 case ipv4-address {
258 when "derived-from-or-self(../action, 'ipv4-next-hop')";
259 leaf ipv4-address {
260 type inet:ipv4-address;
261 description
262 "IPv4 address";
263 }
264 }
265
266 case ipv6-address {
267 when "derived-from-or-self(../action, 'ipv6-next-hop')";
268 leaf ipv6-address {
269 type inet:ipv6-address;
270 description
271 "IPv6 address";
272 }
273 }
274
275 case set-metric {
276 when "derived-from-or-self(../action, 'set-metric')";
277 choice metric-value {
278 description
279 "Metric to set or use";
280 case value {
281 leaf value {
282 type uint32 {
283 range "0..4294967295";
284 }
285 description
286 "Use the following metric value";
287 }
288 }
289
290 case add-metric {
291 leaf add-metric {
292 description "Add value to metric.";
293 type uint32 {
294 range "0..4294967295";
295 }
296 }
297 }
298
299 case subtract-metric {
300 leaf subtract-metric {
301 description "Subtract value from metric.";
302 type uint32 {
303 range "0..4294967295";
304 }
305 }
306 }
307
308 case use-round-trip-time {
309 leaf use-round-trip-time {
310 type boolean;
311 description
312 "Use the round trip time as metric";
313 }
314 }
315
316 case add-round-trip-time {
317 leaf add-round-trip-time {
318 type boolean;
319 description
320 "Add round trip time to metric";
321 }
322 }
323
324 case subtract-round-trip-time {
325 leaf subtract-round-trip-time {
326 type boolean;
327 description
328 "Subtract round trip time to metric";
329 }
330 }
331 }
332 }
333
334 case set-tag {
335 when "derived-from-or-self(../action, 'set-tag')";
336 leaf tag {
337 type uint32 {
338 range "0..4294967295";
339 }
340 description
341 "Tag value";
342 }
343 }
344
345 case set-sr-te-color {
346 when "derived-from-or-self(../action, 'set-sr-te-color')";
347 leaf policy {
348 type string;
349 description
350 "Color of the SR-TE Policies to match with";
351 }
352 }
353 }
354 }
355 }
356
357 container lib {
358 list route-map {
359 key "name";
360 description
361 "Route map instance";
362 leaf name {
363 type route-map-name;
364 description
365 "Route map instance name";
366 }
367 leaf optimization-disabled {
368 type boolean;
369 default false;
370 description "Disables or enables the optimization";
371 }
372
373 list entry {
374 key "sequence";
375 description
376 "Route map entry";
377 leaf sequence {
378 type route-map-sequence;
379 description
380 "Route map instance priority (low number means higher priority)";
381 }
382
383 leaf description {
384 type string;
385 description
386 "Route map description";
387 }
388
389 leaf action {
390 type enumeration {
391 enum "permit" {
392 value 0;
393 description
394 "Executes configured action and permits the prefix/route
395 if the conditions matched. An alternative exit action can
396 be configured to continue processing the route map list
397 or jump to process another route map.";
398 }
399 enum "deny" {
400 value 1;
401 description
402 "If all conditions are met the prefix/route is denied and
403 route map processing stops.";
404 }
405 }
406 mandatory true;
407 description
408 "Route map actions: permit (executes action), deny (quits evaluation)";
409 }
410
411 leaf call {
412 type route-map-name;
413 description
414 "Call another route map before calling `exit-policy`. If the
415 called route map returns deny then this route map will also
416 return deny";
417 }
418
419 leaf exit-policy {
420 type enumeration {
421 enum "permit-or-deny" {
422 value 0;
423 description
424 "End route map evaluation and return";
425 }
426 enum "next" {
427 value 1;
428 description
429 "Proceed evaluating next route map entry per sequence";
430 }
431 enum "goto" {
432 value 2;
433 description
434 "Go to route map entry with the provided sequence number";
435 }
436 }
437 default "permit-or-deny";
438 description
439 "What do to after route map successful match, set and call";
440 }
441
442 leaf goto-value {
443 when "../exit-policy = 'goto'";
444 type route-map-sequence;
445 mandatory true;
446 description
447 "Sequence number to jump (when using `goto` exit policy)";
448 }
449
450 list match-condition {
451 key "condition";
452 description
453 "Route map match conditions";
454 leaf condition {
455 type identityref {
456 base rmap-match-type;
457 }
458 description
459 "Match condition";
460 }
461
462 uses rmap-match-condition;
463 }
464
465 list set-action {
466 key "action";
467 description
468 "Route map set actions";
469 leaf action {
470 type identityref {
471 base rmap-set-type;
472 }
473 description
474 "Action to do when the route map matches";
475 }
476
477 uses rmap-set-action;
478 }
479 }
480 }
481 }
482 }