HI,

   I have implemented an AgentX subagent.
The mib is standard Q-BRIDGE_MIB, node is

dot1qVlanVersionNumber OBJECT-TYPE
    SYNTAX      INTEGER {
                    version1(1)
                }
    MAX-ACCESS  read-only
    STATUS      current
    DESCRIPTION
        "The version number of IEEE 802.1Q that this device
        supports."
    REFERENCE
        "IEEE 802.1Q/D11 Section 12.10.1.1"
    ::= { dot1qBase 1 }


I have generated the code using mib2c dot1qVlanVersionNumber 
1.net-snmp style
2. Both ways scalar and tied integer.

code generated and modified from mib2c.scalar.conf is 
long    dot1qVlanVersionNumber = 1;  /* XXX: set default value */

/*
 * Our initialization routine, called automatically by the agent
 * (Note that the function name must match init_FILENAME())
 */
void
init_dot1qVlanVersionNumber(void)
{

            static oid dot1qVlanVersionNumber_oid[] = { 
1,3,6,1,2,1,17,7,1,1,1 };

              DEBUGMSGTL(("dot1qVlanVersionNumber", "Initializing\n"));

                  netsnmp_register_scalar(
 netsnmp_create_handler_registration("dot1qVlanVersionNumber", 
handle_dot1qVlanVersionNumber,
 dot1qVlanVersionNumber_oid, OID_LENGTH(dot1qVlanVersionNumber_oid),
              HANDLER_CAN_RONLY
                      ));
}
int handle_dot1qVlanVersionNumber(netsnmp_mib_handler *handler,
                          netsnmp_handler_registration *reginfo,
                          netsnmp_agent_request_info   *reqinfo,
                          netsnmp_request_info         *requests)
{

          switch(reqinfo->mode) {

               case MODE_GET:
               case MODE_GETNEXT:
                    snmp_set_var_typed_value(requests->requestvb, 
ASN_INTEGER,
                                        (u_char *) 
&dot1qVlanVersionNumber/* XXX: a pointer to the scalar's data */,
                                         sizeof(long)/* XXX: the length of 
the data in bytes */);
               break;


              default:
                   /* we should never get here, so this is a really bad 
error */
                   snmp_log(LOG_ERR, "unknown mode (%d) in 
handle_dot1qVlanVersionNumber\n", reqinfo->mode );
                   return SNMP_ERR_GENERR;
        }

  return SNMP_ERR_NOERROR;
}



When I do snmpwalk I get

snmpwalk -v3 -u hmcuser -A abc12345 -X abc12345 -a MD5 -l authPriv 
localhost Q-BRIDGE-MIB::dot1qVlanVersionNumber
Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = INTEGER: version1(1)
Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = Wrong Type (should be INTEGER): 
NULL
Error: OID not increasing: Q-BRIDGE-MIB::dot1qVlanVersionNumber.0
 >= Q-BRIDGE-MIB::dot1qVlanVersionNumber.0

snmpget is working fine
snmpget -v3 -u hmcuser -A abc12345 -X abc12345 -a MD5 -l authPriv 
localhost Q-BRIDGE-MIB::dot1qVlanVersionNumber.0
Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = INTEGER: version1(1)

This behaviour is same when code is generated using tied integer.

Why I am getting  Q-BRIDGE-MIB::dot1qVlanVersionNumber.0 = Wrong Type 
(should be INTEGER): NULL
Error: OID not increasing: Q-BRIDGE-MIB::dot1qVlanVersionNumber.0
 >= Q-BRIDGE-MIB::dot1qVlanVersionNumber.0
 in snmpwalk output?

I searched for this in archive and found that this is probably due to my 
agent is broken.
Where is agent broken and how to fix it?

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Net-snmp-coders mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/net-snmp-coders

Reply via email to