From a94f74bc2ed8165b66c640096586e78f63a0aaf4 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Wed, 20 Mar 2024 00:46:07 +0200 Subject: lib: add native RPC processing to mgmt frontend client Signed-off-by: Igor Ryzhov --- lib/northbound_cli.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'lib/northbound_cli.c') 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); -- cgit v1.2.3