]> git.proxmox.com Git - mirror_frr.git/blob - yang/frr-route-map.yang
bgpd: fix heap buffer overflow in lcom -> str enc
[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
13 organization "Free Range Routing";
14 contact
15 "FRR Users List: <mailto:frog@lists.frrouting.org>
16 FRR Development List: <mailto:dev@lists.frrouting.org>";
17 description "This module defines route map settings";
18
19 revision 2019-07-01 {
20 description "Initial revision";
21 }
22
23 /*
24 * Types.
25 */
26 typedef route-map-sequence {
27 description "Route map valid sequence numbers";
28 type uint16 {
29 range "1..65535";
30 }
31 }
32
33 typedef route-map-name {
34 description "Route map name format";
35 type string;
36 }
37
38 /*
39 * Operational data.
40 */
41 container route-map {
42 list instance {
43 description "Route map instance";
44
45 key "name sequence";
46
47 leaf name {
48 description "Route map instance name";
49 type route-map-name;
50 }
51
52 leaf sequence {
53 description
54 "Route map instance priority (low number means higher priority)";
55 type route-map-sequence;
56 }
57
58 leaf description {
59 description "Route map description";
60 type string;
61 }
62
63 leaf action {
64 description
65 "Route map actions: permit (executes action), deny (quits evaluation)";
66 mandatory true;
67 type enumeration {
68 enum permit {
69 description
70 "Executes configured action and permits the prefix/route
71 if the conditions matched. An alternative exit action can
72 be configured to continue processing the route map list
73 or jump to process another route map.";
74 value 0;
75 }
76 enum deny {
77 description
78 "If all conditions are met the prefix/route is denied and
79 route map processing stops.";
80 value 1;
81 }
82 }
83 }
84
85 list match-condition {
86 description "Route map match conditions";
87
88 key "condition";
89
90 leaf condition {
91 description "Match condition";
92 type enumeration {
93 enum interface {
94 description "Match interface";
95 value 0;
96 }
97 enum ipv4-address-list {
98 description "Match an IPv4 access-list";
99 value 1;
100 }
101 enum ipv4-prefix-list {
102 description "Match an IPv4 prefix-list";
103 value 2;
104 }
105 enum ipv4-prefix-length {
106 description "Match an IPv4 prefix length";
107 value 3;
108 }
109 enum ipv4-next-hop-list {
110 description "Match an IPv4 next-hop";
111 value 4;
112 }
113 enum ipv4-next-hop-prefix-list {
114 description "Match an IPv4 next-hop prefix list";
115 value 5;
116 }
117 enum ipv4-next-hop-prefix-length {
118 description "Match an IPv4 next-hop prefix length";
119 value 6;
120 }
121 enum ipv4-next-hop-type {
122 description "Match an IPv4 next-hop type";
123 value 7;
124 }
125 enum ipv6-address-list {
126 description "Match an IPv6 access-list";
127 value 8;
128 }
129 enum ipv6-prefix-list {
130 description "Match an IPv6 prefix-list";
131 value 9;
132 }
133 enum ipv6-prefix-length {
134 description "Match an IPv6 prefix length";
135 value 10;
136 }
137 enum ipv6-next-hop {
138 description "Match an IPv6 next-hop";
139 value 11;
140 }
141 enum ipv6-next-hop-type {
142 description "Match an IPv6 next-hop type";
143 value 12;
144 }
145 enum metric {
146 description "Match a route metric";
147 value 13;
148 }
149 enum tag {
150 description "Match a route tag";
151 value 14;
152 }
153
154 /*
155 * Protocol YANG models should augment the parent node to
156 * contain the routing protocol specific value. The protocol
157 * must also augment `condition-value` to include its specific
158 * values or expand the `when` statement on the existing cases.
159 */
160 enum routing-protocol-specific {
161 description "Match a routing protocol specific type";
162 value 100;
163 }
164 }
165 }
166
167 choice condition-value {
168 description
169 "Value to match (interpretation depends on condition type)";
170 case access-list-num {
171 when "./condition = 'ipv4-address-list' or
172 ./condition = 'ipv4-next-hop-list'";
173 leaf access-list-num {
174 type filter:access-list-standard;
175 }
176 }
177 case access-list-num-extended {
178 when "./condition = 'ipv4-address-list' or
179 ./condition = 'ipv4-next-hop-list'";
180 leaf access-list-num-extended {
181 type filter:access-list-extended;
182 }
183 }
184 case list-name {
185 when "./condition = 'ipv4-address-list' or
186 ./condition = 'ipv4-prefix-list' or
187 ./condition = 'ipv4-next-hop-list' or
188 ./condition = 'ipv4-next-hop-prefix-list' or
189 ./condition = 'ipv6-address-list' or
190 ./condition = 'ipv6-prefix-list'";
191 leaf list-name {
192 type filter:access-list-name;
193 }
194 }
195 case ipv6-address {
196 when "./condition = 'ipv6-next-hop'";
197 leaf ipv6-address {
198 type inet:ipv6-address;
199 }
200 }
201 case ipv4-prefix-length {
202 when "./condition = 'ipv4-prefix-length' or
203 ./condition = 'ipv4-next-hop-prefix-length'";
204 leaf ipv4-prefix-length {
205 type uint8 {
206 range "0..32";
207 }
208 }
209 }
210 case ipv6-prefix-length {
211 when "./condition = 'ipv6-prefix-length'";
212 leaf ipv6-prefix-length {
213 type uint8 {
214 range "0..128";
215 }
216 }
217 }
218 case ipv4-next-hop-type {
219 when "./condition = 'ipv4-next-hop-type'";
220 leaf ipv4-next-hop-type {
221 type enumeration {
222 enum blackhole {
223 value 0;
224 }
225 }
226 }
227 }
228 case ipv6-next-hop-type {
229 when "./condition = 'ipv6-next-hop-type'";
230 leaf ipv6-next-hop-type {
231 type enumeration {
232 enum blackhole {
233 value 0;
234 }
235 }
236 }
237 }
238 case metric {
239 when "./condition = 'metric'";
240 leaf metric {
241 type uint32 {
242 range "1..4294967295";
243 }
244 }
245 }
246 case tag {
247 when "./condition = 'tag'";
248 leaf tag {
249 type uint32 {
250 range "1..4294967295";
251 }
252 }
253 }
254 }
255 }
256
257 list set-action {
258 description "Route map set actions";
259
260 key "action";
261
262 leaf action {
263 description "Action to do when the route map matches";
264 type enumeration {
265 enum ipv4-next-hop {
266 description "Set IPv4 address of the next hop";
267 value 0;
268 }
269 enum ipv6-next-hop {
270 description "Set IPv6 address of the next hop";
271 value 1;
272 }
273 enum metric {
274 description "Set prefix/route metric";
275 value 2;
276 }
277 enum tag {
278 description "Set tag";
279 value 3;
280 }
281
282 /*
283 * Protocol YANG models should augment the parent node to
284 * contain the routing protocol specific value. The protocol
285 * must also augment `action-value` to include its specific
286 * values or expand the `when` statement on the existing cases.
287 */
288 enum routing-protocol-specific {
289 description "Set a routing protocol specific action";
290 value 100;
291 }
292 }
293 }
294
295 choice action-value {
296 description
297 "Value to set (interpretation depends on action-type)";
298 case ipv4-address {
299 when "./action = 'ipv4-next-hop'";
300 leaf ipv4-address {
301 description "IPv4 address";
302 type inet:ipv4-address;
303 }
304 }
305 case ipv6-address {
306 when "./action = 'ipv6-next-hop'";
307 leaf ipv6-address {
308 description "IPv6 address";
309 type inet:ipv6-address;
310 }
311 }
312 case metric {
313 when "./action = 'metric'";
314 choice metric-value {
315 description "Metric to set or use";
316 case value {
317 leaf value {
318 description "Use the following metric value";
319 type uint32 {
320 range "0..4294967295";
321 }
322 }
323 }
324 case add-metric {
325 leaf add-metric {
326 description "Add unit to metric";
327 type boolean;
328 }
329 }
330 case subtract-metric {
331 leaf subtract-metric {
332 description "Subtract unit from metric";
333 type boolean;
334 }
335 }
336 case use-round-trip-time {
337 leaf use-round-trip-time {
338 description "Use the round trip time as metric";
339 type boolean;
340 }
341 }
342 case add-round-trip-time {
343 leaf add-round-trip-time {
344 description "Add round trip time to metric";
345 type boolean;
346 }
347 }
348 case subtract-round-trip-time {
349 leaf subtract-round-trip-time {
350 description "Subtract round trip time to metric";
351 type boolean;
352 }
353 }
354 }
355 }
356 case tag {
357 leaf tag {
358 description "Tag value";
359 type uint32 {
360 range "0..4294967295";
361 }
362 }
363 }
364 }
365 }
366
367 leaf call {
368 description
369 "Call another route map before calling `exit-policy`. If the
370 called route map returns deny then this route map will also
371 return deny";
372 type string;
373 }
374
375 leaf exit-policy {
376 description "What do to after route map successful match, set and call";
377 type enumeration {
378 enum permit-or-deny {
379 description "End route map evaluation and return";
380 value 0;
381 }
382 enum next {
383 description
384 "Proceed evaluating next route map entry per sequence";
385 value 1;
386 }
387 enum goto {
388 description
389 "Go to route map entry with the provided sequence number";
390 value 2;
391 }
392 }
393 default "permit-or-deny";
394 }
395
396 leaf goto-value {
397 when "../exit-policy = 'goto'";
398 description
399 "Sequence number to jump (when using `goto` exit policy)";
400 type route-map-sequence;
401 }
402 }
403 }
404 }