SNMP frontend, forgot add some files in last commit
This commit is contained in:
parent
18ff854e12
commit
b3a6700fd5
4 changed files with 10 additions and 8 deletions
|
|
@ -253,7 +253,7 @@ snmp_scalar_get(clicon_handle h,
|
|||
netsnmp_set_request_error(reqinfo, requests, SNMP_NOSUCHINSTANCE);
|
||||
goto ok;
|
||||
}
|
||||
if (type_yang2asn1(ys, &asn1type) < 0)
|
||||
if (type_yang2asn1(ys, &asn1type, 1) < 0)
|
||||
goto done;
|
||||
if ((ret = type_snmpstr2val(snmpstr, &asn1type, &snmpval, &snmplen, &reason)) < 0)
|
||||
goto done;
|
||||
|
|
@ -383,7 +383,7 @@ clixon_snmp_scalar_handler(netsnmp_mib_handler *handler,
|
|||
break;
|
||||
case MODE_SET_RESERVE1: /* 0 */
|
||||
/* Translate from YANG ys leaf type to SNMP asn1.1 type ids (not value), also cvtype */
|
||||
if (type_yang2asn1(ys, &asn1_type) < 0)
|
||||
if (type_yang2asn1(ys, &asn1_type, 0) < 0)
|
||||
goto done;
|
||||
if (requestvb->type != asn1_type){
|
||||
clicon_debug(1, "%s Expected type:%d, got: %d", __FUNCTION__, requestvb->type, asn1_type);
|
||||
|
|
|
|||
|
|
@ -154,6 +154,7 @@ snmp_handle_free(clixon_snmp_handle *sh)
|
|||
*
|
||||
* @param[in] ys YANG leaf node
|
||||
* @param[out] asn1_type ASN.1 type id
|
||||
* @param[in] extended Special case clixon extended types used in xml<->asn1 data conversions
|
||||
* @retval 0 OK
|
||||
* @retval -1 Error
|
||||
* @see type_yang2snmp, yang only
|
||||
|
|
@ -162,7 +163,8 @@ snmp_handle_free(clixon_snmp_handle *sh)
|
|||
*/
|
||||
int
|
||||
type_yang2asn1(yang_stmt *ys,
|
||||
int *asn1_type)
|
||||
int *asn1_type,
|
||||
int extended)
|
||||
{
|
||||
int retval = -1;
|
||||
yang_stmt *yrestype; /* resolved type */
|
||||
|
|
@ -201,10 +203,10 @@ type_yang2asn1(yang_stmt *ys,
|
|||
else if (strcmp(origtype, "timeticks")==0){
|
||||
at = ASN_TIMETICKS; /* Clixon extended string type */
|
||||
}
|
||||
else if (strcmp(origtype, "phys-address")==0){
|
||||
else if (extended && strcmp(origtype, "phys-address")==0){
|
||||
at = CLIXON_ASN_PHYS_ADDR; /* Clixon extended string type */
|
||||
}
|
||||
else if (strcmp(origtype, "SnmpAdminString")==0){
|
||||
else if (extended && strcmp(origtype, "SnmpAdminString")==0){
|
||||
at = CLIXON_ASN_ADMIN_STRING; /* cf extension display-type 255T? */
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -61,7 +61,7 @@ typedef struct clixon_snmp_handle clixon_snmp_handle;
|
|||
int snmp_access_str2int(char *modes_str);
|
||||
const char *snmp_msg_int2str(int msg);
|
||||
int snmp_handle_free(clixon_snmp_handle *sh);
|
||||
int type_yang2asn1(yang_stmt *ys, int *asn1_type);
|
||||
int type_yang2asn1(yang_stmt *ys, int *asn1_type, int extended);
|
||||
int type_snmp2xml(yang_stmt *ys,
|
||||
netsnmp_variable_list *requestvb,
|
||||
netsnmp_agent_request_info *reqinfo,
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ mib_yang_leaf(clicon_handle h,
|
|||
if (yang_extension_value(ys, "max-access", IETF_YANG_SMIV2_NS, NULL, &modes_str) < 0)
|
||||
goto done;
|
||||
/* Sanity check of types */
|
||||
if (type_yang2asn1(ys, NULL) < 0)
|
||||
if (type_yang2asn1(ys, NULL, 0) < 0)
|
||||
goto done;
|
||||
|
||||
/* Get modes (access) read-only, read-write, not-accessible, accessible-for-notify
|
||||
|
|
@ -292,7 +292,7 @@ mib_yang_table(clicon_handle h,
|
|||
yang_argument_get(ylist), keyname);
|
||||
goto done;
|
||||
}
|
||||
if (type_yang2asn1(yleaf, &asn1type) < 0)
|
||||
if (type_yang2asn1(yleaf, &asn1type, 0) < 0)
|
||||
// goto done;
|
||||
goto ok; // XXX skip
|
||||
if (snmp_varlist_add_variable(&table_info->indexes,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue