]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_routemap_nb.c
doc: Add documentation for AIGP
[mirror_frr.git] / bgpd / bgp_routemap_nb.c
CommitLineData
48cb7ea9
SP
1/*
2 * Copyright (C) 2020 Vmware
3 * Sarita Patra
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; see the file COPYING; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 */
19
20
1f8031f7
DL
21#include <zebra.h>
22
48cb7ea9
SP
23#include "lib/command.h"
24#include "lib/log.h"
25#include "lib/northbound.h"
26#include "lib/routemap.h"
27#include "bgpd/bgpd.h"
28#include "bgpd/bgp_routemap_nb.h"
29
30/* clang-format off */
31const struct frr_yang_module_info frr_bgp_route_map_info = {
32 .name = "frr-bgp-route-map",
33 .nodes = {
34 {
35 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:local-preference",
36 .cbs = {
37 .modify = lib_route_map_entry_match_condition_rmap_match_condition_local_preference_modify,
38 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_local_preference_destroy,
39 }
40 },
2690f18c
DA
41 {
42 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:alias",
43 .cbs = {
44 .modify = lib_route_map_entry_match_condition_rmap_match_condition_alias_modify,
45 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_alias_destroy,
46 }
47 },
48cb7ea9
SP
48 {
49 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:script",
50 .cbs = {
51 .modify = lib_route_map_entry_match_condition_rmap_match_condition_script_modify,
52 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_script_destroy,
53 }
54 },
55 {
56 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:origin",
57 .cbs = {
58 .modify = lib_route_map_entry_match_condition_rmap_match_condition_origin_modify,
59 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_origin_destroy,
60 }
61 },
62 {
63 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:rpki",
64 .cbs = {
65 .modify = lib_route_map_entry_match_condition_rmap_match_condition_rpki_modify,
66 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_rpki_destroy,
67 }
68 },
324e8b1f
DA
69 {
70 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:rpki-extcommunity",
71 .cbs = {
72 .modify = lib_route_map_entry_match_condition_rmap_match_condition_rpki_extcommunity_modify,
73 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_rpki_extcommunity_destroy,
74 }
75 },
48cb7ea9
SP
76 {
77 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:probability",
78 .cbs = {
79 .modify = lib_route_map_entry_match_condition_rmap_match_condition_probability_modify,
80 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_probability_destroy,
81 }
82 },
83 {
84 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:source-vrf",
85 .cbs = {
86 .modify = lib_route_map_entry_match_condition_rmap_match_condition_source_vrf_modify,
87 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_source_vrf_destroy,
88 }
89 },
90 {
91 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
92 .cbs = {
93 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv4_address_modify,
94 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv4_address_destroy,
95 }
96 },
97 {
98 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-interface",
99 .cbs = {
100 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_interface_modify,
101 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_interface_destroy,
102 }
103 },
104 {
105 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
106 .cbs = {
107 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv6_address_modify,
108 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv6_address_destroy,
109 }
110 },
111 {
112 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-local",
113 .cbs = {
114 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_local_modify,
115 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_local_destroy,
116 }
117 },
118 {
119 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:list-name",
120 .cbs = {
121 .modify = lib_route_map_entry_match_condition_rmap_match_condition_list_name_modify,
122 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_list_name_destroy,
123 }
124 },
125 {
126 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-default-route",
127 .cbs = {
128 .create = lib_route_map_entry_match_condition_rmap_match_condition_evpn_default_route_create,
129 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_evpn_default_route_destroy,
130 }
131 },
132 {
133 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-vni",
134 .cbs = {
135 .modify = lib_route_map_entry_match_condition_rmap_match_condition_evpn_vni_modify,
136 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_evpn_vni_destroy,
137 }
138 },
139 {
140 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-route-type",
141 .cbs = {
142 .modify = lib_route_map_entry_match_condition_rmap_match_condition_evpn_route_type_modify,
143 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_evpn_route_type_destroy,
144 }
145 },
146 {
147 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:route-distinguisher",
148 .cbs = {
149 .modify = lib_route_map_entry_match_condition_rmap_match_condition_route_distinguisher_modify,
150 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_route_distinguisher_destroy,
151 }
152 },
153 {
154 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list",
155 .cbs = {
156 .apply_finish = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish,
157 }
158 },
159 {
160 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name",
161 .cbs = {
162 .modify = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_modify,
163 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_destroy,
164 }
165 },
166 {
167 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name-exact-match",
168 .cbs = {
169 .modify = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_modify,
170 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_destroy,
171 }
172 },
173 {
174 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv4-address",
175 .cbs = {
176 .modify = lib_route_map_entry_match_condition_rmap_match_condition_ipv4_address_modify,
177 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_ipv4_address_destroy,
178 }
179 },
180 {
181 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv6-address",
182 .cbs = {
183 .modify = lib_route_map_entry_match_condition_rmap_match_condition_ipv6_address_modify,
184 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_ipv6_address_destroy,
185 }
186 },
187 {
188 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:distance",
189 .cbs = {
190 .modify = lib_route_map_entry_set_action_rmap_set_action_distance_modify,
191 .destroy = lib_route_map_entry_set_action_rmap_set_action_distance_destroy,
192 }
193 },
194 {
195 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-rt",
196 .cbs = {
197 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_rt_modify,
198 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_rt_destroy,
199 }
200 },
201 {
202 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-soo",
203 .cbs = {
204 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_soo_modify,
205 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_soo_destroy,
206 }
207 },
208 {
209 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-address",
210 .cbs = {
211 .modify = lib_route_map_entry_set_action_rmap_set_action_ipv4_address_modify,
212 .destroy = lib_route_map_entry_set_action_rmap_set_action_ipv4_address_destroy,
213 }
214 },
215 {
216 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-nexthop",
217 .cbs = {
218 .modify = lib_route_map_entry_set_action_rmap_set_action_ipv4_nexthop_modify,
219 .destroy = lib_route_map_entry_set_action_rmap_set_action_ipv4_nexthop_destroy,
220 }
221 },
222 {
223 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv6-address",
224 .cbs = {
225 .modify = lib_route_map_entry_set_action_rmap_set_action_ipv6_address_modify,
226 .destroy = lib_route_map_entry_set_action_rmap_set_action_ipv6_address_destroy,
227 }
228 },
229 {
230 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:preference",
231 .cbs = {
232 .modify = lib_route_map_entry_set_action_rmap_set_action_preference_modify,
233 .destroy = lib_route_map_entry_set_action_rmap_set_action_preference_destroy,
234 }
235 },
236 {
237 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:label-index",
238 .cbs = {
239 .modify = lib_route_map_entry_set_action_rmap_set_action_label_index_modify,
240 .destroy = lib_route_map_entry_set_action_rmap_set_action_label_index_destroy,
241 }
242 },
243 {
244 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:local-pref",
245 .cbs = {
246 .modify = lib_route_map_entry_set_action_rmap_set_action_local_pref_modify,
247 .destroy = lib_route_map_entry_set_action_rmap_set_action_local_pref_destroy,
248 }
249 },
250 {
251 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:weight",
252 .cbs = {
253 .modify = lib_route_map_entry_set_action_rmap_set_action_weight_modify,
254 .destroy = lib_route_map_entry_set_action_rmap_set_action_weight_destroy,
255 }
256 },
257 {
258 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:origin",
259 .cbs = {
260 .modify = lib_route_map_entry_set_action_rmap_set_action_origin_modify,
261 .destroy = lib_route_map_entry_set_action_rmap_set_action_origin_destroy,
262 }
263 },
264 {
265 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:originator-id",
266 .cbs = {
267 .modify = lib_route_map_entry_set_action_rmap_set_action_originator_id_modify,
268 .destroy = lib_route_map_entry_set_action_rmap_set_action_originator_id_destroy,
269 }
270 },
271 {
272 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:table",
273 .cbs = {
274 .modify = lib_route_map_entry_set_action_rmap_set_action_table_modify,
275 .destroy = lib_route_map_entry_set_action_rmap_set_action_table_destroy,
276 }
277 },
278 {
279 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:atomic-aggregate",
280 .cbs = {
281 .create = lib_route_map_entry_set_action_rmap_set_action_atomic_aggregate_create,
282 .destroy = lib_route_map_entry_set_action_rmap_set_action_atomic_aggregate_destroy,
283 }
284 },
285 {
286 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:prepend-as-path",
287 .cbs = {
288 .modify = lib_route_map_entry_set_action_rmap_set_action_prepend_as_path_modify,
289 .destroy = lib_route_map_entry_set_action_rmap_set_action_prepend_as_path_destroy,
290 }
291 },
292 {
293 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:last-as",
294 .cbs = {
295 .modify = lib_route_map_entry_set_action_rmap_set_action_last_as_modify,
296 .destroy = lib_route_map_entry_set_action_rmap_set_action_last_as_destroy,
297 }
298 },
299 {
300 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:exclude-as-path",
301 .cbs = {
302 .modify = lib_route_map_entry_set_action_rmap_set_action_exclude_as_path_modify,
303 .destroy = lib_route_map_entry_set_action_rmap_set_action_exclude_as_path_destroy,
304 }
305 },
77e3d821
DA
306 {
307 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:replace-as-path",
308 .cbs = {
309 .modify = lib_route_map_entry_set_action_rmap_set_action_replace_as_path_modify,
310 .destroy = lib_route_map_entry_set_action_rmap_set_action_replace_as_path_destroy,
311 }
312 },
48cb7ea9
SP
313 {
314 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-none",
315 .cbs = {
316 .modify = lib_route_map_entry_set_action_rmap_set_action_community_none_modify,
317 .destroy = lib_route_map_entry_set_action_rmap_set_action_community_none_destroy,
318 }
319 },
320 {
321 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-string",
322 .cbs = {
323 .modify = lib_route_map_entry_set_action_rmap_set_action_community_string_modify,
324 .destroy = lib_route_map_entry_set_action_rmap_set_action_community_string_destroy,
325 }
326 },
327 {
328 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-none",
329 .cbs = {
330 .modify = lib_route_map_entry_set_action_rmap_set_action_large_community_none_modify,
331 .destroy = lib_route_map_entry_set_action_rmap_set_action_large_community_none_destroy,
332 }
333 },
334 {
335 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-string",
336 .cbs = {
337 .modify = lib_route_map_entry_set_action_rmap_set_action_large_community_string_modify,
338 .destroy = lib_route_map_entry_set_action_rmap_set_action_large_community_string_destroy,
339 }
340 },
341 {
342 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator",
343 .cbs = {
344 .apply_finish = lib_route_map_entry_set_action_rmap_set_action_aggregator_finish,
345 }
346 },
347 {
348 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-asn",
349 .cbs = {
350 .modify = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify,
351 .destroy = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_destroy,
352 }
353 },
354 {
355 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address",
356 .cbs = {
357 .modify = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_modify,
358 .destroy = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_destroy,
359 }
360 },
361 {
362 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:comm-list-name",
363 .cbs = {
364 .modify = lib_route_map_entry_set_action_rmap_set_action_comm_list_name_modify,
365 .destroy = lib_route_map_entry_set_action_rmap_set_action_comm_list_name_destroy,
366 }
367 },
bb4dcdd1
DA
368 {
369 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-none",
370 .cbs = {
371 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_none_modify,
372 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_none_destroy,
373 }
374 },
48cb7ea9
SP
375 {
376 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb",
377 .cbs = {
378 .apply_finish = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish,
379 }
380 },
381 {
382 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type",
383 .cbs = {
384 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify,
385 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy,
386 }
387 },
388 {
389 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth",
390 .cbs = {
391 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_modify,
392 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_destroy,
393 }
394 },
395 {
396 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific",
397 .cbs = {
398 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_modify,
399 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy,
400 }
401 },
d0a4ee60
AD
402 {
403 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv4",
404 .cbs = {
405 .modify = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_modify,
406 .destroy = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_destroy,
407 }
408 },
409 {
410 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv6",
411 .cbs = {
412 .modify = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_modify,
413 .destroy = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_destroy,
414 }
415 },
1bb550b6
PG
416 {
417 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:l3vpn-nexthop-encapsulation",
418 .cbs = {
419 .modify = lib_route_map_entry_set_action_rmap_set_action_l3vpn_nexthop_encapsulation_modify,
420 .destroy = lib_route_map_entry_set_action_rmap_set_action_l3vpn_nexthop_encapsulation_destroy,
421 }
422 },
48cb7ea9
SP
423 {
424 .xpath = NULL,
425 },
426 }
427};