diff options
| author | Chirag Shah <chirag@nvidia.com> | 2020-10-03 15:34:33 -0700 |
|---|---|---|
| committer | Chirag Shah <chirag@nvidia.com> | 2020-10-05 13:15:59 -0700 |
| commit | f63f5f1947c3b4a99e97494198520f03fb6b063e (patch) | |
| tree | 8c1071614c685dc9d8a68322ecd6cf0ce85b7e37 /lib/northbound_cli.c | |
| parent | 002bac8b5bc229f892c66e3c13c4c058a2b10e27 (diff) | |
*: add errmsg to nb rpc
Display human readable error message in northbound rpc
transaction failure. In case of vtysh nb client, the error
message will be displayed to user.
Testing:
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 'lib/northbound_cli.c')
| -rw-r--r-- | lib/northbound_cli.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c index 6ce520149a..a7f3a1b305 100644 --- a/lib/northbound_cli.c +++ b/lib/northbound_cli.c @@ -284,10 +284,12 @@ int nb_cli_apply_changes(struct vty *vty, const char *xpath_base_fmt, ...) return CMD_SUCCESS; } -int nb_cli_rpc(const char *xpath, struct list *input, struct list *output) +int nb_cli_rpc(struct vty *vty, const char *xpath, struct list *input, + struct list *output) { struct nb_node *nb_node; int ret; + char errmsg[BUFSIZ] = {0}; nb_node = nb_node_find(xpath); if (!nb_node) { @@ -296,11 +298,14 @@ int nb_cli_rpc(const char *xpath, struct list *input, struct list *output) return CMD_WARNING; } - ret = nb_callback_rpc(nb_node, xpath, input, output); + ret = nb_callback_rpc(nb_node, xpath, input, output, errmsg, + sizeof(errmsg)); switch (ret) { case NB_OK: return CMD_SUCCESS; default: + if (strlen(errmsg)) + vty_show_nb_errors(vty, ret, errmsg); return CMD_WARNING; } } |
