1 // SPDX-License-Identifier: BSD-2-Clause
4 namespace "http://frrouting.org/yang/route-map";
7 import ietf-inet-types {
15 import frr-interface {
22 "FRR Users List: <mailto:frog@lists.frrouting.org>
23 FRR Development List: <mailto:dev@lists.frrouting.org>";
25 "This module defines route map settings
27 Copyright 2020 FRRouting
29 Redistribution and use in source and binary forms, with or without
30 modification, are permitted provided that the following conditions
33 1. Redistributions of source code must retain the above copyright notice,
34 this list of conditions and the following disclaimer.
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.
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.";
57 identity rmap-match-type {
59 "Base route-map match-condition";
68 identity ipv4-address-list {
71 "Match an IPv4 access-list";
74 identity ipv4-prefix-list {
77 "Match an IPv4 prefix-list";
80 identity ipv4-next-hop-list {
83 "Match an IPv4 next-hop";
86 identity ipv4-next-hop-prefix-list {
89 "Match an IPv4 next-hop prefix list";
92 identity ipv4-next-hop-type {
95 "Match an IPv4 next-hop type";
98 identity ipv6-address-list {
101 "Match an IPv6 access-list";
104 identity ipv6-prefix-list {
105 base rmap-match-type;
107 "Match an IPv6 prefix-list";
110 identity ipv6-next-hop-list {
111 base rmap-match-type;
113 "Match an IPv6 next-hop";
116 identity ipv6-next-hop-prefix-list {
117 base rmap-match-type;
119 "Match an IPv6 next-hop prefix list";
122 identity ipv6-next-hop-type {
123 base rmap-match-type;
125 "Match an IPv6 next-hop type";
128 identity match-metric {
129 base rmap-match-type;
131 "Match a route metric";
135 base rmap-match-type;
140 identity rmap-set-type {
142 "Base route-map set-action";
145 identity ipv4-next-hop {
148 "Set IPv4 address of the next hop";
151 identity ipv6-next-hop {
154 "Set IPv6 address of the next hop";
157 identity set-metric {
160 "Set prefix/route metric";
163 identity set-min-metric {
166 "Set minimum prefix/route metric";
169 identity set-max-metric {
172 "Set maximum prefix/route metric";
181 identity set-sr-te-color {
184 "Set Color of the SR-TE";
187 typedef route-map-sequence {
192 "Route map valid sequence numbers";
195 typedef route-map-name {
198 "Route map name format";
201 typedef route-map-ref {
203 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
204 require-instance false;
207 "Reference to a route-map.";
210 grouping rmap-match-condition {
211 container rmap-match-condition {
212 choice match-condition {
214 "Value to match (interpretation depends on condition type)";
216 when "derived-from-or-self(../condition, 'interface')";
218 type frr-interface:interface-ref;
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')";
232 type filter:access-list-name;
236 case ipv4-next-hop-type {
237 when "derived-from-or-self(../condition, 'ipv4-next-hop-type')";
238 leaf ipv4-next-hop-type {
247 case ipv6-next-hop-type {
248 when "derived-from-or-self(../condition, 'ipv6-next-hop-type')";
249 leaf ipv6-next-hop-type {
259 when "derived-from-or-self(../condition, 'match-metric')";
262 range "1..4294967295";
268 when "derived-from-or-self(../condition, 'match-tag')";
271 range "1..4294967295";
279 grouping rmap-set-action {
280 container rmap-set-action {
283 "Value to set (interpretation depends on action-type)";
285 when "derived-from-or-self(../action, 'ipv4-next-hop')";
287 type inet:ipv4-address;
294 when "derived-from-or-self(../action, 'ipv6-next-hop')";
296 type inet:ipv6-address;
303 when "derived-from-or-self(../action, 'set-metric')";
304 choice metric-value {
306 "Metric to set or use";
310 range "0..4294967295";
313 "Use the following metric value";
319 description "Add value to metric.";
321 range "0..4294967295";
326 case subtract-metric {
327 leaf subtract-metric {
328 description "Subtract value from metric.";
330 range "0..4294967295";
335 case use-round-trip-time {
336 leaf use-round-trip-time {
339 "Use the round trip time as metric";
343 case add-round-trip-time {
344 leaf add-round-trip-time {
347 "Add round trip time to metric";
351 case subtract-round-trip-time {
352 leaf subtract-round-trip-time {
355 "Subtract round trip time to metric";
361 case set-min-metric {
362 when "derived-from-or-self(../action, 'set-min-metric')";
363 choice minimun-metric-value {
365 "Mimimum metric to set or use";
369 range "0..4294967295";
372 "Use the following mimumn metric value";
378 case set-max-metric {
379 when "derived-from-or-self(../action, 'set-max-metric')";
380 choice maximum-metric-value {
382 "Maximum metric to set or use";
386 range "0..4294967295";
389 "Use the following maximum metric value";
395 when "derived-from-or-self(../action, 'set-tag')";
398 range "0..4294967295";
405 case set-sr-te-color {
406 when "derived-from-or-self(../action, 'set-sr-te-color')";
410 "Color of the SR-TE Policies to match with";
421 "Route map instance";
425 "Route map instance name";
427 leaf optimization-disabled {
430 description "Disables or enables the optimization";
438 type route-map-sequence;
440 "Route map instance priority (low number means higher priority)";
446 "Route map 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.";
462 "If all conditions are met the prefix/route is denied and
463 route map processing stops.";
468 "Route map actions: permit (executes action), deny (quits evaluation)";
474 "Call another route map before calling `exit-policy`. If the
475 called route map returns deny then this route map will also
481 enum "permit-or-deny" {
484 "End route map evaluation and return";
489 "Proceed evaluating next route map entry per sequence";
494 "Go to route map entry with the provided sequence number";
497 default "permit-or-deny";
499 "What do to after route map successful match, set and call";
503 when "../exit-policy = 'goto'";
504 type route-map-sequence;
507 "Sequence number to jump (when using `goto` exit policy)";
510 list match-condition {
513 "Route map match conditions";
516 base rmap-match-type;
522 uses rmap-match-condition;
528 "Route map set actions";
534 "Action to do when the route map matches";
537 uses rmap-set-action;