]> git.proxmox.com Git - mirror_frr.git/blame - bgpd/bgp_routemap_nb.c
Merge pull request #9408 from mobash-rasool/ospfv2-bug-fixes-03
[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 },
69 {
70 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:probability",
71 .cbs = {
72 .modify = lib_route_map_entry_match_condition_rmap_match_condition_probability_modify,
73 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_probability_destroy,
74 }
75 },
76 {
77 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:source-vrf",
78 .cbs = {
79 .modify = lib_route_map_entry_match_condition_rmap_match_condition_source_vrf_modify,
80 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_source_vrf_destroy,
81 }
82 },
83 {
84 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
85 .cbs = {
86 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv4_address_modify,
87 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv4_address_destroy,
88 }
89 },
90 {
91 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-interface",
92 .cbs = {
93 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_interface_modify,
94 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_interface_destroy,
95 }
96 },
97 {
98 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
99 .cbs = {
100 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv6_address_modify,
101 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv6_address_destroy,
102 }
103 },
104 {
105 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-local",
106 .cbs = {
107 .modify = lib_route_map_entry_match_condition_rmap_match_condition_peer_local_modify,
108 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_peer_local_destroy,
109 }
110 },
111 {
112 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:list-name",
113 .cbs = {
114 .modify = lib_route_map_entry_match_condition_rmap_match_condition_list_name_modify,
115 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_list_name_destroy,
116 }
117 },
118 {
119 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-default-route",
120 .cbs = {
121 .create = lib_route_map_entry_match_condition_rmap_match_condition_evpn_default_route_create,
122 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_evpn_default_route_destroy,
123 }
124 },
125 {
126 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-vni",
127 .cbs = {
128 .modify = lib_route_map_entry_match_condition_rmap_match_condition_evpn_vni_modify,
129 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_evpn_vni_destroy,
130 }
131 },
132 {
133 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-route-type",
134 .cbs = {
135 .modify = lib_route_map_entry_match_condition_rmap_match_condition_evpn_route_type_modify,
136 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_evpn_route_type_destroy,
137 }
138 },
139 {
140 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:route-distinguisher",
141 .cbs = {
142 .modify = lib_route_map_entry_match_condition_rmap_match_condition_route_distinguisher_modify,
143 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_route_distinguisher_destroy,
144 }
145 },
146 {
147 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list",
148 .cbs = {
149 .apply_finish = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish,
150 }
151 },
152 {
153 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name",
154 .cbs = {
155 .modify = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_modify,
156 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_destroy,
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-exact-match",
161 .cbs = {
162 .modify = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_modify,
163 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_destroy,
164 }
165 },
166 {
167 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv4-address",
168 .cbs = {
169 .modify = lib_route_map_entry_match_condition_rmap_match_condition_ipv4_address_modify,
170 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_ipv4_address_destroy,
171 }
172 },
173 {
174 .xpath = "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv6-address",
175 .cbs = {
176 .modify = lib_route_map_entry_match_condition_rmap_match_condition_ipv6_address_modify,
177 .destroy = lib_route_map_entry_match_condition_rmap_match_condition_ipv6_address_destroy,
178 }
179 },
180 {
181 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:distance",
182 .cbs = {
183 .modify = lib_route_map_entry_set_action_rmap_set_action_distance_modify,
184 .destroy = lib_route_map_entry_set_action_rmap_set_action_distance_destroy,
185 }
186 },
187 {
188 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-rt",
189 .cbs = {
190 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_rt_modify,
191 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_rt_destroy,
192 }
193 },
194 {
195 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-soo",
196 .cbs = {
197 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_soo_modify,
198 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_soo_destroy,
199 }
200 },
201 {
202 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-address",
203 .cbs = {
204 .modify = lib_route_map_entry_set_action_rmap_set_action_ipv4_address_modify,
205 .destroy = lib_route_map_entry_set_action_rmap_set_action_ipv4_address_destroy,
206 }
207 },
208 {
209 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-nexthop",
210 .cbs = {
211 .modify = lib_route_map_entry_set_action_rmap_set_action_ipv4_nexthop_modify,
212 .destroy = lib_route_map_entry_set_action_rmap_set_action_ipv4_nexthop_destroy,
213 }
214 },
215 {
216 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv6-address",
217 .cbs = {
218 .modify = lib_route_map_entry_set_action_rmap_set_action_ipv6_address_modify,
219 .destroy = lib_route_map_entry_set_action_rmap_set_action_ipv6_address_destroy,
220 }
221 },
222 {
223 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:preference",
224 .cbs = {
225 .modify = lib_route_map_entry_set_action_rmap_set_action_preference_modify,
226 .destroy = lib_route_map_entry_set_action_rmap_set_action_preference_destroy,
227 }
228 },
229 {
230 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:label-index",
231 .cbs = {
232 .modify = lib_route_map_entry_set_action_rmap_set_action_label_index_modify,
233 .destroy = lib_route_map_entry_set_action_rmap_set_action_label_index_destroy,
234 }
235 },
236 {
237 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:local-pref",
238 .cbs = {
239 .modify = lib_route_map_entry_set_action_rmap_set_action_local_pref_modify,
240 .destroy = lib_route_map_entry_set_action_rmap_set_action_local_pref_destroy,
241 }
242 },
243 {
244 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:weight",
245 .cbs = {
246 .modify = lib_route_map_entry_set_action_rmap_set_action_weight_modify,
247 .destroy = lib_route_map_entry_set_action_rmap_set_action_weight_destroy,
248 }
249 },
250 {
251 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:origin",
252 .cbs = {
253 .modify = lib_route_map_entry_set_action_rmap_set_action_origin_modify,
254 .destroy = lib_route_map_entry_set_action_rmap_set_action_origin_destroy,
255 }
256 },
257 {
258 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:originator-id",
259 .cbs = {
260 .modify = lib_route_map_entry_set_action_rmap_set_action_originator_id_modify,
261 .destroy = lib_route_map_entry_set_action_rmap_set_action_originator_id_destroy,
262 }
263 },
264 {
265 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:table",
266 .cbs = {
267 .modify = lib_route_map_entry_set_action_rmap_set_action_table_modify,
268 .destroy = lib_route_map_entry_set_action_rmap_set_action_table_destroy,
269 }
270 },
271 {
272 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:atomic-aggregate",
273 .cbs = {
274 .create = lib_route_map_entry_set_action_rmap_set_action_atomic_aggregate_create,
275 .destroy = lib_route_map_entry_set_action_rmap_set_action_atomic_aggregate_destroy,
276 }
277 },
278 {
279 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:prepend-as-path",
280 .cbs = {
281 .modify = lib_route_map_entry_set_action_rmap_set_action_prepend_as_path_modify,
282 .destroy = lib_route_map_entry_set_action_rmap_set_action_prepend_as_path_destroy,
283 }
284 },
285 {
286 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:last-as",
287 .cbs = {
288 .modify = lib_route_map_entry_set_action_rmap_set_action_last_as_modify,
289 .destroy = lib_route_map_entry_set_action_rmap_set_action_last_as_destroy,
290 }
291 },
292 {
293 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:exclude-as-path",
294 .cbs = {
295 .modify = lib_route_map_entry_set_action_rmap_set_action_exclude_as_path_modify,
296 .destroy = lib_route_map_entry_set_action_rmap_set_action_exclude_as_path_destroy,
297 }
298 },
299 {
300 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-none",
301 .cbs = {
302 .modify = lib_route_map_entry_set_action_rmap_set_action_community_none_modify,
303 .destroy = lib_route_map_entry_set_action_rmap_set_action_community_none_destroy,
304 }
305 },
306 {
307 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-string",
308 .cbs = {
309 .modify = lib_route_map_entry_set_action_rmap_set_action_community_string_modify,
310 .destroy = lib_route_map_entry_set_action_rmap_set_action_community_string_destroy,
311 }
312 },
313 {
314 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-none",
315 .cbs = {
316 .modify = lib_route_map_entry_set_action_rmap_set_action_large_community_none_modify,
317 .destroy = lib_route_map_entry_set_action_rmap_set_action_large_community_none_destroy,
318 }
319 },
320 {
321 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-string",
322 .cbs = {
323 .modify = lib_route_map_entry_set_action_rmap_set_action_large_community_string_modify,
324 .destroy = lib_route_map_entry_set_action_rmap_set_action_large_community_string_destroy,
325 }
326 },
327 {
328 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator",
329 .cbs = {
330 .apply_finish = lib_route_map_entry_set_action_rmap_set_action_aggregator_finish,
331 }
332 },
333 {
334 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-asn",
335 .cbs = {
336 .modify = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify,
337 .destroy = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_destroy,
338 }
339 },
340 {
341 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address",
342 .cbs = {
343 .modify = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_modify,
344 .destroy = lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_destroy,
345 }
346 },
347 {
348 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:comm-list-name",
349 .cbs = {
350 .modify = lib_route_map_entry_set_action_rmap_set_action_comm_list_name_modify,
351 .destroy = lib_route_map_entry_set_action_rmap_set_action_comm_list_name_destroy,
352 }
353 },
354 {
355 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb",
356 .cbs = {
357 .apply_finish = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish,
358 }
359 },
360 {
361 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type",
362 .cbs = {
363 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify,
364 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy,
365 }
366 },
367 {
368 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth",
369 .cbs = {
370 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_modify,
371 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_destroy,
372 }
373 },
374 {
375 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific",
376 .cbs = {
377 .modify = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_modify,
378 .destroy = lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy,
379 }
380 },
d0a4ee60
AD
381 {
382 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv4",
383 .cbs = {
384 .modify = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_modify,
385 .destroy = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_destroy,
386 }
387 },
388 {
389 .xpath = "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv6",
390 .cbs = {
391 .modify = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_modify,
392 .destroy = lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_destroy,
393 }
394 },
48cb7ea9
SP
395 {
396 .xpath = NULL,
397 },
398 }
399};