]>
git.proxmox.com Git - mirror_frr.git/blob - ospfd/ospf_routemap_nb_config.c
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
20 #include "lib/command.h"
22 #include "lib/northbound.h"
23 #include "lib/routemap.h"
24 #include "ospf_routemap_nb.h"
28 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-ospf-route-map:metric-type
30 int lib_route_map_entry_set_action_rmap_set_action_metric_type_modify(
31 struct nb_cb_modify_args
*args
)
33 struct routemap_hook_context
*rhc
;
37 if (args
->event
!= NB_EV_APPLY
)
40 /* Add configuration. */
41 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
42 type
= yang_dnode_get_string(args
->dnode
, NULL
);
44 /* Set destroy information. */
45 rhc
->rhc_shook
= generic_set_delete
;
46 rhc
->rhc_rule
= "metric-type";
47 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
49 rv
= generic_set_add(rhc
->rhc_rmi
, "metric-type", type
,
50 args
->errmsg
, args
->errmsg_len
);
51 if (rv
!= CMD_SUCCESS
) {
52 rhc
->rhc_mhook
= NULL
;
53 return NB_ERR_INCONSISTENCY
;
59 int lib_route_map_entry_set_action_rmap_set_action_metric_type_destroy(
60 struct nb_cb_destroy_args
*args
)
62 return lib_route_map_entry_set_destroy(args
);