diff options
author | Chirag Shah <chirag@nvidia.com> | 2020-10-04 01:12:31 +0200 |
---|---|---|
committer | Chirag Shah <chirag@nvidia.com> | 2020-10-05 22:57:54 +0200 |
commit | 9bee02322f69e34c54510f8dff245e52794fdfc8 (patch) | |
tree | 13d272969c3abf5a94b472fb9312a186df339b1b /zebra/zebra_nb_rpcs.c | |
parent | *: add errmsg to nb rpc (diff) | |
download | frr-9bee02322f69e34c54510f8dff245e52794fdfc8.tar.xz frr-9bee02322f69e34c54510f8dff245e52794fdfc8.zip |
zebra: display rpc error msg to vtysh
Zebra's clear duplicate detect command is rpc converted.
There is condition where cli fails with human readable message.
Using northboun's errmsg buffer to display error message to
user.
Testing:
bharat# clear evpn dup-addr vni 1002 ip 2011:11::11
Error type: generic error
Error description: Requested IP's associated MAC aa:aa:aa:aa:aa:aa is still in duplicate state
bharat# clear evpn dup-addr vni 1002 ip 11.11.11.11
Error type: generic error
Error description: Requested IP's associated MAC aa:aa:aa:aa:aa:aa is still in duplicate state
Signed-off-by: Chirag Shah <chirag@nvidia.com>
Diffstat (limited to 'zebra/zebra_nb_rpcs.c')
-rw-r--r-- | zebra/zebra_nb_rpcs.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/zebra/zebra_nb_rpcs.c b/zebra/zebra_nb_rpcs.c index 204cc5da6..e7d438b1a 100644 --- a/zebra/zebra_nb_rpcs.c +++ b/zebra/zebra_nb_rpcs.c @@ -65,19 +65,22 @@ int clear_evpn_dup_addr_rpc(struct nb_cb_rpc_args *args) if (yang_dup_mac) { yang_str2mac(yang_dup_mac->value, &mac); ret = zebra_vxlan_clear_dup_detect_vni_mac( - zvrf, vni, &mac); + zvrf, vni, &mac, args->errmsg, + args->errmsg_len); } 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); + zvrf, vni, &host_ip, args->errmsg, + args->errmsg_len); } else ret = zebra_vxlan_clear_dup_detect_vni(zvrf, vni); } } - ret = (ret != CMD_SUCCESS) ? NB_ERR : NB_OK; + if (ret < 0) + return NB_ERR; - return ret; + return NB_OK; } /* |