Symbolic and combined debug names in cmd-line of all applications
New debug levels: BACKEND, CLI, NETCONF,RESTCONF, SNMP, STREAM
This commit is contained in:
parent
86f251f343
commit
4e3bd6fbdd
39 changed files with 564 additions and 416 deletions
|
|
@ -100,7 +100,7 @@ snmp_common_handler(netsnmp_mib_handler *handler,
|
|||
oid_cbuf(cb, (*shp)->sh_oid, (*shp)->sh_oidlen);
|
||||
if (oid_eq(requestvb->name, requestvb->name_length,
|
||||
(*shp)->sh_oid, (*shp)->sh_oidlen) == 0){ /* equal */
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\" %s inclusive:%d %s",
|
||||
clixon_debug(CLIXON_DBG_SNMP, "\"%s\" %s inclusive:%d %s",
|
||||
cbuf_get(cb),
|
||||
snmp_msg_int2str(reqinfo->mode),
|
||||
request->inclusive, tablehandler?"table":"scalar");
|
||||
|
|
@ -110,7 +110,7 @@ snmp_common_handler(netsnmp_mib_handler *handler,
|
|||
oid_cbuf(cb, requestvb->name, requestvb->name_length);
|
||||
cprintf(cb, ")");
|
||||
// nhreg->rootoid same as shp
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "\"%s\" %s inclusive:%d %s",
|
||||
clixon_debug(CLIXON_DBG_SNMP, "\"%s\" %s inclusive:%d %s",
|
||||
cbuf_get(cb),
|
||||
snmp_msg_int2str(reqinfo->mode),
|
||||
request->inclusive, tablehandler?"table":"scalar");
|
||||
|
|
@ -181,7 +181,7 @@ snmp_scalar_return(cxobj *xs,
|
|||
if ((ret = type_xml2snmp(xmlstr, &asn1type, &snmpval, &snmplen, &reason)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", reason);
|
||||
clixon_debug(CLIXON_DBG_SNMP, "%s", reason);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
|
|
@ -246,7 +246,7 @@ snmp_scalar_get(clixon_handle h,
|
|||
cxobj *xcache = NULL;
|
||||
char *body = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
/* Prepare backend call by constructing namespace context */
|
||||
if (xml_nsctx_yang(ys, &nsc) < 0)
|
||||
goto done;
|
||||
|
|
@ -301,7 +301,7 @@ snmp_scalar_get(clixon_handle h,
|
|||
if ((ret = type_xml2snmp(xmlstr, &asn1type, &snmpval, &snmplen, &reason)) < 0)
|
||||
goto done;
|
||||
if (ret == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%s", reason);
|
||||
clixon_debug(CLIXON_DBG_SNMP, "%s", reason);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
|
|
@ -408,7 +408,7 @@ snmp_scalar_set(clixon_handle h,
|
|||
int asn1_type;
|
||||
enum operation_type op = OP_MERGE;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
if ((xtop = xml_new(NETCONF_INPUT_CONFIG, NULL, CX_ELMNT)) == NULL)
|
||||
goto done;
|
||||
if (snmp_yang2xml(xtop, ys, cvk, &xbot) < 0)
|
||||
|
|
@ -557,7 +557,7 @@ snmp_cache_set(clixon_handle h,
|
|||
int isrowstatus = 0;
|
||||
cxobj *xcache = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
if ((yspec = clicon_dbspec_yang(h)) == NULL){
|
||||
clixon_err(OE_FATAL, 0, "No DB_SPEC");
|
||||
goto done;
|
||||
|
|
@ -601,7 +601,7 @@ snmp_cache_set(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
else if (strcmp(valstr, "destroy") == 0){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "%d", rowstatus);
|
||||
clixon_debug(CLIXON_DBG_SNMP, "%d", rowstatus);
|
||||
/* Don't send delete to backend if notInService(2) */
|
||||
if (snmp_cache_row_op(h, yang_parent_get(ys), cvk, "delete", rowstatus!=2) < 0)
|
||||
goto done;
|
||||
|
|
@ -660,7 +660,7 @@ snmp_table_rowstatus_get(clixon_handle h,
|
|||
cxobj *xr;
|
||||
char *body;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
/* Prepare backend call by constructing namespace context */
|
||||
if (xml_nsctx_yang(ys, &nsc) < 0)
|
||||
goto done;
|
||||
|
|
@ -705,7 +705,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
|
|||
netsnmp_variable_list *requestvb = request->requestvb;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP | CLIXON_DBG_DETAIL, "");
|
||||
if (snmp_common_handler(handler, nhreg, reqinfo, request, 0, &sh) < 0)
|
||||
goto done;
|
||||
/* see net-snmp/agent/snmp_agent.h / net-snmp/library/snmp.h */
|
||||
|
|
@ -727,7 +727,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
|
|||
if (type_yang2asn1(sh->sh_ys, &asn1_type, 0) < 0)
|
||||
goto done;
|
||||
if (requestvb->type != asn1_type){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Expected type:%d, got: %d", requestvb->type, asn1_type);
|
||||
clixon_debug(CLIXON_DBG_SNMP, "Expected type:%d, got: %d", requestvb->type, asn1_type);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto ok;
|
||||
|
|
@ -774,7 +774,7 @@ clixon_snmp_scalar_handler1(netsnmp_mib_handler *handler,
|
|||
ok:
|
||||
retval = SNMP_ERR_NOERROR;
|
||||
done:
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "retval:%d", retval);
|
||||
clixon_debug(CLIXON_DBG_SNMP, "retval:%d", retval);
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
|
@ -798,7 +798,7 @@ clixon_snmp_scalar_handler(netsnmp_mib_handler *handler,
|
|||
netsnmp_request_info *req;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
for (req = requests; req; req = req->next){
|
||||
ret = clixon_snmp_scalar_handler1(handler, nhreg, reqinfo, req);
|
||||
if (ret != SNMP_ERR_NOERROR){
|
||||
|
|
@ -1037,7 +1037,7 @@ snmp_table_set(clixon_handle h,
|
|||
goto done;
|
||||
requestvb = request->requestvb;
|
||||
if (requestvb->type != asn1_type){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Expected type:%d, got: %d", requestvb->type, asn1_type);
|
||||
clixon_debug(CLIXON_DBG_SNMP, "Expected type:%d, got: %d", requestvb->type, asn1_type);
|
||||
if ((ret = netsnmp_request_set_error(request, SNMP_ERR_WRONGTYPE)) != SNMPERR_SUCCESS){
|
||||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto ok;
|
||||
|
|
@ -1185,7 +1185,7 @@ snmp_table_getnext(clixon_handle h,
|
|||
yang_stmt *ynext = NULL;
|
||||
cbuf *cb = NULL;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
if ((ys = yang_parent_get(ylist)) == NULL ||
|
||||
yang_keyword_get(ys) != Y_CONTAINER){
|
||||
clixon_err(OE_YANG, EINVAL, "ylist parent is not list");
|
||||
|
|
@ -1247,7 +1247,7 @@ snmp_table_getnext(clixon_handle h,
|
|||
goto done;
|
||||
}
|
||||
oid_cbuf(cb, oidnext, oidnextlen);
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "next: %s", cbuf_get(cb));
|
||||
clixon_debug(CLIXON_DBG_SNMP, "next: %s", cbuf_get(cb));
|
||||
}
|
||||
retval = found;
|
||||
done:
|
||||
|
|
@ -1286,11 +1286,11 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
netsnmp_variable_list *requestvb;
|
||||
int err = 0;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT | CLIXON_DBG_DETAIL, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP | CLIXON_DBG_DETAIL, "");
|
||||
if ((ret = snmp_common_handler(handler, nhreg, reqinfo, request, 1, &sh)) < 0)
|
||||
goto done;
|
||||
if (sh->sh_ys == NULL){
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Error table not registered");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "Error table not registered");
|
||||
goto ok;
|
||||
}
|
||||
requestvb = request->requestvb;
|
||||
|
|
@ -1308,7 +1308,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Nosuchinstance");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "Nosuchinstance");
|
||||
}
|
||||
break;
|
||||
case MODE_GETNEXT: // 161
|
||||
|
|
@ -1323,7 +1323,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "No such object");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "No such object");
|
||||
}
|
||||
break;
|
||||
case MODE_SET_RESERVE1: // 0
|
||||
|
|
@ -1345,7 +1345,7 @@ clixon_snmp_table_handler1(netsnmp_mib_handler *handler,
|
|||
clixon_err(OE_SNMP, ret, "netsnmp_request_set_error");
|
||||
goto done;
|
||||
}
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "Nosuchinstance");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "Nosuchinstance");
|
||||
}
|
||||
/*
|
||||
* There does not seem to be a separate validation action and commit does not
|
||||
|
|
@ -1408,7 +1408,7 @@ clixon_snmp_table_handler(netsnmp_mib_handler *handler,
|
|||
netsnmp_request_info *req;
|
||||
int ret;
|
||||
|
||||
clixon_debug(CLIXON_DBG_CLIENT, "");
|
||||
clixon_debug(CLIXON_DBG_SNMP, "");
|
||||
for (req = requests; req; req = req->next){
|
||||
ret = clixon_snmp_table_handler1(handler, nhreg, reqinfo, req);
|
||||
if (ret != SNMP_ERR_NOERROR){
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue