C-API: All calls to clicon_log_xml() changed to new function `clicon_debug_xml()\
Debugging, moved many detailed debugs from level 1 to 2
This commit is contained in:
parent
3916fa919c
commit
bc6cc2b31f
22 changed files with 114 additions and 49 deletions
|
|
@ -1529,7 +1529,7 @@ from_client_msg(clicon_handle h,
|
|||
char *namespace = NULL;
|
||||
int nr = 0;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
clicon_debug(2, "%s", __FUNCTION__);
|
||||
yspec = clicon_dbspec_yang(h);
|
||||
/* Return netconf message. Should be filled in by the dispatch(sub) functions
|
||||
* as wither rpc-error or by positive response.
|
||||
|
|
@ -1699,7 +1699,7 @@ from_client_msg(clicon_handle h,
|
|||
if (cbuf_len(cbret) == 0)
|
||||
if (netconf_operation_failed(cbret, "application", clicon_errno?clicon_err_reason:"unknown")< 0)
|
||||
goto done;
|
||||
clicon_debug(1, "%s cbret:%s", __FUNCTION__, cbuf_get(cbret));
|
||||
clicon_debug(2, "%s cbret:%s", __FUNCTION__, cbuf_get(cbret));
|
||||
/* XXX problem here is that cbret has not been parsed so may contain
|
||||
parse errors */
|
||||
if (send_msg_reply(ce->ce_s, cbuf_get(cbret), cbuf_len(cbret)+1) < 0){
|
||||
|
|
@ -1759,7 +1759,7 @@ from_client(int s,
|
|||
clicon_handle h = ce->ce_handle;
|
||||
int eof = 0;
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
clicon_debug(2, "%s", __FUNCTION__);
|
||||
if (s != ce->ce_s){
|
||||
clicon_err(OE_NETCONF, EINVAL, "Internal error: s != ce->ce_s");
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -751,8 +751,7 @@ get_list_pagination(clicon_handle h,
|
|||
if ((ret = xml_bind_yang(xret, YB_MODULE, yspec, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_debug_get() && xret)
|
||||
clicon_log_xml(LOG_DEBUG, xret, "Yang bind pagination state");
|
||||
clicon_debug_xml(1, xret, "Yang bind pagination state");
|
||||
if (clixon_netconf_internal_error(xerr,
|
||||
". Internal error, state callback returned invalid XML",
|
||||
NULL) < 0)
|
||||
|
|
@ -860,8 +859,7 @@ get_common(clicon_handle h,
|
|||
#else
|
||||
wdef = WITHDEFAULTS_EXPLICIT;
|
||||
#endif
|
||||
|
||||
clicon_debug(1, "%s", __FUNCTION__);
|
||||
clicon_debug(2, "%s", __FUNCTION__);
|
||||
username = clicon_username_get(h);
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clicon_err(OE_YANG, ENOENT, "No yang spec9");
|
||||
|
|
@ -1007,8 +1005,7 @@ get_common(clicon_handle h,
|
|||
(ret = xml_yang_validate_add(h, xret, &xerr)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "VALIDATE_STATE");
|
||||
clicon_debug_xml(1, xret, "VALIDATE_STATE");
|
||||
if (clixon_netconf_internal_error(xerr,
|
||||
". Internal error, state callback returned invalid XML",
|
||||
NULL) < 0)
|
||||
|
|
@ -1039,7 +1036,7 @@ get_common(clicon_handle h,
|
|||
ok:
|
||||
retval = 0;
|
||||
done:
|
||||
clicon_debug(1, "%s retval:%d", __FUNCTION__, retval);
|
||||
clicon_debug(2, "%s retval:%d", __FUNCTION__, retval);
|
||||
if (xvec)
|
||||
free(xvec);
|
||||
if (xret)
|
||||
|
|
|
|||
|
|
@ -368,8 +368,7 @@ clixon_plugin_statedata_all(clicon_handle h,
|
|||
x = NULL;
|
||||
continue;
|
||||
}
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
|
||||
clicon_debug_xml(2, x, "%s %s STATE:", __FUNCTION__, clixon_plugin_name_get(cp));
|
||||
/* XXX: ret == 0 invalid yang binding should be handled as internal error */
|
||||
if ((ret = xml_bind_yang(x, YB_MODULE, yspec, &xerr)) < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -238,8 +238,7 @@ api_return_err(clicon_handle h,
|
|||
}
|
||||
}
|
||||
#if 1
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xerr, "%s Send error:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xerr, "%s Send error:", __FUNCTION__);
|
||||
#endif
|
||||
if (xml_name_set(xerr, "error") < 0)
|
||||
goto done;
|
||||
|
|
|
|||
|
|
@ -490,7 +490,7 @@ api_data_write(clicon_handle h,
|
|||
goto done;
|
||||
}
|
||||
if (namespace == NULL){
|
||||
clicon_log_xml(LOG_DEBUG, xparent, "%s xparent:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xparent, "%s xparent:", __FUNCTION__);
|
||||
/* XXX */
|
||||
}
|
||||
/* Set xmlns="" default namespace attribute (if diff from default) */
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ api_data_get2(clicon_handle h,
|
|||
*/
|
||||
#if 0 /* DEBUG */
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "%s xret:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xret, "%s xret:", __FUNCTION__);
|
||||
#endif
|
||||
/* Check if error return */
|
||||
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
|
|
@ -502,8 +502,7 @@ api_data_pagination(clicon_handle h,
|
|||
* We need to cut that tree to only the object.
|
||||
*/
|
||||
#if 0 /* DEBUG */
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "%s xret:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xret, "%s xret:", __FUNCTION__);
|
||||
#endif
|
||||
/* Check if error return */
|
||||
if ((xe = xpath_first(xret, NULL, "//rpc-error")) != NULL){
|
||||
|
|
|
|||
|
|
@ -622,8 +622,7 @@ yang_patch_do_edit(clicon_handle h,
|
|||
yang_stmt *ybot = NULL;
|
||||
yang_stmt *ymod;
|
||||
|
||||
|
||||
clicon_log_xml(LOG_DEBUG, xn, "%s %d xn:", __FUNCTION__, __LINE__);
|
||||
clicon_debug_xml(1, xn, "%s %d xn:", __FUNCTION__, __LINE__);
|
||||
/* Create cbufs:s */
|
||||
if ((simple_patch_request_uri = cbuf_new()) == NULL){
|
||||
clicon_err(OE_UNIX, errno, "cbuf_new");
|
||||
|
|
|
|||
|
|
@ -326,8 +326,7 @@ api_data_post(clicon_handle h,
|
|||
if (restconf_insert_attributes(xdata, qvec) < 0)
|
||||
goto done;
|
||||
#if 1
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xdata, "%s xdata:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xdata, "%s xdata:", __FUNCTION__);
|
||||
#endif
|
||||
|
||||
/* Create text buffer for transfer to backend */
|
||||
|
|
@ -487,8 +486,7 @@ api_operations_post_input(clicon_handle h,
|
|||
* <data><input xmlns="urn:example:clixon">...</input></data>
|
||||
*/
|
||||
#if 1
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xdata, "%s xdata:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xdata, "%s xdata:", __FUNCTION__);
|
||||
#endif
|
||||
/* Validate that exactly only <input> tag */
|
||||
if ((xinput = xml_child_i_type(xdata, 0, CX_ELMNT)) == NULL ||
|
||||
|
|
@ -585,8 +583,7 @@ api_operations_post_output(clicon_handle h,
|
|||
xml_name_set(xoutput, "output");
|
||||
/* xoutput should now look: <output><x xmlns="uri">0</x></output> */
|
||||
#if 1
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xoutput, "%s xoutput:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xoutput, "%s xoutput:", __FUNCTION__);
|
||||
#endif
|
||||
/* Remove original netconf default namespace. Somewhat unsure what "output" belongs to? */
|
||||
if ((xa = xml_find_type(xoutput, NULL, "xmlns", CX_ATTR)) != NULL)
|
||||
|
|
@ -798,8 +795,7 @@ api_operations_post(clicon_handle h,
|
|||
/* Here xtop is:
|
||||
<rpc username="foo"><myfn xmlns="uri"><x>42</x></myfn></rpc> */
|
||||
#if 1
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xtop, "%s 5. Translate input args:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xtop, "%s 5. Translate input args:", __FUNCTION__);
|
||||
#endif
|
||||
/* 6. Validate outgoing RPC and fill in defaults */
|
||||
if ((ret = xml_bind_yang_rpc(xtop, yspec, &xerr)) < 0) /* */
|
||||
|
|
@ -820,8 +816,7 @@ api_operations_post(clicon_handle h,
|
|||
* <rpc username="foo"><myfn xmlns="uri"><x>42</x><y>99</y></myfn></rpc>
|
||||
*/
|
||||
#if 0
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xtop, "%s 6. Validate and defaults:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xtop, "%s 6. Validate and defaults:", __FUNCTION__);
|
||||
#endif
|
||||
/* 7. Send to RPC handler, either local or backend
|
||||
* Note (1) xtop is <rpc><method> xbot is <method>
|
||||
|
|
@ -862,8 +857,7 @@ api_operations_post(clicon_handle h,
|
|||
* <rpc-reply><x xmlns="uri">0</x></rpc-reply>
|
||||
*/
|
||||
#if 1
|
||||
if (clicon_debug_get())
|
||||
clicon_log_xml(LOG_DEBUG, xret, "%s Receive reply:", __FUNCTION__);
|
||||
clicon_debug_xml(1, xret, "%s Receive reply:", __FUNCTION__);
|
||||
#endif
|
||||
youtput = yang_find(yrpc, Y_OUTPUT, NULL);
|
||||
if ((ret = api_operations_post_output(h, req, xret, yspec, youtput, namespace,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue