diff options
author | Christian Hopps <chopps@labn.net> | 2024-09-17 03:34:10 +0200 |
---|---|---|
committer | Christian Hopps <chopps@labn.net> | 2024-09-18 04:27:36 +0200 |
commit | c5df98aece868db29743b72e4a24112067944bd4 (patch) | |
tree | 93d5d8df353a778755a0e7dac412812f030c5647 /mgmtd/mgmt_fe_adapter.c | |
parent | Merge pull request #16774 from donaldsharp/bgp_give_some_ordering_increases (diff) | |
download | frr-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.c | 25 |
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; |