summaryrefslogtreecommitdiff
path: root/lib/northbound_cli.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-03-20 00:46:07 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-04-22 16:36:23 +0300
commita94f74bc2ed8165b66c640096586e78f63a0aaf4 (patch)
treed5e0d0f56973c0f9ea946a5707f85eef4830dbd8 /lib/northbound_cli.c
parentcb6c18285235be8a5d030f87db837632cc20611f (diff)
lib: add native RPC processing to mgmt frontend client
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib/northbound_cli.c')
-rw-r--r--lib/northbound_cli.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/northbound_cli.c b/lib/northbound_cli.c
index 5be64f0134..4f962cda5c 100644
--- a/lib/northbound_cli.c
+++ b/lib/northbound_cli.c
@@ -322,6 +322,22 @@ int nb_cli_rpc(struct vty *vty, const char *xpath, struct lyd_node **output_p)
assert(err == LY_SUCCESS);
}
+ if (vty_mgmt_fe_enabled()) {
+ char *data = NULL;
+
+ err = lyd_print_mem(&data, input, LYD_JSON, LYD_PRINT_SHRINK);
+ assert(err == LY_SUCCESS);
+
+ ret = vty_mgmt_send_rpc_req(vty, LYD_JSON, xpath, data);
+
+ free(data);
+ lyd_free_all(input);
+
+ if (ret < 0)
+ return CMD_WARNING;
+ return CMD_SUCCESS;
+ }
+
/* validate input tree to create implicit defaults */
err = lyd_validate_op(input, NULL, LYD_TYPE_RPC_YANG, NULL);
assert(err == LY_SUCCESS);