summaryrefslogtreecommitdiffstats
path: root/mgmtd/mgmt_fe_adapter.c
diff options
context:
space:
mode:
authorChristian Hopps <chopps@labn.net>2024-09-17 03:34:10 +0200
committerChristian Hopps <chopps@labn.net>2024-09-18 04:27:36 +0200
commitc5df98aece868db29743b72e4a24112067944bd4 (patch)
tree93d5d8df353a778755a0e7dac412812f030c5647 /mgmtd/mgmt_fe_adapter.c
parentMerge pull request #16774 from donaldsharp/bgp_give_some_ordering_increases (diff)
downloadfrr-c5df98aece868db29743b72e4a24112067944bd4.tar.xz
frr-c5df98aece868db29743b72e4a24112067944bd4.zip
mgmtd: add ietf-yang-library support
Signed-off-by: Christian Hopps <chopps@labn.net>
Diffstat (limited to 'mgmtd/mgmt_fe_adapter.c')
-rw-r--r--mgmtd/mgmt_fe_adapter.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/mgmtd/mgmt_fe_adapter.c b/mgmtd/mgmt_fe_adapter.c
index 8d305ed52..32f28a577 100644
--- a/mgmtd/mgmt_fe_adapter.c
+++ b/mgmtd/mgmt_fe_adapter.c
@@ -1337,6 +1337,31 @@ static void fe_adapter_handle_get_data(struct mgmt_fe_session_ctx *session,
goto done;
}
+ /* Check for yang-library shortcut */
+ if (nb_oper_is_yang_lib_query(msg->xpath)) {
+ struct lyd_node *ylib = NULL;
+ LY_ERR err;
+
+ err = ly_ctx_get_yanglib_data(ly_native_ctx, &ylib, "%u",
+ ly_ctx_get_change_count(
+ ly_native_ctx));
+ if (err) {
+ fe_adapter_send_error(session, req_id, false, err,
+ "Error getting yang-library data, session-id: %" PRIu64
+ " error: %s",
+ session->session_id,
+ ly_last_errmsg());
+ } else {
+ yang_lyd_trim_xpath(&ylib, msg->xpath);
+ (void)fe_adapter_send_tree_data(session, req_id, false,
+ msg->result_type,
+ wd_options, ylib, 0);
+ }
+ if (ylib)
+ lyd_free_all(ylib);
+ goto done;
+ }
+
switch (msg->datastore) {
case MGMT_MSG_DATASTORE_CANDIDATE:
ds_id = MGMTD_DS_CANDIDATE;