]>
git.proxmox.com Git - mirror_frr.git/blob - ospf6d/ospf6_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 "ospf6_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 switch (args
->event
) {
32 /* Add configuration. */
33 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
34 type
= yang_dnode_get_string(args
->dnode
, NULL
);
36 /* Set destroy information. */
37 rhc
->rhc_shook
= generic_set_delete
;
38 rhc
->rhc_rule
= "metric-type";
39 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
41 rv
= generic_set_add(rhc
->rhc_rmi
, "metric-type", type
,
42 args
->errmsg
, args
->errmsg_len
);
43 if (rv
!= CMD_SUCCESS
) {
44 rhc
->rhc_mhook
= NULL
;
45 return NB_ERR_INCONSISTENCY
;
52 int lib_route_map_entry_set_action_rmap_set_action_metric_type_destroy(
53 struct nb_cb_destroy_args
*args
)
55 switch (args
->event
) {
61 return lib_route_map_entry_set_destroy(args
);
69 * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-ospf6-route-map:ipv6-address
71 int lib_route_map_entry_set_action_rmap_set_action_ipv6_address_modify(
72 struct nb_cb_modify_args
*args
)
74 struct routemap_hook_context
*rhc
;
75 const char *ipv6_addr
;
78 switch (args
->event
) {
84 /* Add configuration. */
85 rhc
= nb_running_get_entry(args
->dnode
, NULL
, true);
86 ipv6_addr
= yang_dnode_get_string(args
->dnode
, NULL
);
88 /* Set destroy information. */
89 rhc
->rhc_shook
= generic_set_delete
;
90 rhc
->rhc_rule
= "forwarding-address";
91 rhc
->rhc_event
= RMAP_EVENT_SET_DELETED
;
93 rv
= generic_set_add(rhc
->rhc_rmi
, "forwarding-address",
95 args
->errmsg
, args
->errmsg_len
);
96 if (rv
!= CMD_SUCCESS
) {
97 rhc
->rhc_mhook
= NULL
;
98 return NB_ERR_INCONSISTENCY
;
105 int lib_route_map_entry_set_action_rmap_set_action_ipv6_address_destroy(
106 struct nb_cb_destroy_args
*args
)
108 switch (args
->event
) {
114 return lib_route_map_entry_set_destroy(args
);