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";
169 identity set-sr-te-color {
172 "Set Color of the SR-TE";
175 typedef route-map-sequence {
180 "Route map valid sequence numbers";
183 typedef route-map-name {
186 "Route map name format";
189 typedef route-map-ref {
191 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
192 require-instance false;
195 "Reference to a route-map.";
198 grouping rmap-match-condition {
199 container rmap-match-condition {
200 choice match-condition {
202 "Value to match (interpretation depends on condition type)";
204 when "derived-from-or-self(../condition, 'interface')";
206 type frr-interface:interface-ref;
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')";
220 type filter:access-list-name;
224 case ipv4-next-hop-type {
225 when "derived-from-or-self(../condition, 'ipv4-next-hop-type')";
226 leaf ipv4-next-hop-type {
235 case ipv6-next-hop-type {
236 when "derived-from-or-self(../condition, 'ipv6-next-hop-type')";
237 leaf ipv6-next-hop-type {
247 when "derived-from-or-self(../condition, 'match-metric')";
250 range "1..4294967295";
256 when "derived-from-or-self(../condition, 'match-tag')";
259 range "1..4294967295";
267 grouping rmap-set-action {
268 container rmap-set-action {
271 "Value to set (interpretation depends on action-type)";
273 when "derived-from-or-self(../action, 'ipv4-next-hop')";
275 type inet:ipv4-address;
282 when "derived-from-or-self(../action, 'ipv6-next-hop')";
284 type inet:ipv6-address;
291 when "derived-from-or-self(../action, 'set-metric')";
292 choice metric-value {
294 "Metric to set or use";
298 range "0..4294967295";
301 "Use the following metric value";
307 description "Add value to metric.";
309 range "0..4294967295";
314 case subtract-metric {
315 leaf subtract-metric {
316 description "Subtract value from metric.";
318 range "0..4294967295";
323 case use-round-trip-time {
324 leaf use-round-trip-time {
327 "Use the round trip time as metric";
331 case add-round-trip-time {
332 leaf add-round-trip-time {
335 "Add round trip time to metric";
339 case subtract-round-trip-time {
340 leaf subtract-round-trip-time {
343 "Subtract round trip time to metric";
350 when "derived-from-or-self(../action, 'set-tag')";
353 range "0..4294967295";
360 case set-sr-te-color {
361 when "derived-from-or-self(../action, 'set-sr-te-color')";
365 "Color of the SR-TE Policies to match with";
376 "Route map instance";
380 "Route map instance name";
382 leaf optimization-disabled {
385 description "Disables or enables the optimization";
393 type route-map-sequence;
395 "Route map instance priority (low number means higher priority)";
401 "Route map 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.";
417 "If all conditions are met the prefix/route is denied and
418 route map processing stops.";
423 "Route map actions: permit (executes action), deny (quits evaluation)";
429 "Call another route map before calling `exit-policy`. If the
430 called route map returns deny then this route map will also
436 enum "permit-or-deny" {
439 "End route map evaluation and return";
444 "Proceed evaluating next route map entry per sequence";
449 "Go to route map entry with the provided sequence number";
452 default "permit-or-deny";
454 "What do to after route map successful match, set and call";
458 when "../exit-policy = 'goto'";
459 type route-map-sequence;
462 "Sequence number to jump (when using `goto` exit policy)";
465 list match-condition {
468 "Route map match conditions";
471 base rmap-match-type;
477 uses rmap-match-condition;
483 "Route map set actions";
489 "Action to do when the route map matches";
492 uses rmap-set-action;