summaryrefslogtreecommitdiffstats
path: root/zebra
diff options
context:
space:
mode:
authorChirag Shah <chirag@cumulusnetworks.com>2020-01-29 21:05:35 +0100
committerSantosh P K <sapk@vmware.com>2020-04-16 17:17:57 +0200
commitc37c6fd8183c8ad53312f80b88d7eaaca4ed3533 (patch)
tree6b41a13f6380d1cefa0bc5033bf566ada0a263be /zebra
parentzebra: clear dup detect cleanup for nb conversion (diff)
downloadfrr-c37c6fd8183c8ad53312f80b88d7eaaca4ed3533.tar.xz
frr-c37c6fd8183c8ad53312f80b88d7eaaca4ed3533.zip
zebra: nb rpc cb for clear evpn dup addr cmd
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r--zebra/zebra_nb_rpcs.c68
1 files changed, 58 insertions, 10 deletions
diff --git a/zebra/zebra_nb_rpcs.c b/zebra/zebra_nb_rpcs.c
index d0337f8c5..c8b73e7c3 100644
--- a/zebra/zebra_nb_rpcs.c
+++ b/zebra/zebra_nb_rpcs.c
@@ -22,6 +22,64 @@
#include "libfrr.h"
#include "zebra/zebra_nb.h"
+#include "zebra/zebra_router.h"
+#include "zebra/zebra_vrf.h"
+#include "zebra/zebra_vxlan.h"
+
+/*
+ * XPath: /frr-zebra:clear-evpn-dup-addr
+ */
+int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input,
+ struct list *output)
+{
+ struct zebra_vrf *zvrf;
+ int ret = NB_OK;
+ struct yang_data *yang_dup_choice = NULL, *yang_dup_vni = NULL,
+ *yang_dup_ip = NULL, *yang_dup_mac = NULL;
+
+ yang_dup_choice = yang_data_list_find(input, "%s/%s", xpath,
+ "input/clear-dup-choice");
+
+ zvrf = zebra_vrf_get_evpn();
+
+ if (yang_dup_choice
+ && strcmp(yang_dup_choice->value, "all-case") == 0) {
+ zebra_vxlan_clear_dup_detect_vni_all(NULL, zvrf);
+ } else {
+ vni_t vni;
+ struct ipaddr host_ip = {.ipa_type = IPADDR_NONE};
+ struct ethaddr mac;
+
+ yang_dup_vni = yang_data_list_find(
+ input, "%s/%s", xpath,
+ "input/clear-dup-choice/single-case/vni-id");
+ if (yang_dup_vni) {
+ vni = yang_str2uint32(yang_dup_vni->value);
+
+ yang_dup_mac = yang_data_list_find(
+ input, "%s/%s", xpath,
+ "input/clear-dup-choice/single-case/vni-id/mac-addr");
+ yang_dup_ip = yang_data_list_find(
+ input, "%s/%s", xpath,
+ "input/clear-dup-choice/single-case/vni-id/vni-ipaddr");
+
+ if (yang_dup_mac) {
+ yang_str2mac(value, &mac);
+ ret = zebra_vxlan_clear_dup_detect_vni_mac(
+ zvrf, vni, &mac);
+ } else if (yang_dup_ip) {
+ yang_str2ip(yang_dup_ip->value, &host_ip);
+ ret = zebra_vxlan_clear_dup_detect_vni_ip(
+ zvrf, vni, &host_ip);
+ } else
+ ret = zebra_vxlan_clear_dup_detect_vni(zvrf,
+ vni);
+ }
+ }
+ ret = (ret != CMD_SUCCESS) ? NB_ERR : NB_OK;
+
+ return ret;
+}
/*
* XPath: /frr-zebra:get-route-information
@@ -104,16 +162,6 @@ int get_evpn_vni_nexthops_rpc(const char *xpath, const struct list *input,
}
/*
- * XPath: /frr-zebra:clear-evpn-dup-addr
- */
-int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input,
- struct list *output)
-{
- /* TODO: implement me. */
- return NB_ERR_NOT_FOUND;
-}
-
-/*
* XPath: /frr-zebra:get-evpn-macs
*/
int get_evpn_macs_rpc(const char *xpath, const struct list *input,