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