]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-route-map.yang
Merge pull request #6384 from kooky/set-src-doc
[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 import frr-filter {
10 prefix filter;
11 }
12 import frr-interface {
13 prefix frr-interface;
14 }
15
16 organization "FRRouting";
17 contact
18 "FRR Users List: <mailto:frog@lists.frrouting.org>
19 FRR Development List: <mailto:dev@lists.frrouting.org>";
20 description
21 "This module defines route map settings
22
23 Copyright 2020 FRRouting
24
25 Redistribution and use in source and binary forms, with or without
26 modification, are permitted provided that the following conditions
27 are met:
28
29 1. Redistributions of source code must retain the above copyright notice,
30 this list of conditions and the following disclaimer.
31
32 2. Redistributions in binary form must reproduce the above copyright
33 notice, this list of conditions and the following disclaimer in the
34 documentation and/or other materials provided with the distribution.
35
36 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
37 \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
38 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
39 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
40 HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
43 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
44 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
45 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
46 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.";
47
48 revision 2019-07-01 {
49 description "Initial revision";
50 }
51
52 /*
53 * Types.
54 */
55 typedef route-map-sequence {
56 description "Route map valid sequence numbers";
57 type uint16 {
58 range "1..65535";
59 }
60 }
61
62 typedef route-map-name {
63 description "Route map name format";
64 type string;
65 }
66
67 /*
68 * Operational data.
69 */
70 container lib {
71 list route-map {
72 description "Route map instance";
73
74 key "name";
75
76 leaf name {
77 description "Route map instance name";
78 type route-map-name;
79 }
80
81 list entry {
82 description "Route map entry";
83
84 key "sequence";
85
86 leaf sequence {
87 description
88 "Route map instance priority (low number means higher priority)";
89 type route-map-sequence;
90 }
91
92 leaf description {
93 description "Route map description";
94 type string;
95 }
96
97 leaf action {
98 description
99 "Route map actions: permit (executes action), deny (quits evaluation)";
100 mandatory true;
101 type enumeration {
102 enum permit {
103 description
104 "Executes configured action and permits the prefix/route
105 if the conditions matched. An alternative exit action can
106 be configured to continue processing the route map list
107 or jump to process another route map.";
108 value 0;
109 }
110 enum deny {
111 description
112 "If all conditions are met the prefix/route is denied and
113 route map processing stops.";
114 value 1;
115 }
116 }
117 }
118
119 leaf call {
120 description
121 "Call another route map before calling `exit-policy`. If the
122 called route map returns deny then this route map will also
123 return deny";
124 type route-map-name;
125 }
126
127 leaf exit-policy {
128 description "What do to after route map successful match, set and call";
129 type enumeration {
130 enum permit-or-deny {
131 description "End route map evaluation and return";
132 value 0;
133 }
134 enum next {
135 description
136 "Proceed evaluating next route map entry per sequence";
137 value 1;
138 }
139 enum goto {
140 description
141 "Go to route map entry with the provided sequence number";
142 value 2;
143 }
144 }
145 default "permit-or-deny";
146 }
147
148 leaf goto-value {
149 when "../exit-policy = 'goto'";
150 description
151 "Sequence number to jump (when using `goto` exit policy)";
152 mandatory true;
153 type route-map-sequence;
154 }
155
156 list match-condition {
157 description "Route map match conditions";
158
159 key "condition";
160
161 leaf condition {
162 description "Match condition";
163 type enumeration {
164 enum interface {
165 description "Match interface";
166 value 0;
167 }
168 enum ipv4-address-list {
169 description "Match an IPv4 access-list";
170 value 1;
171 }
172 enum ipv4-prefix-list {
173 description "Match an IPv4 prefix-list";
174 value 2;
175 }
176 enum ipv4-next-hop-list {
177 description "Match an IPv4 next-hop";
178 value 3;
179 }
180 enum ipv4-next-hop-prefix-list {
181 description "Match an IPv4 next-hop prefix list";
182 value 4;
183 }
184 enum ipv4-next-hop-type {
185 description "Match an IPv4 next-hop type";
186 value 5;
187 }
188 enum ipv6-address-list {
189 description "Match an IPv6 access-list";
190 value 6;
191 }
192 enum ipv6-prefix-list {
193 description "Match an IPv6 prefix-list";
194 value 7;
195 }
196 enum ipv6-next-hop-type {
197 description "Match an IPv6 next-hop type";
198 value 8;
199 }
200 enum metric {
201 description "Match a route metric";
202 value 9;
203 }
204 enum tag {
205 description "Match a route tag";
206 value 10;
207 }
208 /* zebra specific conditions. */
209 enum ipv4-prefix-length {
210 description "Match IPv4 prefix length";
211 value 100;
212 }
213 enum ipv6-prefix-length {
214 description "Match IPv6 prefix length";
215 value 101;
216 }
217 enum ipv4-next-hop-prefix-length {
218 description "Match next-hop prefix length";
219 value 102;
220 }
221 enum source-protocol {
222 description "Match source protocol";
223 value 103;
224 }
225 enum source-instance {
226 description "Match source protocol instance";
227 value 104;
228 }
229 }
230 }
231
232 choice condition-value {
233 description
234 "Value to match (interpretation depends on condition type)";
235 mandatory true;
236 case interface {
237 when "./condition = 'interface'";
238 leaf interface {
239 type string;
240 }
241 }
242 case access-list-num {
243 when "./condition = 'ipv4-address-list' or
244 ./condition = 'ipv4-next-hop-list'";
245 leaf access-list-num {
246 type filter:access-list-standard;
247 }
248 }
249 case access-list-num-extended {
250 when "./condition = 'ipv4-address-list' or
251 ./condition = 'ipv4-next-hop-list'";
252 leaf access-list-num-extended {
253 type filter:access-list-extended;
254 }
255 }
256 case list-name {
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'";
263 leaf list-name {
264 type filter:access-list-name;
265 }
266 }
267 case ipv4-next-hop-type {
268 when "./condition = 'ipv4-next-hop-type'";
269 leaf ipv4-next-hop-type {
270 type enumeration {
271 enum blackhole {
272 value 0;
273 }
274 }
275 }
276 }
277 case ipv6-next-hop-type {
278 when "./condition = 'ipv6-next-hop-type'";
279 leaf ipv6-next-hop-type {
280 type enumeration {
281 enum blackhole {
282 value 0;
283 }
284 }
285 }
286 }
287 case metric {
288 when "./condition = 'metric'";
289 leaf metric {
290 type uint32 {
291 range "1..4294967295";
292 }
293 }
294 }
295 case tag {
296 when "./condition = 'tag'";
297 leaf tag {
298 type uint32 {
299 range "1..4294967295";
300 }
301 }
302 }
303 }
304 }
305
306 list set-action {
307 description "Route map set actions";
308
309 key "action";
310
311 leaf action {
312 description "Action to do when the route map matches";
313 type enumeration {
314 enum ipv4-next-hop {
315 description "Set IPv4 address of the next hop";
316 value 0;
317 }
318 enum ipv6-next-hop {
319 description "Set IPv6 address of the next hop";
320 value 1;
321 }
322 enum metric {
323 description "Set prefix/route metric";
324 value 2;
325 }
326 enum tag {
327 description "Set tag";
328 value 3;
329 }
330 /* zebra specific conditions. */
331 enum source {
332 description "Set source address for route";
333 value 100;
334 }
335 }
336 }
337
338 choice action-value {
339 description
340 "Value to set (interpretation depends on action-type)";
341 case ipv4-address {
342 when "./action = 'ipv4-next-hop'";
343 leaf ipv4-address {
344 description "IPv4 address";
345 type inet:ipv4-address;
346 }
347 }
348 case ipv6-address {
349 when "./action = 'ipv6-next-hop'";
350 leaf ipv6-address {
351 description "IPv6 address";
352 type inet:ipv6-address;
353 }
354 }
355 case metric {
356 when "./action = 'metric'";
357 choice metric-value {
358 description "Metric to set or use";
359 case value {
360 leaf value {
361 description "Use the following metric value";
362 type uint32 {
363 range "0..4294967295";
364 }
365 }
366 }
367 case add-metric {
368 leaf add-metric {
369 description "Add unit to metric";
370 type boolean;
371 }
372 }
373 case subtract-metric {
374 leaf subtract-metric {
375 description "Subtract unit from metric";
376 type boolean;
377 }
378 }
379 case use-round-trip-time {
380 leaf use-round-trip-time {
381 description "Use the round trip time as metric";
382 type boolean;
383 }
384 }
385 case add-round-trip-time {
386 leaf add-round-trip-time {
387 description "Add round trip time to metric";
388 type boolean;
389 }
390 }
391 case subtract-round-trip-time {
392 leaf subtract-round-trip-time {
393 description "Subtract round trip time to metric";
394 type boolean;
395 }
396 }
397 }
398 }
399 case tag {
400 when "./action = 'tag'";
401 leaf tag {
402 description "Tag value";
403 type uint32 {
404 range "0..4294967295";
405 }
406 }
407 }
408 }
409 }
410 }
411 }
412 }
413 }