summaryrefslogtreecommitdiff
path: root/mgmtd/mgmt_vty.c
diff options
context:
space:
mode:
authorIgor Ryzhov <iryzhov@nfware.com>2024-01-14 00:53:21 +0200
committerIgor Ryzhov <iryzhov@nfware.com>2024-01-15 10:27:33 +0200
commit9859f308d23bf12a7f454ae65dada6d90f4c31db (patch)
tree57bb470f695f7dee68dbc3a53fc8507951134843 /mgmtd/mgmt_vty.c
parent10eac0a54dd943cabe43c59bce3f880b2e43b367 (diff)
lib, mgmtd: add ability to request the exact node in get-data request
RESTCONF expects to receive the exact node as a result, not the whole data tree. Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
Diffstat (limited to 'mgmtd/mgmt_vty.c')
-rw-r--r--mgmtd/mgmt_vty.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/mgmtd/mgmt_vty.c b/mgmtd/mgmt_vty.c
index e6f74c3129..f4b24acf3a 100644
--- a/mgmtd/mgmt_vty.c
+++ b/mgmtd/mgmt_vty.c
@@ -251,13 +251,14 @@ DEFPY(show_mgmt_get_config, show_mgmt_get_config_cmd,
}
DEFPY(show_mgmt_get_data, show_mgmt_get_data_cmd,
- "show mgmt get-data WORD$path [with-config|only-config]$content [json|xml]$fmt",
+ "show mgmt get-data WORD$path [with-config|only-config]$content [exact]$exact [json|xml]$fmt",
SHOW_STR
MGMTD_STR
"Get a data from the operational datastore\n"
"XPath expression specifying the YANG data root\n"
"Include \"config true\" data\n"
"Get only \"config true\" data\n"
+ "Get exact node instead of the whole data tree\n"
"JSON output format\n"
"XML output format\n")
{
@@ -269,6 +270,9 @@ DEFPY(show_mgmt_get_data, show_mgmt_get_data_cmd,
if (content && content[0] == 'w')
flags |= GET_DATA_FLAG_STATE;
+ if (exact)
+ flags |= GET_DATA_FLAG_EXACT;
+
/* get rid of extraneous trailing slash-* or single '/' unless root */
if (plen > 2 && ((path[plen - 2] == '/' && path[plen - 1] == '*') ||
(path[plen - 2] != '/' && path[plen - 1] == '/'))) {