back to topotato report
topotato coverage report
Current view: top level - ospfd - ospf_routemap_nb_config.c (source / functions) Hit Total Coverage
Test: aggregated run ( view descriptions ) Lines: 0 16 0.0 %
Date: 2023-02-24 14:41:08 Functions: 0 2 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2020        Vmware
       3             :  *                           Sarita Patra
       4             :  *
       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)
       8             :  * any later version.
       9             :  *
      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
      13             :  * more details.
      14             :  *
      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
      18             :  */
      19             : 
      20             : #include <zebra.h>
      21             : 
      22             : #include "lib/command.h"
      23             : #include "lib/log.h"
      24             : #include "lib/northbound.h"
      25             : #include "lib/routemap.h"
      26             : #include "ospf_routemap_nb.h"
      27             : 
      28             : /*
      29             :  * XPath:
      30             :  * /frr-route-map:lib/route-map/entry/set-action/rmap-set-action/frr-ospf-route-map:metric-type
      31             :  */
      32           0 : int lib_route_map_entry_set_action_rmap_set_action_metric_type_modify(
      33             :         struct nb_cb_modify_args *args)
      34             : {
      35           0 :         struct routemap_hook_context *rhc;
      36           0 :         const char *type;
      37           0 :         int rv;
      38             : 
      39           0 :         if (args->event != NB_EV_APPLY)
      40             :                 return NB_OK;
      41             : 
      42             :         /* Add configuration. */
      43           0 :         rhc = nb_running_get_entry(args->dnode, NULL, true);
      44           0 :         type = yang_dnode_get_string(args->dnode, NULL);
      45             : 
      46             :         /* Set destroy information. */
      47           0 :         rhc->rhc_shook = generic_set_delete;
      48           0 :         rhc->rhc_rule = "metric-type";
      49           0 :         rhc->rhc_event = RMAP_EVENT_SET_DELETED;
      50             : 
      51           0 :         rv = generic_set_add(rhc->rhc_rmi, "metric-type", type,
      52             :                              args->errmsg, args->errmsg_len);
      53           0 :         if (rv != CMD_SUCCESS) {
      54           0 :                 rhc->rhc_mhook = NULL;
      55           0 :                 return NB_ERR_INCONSISTENCY;
      56             :         }
      57             : 
      58             :         return NB_OK;
      59             : }
      60             : 
      61           0 : int lib_route_map_entry_set_action_rmap_set_action_metric_type_destroy(
      62             :         struct nb_cb_destroy_args *args)
      63             : {
      64           0 :         return lib_route_map_entry_set_destroy(args);
      65             : }

Generated by: LCOV version v1.16-topotato