diff options
author | Chirag Shah <chirag@cumulusnetworks.com> | 2020-02-06 22:32:34 +0100 |
---|---|---|
committer | Santosh P K <sapk@vmware.com> | 2020-04-16 17:17:59 +0200 |
commit | d36228c956d54e1f0f8c24ea166f83c14b1450bc (patch) | |
tree | 35cc762bb512c72c6a07d11f3180a55e4621d9aa /zebra | |
parent | zebra: nb rpc cb for clear evpn dup addr cmd (diff) | |
download | frr-d36228c956d54e1f0f8c24ea166f83c14b1450bc.tar.xz frr-d36228c956d54e1f0f8c24ea166f83c14b1450bc.zip |
zebra: convert clear evpn dup addr command to nb
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
Diffstat (limited to 'zebra')
-rw-r--r-- | zebra/zebra_nb_rpcs.c | 4 | ||||
-rw-r--r-- | zebra/zebra_vty.c | 44 |
2 files changed, 35 insertions, 13 deletions
diff --git a/zebra/zebra_nb_rpcs.c b/zebra/zebra_nb_rpcs.c index c8b73e7c3..cf8efe40a 100644 --- a/zebra/zebra_nb_rpcs.c +++ b/zebra/zebra_nb_rpcs.c @@ -44,7 +44,7 @@ int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input, if (yang_dup_choice && strcmp(yang_dup_choice->value, "all-case") == 0) { - zebra_vxlan_clear_dup_detect_vni_all(NULL, zvrf); + zebra_vxlan_clear_dup_detect_vni_all(zvrf); } else { vni_t vni; struct ipaddr host_ip = {.ipa_type = IPADDR_NONE}; @@ -64,7 +64,7 @@ int clear_evpn_dup_addr_rpc(const char *xpath, const struct list *input, "input/clear-dup-choice/single-case/vni-id/vni-ipaddr"); if (yang_dup_mac) { - yang_str2mac(value, &mac); + yang_str2mac(yang_dup_mac->value, &mac); ret = zebra_vxlan_clear_dup_detect_vni_mac( zvrf, vni, &mac); } else if (yang_dup_ip) { diff --git a/zebra/zebra_vty.c b/zebra/zebra_vty.c index 0b9d1e9e7..9bd15cdf9 100644 --- a/zebra/zebra_vty.c +++ b/zebra/zebra_vty.c @@ -54,6 +54,7 @@ #include "zebra/zebra_pbr.h" #include "zebra/zebra_nhg.h" #include "zebra/interface.h" +#include "northbound_cli.h" extern int allow_delete; @@ -2934,15 +2935,28 @@ DEFPY (clear_evpn_dup_addr, "IPv4 address\n" "IPv6 address\n") { - struct zebra_vrf *zvrf; struct ipaddr host_ip = {.ipa_type = IPADDR_NONE }; int ret = CMD_SUCCESS; + struct list *input; + struct yang_data *yang_dup = NULL, *yang_dup_ip = NULL, + *yang_dup_mac = NULL; - zvrf = zebra_vrf_get_evpn(); - if (vni_str) { + input = list_new(); + + if (!vni_str) { + yang_dup = yang_data_new( + "/frr-zebra:clear-evpn-dup-addr/input/clear-dup-choice", + "all-case"); + } else { + yang_dup = yang_data_new_uint32( + "/frr-zebra:clear-evpn-dup-addr/input/clear-dup-choice/single-case/vni-id", + vni); if (!is_zero_mac(&mac->eth_addr)) { - ret = zebra_vxlan_clear_dup_detect_vni_mac( - zvrf, vni, &mac->eth_addr); + yang_dup_mac = yang_data_new_mac( + "/frr-zebra:clear-evpn-dup-addr/input/clear-dup-choice/single-case/vni-id/mac-addr", + &mac->eth_addr); + if (yang_dup_mac) + listnode_add(input, yang_dup_mac); } else if (ip) { if (sockunion_family(ip) == AF_INET) { host_ip.ipa_type = IPADDR_V4; @@ -2952,15 +2966,23 @@ DEFPY (clear_evpn_dup_addr, memcpy(&host_ip.ipaddr_v6, &ip->sin6.sin6_addr, sizeof(struct in6_addr)); } - ret = zebra_vxlan_clear_dup_detect_vni_ip(zvrf, vni, - &host_ip); - } else - ret = zebra_vxlan_clear_dup_detect_vni(zvrf, vni); - } else { - ret = zebra_vxlan_clear_dup_detect_vni_all(zvrf); + yang_dup_ip = yang_data_new_ip( + "/frr-zebra:clear-evpn-dup-addr/input/clear-dup-choice/single-case/vni-id/vni-ipaddr", + &host_ip); + + if (yang_dup_ip) + listnode_add(input, yang_dup_ip); + } } + if (yang_dup) { + listnode_add(input, yang_dup); + ret = nb_cli_rpc("/frr-zebra:clear-evpn-dup-addr", input, NULL); + } + + list_delete(&input); + return ret; } |