]> git.proxmox.com Git - mirror_frr.git/blame - ospfd/ospf_routemap_nb_config.c
Merge pull request #12798 from donaldsharp/rib_match_multicast
[mirror_frr.git] / ospfd / ospf_routemap_nb_config.c
CommitLineData
acddc0ed 1// SPDX-License-Identifier: GPL-2.0-or-later
a623b526
SP
2/*
3 * Copyright (C) 2020 Vmware
4 * Sarita Patra
a623b526
SP
5 */
6
1f8031f7
DL
7#include <zebra.h>
8
a623b526
SP
9#include "lib/command.h"
10#include "lib/log.h"
11#include "lib/northbound.h"
12#include "lib/routemap.h"
13#include "ospf_routemap_nb.h"
14
15/*
16 * XPath:
17 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-ospf-route-map:metric-type
18 */
19int lib_route_map_entry_set_action_rmap_set_action_metric_type_modify(
20 struct nb_cb_modify_args *args)
21{
22 struct routemap_hook_context *rhc;
23 const char *type;
24 int rv;
25
26 if (args->event != NB_EV_APPLY)
27 return NB_OK;
28
29 /* Add configuration. */
30 rhc = nb_running_get_entry(args->dnode, NULL, true);
31 type = yang_dnode_get_string(args->dnode, NULL);
32
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;
37
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;
43 }
44
45 return NB_OK;
46}
47
48int lib_route_map_entry_set_action_rmap_set_action_metric_type_destroy(
49 struct nb_cb_destroy_args *args)
50{
51 return lib_route_map_entry_set_destroy(args);
52}