[SNMP4J] Tables: createRow

Jerome Jabson jjabson at yahoo.com
Tue Oct 13 23:26:14 CEST 2009


Thanks Frank! I'm still having some problems trying to create a row. I have the code below:

        OID rowStatusOid = new OID("1.3.6.1.4.1.9.9.42.1.2.1.1.9");
        OID indexOid = new OID("1.3.6.1.4.1.9.9.42.1.2.1.1.1");
        
        Variable[] rowValue = new Variable[]{
            new OctetString("Admin"),
            new OctetString("Admin Tag"),
            new Integer32(5),
            new Integer32(5001),
            new Integer32(65),
            new Integer32(5001),
            new Integer32(2),
            new Integer32(1),
            new Integer32(1),
            new OctetString("Group1")        
        };
        
        responseEvent = tableUtils.createRow(target, rowStatusOid, indexOid, (VariableBinding[]) rowValue);
        System.out.println("CreatRow response: " + responseEvent.toString());

When createRow gets called I get the following error:
java.lang.ClassCastException: [Lorg.snmp4j.smi.Variable; cannot be cast to [Lorg.snmp4j.smi.VariableBinding;

Am I calling this the right way? 

Thanks again,
Jerome




----- Original Message ----
From: Frank Fock <fock at agentpp.com>
To: Jerome Jabson <jjabson at yahoo.com>
Cc: snmp4j at agentpp.org
Sent: Tue, October 13, 2009 12:14:34 PM
Subject: Re: [SNMP4J] Tables: createRow

Hello Jerome,

All TCs are directly based on SNMP base types (if not
the MIB specification is buggy). Use that base type,
because on the wire there are no TCs but base types
only.

Best regards,
Frank

Jerome Jabson wrote:
> Hello,
> 
> I'm new to using SNMP4J. I'm writing a compliance test application, and wanted to use the SNMP4J APIs. I'm having some difficulties with trying to create a row, and have searched the forum for some examples. the Java docs for TableUtils createRow requires an array of VariableBinding values such as:
> 
> 
> Variable[] rowValues = new Variable[] {
>                     new Integer32(RowStatus.active),
>                     new Integer32(rowCount),
>                     new OctetString(remotePeer.cisIp),
>                     new OctetString(remotePeer.uid),
>                     new OctetString(remotePeer.admIp),
>                     new Integer32(1),
>                     new Integer32(1),
>                     new Integer32(1),
>                     new Integer32(1),
>                     new OctetString()
>                  };
> 
> My question is: How can I do this for types that are custom developed? i.e. We have TC type of RttmonRttType or other types
> I can't seem to fined such ass SnmpAdminString, TruthValue, etc...
> Is there someplace that shows me how I can accomplish this?
> 
> Thanks in advance,
> Jerome
> 
> 
>       _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j

-- AGENT++
http://www.agentpp.com
http://www.snmp4j.com
http://www.mibexplorer.com
http://www.mibdesigner.com


      



More information about the SNMP4J mailing list