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