diff options
author | Igor Ryzhov <iryzhov@nfware.com> | 2024-03-18 18:24:40 +0100 |
---|---|---|
committer | Igor Ryzhov <iryzhov@nfware.com> | 2024-04-22 15:36:22 +0200 |
commit | 03883ee431565b4a1f4857f6655ed8c97313b204 (patch) | |
tree | d5f73327c8172b13b7c59c23f704b5fe9377ca2e /lib | |
parent | lib: rework northbound RPC callback (diff) | |
download | frr-03883ee431565b4a1f4857f6655ed8c97313b204.tar.xz frr-03883ee431565b4a1f4857f6655ed8c97313b204.zip |
tests: add test for NB RPC callback
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/yang.c | 10 | ||||
-rw-r--r-- | lib/yang.h | 15 |
2 files changed, 25 insertions, 0 deletions
diff --git a/lib/yang.c b/lib/yang.c index 013a76284..f506d8bf2 100644 --- a/lib/yang.c +++ b/lib/yang.c @@ -653,6 +653,16 @@ void yang_dnode_free(struct lyd_node *dnode) lyd_free_all(dnode); } +void yang_dnode_rpc_output_add(struct lyd_node *output, const char *xpath, + const char *value) +{ + LY_ERR err; + + err = lyd_new_path(output, ly_native_ctx, xpath, value, + LYD_NEW_PATH_OUTPUT | LYD_NEW_PATH_UPDATE, NULL); + assert(err == LY_SUCCESS); +} + struct yang_data *yang_data_new(const char *xpath, const char *value) { struct yang_data *data; diff --git a/lib/yang.h b/lib/yang.h index 25703b187..1903079d1 100644 --- a/lib/yang.h +++ b/lib/yang.h @@ -536,6 +536,21 @@ extern struct lyd_node *yang_dnode_dup(const struct lyd_node *dnode); extern void yang_dnode_free(struct lyd_node *dnode); /* + * Add a libyang data node to an RPC/action output container. + * + * output + * RPC/action output container. + * + * xpath + * XPath of the data node to add, relative to the output container. + * + * value + * String representing the value of the data node. + */ +extern void yang_dnode_rpc_output_add(struct lyd_node *output, + const char *xpath, const char *value); + +/* * Create a new yang_data structure. * * xpath |