back to topotato report
topotato coverage report
Current view: top level - zebra - zebra_nb_rpcs.c (source / functions) Hit Total Coverage
Test: test_ospf6_p2xp.py::PtMPBasic Lines: 0 52 0.0 %
Date: 2023-02-24 18:38:14 Functions: 0 14 0.0 %

          Line data    Source code
       1             : /*
       2             :  * Copyright (C) 2020 Cumulus Networks, Inc.
       3             :  *                    Chirag Shah
       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             : #include "northbound.h"
      22             : #include "libfrr.h"
      23             : 
      24             : #include "zebra/zebra_nb.h"
      25             : #include "zebra/zebra_router.h"
      26             : #include "zebra/zebra_vrf.h"
      27             : #include "zebra/zebra_vxlan.h"
      28             : 
      29             : /*
      30             :  * XPath: /frr-zebra:clear-evpn-dup-addr
      31             :  */
      32           0 : int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args)
      33             : {
      34           0 :         struct zebra_vrf *zvrf;
      35           0 :         int ret = NB_OK;
      36           0 :         struct yang_data *yang_dup_choice = NULL, *yang_dup_vni = NULL,
      37           0 :                          *yang_dup_ip = NULL, *yang_dup_mac = NULL;
      38             : 
      39           0 :         yang_dup_choice = yang_data_list_find(args->input, "%s/%s", args->xpath,
      40             :                                               "input/clear-dup-choice");
      41             : 
      42           0 :         zvrf = zebra_vrf_get_evpn();
      43             : 
      44           0 :         if (yang_dup_choice
      45           0 :             && strcmp(yang_dup_choice->value, "all-case") == 0) {
      46           0 :                 zebra_vxlan_clear_dup_detect_vni_all(zvrf);
      47             :         } else {
      48           0 :                 vni_t vni;
      49           0 :                 struct ipaddr host_ip = {.ipa_type = IPADDR_NONE};
      50           0 :                 struct ethaddr mac;
      51             : 
      52           0 :                 yang_dup_vni = yang_data_list_find(
      53             :                         args->input, "%s/%s", args->xpath,
      54             :                         "input/clear-dup-choice/single-case/vni-id");
      55           0 :                 if (yang_dup_vni) {
      56           0 :                         vni = yang_str2uint32(yang_dup_vni->value);
      57             : 
      58           0 :                         yang_dup_mac = yang_data_list_find(
      59             :                                 args->input, "%s/%s", args->xpath,
      60             :                                 "input/clear-dup-choice/single-case/vni-id/mac-addr");
      61           0 :                         yang_dup_ip = yang_data_list_find(
      62             :                                 args->input, "%s/%s", args->xpath,
      63             :                                 "input/clear-dup-choice/single-case/vni-id/vni-ipaddr");
      64             : 
      65           0 :                         if (yang_dup_mac) {
      66           0 :                                 yang_str2mac(yang_dup_mac->value, &mac);
      67           0 :                                 ret = zebra_vxlan_clear_dup_detect_vni_mac(
      68             :                                         zvrf, vni, &mac, args->errmsg,
      69             :                                         args->errmsg_len);
      70           0 :                         } else if (yang_dup_ip) {
      71           0 :                                 yang_str2ip(yang_dup_ip->value, &host_ip);
      72           0 :                                 ret = zebra_vxlan_clear_dup_detect_vni_ip(
      73             :                                         zvrf, vni, &host_ip, args->errmsg,
      74             :                                         args->errmsg_len);
      75             :                         } else
      76           0 :                                 ret = zebra_vxlan_clear_dup_detect_vni(zvrf,
      77             :                                                                        vni);
      78             :                 }
      79             :         }
      80           0 :         if (ret < 0)
      81             :                 return NB_ERR;
      82             : 
      83             :         return NB_OK;
      84             : }
      85             : 
      86             : /*
      87             :  * XPath: /frr-zebra:get-route-information
      88             :  */
      89           0 : int get_route_information_rpc(struct nb_cb_rpc_args *args)
      90             : {
      91             :         /* TODO: implement me. */
      92           0 :         return NB_ERR_NOT_FOUND;
      93             : }
      94             : 
      95             : /*
      96             :  * XPath: /frr-zebra:get-v6-mroute-info
      97             :  */
      98           0 : int get_v6_mroute_info_rpc(struct nb_cb_rpc_args *args)
      99             : {
     100             :         /* TODO: implement me. */
     101           0 :         return NB_ERR_NOT_FOUND;
     102             : }
     103             : 
     104             : /*
     105             :  * XPath: /frr-zebra:get-vrf-info
     106             :  */
     107           0 : int get_vrf_info_rpc(struct nb_cb_rpc_args *args)
     108             : {
     109             :         /* TODO: implement me. */
     110           0 :         return NB_ERR_NOT_FOUND;
     111             : }
     112             : 
     113             : /*
     114             :  * XPath: /frr-zebra:get-vrf-vni-info
     115             :  */
     116           0 : int get_vrf_vni_info_rpc(struct nb_cb_rpc_args *args)
     117             : {
     118             :         /* TODO: implement me. */
     119           0 :         return NB_ERR_NOT_FOUND;
     120             : }
     121             : 
     122             : /*
     123             :  * XPath: /frr-zebra:get-evpn-info
     124             :  */
     125           0 : int get_evpn_info_rpc(struct nb_cb_rpc_args *args)
     126             : {
     127             :         /* TODO: implement me. */
     128           0 :         return NB_ERR_NOT_FOUND;
     129             : }
     130             : 
     131             : /*
     132             :  * XPath: /frr-zebra:get-vni-info
     133             :  */
     134           0 : int get_vni_info_rpc(struct nb_cb_rpc_args *args)
     135             : {
     136             :         /* TODO: implement me. */
     137           0 :         return NB_ERR_NOT_FOUND;
     138             : }
     139             : 
     140             : /*
     141             :  * XPath: /frr-zebra:get-evpn-vni-rmac
     142             :  */
     143           0 : int get_evpn_vni_rmac_rpc(struct nb_cb_rpc_args *args)
     144             : {
     145             :         /* TODO: implement me. */
     146           0 :         return NB_ERR_NOT_FOUND;
     147             : }
     148             : 
     149             : /*
     150             :  * XPath: /frr-zebra:get-evpn-vni-nexthops
     151             :  */
     152           0 : int get_evpn_vni_nexthops_rpc(struct nb_cb_rpc_args *args)
     153             : {
     154             :         /* TODO: implement me. */
     155           0 :         return NB_ERR_NOT_FOUND;
     156             : }
     157             : 
     158             : /*
     159             :  * XPath: /frr-zebra:get-evpn-macs
     160             :  */
     161           0 : int get_evpn_macs_rpc(struct nb_cb_rpc_args *args)
     162             : {
     163             :         /* TODO: implement me. */
     164           0 :         return NB_ERR_NOT_FOUND;
     165             : }
     166             : 
     167             : /*
     168             :  * XPath: /frr-zebra:get-evpn-arp-cache
     169             :  */
     170           0 : int get_evpn_arp_cache_rpc(struct nb_cb_rpc_args *args)
     171             : {
     172             :         /* TODO: implement me. */
     173           0 :         return NB_ERR_NOT_FOUND;
     174             : }
     175             : 
     176             : /*
     177             :  * XPath: /frr-zebra:get-pbr-ipset
     178             :  */
     179           0 : int get_pbr_ipset_rpc(struct nb_cb_rpc_args *args)
     180             : {
     181             :         /* TODO: implement me. */
     182           0 :         return NB_ERR_NOT_FOUND;
     183             : }
     184             : 
     185             : /*
     186             :  * XPath: /frr-zebra:get-pbr-iptable
     187             :  */
     188           0 : int get_pbr_iptable_rpc(struct nb_cb_rpc_args *args)
     189             : {
     190             :         /* TODO: implement me. */
     191           0 :         return NB_ERR_NOT_FOUND;
     192             : }
     193             : 
     194             : /*
     195             :  * XPath: /frr-zebra:get-debugs
     196             :  */
     197           0 : int get_debugs_rpc(struct nb_cb_rpc_args *args)
     198             : {
     199             :         /* TODO: implement me. */
     200           0 :         return NB_ERR_NOT_FOUND;
     201             : }

Generated by: LCOV version v1.16-topotato