]> git.proxmox.com Git - mirror_frr.git/blob - zebra/zebra_nb_rpcs.c
Merge pull request #6242 from pguibert6WIND/flowspec_nlri_too_big
[mirror_frr.git] / zebra / zebra_nb_rpcs.c
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 int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input,
33 struct list *output)
34 {
35 struct zebra_vrf *zvrf;
36 int ret = NB_OK;
37 struct yang_data *yang_dup_choice = NULL, *yang_dup_vni = NULL,
38 *yang_dup_ip = NULL, *yang_dup_mac = NULL;
39
40 yang_dup_choice = yang_data_list_find(input, "%s/%s", xpath,
41 "input/clear-dup-choice");
42
43 zvrf = zebra_vrf_get_evpn();
44
45 if (yang_dup_choice
46 && strcmp(yang_dup_choice->value, "all-case") == 0) {
47 zebra_vxlan_clear_dup_detect_vni_all(zvrf);
48 } else {
49 vni_t vni;
50 struct ipaddr host_ip = {.ipa_type = IPADDR_NONE};
51 struct ethaddr mac;
52
53 yang_dup_vni = yang_data_list_find(
54 input, "%s/%s", xpath,
55 "input/clear-dup-choice/single-case/vni-id");
56 if (yang_dup_vni) {
57 vni = yang_str2uint32(yang_dup_vni->value);
58
59 yang_dup_mac = yang_data_list_find(
60 input, "%s/%s", xpath,
61 "input/clear-dup-choice/single-case/vni-id/mac-addr");
62 yang_dup_ip = yang_data_list_find(
63 input, "%s/%s", xpath,
64 "input/clear-dup-choice/single-case/vni-id/vni-ipaddr");
65
66 if (yang_dup_mac) {
67 yang_str2mac(yang_dup_mac->value, &mac);
68 ret = zebra_vxlan_clear_dup_detect_vni_mac(
69 zvrf, vni, &mac);
70 } else if (yang_dup_ip) {
71 yang_str2ip(yang_dup_ip->value, &host_ip);
72 ret = zebra_vxlan_clear_dup_detect_vni_ip(
73 zvrf, vni, &host_ip);
74 } else
75 ret = zebra_vxlan_clear_dup_detect_vni(zvrf,
76 vni);
77 }
78 }
79 ret = (ret != CMD_SUCCESS) ? NB_ERR : NB_OK;
80
81 return ret;
82 }
83
84 /*
85 * XPath: /frr-zebra:get-route-information
86 */
87 int get_route_information_rpc(const char *xpath, const struct list *input,
88 struct list *output)
89 {
90 /* TODO: implement me. */
91 return NB_ERR_NOT_FOUND;
92 }
93
94 /*
95 * XPath: /frr-zebra:get-v6-mroute-info
96 */
97 int get_v6_mroute_info_rpc(const char *xpath, const struct list *input,
98 struct list *output)
99 {
100 /* TODO: implement me. */
101 return NB_ERR_NOT_FOUND;
102 }
103
104 /*
105 * XPath: /frr-zebra:get-vrf-info
106 */
107 int get_vrf_info_rpc(const char *xpath, const struct list *input,
108 struct list *output)
109 {
110 /* TODO: implement me. */
111 return NB_ERR_NOT_FOUND;
112 }
113
114 /*
115 * XPath: /frr-zebra:get-vrf-vni-info
116 */
117 int get_vrf_vni_info_rpc(const char *xpath, const struct list *input,
118 struct list *output)
119 {
120 /* TODO: implement me. */
121 return NB_ERR_NOT_FOUND;
122 }
123
124 /*
125 * XPath: /frr-zebra:get-evpn-info
126 */
127 int get_evpn_info_rpc(const char *xpath, const struct list *input,
128 struct list *output)
129 {
130 /* TODO: implement me. */
131 return NB_ERR_NOT_FOUND;
132 }
133
134 /*
135 * XPath: /frr-zebra:get-vni-info
136 */
137 int get_vni_info_rpc(const char *xpath, const struct list *input,
138 struct list *output)
139 {
140 /* TODO: implement me. */
141 return NB_ERR_NOT_FOUND;
142 }
143
144 /*
145 * XPath: /frr-zebra:get-evpn-vni-rmac
146 */
147 int get_evpn_vni_rmac_rpc(const char *xpath, const struct list *input,
148 struct list *output)
149 {
150 /* TODO: implement me. */
151 return NB_ERR_NOT_FOUND;
152 }
153
154 /*
155 * XPath: /frr-zebra:get-evpn-vni-nexthops
156 */
157 int get_evpn_vni_nexthops_rpc(const char *xpath, const struct list *input,
158 struct list *output)
159 {
160 /* TODO: implement me. */
161 return NB_ERR_NOT_FOUND;
162 }
163
164 /*
165 * XPath: /frr-zebra:get-evpn-macs
166 */
167 int get_evpn_macs_rpc(const char *xpath, const struct list *input,
168 struct list *output)
169 {
170 /* TODO: implement me. */
171 return NB_ERR_NOT_FOUND;
172 }
173
174 /*
175 * XPath: /frr-zebra:get-evpn-arp-cache
176 */
177 int get_evpn_arp_cache_rpc(const char *xpath, const struct list *input,
178 struct list *output)
179 {
180 /* TODO: implement me. */
181 return NB_ERR_NOT_FOUND;
182 }
183
184 /*
185 * XPath: /frr-zebra:get-pbr-ipset
186 */
187 int get_pbr_ipset_rpc(const char *xpath, const struct list *input,
188 struct list *output)
189 {
190 /* TODO: implement me. */
191 return NB_ERR_NOT_FOUND;
192 }
193
194 /*
195 * XPath: /frr-zebra:get-pbr-iptable
196 */
197 int get_pbr_iptable_rpc(const char *xpath, const struct list *input,
198 struct list *output)
199 {
200 /* TODO: implement me. */
201 return NB_ERR_NOT_FOUND;
202 }
203
204 /*
205 * XPath: /frr-zebra:get-debugs
206 */
207 int get_debugs_rpc(const char *xpath, const struct list *input,
208 struct list *output)
209 {
210 /* TODO: implement me. */
211 return NB_ERR_NOT_FOUND;
212 }