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