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
22 #include "lib/command.h"
24 #include "lib/northbound.h"
25 #include "lib/routemap.h"
26 #include "bgpd/bgpd.h"
27 #include "bgpd/bgp_routemap_nb.h"
28 #include "bgpd/bgp_ecommunity.h"
30 /* Add bgp route map rule. */
31 static int bgp_route_match_add(struct route_map_index
*index
,
32 const char *command
, const char *arg
,
33 route_map_event_t type
,
34 char *errmsg
, size_t errmsg_len
)
36 int retval
= CMD_SUCCESS
;
37 enum rmap_compile_rets ret
;
39 ret
= route_map_add_match(index
, command
, arg
, type
);
41 case RMAP_RULE_MISSING
:
42 snprintf(errmsg
, errmsg_len
, "%% BGP Can't find rule.");
43 retval
= CMD_WARNING_CONFIG_FAILED
;
45 case RMAP_COMPILE_ERROR
:
46 snprintf(errmsg
, errmsg_len
, "%% BGP Argument is malformed.");
47 retval
= CMD_WARNING_CONFIG_FAILED
;
49 case RMAP_COMPILE_SUCCESS
:
51 * Intentionally doing nothing here.
59 /* Delete bgp route map rule. */
60 static int bgp_route_match_delete(struct route_map_index
*index
,
61 const char *command
, const char *arg
,
62 route_map_event_t type
,
63 char *errmsg
, size_t errmsg_len
)
65 enum rmap_compile_rets ret
;
66 int retval
= CMD_SUCCESS
;
67 char *dep_name
= NULL
;
69 char *rmap_name
= NULL
;
71 if (type
!= RMAP_EVENT_MATCH_DELETED
) {
72 /* ignore the mundane, the types without any dependency */
74 tmpstr
= route_map_get_match_arg(index
, command
);
77 XSTRDUP(MTYPE_ROUTE_MAP_RULE
, tmpstr
);
79 dep_name
= XSTRDUP(MTYPE_ROUTE_MAP_RULE
, arg
);
81 rmap_name
= XSTRDUP(MTYPE_ROUTE_MAP_NAME
, index
->map
->name
);
84 ret
= route_map_delete_match(index
, command
, dep_name
, type
);
86 case RMAP_RULE_MISSING
:
87 snprintf(errmsg
, errmsg_len
, "%% BGP Can't find rule.");
88 retval
= CMD_WARNING_CONFIG_FAILED
;
90 case RMAP_COMPILE_ERROR
:
91 snprintf(errmsg
, errmsg_len
,
92 "%% BGP Argument is malformed.");
93 retval
= CMD_WARNING_CONFIG_FAILED
;
95 case RMAP_COMPILE_SUCCESS
:
102 XFREE(MTYPE_ROUTE_MAP_RULE
, dep_name
);
103 XFREE(MTYPE_ROUTE_MAP_NAME
, rmap_name
);
109 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:local-preference
112 lib_route_map_entry_match_condition_rmap_match_condition_local_preference_modify(
113 struct nb_cb_modify_args
*args
)
115 struct routemap_hook_context
*rhc
;
116 const char *local_pref
;
117 enum rmap_compile_rets ret
;
119 switch (args
->event
) {
125 /* Add configuration. */
126 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
127 local_pref
= yang_dnode_get_string(args
->dnode
, NULL
);
129 /* Set destroy information. */
130 rhc
->rhc_mhook
= bgp_route_match_delete
;
131 rhc
->rhc_rule
= "local-preference";
132 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
134 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "local-preference",
135 local_pref
, RMAP_EVENT_MATCH_ADDED
,
136 args
->errmsg
, args
->errmsg_len
);
138 if (ret
!= RMAP_COMPILE_SUCCESS
) {
139 rhc
->rhc_mhook
= NULL
;
140 return NB_ERR_INCONSISTENCY
;
148 lib_route_map_entry_match_condition_rmap_match_condition_local_preference_destroy(
149 struct nb_cb_destroy_args
*args
)
151 switch (args
->event
) {
157 return lib_route_map_entry_match_destroy(args
);
165 * /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:alias
167 int lib_route_map_entry_match_condition_rmap_match_condition_alias_modify(
168 struct nb_cb_modify_args
*args
)
170 struct routemap_hook_context
*rhc
;
172 enum rmap_compile_rets ret
;
174 switch (args
->event
) {
180 /* Add configuration. */
181 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
182 alias
= yang_dnode_get_string(args
->dnode
, NULL
);
184 /* Set destroy information. */
185 rhc
->rhc_mhook
= bgp_route_match_delete
;
186 rhc
->rhc_rule
= "alias";
187 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
189 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "alias", alias
,
190 RMAP_EVENT_MATCH_ADDED
, args
->errmsg
,
193 if (ret
!= RMAP_COMPILE_SUCCESS
) {
194 rhc
->rhc_mhook
= NULL
;
195 return NB_ERR_VALIDATION
;
204 int lib_route_map_entry_match_condition_rmap_match_condition_alias_destroy(
205 struct nb_cb_destroy_args
*args
)
207 switch (args
->event
) {
213 return lib_route_map_entry_match_destroy(args
);
220 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:script
223 lib_route_map_entry_match_condition_rmap_match_condition_script_modify(
224 struct nb_cb_modify_args
*args
)
226 struct routemap_hook_context
*rhc
;
228 enum rmap_compile_rets ret
;
230 switch (args
->event
) {
236 /* Add configuration. */
237 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
238 script
= yang_dnode_get_string(args
->dnode
, NULL
);
240 /* Set destroy information. */
241 rhc
->rhc_mhook
= bgp_route_match_delete
;
242 rhc
->rhc_rule
= "script";
243 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
245 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "script",
246 script
, RMAP_EVENT_MATCH_ADDED
,
247 args
->errmsg
, args
->errmsg_len
);
249 if (ret
!= RMAP_COMPILE_SUCCESS
) {
250 rhc
->rhc_mhook
= NULL
;
251 return NB_ERR_INCONSISTENCY
;
259 lib_route_map_entry_match_condition_rmap_match_condition_script_destroy(
260 struct nb_cb_destroy_args
*args
)
262 switch (args
->event
) {
268 return lib_route_map_entry_match_destroy(args
);
275 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:origin
278 lib_route_map_entry_match_condition_rmap_match_condition_origin_modify(
279 struct nb_cb_modify_args
*args
)
281 struct routemap_hook_context
*rhc
;
283 enum rmap_compile_rets ret
;
285 switch (args
->event
) {
291 /* Add configuration. */
292 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
293 origin
= yang_dnode_get_string(args
->dnode
, NULL
);
295 /* Set destroy information. */
296 rhc
->rhc_mhook
= bgp_route_match_delete
;
297 rhc
->rhc_rule
= "origin";
298 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
300 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "origin", origin
,
301 RMAP_EVENT_MATCH_ADDED
,
302 args
->errmsg
, args
->errmsg_len
);
304 if (ret
!= RMAP_COMPILE_SUCCESS
) {
305 rhc
->rhc_mhook
= NULL
;
306 return NB_ERR_INCONSISTENCY
;
314 lib_route_map_entry_match_condition_rmap_match_condition_origin_destroy(
315 struct nb_cb_destroy_args
*args
)
317 switch (args
->event
) {
323 return lib_route_map_entry_match_destroy(args
);
330 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:rpki
333 lib_route_map_entry_match_condition_rmap_match_condition_rpki_modify(
334 struct nb_cb_modify_args
*args
)
336 struct routemap_hook_context
*rhc
;
338 enum rmap_compile_rets ret
;
340 switch (args
->event
) {
346 /* Add configuration. */
347 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
348 rpki
= yang_dnode_get_string(args
->dnode
, NULL
);
350 /* Set destroy information. */
351 rhc
->rhc_mhook
= bgp_route_match_delete
;
352 rhc
->rhc_rule
= "rpki";
353 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
355 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "rpki", rpki
,
356 RMAP_EVENT_MATCH_ADDED
,
357 args
->errmsg
, args
->errmsg_len
);
359 if (ret
!= RMAP_COMPILE_SUCCESS
) {
360 rhc
->rhc_mhook
= NULL
;
361 return NB_ERR_INCONSISTENCY
;
369 lib_route_map_entry_match_condition_rmap_match_condition_rpki_destroy(
370 struct nb_cb_destroy_args
*args
)
372 switch (args
->event
) {
378 return lib_route_map_entry_match_destroy(args
);
385 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:probability
388 lib_route_map_entry_match_condition_rmap_match_condition_probability_modify(
389 struct nb_cb_modify_args
*args
)
391 struct routemap_hook_context
*rhc
;
392 const char *probability
;
393 enum rmap_compile_rets ret
;
395 switch (args
->event
) {
401 /* Add configuration. */
402 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
403 probability
= yang_dnode_get_string(args
->dnode
, NULL
);
405 /* Set destroy information. */
406 rhc
->rhc_mhook
= bgp_route_match_delete
;
407 rhc
->rhc_rule
= "probability";
408 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
410 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "probability",
411 probability
, RMAP_EVENT_MATCH_ADDED
,
412 args
->errmsg
, args
->errmsg_len
);
414 if (ret
!= RMAP_COMPILE_SUCCESS
) {
415 rhc
->rhc_mhook
= NULL
;
416 return NB_ERR_INCONSISTENCY
;
424 lib_route_map_entry_match_condition_rmap_match_condition_probability_destroy(
425 struct nb_cb_destroy_args
*args
)
427 switch (args
->event
) {
432 return lib_route_map_entry_match_destroy(args
);
439 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:source-vrf
442 lib_route_map_entry_match_condition_rmap_match_condition_source_vrf_modify(
443 struct nb_cb_modify_args
*args
)
445 struct routemap_hook_context
*rhc
;
447 enum rmap_compile_rets ret
;
449 switch (args
->event
) {
455 /* Add configuration. */
456 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
457 vrf
= yang_dnode_get_string(args
->dnode
, NULL
);
459 /* Set destroy information. */
460 rhc
->rhc_mhook
= bgp_route_match_delete
;
461 rhc
->rhc_rule
= "source-vrf";
462 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
464 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "source-vrf", vrf
,
465 RMAP_EVENT_MATCH_ADDED
,
466 args
->errmsg
, args
->errmsg_len
);
468 if (ret
!= RMAP_COMPILE_SUCCESS
) {
469 rhc
->rhc_mhook
= NULL
;
470 return NB_ERR_INCONSISTENCY
;
478 lib_route_map_entry_match_condition_rmap_match_condition_source_vrf_destroy(
479 struct nb_cb_destroy_args
*args
)
481 switch (args
->event
) {
487 return lib_route_map_entry_match_destroy(args
);
494 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv4-address
497 lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv4_address_modify(
498 struct nb_cb_modify_args
*args
)
500 struct routemap_hook_context
*rhc
;
502 enum rmap_compile_rets ret
;
504 switch (args
->event
) {
510 /* Add configuration. */
511 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
512 peer
= yang_dnode_get_string(args
->dnode
, NULL
);
514 /* Set destroy information. */
515 rhc
->rhc_mhook
= bgp_route_match_delete
;
516 rhc
->rhc_rule
= "peer";
517 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
519 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "peer", peer
,
520 RMAP_EVENT_MATCH_ADDED
,
521 args
->errmsg
, args
->errmsg_len
);
523 if (ret
!= RMAP_COMPILE_SUCCESS
) {
524 rhc
->rhc_mhook
= NULL
;
525 return NB_ERR_INCONSISTENCY
;
533 lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv4_address_destroy(
534 struct nb_cb_destroy_args
*args
)
536 switch (args
->event
) {
542 return lib_route_map_entry_match_destroy(args
);
549 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-interface
552 lib_route_map_entry_match_condition_rmap_match_condition_peer_interface_modify(
553 struct nb_cb_modify_args
*args
)
555 struct routemap_hook_context
*rhc
;
557 enum rmap_compile_rets ret
;
559 switch (args
->event
) {
565 /* Add configuration. */
566 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
567 peer
= yang_dnode_get_string(args
->dnode
, NULL
);
569 /* Set destroy information. */
570 rhc
->rhc_mhook
= bgp_route_match_delete
;
571 rhc
->rhc_rule
= "peer";
572 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
574 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "peer", peer
,
575 RMAP_EVENT_MATCH_ADDED
,
576 args
->errmsg
, args
->errmsg_len
);
578 if (ret
!= RMAP_COMPILE_SUCCESS
) {
579 rhc
->rhc_mhook
= NULL
;
580 return NB_ERR_INCONSISTENCY
;
588 lib_route_map_entry_match_condition_rmap_match_condition_peer_interface_destroy(
589 struct nb_cb_destroy_args
*args
)
591 switch (args
->event
) {
597 return lib_route_map_entry_match_destroy(args
);
604 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-ipv6-address
607 lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv6_address_modify(
608 struct nb_cb_modify_args
*args
)
610 struct routemap_hook_context
*rhc
;
612 enum rmap_compile_rets ret
;
614 switch (args
->event
) {
620 /* Add configuration. */
621 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
622 peer
= yang_dnode_get_string(args
->dnode
, NULL
);
624 /* Set destroy information. */
625 rhc
->rhc_mhook
= bgp_route_match_delete
;
626 rhc
->rhc_rule
= "peer";
627 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
629 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "peer", peer
,
630 RMAP_EVENT_MATCH_ADDED
,
631 args
->errmsg
, args
->errmsg_len
);
633 if (ret
!= RMAP_COMPILE_SUCCESS
) {
634 rhc
->rhc_mhook
= NULL
;
635 return NB_ERR_INCONSISTENCY
;
643 lib_route_map_entry_match_condition_rmap_match_condition_peer_ipv6_address_destroy(
644 struct nb_cb_destroy_args
*args
)
646 switch (args
->event
) {
652 return lib_route_map_entry_match_destroy(args
);
659 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:peer-local
662 lib_route_map_entry_match_condition_rmap_match_condition_peer_local_modify(
663 struct nb_cb_modify_args
*args
)
665 struct routemap_hook_context
*rhc
;
667 enum rmap_compile_rets ret
;
669 switch (args
->event
) {
675 /* Add configuration. */
676 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
677 value
= yang_dnode_get_bool(args
->dnode
, NULL
);
679 /* Set destroy information. */
680 rhc
->rhc_mhook
= bgp_route_match_delete
;
681 rhc
->rhc_rule
= "peer";
682 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
685 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "peer",
687 RMAP_EVENT_MATCH_ADDED
,
688 args
->errmsg
, args
->errmsg_len
);
690 if (ret
!= RMAP_COMPILE_SUCCESS
) {
691 rhc
->rhc_mhook
= NULL
;
692 return NB_ERR_INCONSISTENCY
;
701 lib_route_map_entry_match_condition_rmap_match_condition_peer_local_destroy(
702 struct nb_cb_destroy_args
*args
)
704 switch (args
->event
) {
710 return lib_route_map_entry_match_destroy(args
);
717 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:list-name
720 lib_route_map_entry_match_condition_rmap_match_condition_list_name_modify(
721 struct nb_cb_modify_args
*args
)
723 struct routemap_hook_context
*rhc
;
724 const char *list_name
;
725 enum rmap_compile_rets ret
= RMAP_COMPILE_SUCCESS
;
726 const char *condition
;
728 switch (args
->event
) {
734 /* Add configuration. */
735 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
736 list_name
= yang_dnode_get_string(args
->dnode
, NULL
);
737 condition
= yang_dnode_get_string(args
->dnode
,
738 "../../frr-route-map:condition");
740 if (IS_MATCH_AS_LIST(condition
)) {
741 /* Set destroy information. */
742 rhc
->rhc_mhook
= bgp_route_match_delete
;
743 rhc
->rhc_rule
= "as-path";
744 rhc
->rhc_event
= RMAP_EVENT_ASLIST_DELETED
;
746 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "as-path",
747 list_name
, RMAP_EVENT_ASLIST_ADDED
,
748 args
->errmsg
, args
->errmsg_len
);
749 } else if (IS_MATCH_MAC_LIST(condition
)) {
750 /* Set destroy information. */
751 rhc
->rhc_mhook
= bgp_route_match_delete
;
752 rhc
->rhc_rule
= "mac address";
753 rhc
->rhc_event
= RMAP_EVENT_FILTER_DELETED
;
755 ret
= bgp_route_match_add(rhc
->rhc_rmi
,
758 RMAP_EVENT_FILTER_ADDED
,
759 args
->errmsg
, args
->errmsg_len
);
760 } else if (IS_MATCH_ROUTE_SRC(condition
)) {
761 /* Set destroy information. */
762 rhc
->rhc_mhook
= bgp_route_match_delete
;
763 rhc
->rhc_rule
= "ip route-source";
764 rhc
->rhc_event
= RMAP_EVENT_FILTER_DELETED
;
766 ret
= bgp_route_match_add(rhc
->rhc_rmi
,
768 list_name
, RMAP_EVENT_FILTER_ADDED
,
769 args
->errmsg
, args
->errmsg_len
);
770 } else if (IS_MATCH_ROUTE_SRC_PL(condition
)) {
771 /* Set destroy information. */
772 rhc
->rhc_mhook
= bgp_route_match_delete
;
773 rhc
->rhc_rule
= "ip route-source prefix-list";
774 rhc
->rhc_event
= RMAP_EVENT_PLIST_DELETED
;
776 ret
= bgp_route_match_add(rhc
->rhc_rmi
,
777 "ip route-source prefix-list",
778 list_name
, RMAP_EVENT_PLIST_ADDED
,
779 args
->errmsg
, args
->errmsg_len
);
782 if (ret
!= RMAP_COMPILE_SUCCESS
) {
783 rhc
->rhc_mhook
= NULL
;
784 return NB_ERR_INCONSISTENCY
;
792 lib_route_map_entry_match_condition_rmap_match_condition_list_name_destroy(
793 struct nb_cb_destroy_args
*args
)
795 switch (args
->event
) {
801 return lib_route_map_entry_match_destroy(args
);
808 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-default-route
811 lib_route_map_entry_match_condition_rmap_match_condition_evpn_default_route_create(
812 struct nb_cb_create_args
*args
)
814 struct routemap_hook_context
*rhc
;
815 enum rmap_compile_rets ret
;
817 switch (args
->event
) {
823 /* Add configuration. */
824 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
826 /* Set destroy information. */
827 rhc
->rhc_mhook
= bgp_route_match_delete
;
828 rhc
->rhc_rule
= "evpn default-route";
829 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
831 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "evpn default-route",
832 NULL
, RMAP_EVENT_MATCH_ADDED
,
833 args
->errmsg
, args
->errmsg_len
);
835 if (ret
!= RMAP_COMPILE_SUCCESS
) {
836 rhc
->rhc_mhook
= NULL
;
837 return NB_ERR_INCONSISTENCY
;
845 lib_route_map_entry_match_condition_rmap_match_condition_evpn_default_route_destroy(
846 struct nb_cb_destroy_args
*args
)
848 switch (args
->event
) {
854 return lib_route_map_entry_match_destroy(args
);
861 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-vni
864 lib_route_map_entry_match_condition_rmap_match_condition_evpn_vni_modify(
865 struct nb_cb_modify_args
*args
)
867 struct routemap_hook_context
*rhc
;
869 enum rmap_compile_rets ret
;
871 switch (args
->event
) {
877 /* Add configuration. */
878 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
879 vni
= yang_dnode_get_string(args
->dnode
, NULL
);
881 /* Set destroy information. */
882 rhc
->rhc_mhook
= bgp_route_match_delete
;
883 rhc
->rhc_rule
= "evpn vni";
884 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
886 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "evpn vni", vni
,
887 RMAP_EVENT_MATCH_ADDED
,
888 args
->errmsg
, args
->errmsg_len
);
890 if (ret
!= RMAP_COMPILE_SUCCESS
) {
891 rhc
->rhc_mhook
= NULL
;
892 return NB_ERR_INCONSISTENCY
;
900 lib_route_map_entry_match_condition_rmap_match_condition_evpn_vni_destroy(
901 struct nb_cb_destroy_args
*args
)
903 switch (args
->event
) {
909 return lib_route_map_entry_match_destroy(args
);
916 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:evpn-route-type
919 lib_route_map_entry_match_condition_rmap_match_condition_evpn_route_type_modify(
920 struct nb_cb_modify_args
*args
)
922 struct routemap_hook_context
*rhc
;
924 enum rmap_compile_rets ret
;
926 switch (args
->event
) {
932 /* Add configuration. */
933 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
934 type
= yang_dnode_get_string(args
->dnode
, NULL
);
936 /* Set destroy information. */
937 rhc
->rhc_mhook
= bgp_route_match_delete
;
938 rhc
->rhc_rule
= "evpn route-type";
939 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
941 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "evpn route-type",
943 RMAP_EVENT_MATCH_ADDED
,
944 args
->errmsg
, args
->errmsg_len
);
946 if (ret
!= RMAP_COMPILE_SUCCESS
) {
947 rhc
->rhc_mhook
= NULL
;
948 return NB_ERR_INCONSISTENCY
;
956 lib_route_map_entry_match_condition_rmap_match_condition_evpn_route_type_destroy(
957 struct nb_cb_destroy_args
*args
)
959 switch (args
->event
) {
965 return lib_route_map_entry_match_destroy(args
);
972 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:route-distinguisher
975 lib_route_map_entry_match_condition_rmap_match_condition_route_distinguisher_modify(
976 struct nb_cb_modify_args
*args
)
978 struct routemap_hook_context
*rhc
;
980 enum rmap_compile_rets ret
;
982 switch (args
->event
) {
988 /* Add configuration. */
989 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
990 rd
= yang_dnode_get_string(args
->dnode
, NULL
);
992 /* Set destroy information. */
993 rhc
->rhc_mhook
= bgp_route_match_delete
;
994 rhc
->rhc_rule
= "evpn rd";
995 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
997 ret
= bgp_route_match_add(rhc
->rhc_rmi
, "evpn rd", rd
,
998 RMAP_EVENT_MATCH_ADDED
,
999 args
->errmsg
, args
->errmsg_len
);
1001 if (ret
!= RMAP_COMPILE_SUCCESS
) {
1002 rhc
->rhc_mhook
= NULL
;
1003 return NB_ERR_INCONSISTENCY
;
1011 lib_route_map_entry_match_condition_rmap_match_condition_route_distinguisher_destroy(
1012 struct nb_cb_destroy_args
*args
)
1014 switch (args
->event
) {
1015 case NB_EV_VALIDATE
:
1020 return lib_route_map_entry_match_destroy(args
);
1027 * XPath = /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list
1030 lib_route_map_entry_match_condition_rmap_match_condition_comm_list_finish(
1031 struct nb_cb_apply_finish_args
*args
)
1033 struct routemap_hook_context
*rhc
;
1035 bool exact_match
= false;
1037 const char *condition
;
1038 route_map_event_t event
;
1040 /* Add configuration. */
1041 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1042 value
= yang_dnode_get_string(args
->dnode
, "./comm-list-name");
1044 if (yang_dnode_exists(args
->dnode
, "./comm-list-name-exact-match"))
1045 exact_match
= yang_dnode_get_bool(
1046 args
->dnode
, "./comm-list-name-exact-match");
1049 argstr
= XMALLOC(MTYPE_ROUTE_MAP_COMPILED
,
1050 strlen(value
) + strlen("exact-match") + 2);
1052 snprintf(argstr
, (strlen(value
) + strlen("exact-match") + 2),
1053 "%s exact-match", value
);
1055 argstr
= (char *)value
;
1057 /* Set destroy information. */
1058 rhc
->rhc_mhook
= bgp_route_match_delete
;
1060 condition
= yang_dnode_get_string(args
->dnode
,
1061 "../../frr-route-map:condition");
1062 if (IS_MATCH_COMMUNITY(condition
)) {
1063 rhc
->rhc_rule
= "community";
1064 event
= RMAP_EVENT_CLIST_ADDED
;
1065 rhc
->rhc_event
= RMAP_EVENT_CLIST_DELETED
;
1066 } else if (IS_MATCH_LCOMMUNITY(condition
)) {
1067 rhc
->rhc_rule
= "large-community";
1068 event
= RMAP_EVENT_LLIST_ADDED
;
1069 rhc
->rhc_event
= RMAP_EVENT_LLIST_DELETED
;
1071 rhc
->rhc_rule
= "extcommunity";
1072 event
= RMAP_EVENT_ECLIST_ADDED
;
1073 rhc
->rhc_event
= RMAP_EVENT_ECLIST_DELETED
;
1076 bgp_route_match_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, argstr
, event
,
1077 args
->errmsg
, args
->errmsg_len
);
1079 if (argstr
!= value
)
1080 XFREE(MTYPE_ROUTE_MAP_COMPILED
, argstr
);
1085 * /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name
1088 lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_modify(
1089 struct nb_cb_modify_args
*args
)
1091 switch (args
->event
) {
1092 case NB_EV_VALIDATE
:
1103 lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_destroy(
1104 struct nb_cb_destroy_args
*args
)
1106 switch (args
->event
) {
1107 case NB_EV_VALIDATE
:
1112 return lib_route_map_entry_match_destroy(args
);
1120 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:comm-list/comm-list-name-exact-match
1123 lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_modify(
1124 struct nb_cb_modify_args
*args
)
1126 switch (args
->event
) {
1127 case NB_EV_VALIDATE
:
1138 lib_route_map_entry_match_condition_rmap_match_condition_comm_list_comm_list_name_exact_match_destroy(
1139 struct nb_cb_destroy_args
*args
)
1141 switch (args
->event
) {
1142 case NB_EV_VALIDATE
:
1147 return lib_route_map_entry_match_destroy(args
);
1154 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv4-address
1157 lib_route_map_entry_match_condition_rmap_match_condition_ipv4_address_modify(
1158 struct nb_cb_modify_args
*args
)
1160 struct routemap_hook_context
*rhc
;
1162 enum rmap_compile_rets ret
;
1164 switch (args
->event
) {
1165 case NB_EV_VALIDATE
:
1170 /* Add configuration. */
1171 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1172 peer
= yang_dnode_get_string(args
->dnode
, NULL
);
1174 /* Set destroy information. */
1175 rhc
->rhc_mhook
= bgp_route_match_delete
;
1176 rhc
->rhc_rule
= "ip next-hop address";
1177 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
1179 ret
= bgp_route_match_add(rhc
->rhc_rmi
, rhc
->rhc_rule
,
1180 peer
, RMAP_EVENT_MATCH_ADDED
,
1181 args
->errmsg
, args
->errmsg_len
);
1183 if (ret
!= RMAP_COMPILE_SUCCESS
) {
1184 rhc
->rhc_mhook
= NULL
;
1185 return NB_ERR_INCONSISTENCY
;
1193 lib_route_map_entry_match_condition_rmap_match_condition_ipv4_address_destroy(
1194 struct nb_cb_destroy_args
*args
)
1196 switch (args
->event
) {
1197 case NB_EV_VALIDATE
:
1202 return lib_route_map_entry_match_destroy(args
);
1209 * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:ipv6-address
1212 lib_route_map_entry_match_condition_rmap_match_condition_ipv6_address_modify(
1213 struct nb_cb_modify_args
*args
)
1215 struct routemap_hook_context
*rhc
;
1217 enum rmap_compile_rets ret
;
1219 switch (args
->event
) {
1220 case NB_EV_VALIDATE
:
1225 /* Add configuration. */
1226 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1227 peer
= yang_dnode_get_string(args
->dnode
, NULL
);
1229 /* Set destroy information. */
1230 rhc
->rhc_mhook
= bgp_route_match_delete
;
1231 rhc
->rhc_rule
= "ipv6 next-hop";
1232 rhc
->rhc_event
= RMAP_EVENT_MATCH_DELETED
;
1234 ret
= bgp_route_match_add(rhc
->rhc_rmi
, rhc
->rhc_rule
,
1235 peer
, RMAP_EVENT_MATCH_ADDED
,
1236 args
->errmsg
, args
->errmsg_len
);
1238 if (ret
!= RMAP_COMPILE_SUCCESS
) {
1239 rhc
->rhc_mhook
= NULL
;
1240 return NB_ERR_INCONSISTENCY
;
1248 lib_route_map_entry_match_condition_rmap_match_condition_ipv6_address_destroy(
1249 struct nb_cb_destroy_args
*args
)
1251 switch (args
->event
) {
1252 case NB_EV_VALIDATE
:
1257 return lib_route_map_entry_match_destroy(args
);
1265 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:distance
1267 int lib_route_map_entry_set_action_rmap_set_action_distance_modify(
1268 struct nb_cb_modify_args
*args
)
1270 struct routemap_hook_context
*rhc
;
1274 switch (args
->event
) {
1275 case NB_EV_VALIDATE
:
1280 /* Add configuration. */
1281 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1282 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1284 /* Set destroy information. */
1285 rhc
->rhc_shook
= generic_set_delete
;
1286 rhc
->rhc_rule
= "distance";
1287 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1289 rv
= generic_set_add(rhc
->rhc_rmi
, "distance", type
,
1290 args
->errmsg
, args
->errmsg_len
);
1291 if (rv
!= CMD_SUCCESS
) {
1292 rhc
->rhc_shook
= NULL
;
1293 return NB_ERR_INCONSISTENCY
;
1300 int lib_route_map_entry_set_action_rmap_set_action_distance_destroy(
1301 struct nb_cb_destroy_args
*args
)
1303 switch (args
->event
) {
1304 case NB_EV_VALIDATE
:
1309 return lib_route_map_entry_match_destroy(args
);
1317 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-rt
1320 lib_route_map_entry_set_action_rmap_set_action_extcommunity_rt_modify(
1321 struct nb_cb_modify_args
*args
)
1323 struct routemap_hook_context
*rhc
;
1327 switch (args
->event
) {
1328 case NB_EV_VALIDATE
:
1333 /* Add configuration. */
1334 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1335 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1337 /* Set destroy information. */
1338 rhc
->rhc_shook
= generic_set_delete
;
1339 rhc
->rhc_rule
= "extcommunity rt";
1340 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1342 rv
= generic_set_add(rhc
->rhc_rmi
, "extcommunity rt", type
,
1343 args
->errmsg
, args
->errmsg_len
);
1344 if (rv
!= CMD_SUCCESS
) {
1345 rhc
->rhc_shook
= NULL
;
1346 return NB_ERR_INCONSISTENCY
;
1354 lib_route_map_entry_set_action_rmap_set_action_extcommunity_rt_destroy(
1355 struct nb_cb_destroy_args
*args
)
1357 switch (args
->event
) {
1358 case NB_EV_VALIDATE
:
1363 return lib_route_map_entry_match_destroy(args
);
1371 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-soo
1374 lib_route_map_entry_set_action_rmap_set_action_extcommunity_soo_modify(
1375 struct nb_cb_modify_args
*args
)
1377 struct routemap_hook_context
*rhc
;
1381 switch (args
->event
) {
1382 case NB_EV_VALIDATE
:
1387 /* Add configuration. */
1388 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1389 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1391 /* Set destroy information. */
1392 rhc
->rhc_shook
= generic_set_delete
;
1393 rhc
->rhc_rule
= "extcommunity soo";
1394 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1396 rv
= generic_set_add(rhc
->rhc_rmi
, "extcommunity soo",
1398 args
->errmsg
, args
->errmsg_len
);
1399 if (rv
!= CMD_SUCCESS
) {
1400 rhc
->rhc_shook
= NULL
;
1401 return NB_ERR_INCONSISTENCY
;
1409 lib_route_map_entry_set_action_rmap_set_action_extcommunity_soo_destroy(
1410 struct nb_cb_destroy_args
*args
)
1412 switch (args
->event
) {
1413 case NB_EV_VALIDATE
:
1418 return lib_route_map_entry_match_destroy(args
);
1426 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-address
1428 int lib_route_map_entry_set_action_rmap_set_action_ipv4_address_modify(
1429 struct nb_cb_modify_args
*args
)
1431 struct routemap_hook_context
*rhc
;
1433 int rv
= CMD_SUCCESS
;
1435 switch (args
->event
) {
1436 case NB_EV_VALIDATE
:
1441 /* Add configuration. */
1442 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1443 addr
= yang_dnode_get_string(args
->dnode
, NULL
);
1445 rhc
->rhc_shook
= generic_set_delete
;
1446 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1447 rhc
->rhc_rule
= "ipv4 vpn next-hop";
1449 rv
= generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, addr
,
1450 args
->errmsg
, args
->errmsg_len
);
1452 if (rv
!= CMD_SUCCESS
) {
1453 rhc
->rhc_shook
= NULL
;
1454 return NB_ERR_INCONSISTENCY
;
1461 int lib_route_map_entry_set_action_rmap_set_action_ipv4_address_destroy(
1462 struct nb_cb_destroy_args
*args
)
1464 switch (args
->event
) {
1465 case NB_EV_VALIDATE
:
1470 return lib_route_map_entry_set_destroy(args
);
1478 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv4-nexthop
1480 int lib_route_map_entry_set_action_rmap_set_action_ipv4_nexthop_modify(
1481 struct nb_cb_modify_args
*args
)
1483 struct routemap_hook_context
*rhc
;
1487 switch (args
->event
) {
1488 case NB_EV_VALIDATE
:
1493 /* Add configuration. */
1494 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1495 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1497 /* Set destroy information. */
1498 rhc
->rhc_shook
= generic_set_delete
;
1499 rhc
->rhc_rule
= "ip next-hop";
1500 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1502 rv
= generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, type
,
1503 args
->errmsg
, args
->errmsg_len
);
1505 if (rv
!= CMD_SUCCESS
) {
1506 rhc
->rhc_shook
= NULL
;
1507 return NB_ERR_INCONSISTENCY
;
1514 int lib_route_map_entry_set_action_rmap_set_action_ipv4_nexthop_destroy(
1515 struct nb_cb_destroy_args
*args
)
1517 switch (args
->event
) {
1518 case NB_EV_VALIDATE
:
1523 return lib_route_map_entry_set_destroy(args
);
1531 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:ipv6-address
1533 int lib_route_map_entry_set_action_rmap_set_action_ipv6_address_modify(
1534 struct nb_cb_modify_args
*args
)
1536 struct routemap_hook_context
*rhc
;
1538 int rv
= CMD_SUCCESS
;
1539 const char *action
= NULL
;
1540 struct in6_addr i6a
;
1542 action
= yang_dnode_get_string(args
->dnode
,
1543 "../../frr-route-map:action");
1544 switch (args
->event
) {
1545 case NB_EV_VALIDATE
:
1546 if (action
&& IS_SET_IPV6_NH_GLOBAL(action
)) {
1547 yang_dnode_get_ipv6(&i6a
, args
->dnode
, NULL
);
1548 if (IN6_IS_ADDR_UNSPECIFIED(&i6a
)
1549 || IN6_IS_ADDR_LOOPBACK(&i6a
)
1550 || IN6_IS_ADDR_MULTICAST(&i6a
)
1551 || IN6_IS_ADDR_LINKLOCAL(&i6a
))
1552 return NB_ERR_VALIDATION
;
1562 /* Add configuration. */
1563 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1564 addr
= yang_dnode_get_string(args
->dnode
, NULL
);
1566 rhc
->rhc_shook
= generic_set_delete
;
1567 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1569 if (IS_SET_IPV6_NH_GLOBAL(action
))
1570 /* Set destroy information. */
1571 rhc
->rhc_rule
= "ipv6 next-hop global";
1573 rhc
->rhc_rule
= "ipv6 vpn next-hop";
1575 rv
= generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, addr
,
1576 args
->errmsg
, args
->errmsg_len
);
1578 if (rv
!= CMD_SUCCESS
) {
1579 rhc
->rhc_shook
= NULL
;
1580 return NB_ERR_INCONSISTENCY
;
1586 int lib_route_map_entry_set_action_rmap_set_action_ipv6_address_destroy(
1587 struct nb_cb_destroy_args
*args
)
1589 switch (args
->event
) {
1590 case NB_EV_VALIDATE
:
1595 return lib_route_map_entry_set_destroy(args
);
1603 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:preference
1605 int lib_route_map_entry_set_action_rmap_set_action_preference_modify(
1606 struct nb_cb_modify_args
*args
)
1608 struct routemap_hook_context
*rhc
;
1609 int rv
= CMD_SUCCESS
;
1610 const char *action
= NULL
;
1613 switch (args
->event
) {
1614 case NB_EV_VALIDATE
:
1619 /* Add configuration. */
1620 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1621 value
= yang_dnode_get_bool(args
->dnode
, NULL
);
1623 rhc
->rhc_shook
= generic_set_delete
;
1624 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1626 action
= yang_dnode_get_string(args
->dnode
,
1627 "../../frr-route-map:action");
1630 if (IS_SET_IPV6_PEER_ADDR(action
))
1631 /* Set destroy information. */
1632 rhc
->rhc_rule
= "ipv6 next-hop peer-address";
1634 rhc
->rhc_rule
= "ipv6 next-hop prefer-global";
1636 rv
= generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
,
1638 args
->errmsg
, args
->errmsg_len
);
1641 if (rv
!= CMD_SUCCESS
) {
1642 rhc
->rhc_shook
= NULL
;
1643 return NB_ERR_INCONSISTENCY
;
1650 int lib_route_map_entry_set_action_rmap_set_action_preference_destroy(
1651 struct nb_cb_destroy_args
*args
)
1653 switch (args
->event
) {
1654 case NB_EV_VALIDATE
:
1659 return lib_route_map_entry_set_destroy(args
);
1667 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:label-index
1669 int lib_route_map_entry_set_action_rmap_set_action_label_index_modify(
1670 struct nb_cb_modify_args
*args
)
1672 struct routemap_hook_context
*rhc
;
1676 switch (args
->event
) {
1677 case NB_EV_VALIDATE
:
1682 /* Add configuration. */
1683 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1684 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1686 /* Set destroy information. */
1687 rhc
->rhc_shook
= generic_set_delete
;
1688 rhc
->rhc_rule
= "label-index";
1689 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1691 rv
= generic_set_add(rhc
->rhc_rmi
, "label-index", type
,
1692 args
->errmsg
, args
->errmsg_len
);
1693 if (rv
!= CMD_SUCCESS
) {
1694 rhc
->rhc_shook
= NULL
;
1695 return NB_ERR_INCONSISTENCY
;
1702 int lib_route_map_entry_set_action_rmap_set_action_label_index_destroy(
1703 struct nb_cb_destroy_args
*args
)
1705 switch (args
->event
) {
1706 case NB_EV_VALIDATE
:
1711 return lib_route_map_entry_set_destroy(args
);
1719 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:local-pref
1721 int lib_route_map_entry_set_action_rmap_set_action_local_pref_modify(
1722 struct nb_cb_modify_args
*args
)
1724 struct routemap_hook_context
*rhc
;
1728 switch (args
->event
) {
1729 case NB_EV_VALIDATE
:
1734 /* Add configuration. */
1735 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1736 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1738 /* Set destroy information. */
1739 rhc
->rhc_shook
= generic_set_delete
;
1740 rhc
->rhc_rule
= "local-preference";
1741 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1743 rv
= generic_set_add(rhc
->rhc_rmi
, "local-preference",
1745 args
->errmsg
, args
->errmsg_len
);
1746 if (rv
!= CMD_SUCCESS
) {
1747 rhc
->rhc_shook
= NULL
;
1748 return NB_ERR_INCONSISTENCY
;
1755 int lib_route_map_entry_set_action_rmap_set_action_local_pref_destroy(
1756 struct nb_cb_destroy_args
*args
)
1758 switch (args
->event
) {
1759 case NB_EV_VALIDATE
:
1764 return lib_route_map_entry_set_destroy(args
);
1772 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:weight
1774 int lib_route_map_entry_set_action_rmap_set_action_weight_modify(
1775 struct nb_cb_modify_args
*args
)
1777 struct routemap_hook_context
*rhc
;
1781 switch (args
->event
) {
1782 case NB_EV_VALIDATE
:
1787 /* Add configuration. */
1788 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1789 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1791 /* Set destroy information. */
1792 rhc
->rhc_shook
= generic_set_delete
;
1793 rhc
->rhc_rule
= "weight";
1794 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1796 rv
= generic_set_add(rhc
->rhc_rmi
, "weight", type
,
1797 args
->errmsg
, args
->errmsg_len
);
1798 if (rv
!= CMD_SUCCESS
) {
1799 rhc
->rhc_shook
= NULL
;
1800 return NB_ERR_INCONSISTENCY
;
1807 int lib_route_map_entry_set_action_rmap_set_action_weight_destroy(
1808 struct nb_cb_destroy_args
*args
)
1810 switch (args
->event
) {
1811 case NB_EV_VALIDATE
:
1816 return lib_route_map_entry_set_destroy(args
);
1824 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:origin
1826 int lib_route_map_entry_set_action_rmap_set_action_origin_modify(
1827 struct nb_cb_modify_args
*args
)
1829 struct routemap_hook_context
*rhc
;
1833 switch (args
->event
) {
1834 case NB_EV_VALIDATE
:
1839 /* Add configuration. */
1840 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1841 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1843 /* Set destroy information. */
1844 rhc
->rhc_shook
= generic_set_delete
;
1845 rhc
->rhc_rule
= "origin";
1846 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1848 rv
= generic_set_add(rhc
->rhc_rmi
, "origin", type
,
1849 args
->errmsg
, args
->errmsg_len
);
1850 if (rv
!= CMD_SUCCESS
) {
1851 rhc
->rhc_shook
= NULL
;
1852 return NB_ERR_INCONSISTENCY
;
1859 int lib_route_map_entry_set_action_rmap_set_action_origin_destroy(
1860 struct nb_cb_destroy_args
*args
)
1862 switch (args
->event
) {
1863 case NB_EV_VALIDATE
:
1868 return lib_route_map_entry_set_destroy(args
);
1877 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:originator-id
1879 int lib_route_map_entry_set_action_rmap_set_action_originator_id_modify(
1880 struct nb_cb_modify_args
*args
)
1882 struct routemap_hook_context
*rhc
;
1886 switch (args
->event
) {
1887 case NB_EV_VALIDATE
:
1892 /* Add configuration. */
1893 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1894 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1896 /* Set destroy information. */
1897 rhc
->rhc_shook
= generic_set_delete
;
1898 rhc
->rhc_rule
= "originator-id";
1899 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1901 rv
= generic_set_add(rhc
->rhc_rmi
, "originator-id", type
,
1902 args
->errmsg
, args
->errmsg_len
);
1903 if (rv
!= CMD_SUCCESS
) {
1904 rhc
->rhc_shook
= NULL
;
1905 return NB_ERR_INCONSISTENCY
;
1912 int lib_route_map_entry_set_action_rmap_set_action_originator_id_destroy(
1913 struct nb_cb_destroy_args
*args
)
1915 switch (args
->event
) {
1916 case NB_EV_VALIDATE
:
1921 return lib_route_map_entry_set_destroy(args
);
1929 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:table
1931 int lib_route_map_entry_set_action_rmap_set_action_table_modify(
1932 struct nb_cb_modify_args
*args
)
1934 struct routemap_hook_context
*rhc
;
1938 switch (args
->event
) {
1939 case NB_EV_VALIDATE
:
1944 /* Add configuration. */
1945 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1946 type
= yang_dnode_get_string(args
->dnode
, NULL
);
1948 /* Set destroy information. */
1949 rhc
->rhc_shook
= generic_set_delete
;
1950 rhc
->rhc_rule
= "table";
1951 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
1953 rv
= generic_set_add(rhc
->rhc_rmi
, "table", type
,
1954 args
->errmsg
, args
->errmsg_len
);
1955 if (rv
!= CMD_SUCCESS
) {
1956 rhc
->rhc_shook
= NULL
;
1957 return NB_ERR_INCONSISTENCY
;
1964 int lib_route_map_entry_set_action_rmap_set_action_table_destroy(
1965 struct nb_cb_destroy_args
*args
)
1967 switch (args
->event
) {
1968 case NB_EV_VALIDATE
:
1973 return lib_route_map_entry_set_destroy(args
);
1981 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:atomic-aggregate
1984 lib_route_map_entry_set_action_rmap_set_action_atomic_aggregate_create(
1985 struct nb_cb_create_args
*args
)
1987 struct routemap_hook_context
*rhc
;
1990 switch (args
->event
) {
1991 case NB_EV_VALIDATE
:
1996 /* Add configuration. */
1997 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
1999 /* Set destroy information. */
2000 rhc
->rhc_shook
= generic_set_delete
;
2001 rhc
->rhc_rule
= "atomic-aggregate";
2002 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2004 rv
= generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, NULL
,
2005 args
->errmsg
, args
->errmsg_len
);
2006 if (rv
!= CMD_SUCCESS
) {
2007 rhc
->rhc_shook
= NULL
;
2008 return NB_ERR_INCONSISTENCY
;
2016 lib_route_map_entry_set_action_rmap_set_action_atomic_aggregate_destroy(
2017 struct nb_cb_destroy_args
*args
)
2019 switch (args
->event
) {
2020 case NB_EV_VALIDATE
:
2025 return lib_route_map_entry_set_destroy(args
);
2033 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:prepend-as-path
2036 lib_route_map_entry_set_action_rmap_set_action_prepend_as_path_modify(
2037 struct nb_cb_modify_args
*args
)
2039 struct routemap_hook_context
*rhc
;
2043 switch (args
->event
) {
2044 case NB_EV_VALIDATE
:
2049 /* Add configuration. */
2050 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2051 type
= yang_dnode_get_string(args
->dnode
, NULL
);
2053 /* Set destroy information. */
2054 rhc
->rhc_shook
= generic_set_delete
;
2055 rhc
->rhc_rule
= "as-path prepend";
2056 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2058 rv
= generic_set_add(rhc
->rhc_rmi
, "as-path prepend",
2060 args
->errmsg
, args
->errmsg_len
);
2061 if (rv
!= CMD_SUCCESS
) {
2062 rhc
->rhc_shook
= NULL
;
2063 return NB_ERR_INCONSISTENCY
;
2071 lib_route_map_entry_set_action_rmap_set_action_prepend_as_path_destroy(
2072 struct nb_cb_destroy_args
*args
)
2074 switch (args
->event
) {
2075 case NB_EV_VALIDATE
:
2080 return lib_route_map_entry_set_destroy(args
);
2088 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:last-as
2090 int lib_route_map_entry_set_action_rmap_set_action_last_as_modify(
2091 struct nb_cb_modify_args
*args
)
2093 struct routemap_hook_context
*rhc
;
2098 switch (args
->event
) {
2099 case NB_EV_VALIDATE
:
2104 /* Add configuration. */
2105 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2106 value
= yang_dnode_get_string(args
->dnode
, NULL
);
2108 /* Set destroy information. */
2109 rhc
->rhc_shook
= generic_set_delete
;
2110 rhc
->rhc_rule
= "as-path prepend";
2111 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2113 argstr
= XMALLOC(MTYPE_ROUTE_MAP_COMPILED
,
2114 strlen(value
) + strlen("last-as") + 2);
2116 snprintf(argstr
, (strlen(value
) + strlen("last-as") + 2),
2117 "last-as %s", value
);
2119 rv
= generic_set_add(rhc
->rhc_rmi
, "as-path prepend",
2121 args
->errmsg
, args
->errmsg_len
);
2122 if (rv
!= CMD_SUCCESS
) {
2123 rhc
->rhc_shook
= NULL
;
2124 XFREE(MTYPE_ROUTE_MAP_COMPILED
, argstr
);
2125 return NB_ERR_INCONSISTENCY
;
2128 XFREE(MTYPE_ROUTE_MAP_COMPILED
, argstr
);
2134 int lib_route_map_entry_set_action_rmap_set_action_last_as_destroy(
2135 struct nb_cb_destroy_args
*args
)
2137 switch (args
->event
) {
2138 case NB_EV_VALIDATE
:
2143 return lib_route_map_entry_set_destroy(args
);
2151 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:exclude-as-path
2154 lib_route_map_entry_set_action_rmap_set_action_exclude_as_path_modify(
2155 struct nb_cb_modify_args
*args
)
2157 struct routemap_hook_context
*rhc
;
2161 switch (args
->event
) {
2162 case NB_EV_VALIDATE
:
2167 /* Add configuration. */
2168 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2169 type
= yang_dnode_get_string(args
->dnode
, NULL
);
2171 /* Set destroy information. */
2172 rhc
->rhc_shook
= generic_set_delete
;
2173 rhc
->rhc_rule
= "as-path exclude";
2174 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2176 rv
= generic_set_add(rhc
->rhc_rmi
, "as-path exclude",
2178 args
->errmsg
, args
->errmsg_len
);
2179 if (rv
!= CMD_SUCCESS
) {
2180 rhc
->rhc_shook
= NULL
;
2181 return NB_ERR_INCONSISTENCY
;
2189 lib_route_map_entry_set_action_rmap_set_action_exclude_as_path_destroy(
2190 struct nb_cb_destroy_args
*args
)
2192 switch (args
->event
) {
2193 case NB_EV_VALIDATE
:
2198 return lib_route_map_entry_set_destroy(args
);
2206 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-none
2208 int lib_route_map_entry_set_action_rmap_set_action_community_none_modify(
2209 struct nb_cb_modify_args
*args
)
2211 struct routemap_hook_context
*rhc
;
2215 switch (args
->event
) {
2216 case NB_EV_VALIDATE
:
2221 /* Add configuration. */
2222 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2223 none
= yang_dnode_get_bool(args
->dnode
, NULL
);
2225 /* Set destroy information. */
2226 rhc
->rhc_shook
= generic_set_delete
;
2227 rhc
->rhc_rule
= "community";
2228 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2231 rv
= generic_set_add(rhc
->rhc_rmi
, "community",
2233 args
->errmsg
, args
->errmsg_len
);
2234 if (rv
!= CMD_SUCCESS
) {
2235 rhc
->rhc_shook
= NULL
;
2236 return NB_ERR_INCONSISTENCY
;
2241 return NB_ERR_INCONSISTENCY
;
2248 lib_route_map_entry_set_action_rmap_set_action_community_none_destroy(
2249 struct nb_cb_destroy_args
*args
)
2251 switch (args
->event
) {
2252 case NB_EV_VALIDATE
:
2257 return lib_route_map_entry_set_destroy(args
);
2265 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:community-string
2268 lib_route_map_entry_set_action_rmap_set_action_community_string_modify(
2269 struct nb_cb_modify_args
*args
)
2271 struct routemap_hook_context
*rhc
;
2275 switch (args
->event
) {
2276 case NB_EV_VALIDATE
:
2281 /* Add configuration. */
2282 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2283 type
= yang_dnode_get_string(args
->dnode
, NULL
);
2285 /* Set destroy information. */
2286 rhc
->rhc_shook
= generic_set_delete
;
2287 rhc
->rhc_rule
= "community";
2288 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2290 rv
= generic_set_add(rhc
->rhc_rmi
, "community", type
,
2291 args
->errmsg
, args
->errmsg_len
);
2292 if (rv
!= CMD_SUCCESS
) {
2293 rhc
->rhc_shook
= NULL
;
2294 return NB_ERR_INCONSISTENCY
;
2302 lib_route_map_entry_set_action_rmap_set_action_community_string_destroy(
2303 struct nb_cb_destroy_args
*args
)
2305 switch (args
->event
) {
2306 case NB_EV_VALIDATE
:
2311 return lib_route_map_entry_set_destroy(args
);
2319 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-none
2322 lib_route_map_entry_set_action_rmap_set_action_large_community_none_modify(
2323 struct nb_cb_modify_args
*args
)
2325 struct routemap_hook_context
*rhc
;
2329 switch (args
->event
) {
2330 case NB_EV_VALIDATE
:
2335 /* Add configuration. */
2336 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2337 none
= yang_dnode_get_bool(args
->dnode
, NULL
);
2339 /* Set destroy information. */
2340 rhc
->rhc_shook
= generic_set_delete
;
2341 rhc
->rhc_rule
= "large-community";
2342 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2345 rv
= generic_set_add(rhc
->rhc_rmi
,
2348 args
->errmsg
, args
->errmsg_len
);
2349 if (rv
!= CMD_SUCCESS
) {
2350 rhc
->rhc_shook
= NULL
;
2351 return NB_ERR_INCONSISTENCY
;
2356 return NB_ERR_INCONSISTENCY
;
2363 lib_route_map_entry_set_action_rmap_set_action_large_community_none_destroy(
2364 struct nb_cb_destroy_args
*args
)
2366 switch (args
->event
) {
2367 case NB_EV_VALIDATE
:
2372 return lib_route_map_entry_set_destroy(args
);
2380 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:large-community-string
2383 lib_route_map_entry_set_action_rmap_set_action_large_community_string_modify(
2384 struct nb_cb_modify_args
*args
)
2386 struct routemap_hook_context
*rhc
;
2390 switch (args
->event
) {
2391 case NB_EV_VALIDATE
:
2396 /* Add configuration. */
2397 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2398 type
= yang_dnode_get_string(args
->dnode
, NULL
);
2400 /* Set destroy information. */
2401 rhc
->rhc_shook
= generic_set_delete
;
2402 rhc
->rhc_rule
= "large-community";
2403 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2405 rv
= generic_set_add(rhc
->rhc_rmi
, "large-community",
2407 args
->errmsg
, args
->errmsg_len
);
2408 if (rv
!= CMD_SUCCESS
) {
2409 rhc
->rhc_shook
= NULL
;
2410 return NB_ERR_INCONSISTENCY
;
2418 lib_route_map_entry_set_action_rmap_set_action_large_community_string_destroy(
2419 struct nb_cb_destroy_args
*args
)
2421 switch (args
->event
) {
2422 case NB_EV_VALIDATE
:
2427 return lib_route_map_entry_set_destroy(args
);
2435 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator
2437 void lib_route_map_entry_set_action_rmap_set_action_aggregator_finish(
2438 struct nb_cb_apply_finish_args
*args
)
2440 struct routemap_hook_context
*rhc
;
2445 /* Add configuration. */
2446 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2447 asn
= yang_dnode_get_string(args
->dnode
, "./aggregator-asn");
2448 addr
= yang_dnode_get_string(args
->dnode
, "./aggregator-address");
2450 argstr
= XMALLOC(MTYPE_ROUTE_MAP_COMPILED
,
2451 strlen(asn
) + strlen(addr
) + 2);
2453 snprintf(argstr
, (strlen(asn
) + strlen(addr
) + 2), "%s %s", asn
, addr
);
2455 /* Set destroy information. */
2456 rhc
->rhc_shook
= generic_set_delete
;
2457 rhc
->rhc_rule
= "aggregator as";
2458 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2460 generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, argstr
,
2461 args
->errmsg
, args
->errmsg_len
);
2462 XFREE(MTYPE_ROUTE_MAP_COMPILED
, argstr
);
2466 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-asn
2469 lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_modify(
2470 struct nb_cb_modify_args
*args
)
2472 switch (args
->event
) {
2473 case NB_EV_VALIDATE
:
2484 lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_asn_destroy(
2485 struct nb_cb_destroy_args
*args
)
2487 switch (args
->event
) {
2488 case NB_EV_VALIDATE
:
2493 return lib_route_map_entry_set_destroy(args
);
2501 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:aggregator/aggregator-address
2504 lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_modify(
2505 struct nb_cb_modify_args
*args
)
2507 switch (args
->event
) {
2508 case NB_EV_VALIDATE
:
2519 lib_route_map_entry_set_action_rmap_set_action_aggregator_aggregator_address_destroy(
2520 struct nb_cb_destroy_args
*args
)
2522 switch (args
->event
) {
2523 case NB_EV_VALIDATE
:
2528 return lib_route_map_entry_set_destroy(args
);
2536 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:comm-list-name
2538 int lib_route_map_entry_set_action_rmap_set_action_comm_list_name_modify(
2539 struct nb_cb_modify_args
*args
)
2541 struct routemap_hook_context
*rhc
;
2544 int rv
= CMD_SUCCESS
;
2546 switch (args
->event
) {
2547 case NB_EV_VALIDATE
:
2552 /* Add configuration. */
2553 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2554 value
= yang_dnode_get_string(args
->dnode
, NULL
);
2556 /* Set destroy information. */
2557 rhc
->rhc_shook
= generic_set_delete
;
2559 action
= yang_dnode_get_string(args
->dnode
,
2560 "../../frr-route-map:action");
2561 if (IS_SET_COMM_LIST_DEL(action
))
2562 rhc
->rhc_rule
= "comm-list";
2564 rhc
->rhc_rule
= "large-comm-list";
2566 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2568 rv
= generic_set_add(rhc
->rhc_rmi
, rhc
->rhc_rule
, value
,
2569 args
->errmsg
, args
->errmsg_len
);
2571 if (rv
!= CMD_SUCCESS
) {
2572 rhc
->rhc_shook
= NULL
;
2573 return NB_ERR_INCONSISTENCY
;
2581 lib_route_map_entry_set_action_rmap_set_action_comm_list_name_destroy(
2582 struct nb_cb_destroy_args
*args
)
2584 switch (args
->event
) {
2585 case NB_EV_VALIDATE
:
2590 return lib_route_map_entry_set_destroy(args
);
2598 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb
2601 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_finish(
2602 struct nb_cb_apply_finish_args
*args
)
2604 struct routemap_hook_context
*rhc
;
2605 enum ecommunity_lb_type lb_type
;
2606 char str
[VTY_BUFSIZ
];
2609 /* Add configuration. */
2610 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2611 lb_type
= yang_dnode_get_enum(args
->dnode
, "./lb-type");
2613 /* Set destroy information. */
2614 rhc
->rhc_shook
= generic_set_delete
;
2615 rhc
->rhc_rule
= "extcommunity bandwidth";
2616 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2619 case EXPLICIT_BANDWIDTH
:
2620 bandwidth
= yang_dnode_get_uint16(args
->dnode
, "./bandwidth");
2621 snprintf(str
, sizeof(str
), "%d", bandwidth
);
2623 case CUMULATIVE_BANDWIDTH
:
2624 snprintf(str
, sizeof(str
), "%s", "cumulative");
2626 case COMPUTED_BANDWIDTH
:
2627 snprintf(str
, sizeof(str
), "%s", "num-multipaths");
2630 if (yang_dnode_get_bool(args
->dnode
, "./two-octet-as-specific"))
2631 strlcat(str
, " non-transitive", sizeof(str
));
2633 generic_set_add(rhc
->rhc_rmi
,
2634 "extcommunity bandwidth", str
,
2635 args
->errmsg
, args
->errmsg_len
);
2640 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/lb-type
2643 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_modify(
2644 struct nb_cb_modify_args
*args
)
2650 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_lb_type_destroy(
2651 struct nb_cb_destroy_args
*args
)
2653 return lib_route_map_entry_set_destroy(args
);
2658 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/bandwidth
2661 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_modify(
2662 struct nb_cb_modify_args
*args
)
2668 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_bandwidth_destroy(
2669 struct nb_cb_destroy_args
*args
)
2671 return lib_route_map_entry_set_destroy(args
);
2676 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:extcommunity-lb/two-octet-as-specific
2679 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_modify(
2680 struct nb_cb_modify_args
*args
)
2686 lib_route_map_entry_set_action_rmap_set_action_extcommunity_lb_two_octet_as_specific_destroy(
2687 struct nb_cb_destroy_args
*args
)
2689 return lib_route_map_entry_set_destroy(args
);
2694 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv4
2696 int lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_modify(
2697 struct nb_cb_modify_args
*args
)
2699 struct routemap_hook_context
*rhc
;
2703 switch (args
->event
) {
2704 case NB_EV_VALIDATE
:
2709 /* Add configuration. */
2710 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2711 type
= yang_dnode_get_string(args
->dnode
, NULL
);
2713 /* Set destroy information. */
2714 rhc
->rhc_shook
= generic_set_delete
;
2715 rhc
->rhc_rule
= "evpn gateway-ip ipv4";
2716 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2718 rv
= generic_set_add(rhc
->rhc_rmi
, "evpn gateway-ip ipv4", type
,
2719 args
->errmsg
, args
->errmsg_len
);
2720 if (rv
!= CMD_SUCCESS
) {
2721 rhc
->rhc_shook
= NULL
;
2722 return NB_ERR_INCONSISTENCY
;
2729 int lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv4_destroy(
2730 struct nb_cb_destroy_args
*args
)
2732 switch (args
->event
) {
2733 case NB_EV_VALIDATE
:
2738 return lib_route_map_entry_set_destroy(args
);
2746 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-bgp-route-map:evpn-gateway-ip-ipv6
2748 int lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_modify(
2749 struct nb_cb_modify_args
*args
)
2751 struct routemap_hook_context
*rhc
;
2755 switch (args
->event
) {
2756 case NB_EV_VALIDATE
:
2761 /* Add configuration. */
2762 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
2763 type
= yang_dnode_get_string(args
->dnode
, NULL
);
2765 /* Set destroy information. */
2766 rhc
->rhc_shook
= generic_set_delete
;
2767 rhc
->rhc_rule
= "evpn gateway-ip ipv6";
2768 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
2770 rv
= generic_set_add(rhc
->rhc_rmi
, "evpn gateway-ip ipv6", type
,
2771 args
->errmsg
, args
->errmsg_len
);
2772 if (rv
!= CMD_SUCCESS
) {
2773 rhc
->rhc_shook
= NULL
;
2774 return NB_ERR_INCONSISTENCY
;
2781 int lib_route_map_entry_set_action_rmap_set_action_evpn_gateway_ip_ipv6_destroy(
2782 struct nb_cb_destroy_args
*args
)
2784 switch (args
->event
) {
2785 case NB_EV_VALIDATE
:
2790 return lib_route_map_entry_set_destroy(args
);