RFC8040 4.8.9. RESTCONF with-defaults Query Parameter

This commit is contained in:
Jan-Olof Carlson 2022-07-26 13:44:06 +00:00 committed by Olof hagsand
parent 9647177165
commit 6bee1746e0
4 changed files with 90 additions and 2 deletions

View file

@ -54,6 +54,7 @@ int clicon_rpc_copy_config(clicon_handle h, char *db1, char *db2);
int clicon_rpc_delete_config(clicon_handle h, char *db);
int clicon_rpc_lock(clicon_handle h, char *db);
int clicon_rpc_unlock(clicon_handle h, char *db);
int clicon_rpc_get2(clicon_handle h, char *xpath, cvec *nsc, netconf_content content, int32_t depth, char *with_defaults, cxobj **xret);
int clicon_rpc_get(clicon_handle h, char *xpath, cvec *nsc, netconf_content content, int32_t depth, cxobj **xret);
int clicon_rpc_get_pageable_list(clicon_handle h, char *datastore, char *xpath,
cvec *nsc, netconf_content content, int32_t depth,

View file

@ -858,6 +858,21 @@ clicon_rpc_get(clicon_handle h,
netconf_content content,
int32_t depth,
cxobj **xt)
{
return clicon_rpc_get2(h, xpath, nsc, content, depth, NULL, xt);
}
/*! Same functionality as the 'clicon_rpc_get' function, but with an additional input parameter 'with-defaults'.
* @see clicon_rpc_get
*/
int
clicon_rpc_get2(clicon_handle h,
char *xpath,
cvec *nsc, /* namespace context for filter */
netconf_content content,
int32_t depth,
char *with_defaults,
cxobj **xt)
{
int retval = -1;
struct clicon_msg *msg = NULL;
@ -897,6 +912,8 @@ clicon_rpc_get(clicon_handle h,
goto done;
cprintf(cb, "/>");
}
if (with_defaults != NULL)
cprintf(cb, "<with-defaults xmlns=\"urn:ietf:params:xml:ns:yang:ietf-netconf-with-defaults\">%s</with-defaults>", with_defaults);
cprintf(cb, "</get></rpc>");
if ((msg = clicon_msg_encode(session_id,
"%s", cbuf_get(cb))) == NULL)