]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
ce45ffe7 CS |
2 | /* |
3 | * Copyright (C) 2020 Cumulus Networks, Inc. | |
4 | * Chirag Shah | |
ce45ffe7 CS |
5 | */ |
6 | ||
7 | #include <zebra.h> | |
8 | #include "northbound.h" | |
9 | #include "libfrr.h" | |
10 | ||
11 | #include "zebra/zebra_nb.h" | |
c37c6fd8 CS |
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 | */ | |
60ee8be1 | 19 | int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args) |
c37c6fd8 CS |
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 | ||
60ee8be1 | 26 | yang_dup_choice = yang_data_list_find(args->input, "%s/%s", args->xpath, |
c37c6fd8 CS |
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) { | |
d36228c9 | 33 | zebra_vxlan_clear_dup_detect_vni_all(zvrf); |
c37c6fd8 CS |
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( | |
60ee8be1 | 40 | args->input, "%s/%s", args->xpath, |
c37c6fd8 CS |
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( | |
60ee8be1 | 46 | args->input, "%s/%s", args->xpath, |
c37c6fd8 CS |
47 | "input/clear-dup-choice/single-case/vni-id/mac-addr"); |
48 | yang_dup_ip = yang_data_list_find( | |
60ee8be1 | 49 | args->input, "%s/%s", args->xpath, |
c37c6fd8 CS |
50 | "input/clear-dup-choice/single-case/vni-id/vni-ipaddr"); |
51 | ||
52 | if (yang_dup_mac) { | |
d36228c9 | 53 | yang_str2mac(yang_dup_mac->value, &mac); |
c37c6fd8 | 54 | ret = zebra_vxlan_clear_dup_detect_vni_mac( |
9bee0232 CS |
55 | zvrf, vni, &mac, args->errmsg, |
56 | args->errmsg_len); | |
c37c6fd8 CS |
57 | } else if (yang_dup_ip) { |
58 | yang_str2ip(yang_dup_ip->value, &host_ip); | |
59 | ret = zebra_vxlan_clear_dup_detect_vni_ip( | |
9bee0232 CS |
60 | zvrf, vni, &host_ip, args->errmsg, |
61 | args->errmsg_len); | |
c37c6fd8 CS |
62 | } else |
63 | ret = zebra_vxlan_clear_dup_detect_vni(zvrf, | |
64 | vni); | |
65 | } | |
66 | } | |
9bee0232 CS |
67 | if (ret < 0) |
68 | return NB_ERR; | |
c37c6fd8 | 69 | |
9bee0232 | 70 | return NB_OK; |
c37c6fd8 | 71 | } |
ce45ffe7 CS |
72 | |
73 | /* | |
74 | * XPath: /frr-zebra:get-route-information | |
75 | */ | |
60ee8be1 | 76 | int get_route_information_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
77 | { |
78 | /* TODO: implement me. */ | |
79 | return NB_ERR_NOT_FOUND; | |
80 | } | |
81 | ||
82 | /* | |
83 | * XPath: /frr-zebra:get-v6-mroute-info | |
84 | */ | |
60ee8be1 | 85 | int get_v6_mroute_info_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
86 | { |
87 | /* TODO: implement me. */ | |
88 | return NB_ERR_NOT_FOUND; | |
89 | } | |
90 | ||
91 | /* | |
92 | * XPath: /frr-zebra:get-vrf-info | |
93 | */ | |
60ee8be1 | 94 | int get_vrf_info_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
95 | { |
96 | /* TODO: implement me. */ | |
97 | return NB_ERR_NOT_FOUND; | |
98 | } | |
99 | ||
100 | /* | |
101 | * XPath: /frr-zebra:get-vrf-vni-info | |
102 | */ | |
60ee8be1 | 103 | int get_vrf_vni_info_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
104 | { |
105 | /* TODO: implement me. */ | |
106 | return NB_ERR_NOT_FOUND; | |
107 | } | |
108 | ||
109 | /* | |
110 | * XPath: /frr-zebra:get-evpn-info | |
111 | */ | |
60ee8be1 | 112 | int get_evpn_info_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
113 | { |
114 | /* TODO: implement me. */ | |
115 | return NB_ERR_NOT_FOUND; | |
116 | } | |
117 | ||
118 | /* | |
119 | * XPath: /frr-zebra:get-vni-info | |
120 | */ | |
60ee8be1 | 121 | int get_vni_info_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
122 | { |
123 | /* TODO: implement me. */ | |
124 | return NB_ERR_NOT_FOUND; | |
125 | } | |
126 | ||
127 | /* | |
128 | * XPath: /frr-zebra:get-evpn-vni-rmac | |
129 | */ | |
60ee8be1 | 130 | int get_evpn_vni_rmac_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
131 | { |
132 | /* TODO: implement me. */ | |
133 | return NB_ERR_NOT_FOUND; | |
134 | } | |
135 | ||
136 | /* | |
137 | * XPath: /frr-zebra:get-evpn-vni-nexthops | |
138 | */ | |
60ee8be1 | 139 | int get_evpn_vni_nexthops_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
140 | { |
141 | /* TODO: implement me. */ | |
142 | return NB_ERR_NOT_FOUND; | |
143 | } | |
144 | ||
145 | /* | |
146 | * XPath: /frr-zebra:get-evpn-macs | |
147 | */ | |
60ee8be1 | 148 | int get_evpn_macs_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
149 | { |
150 | /* TODO: implement me. */ | |
151 | return NB_ERR_NOT_FOUND; | |
152 | } | |
153 | ||
154 | /* | |
155 | * XPath: /frr-zebra:get-evpn-arp-cache | |
156 | */ | |
60ee8be1 | 157 | int get_evpn_arp_cache_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
158 | { |
159 | /* TODO: implement me. */ | |
160 | return NB_ERR_NOT_FOUND; | |
161 | } | |
162 | ||
163 | /* | |
164 | * XPath: /frr-zebra:get-pbr-ipset | |
165 | */ | |
60ee8be1 | 166 | int get_pbr_ipset_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
167 | { |
168 | /* TODO: implement me. */ | |
169 | return NB_ERR_NOT_FOUND; | |
170 | } | |
171 | ||
172 | /* | |
173 | * XPath: /frr-zebra:get-pbr-iptable | |
174 | */ | |
60ee8be1 | 175 | int get_pbr_iptable_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
176 | { |
177 | /* TODO: implement me. */ | |
178 | return NB_ERR_NOT_FOUND; | |
179 | } | |
180 | ||
181 | /* | |
182 | * XPath: /frr-zebra:get-debugs | |
183 | */ | |
60ee8be1 | 184 | int get_debugs_rpc(struct nb_cb_rpc_args *args) |
ce45ffe7 CS |
185 | { |
186 | /* TODO: implement me. */ | |
187 | return NB_ERR_NOT_FOUND; | |
188 | } |