3 namespace "http://frrouting.org/yang/route-map";
6 import ietf-inet-types {
14 import frr-interface {
21 "FRR Users List: <mailto:frog@lists.frrouting.org>
22 FRR Development List: <mailto:dev@lists.frrouting.org>";
24 "This module defines route map settings
26 Copyright 2020 FRRouting
28 Redistribution and use in source and binary forms, with or without
29 modification, are permitted provided that the following conditions
32 1. Redistributions of source code must retain the above copyright notice,
33 this list of conditions and the following disclaimer.
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.
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.";
59 typedef route-map-sequence {
64 "Route map valid sequence numbers.";
67 typedef route-map-name {
70 "Route map name format.";
73 typedef route-map-ref {
75 path "/frr-route-map:lib/frr-route-map:route-map/frr-route-map:name";
76 require-instance false;
79 "Reference to a route-map.";
89 "Route map instance.";
93 "Route map instance name.";
102 "Route map instance priority (low number means higher priority).";
103 type route-map-sequence;
107 description "Route map description.";
113 "Route map actions: permit (executes action), deny (quits evaluation).";
118 "Executes configured action and permits the prefix/route
119 if the conditions matched. An alternative exit action can
120 be configured to continue processing the route map list
121 or jump to process another route map.";
126 "If all conditions are met the prefix/route is denied and
127 route map processing stops.";
135 "Call another route map before calling `exit-policy`. If the
136 called route map returns deny then this route map will also
142 description "What do to after route map successful match, set and call.";
144 enum permit-or-deny {
145 description "End route map evaluation and return.";
150 "Proceed evaluating next route map entry per sequence.";
155 "Go to route map entry with the provided sequence number.";
159 default "permit-or-deny";
163 when "../exit-policy = 'goto'";
165 "Sequence number to jump (when using `goto` exit policy).";
167 type route-map-sequence;
170 list match-condition {
173 "Route map match conditions.";
175 description "Match condition.";
178 description "Match interface.";
181 enum ipv4-address-list {
182 description "Match an IPv4 access-list.";
185 enum ipv4-prefix-list {
186 description "Match an IPv4 prefix-list.";
189 enum ipv4-next-hop-list {
190 description "Match an IPv4 next-hop.";
193 enum ipv4-next-hop-prefix-list {
194 description "Match an IPv4 next-hop prefix list.";
197 enum ipv4-next-hop-type {
198 description "Match an IPv4 next-hop type.";
201 enum ipv6-address-list {
202 description "Match an IPv6 access-list.";
205 enum ipv6-prefix-list {
206 description "Match an IPv6 prefix-list.";
209 enum ipv6-next-hop-type {
210 description "Match an IPv6 next-hop type.";
214 description "Match a route metric.";
218 description "Match a route tag.";
221 /* zebra specific conditions. */
222 enum ipv4-prefix-length {
223 description "Match IPv4 prefix length.";
226 enum ipv6-prefix-length {
227 description "Match IPv6 prefix length.";
230 enum ipv4-next-hop-prefix-length {
231 description "Match next-hop prefix length.";
234 enum source-protocol {
235 description "Match source protocol.";
238 enum source-instance {
239 description "Match source protocol instance.";
245 choice condition-value {
247 "Value to match (interpretation depends on condition type).";
250 when "./condition = 'interface'";
252 type frr-interface:interface-ref;
257 when "./condition = 'ipv4-address-list' or
258 ./condition = 'ipv4-prefix-list' or
259 ./condition = 'ipv4-next-hop-list' or
260 ./condition = 'ipv4-next-hop-prefix-list' or
261 ./condition = 'ipv6-address-list' or
262 ./condition = 'ipv6-prefix-list'";
264 type filter:access-list-name;
268 case ipv4-next-hop-type {
269 when "./condition = 'ipv4-next-hop-type'";
270 leaf ipv4-next-hop-type {
279 case ipv6-next-hop-type {
280 when "./condition = 'ipv6-next-hop-type'";
281 leaf ipv6-next-hop-type {
291 when "./condition = 'metric'";
294 range "1..4294967295";
300 when "./condition = 'tag'";
303 range "1..4294967295";
311 description "Route map set actions.";
316 description "Action to do when the route map matches.";
319 description "Set IPv4 address of the next hop.";
323 description "Set IPv6 address of the next hop.";
327 description "Set prefix/route metric.";
331 description "Set tag.";
334 /* zebra specific conditions. */
336 description "Set source address for route.";
342 choice action-value {
344 "Value to set (interpretation depends on action-type).";
346 when "./action = 'ipv4-next-hop'";
348 description "IPv4 address.";
349 type inet:ipv4-address;
354 when "./action = 'ipv6-next-hop'";
356 description "IPv6 address.";
357 type inet:ipv6-address;
362 when "./action = 'metric'";
363 choice metric-value {
364 description "Metric to set or use.";
367 description "Use the following metric value.";
369 range "0..4294967295";
376 description "Add unit to metric.";
381 case subtract-metric {
382 leaf subtract-metric {
383 description "Subtract unit from metric.";
388 case use-round-trip-time {
389 leaf use-round-trip-time {
390 description "Use the round trip time as metric.";
395 case add-round-trip-time {
396 leaf add-round-trip-time {
397 description "Add round trip time to metric.";
402 case subtract-round-trip-time {
403 leaf subtract-round-trip-time {
404 description "Subtract round trip time to metric.";
412 when "./action = 'tag'";
414 description "Tag value.";
416 range "0..4294967295";