]>
git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_routemap_nb_config.c
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (C) 2020 Vmware
9 #include "lib/command.h"
11 #include "lib/northbound.h"
12 #include "lib/routemap.h"
13 #include "ospf_routemap_nb.h"
17 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-ospf-route-map:metric-type
19 int lib_route_map_entry_set_action_rmap_set_action_metric_type_modify(
20 struct nb_cb_modify_args
*args
)
22 struct routemap_hook_context
*rhc
;
26 if (args
->event
!= NB_EV_APPLY
)
29 /* Add configuration. */
30 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
31 type
= yang_dnode_get_string(args
->dnode
, NULL
);
33 /* Set destroy information. */
34 rhc
->rhc_shook
= generic_set_delete
;
35 rhc
->rhc_rule
= "metric-type";
36 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
38 rv
= generic_set_add(rhc
->rhc_rmi
, "metric-type", type
,
39 args
->errmsg
, args
->errmsg_len
);
40 if (rv
!= CMD_SUCCESS
) {
41 rhc
->rhc_mhook
= NULL
;
42 return NB_ERR_INCONSISTENCY
;
48 int lib_route_map_entry_set_action_rmap_set_action_metric_type_destroy(
49 struct nb_cb_destroy_args
*args
)
51 return lib_route_map_entry_set_destroy(args
);