diff options
Diffstat (limited to 'bgpd/bgp_routemap_nb_config.c')
| -rw-r--r-- | bgpd/bgp_routemap_nb_config.c | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/bgpd/bgp_routemap_nb_config.c b/bgpd/bgp_routemap_nb_config.c index 88e3f6438f..45f5c8f4bc 100644 --- a/bgpd/bgp_routemap_nb_config.c +++ b/bgpd/bgp_routemap_nb_config.c @@ -160,6 +160,62 @@ lib_route_map_entry_match_condition_rmap_match_condition_local_preference_destro } /* + * XPath: + * /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:alias + */ +int lib_route_map_entry_match_condition_rmap_match_condition_alias_modify( + struct nb_cb_modify_args *args) +{ + struct routemap_hook_context *rhc; + const char *alias; + enum rmap_compile_rets ret; + + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + /* Add configuration. */ + rhc = nb_running_get_entry(args->dnode, NULL, true); + alias = yang_dnode_get_string(args->dnode, NULL); + + /* Set destroy information. */ + rhc->rhc_mhook = bgp_route_match_delete; + rhc->rhc_rule = "alias"; + rhc->rhc_event = RMAP_EVENT_MATCH_DELETED; + + ret = bgp_route_match_add(rhc->rhc_rmi, "alias", alias, + RMAP_EVENT_MATCH_ADDED, args->errmsg, + args->errmsg_len); + + if (ret != RMAP_COMPILE_SUCCESS) { + rhc->rhc_mhook = NULL; + return NB_ERR_VALIDATION; + } + + break; + } + + return NB_OK; +} + +int lib_route_map_entry_match_condition_rmap_match_condition_alias_destroy( + struct nb_cb_destroy_args *args) +{ + switch (args->event) { + case NB_EV_VALIDATE: + case NB_EV_PREPARE: + case NB_EV_ABORT: + break; + case NB_EV_APPLY: + return lib_route_map_entry_match_destroy(args); + } + + return NB_OK; +} + +/* * XPath: /frr-route-map:lib/route-map/entry/match-condition/rmap-match-condition/frr-bgp-route-map:script */ int |
