2 * Copyright (C) 2020 Vmware
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)
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
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
23 #include "lib/command.h"
25 #include "lib/northbound.h"
26 #include "lib/routemap.h"
27 #include "bgpd/bgpd.h"
28 #include "bgpd/bgp_routemap_nb.h"
30 /* clang-format off */
31 const struct frr_yang_module_info frr_bgp_route_map_info
= {
32 .name
= "frr-bgp-route-map",
35 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:local-preference",
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
,
42 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:alias",
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
,
49 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:script",
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
,
56 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:origin",
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
,
63 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:rpki",
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
,
70 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:probability",
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
,
77 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:source-vrf",
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
,
84 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address",
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
,
91 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-interface",
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
,
98 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address",
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
,
105 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-local",
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
,
112 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:list-name",
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
,
119 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-default-route",
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
,
126 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-vni",
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
,
133 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-route-type",
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
,
140 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:route-distinguisher",
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
,
147 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list",
149 .apply_finish
= lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish
,
153 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name",
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
,
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",
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
,
167 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv4-address",
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
,
174 .xpath
= "/frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv6-address",
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
,
181 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:distance",
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
,
188 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-rt",
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
,
195 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-soo",
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
,
202 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-address",
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
,
209 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-nexthop",
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
,
216 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv6-address",
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
,
223 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:preference",
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
,
230 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:label-index",
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
,
237 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:local-pref",
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
,
244 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:weight",
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
,
251 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:origin",
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
,
258 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:originator-id",
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
,
265 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:table",
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
,
272 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:atomic-aggregate",
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
,
279 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:prepend-as-path",
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
,
286 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:last-as",
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
,
293 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:exclude-as-path",
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
,
300 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-none",
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
,
307 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-string",
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
,
314 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-none",
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
,
321 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-string",
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
,
328 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator",
330 .apply_finish
= lib_route_map_entry_set_action_rmap_set_action_aggregator_finish
,
334 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-asn",
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
,
341 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address",
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
,
348 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:comm-list-name",
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
,
355 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-none",
357 .modify
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_none_modify
,
358 .destroy
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_none_destroy
,
362 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb",
364 .apply_finish
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish
,
368 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type",
370 .modify
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify
,
371 .destroy
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy
,
375 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth",
377 .modify
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_modify
,
378 .destroy
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_destroy
,
382 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific",
384 .modify
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_modify
,
385 .destroy
= lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy
,
389 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv4",
391 .modify
= lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_modify
,
392 .destroy
= lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_destroy
,
396 .xpath
= "/frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv6",
398 .modify
= lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_modify
,
399 .destroy
= lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_destroy
,