SNMP frontend, new preli table handling code

Skipped data set and use table-helper only
Specialized SNMP error handling
This commit is contained in:
Olof hagsand 2022-05-26 17:47:28 +02:00
parent 1a2edb7a2a
commit b2be7e9e1b
15 changed files with 750 additions and 363 deletions

View file

@ -124,6 +124,7 @@ static struct errvec EV[] = {
{"Undefined", OE_UNDEF},
/* From here error extensions using clixon_err_cat_reg */
{"OpenSSL error", OE_SSL},
{"SNMP error", OE_SNMP},
{"Nghttp2 error", OE_NGHTTP2},
{NULL, -1}
};

View file

@ -186,7 +186,7 @@ clicon_rpc_msg(clicon_handle h,
#ifdef RPC_USERNAME_ASSERT
assert(strstr(msg->op_body, "username")!=NULL); /* XXX */
#endif
clicon_debug(1, "%s request:%s", __FUNCTION__, msg->op_body);
clicon_debug(2, "%s request:%s", __FUNCTION__, msg->op_body);
/* Create a socket and connect to it, either UNIX, IPv4 or IPv6 per config options */
if (clicon_rpc_msg_once(h, msg, &retdata, &eof, &s) < 0)
goto done;
@ -215,7 +215,7 @@ clicon_rpc_msg(clicon_handle h,
goto done;
#endif
}
clicon_debug(1, "%s retdata:%s", __FUNCTION__, retdata);
clicon_debug(2, "%s retdata:%s", __FUNCTION__, retdata);
if (retdata){
/* Cannot populate xret here because need to know RPC name (eg "lock") in order to associate yang

View file

@ -1959,6 +1959,9 @@ yang_valstr2enum(yang_stmt *ytype,
* @param[in] ytype YANG type noden
* @param[in] enumstr Value of enum
* @param[out] valstr Corresponding string containing an int (direct pointer, dont free)
* @retval 1 OK, result in valstr
* @retval 0 Invalid, not found
* @retval -1 Error
*/
int
yang_enum2valstr(yang_stmt *ytype,
@ -1974,14 +1977,17 @@ yang_enum2valstr(yang_stmt *ytype,
goto done;
}
if ((yenum = yang_find(ytype, Y_ENUM, enumstr)) == NULL)
goto done;
goto fail;
/* Should assign value if yval not found */
if ((yval = yang_find(yenum, Y_VALUE, NULL)) == NULL)
goto done;
*valstr = yang_argument_get(yval);
retval = 0;
retval = 1;
done:
return retval;
fail:
retval = 0;
goto done;
}
/*! Get integer value from xml node from yang enumeration

View file

@ -473,7 +473,7 @@ ys_do_refine(yang_stmt *yr,
return retval;
}
/*! Yang node yg is a leaf in yang node list yn
/*! Check if Yang node y is a leaf in yang node list yp
* Could be made to a generic function used elsewhere as well
* @param[in] y Yang leaf
* @param[in] yp Yang list parent
@ -503,7 +503,6 @@ ys_iskey(yang_stmt *y,
return 0;
}
/*! Helper function to yang_expand_grouping
* @param[in] yn Yang parent node of uses ststement
* @param[in] ys Uses statement