Resending the mail. -----Original Message----- From: Aswin, Adireddy Sent: Tuesday, November 01, 2011 5:33 PM To: 'Frank Fock' Subject: RE: [SNMP4J] Issues with SET on a read-write column
Hi Frank, Thank you for a quick response. Here are my index definitions for the table mentioned earlier. oidTestConfigEntry = new OID(new int[]{1, 3, 6, 1, 4, 1, 2197, 10, 1, 3, 12, 1}); OID oidIDXTestConfigHost = new OID(new int[]{1, 3, 6, 1, 4, 1, 2197, 10, 1, 3, 12, 1, 1}); OID oidIDXTestConfigParamName = new OID(new int[]{1, 3, 6, 1, 4, 1, 2197, 10, 1, 3, 12, 1, 2}); MOTableSubIndex[] testConfigEntryIndexes = new MOTableSubIndex[]{ moFactory.createSubIndex(oidIDXDispatcherRuntimeConfigHost, SMIConstants.SYNTAX_OCTET_STRING), moFactory.createSubIndex(oidIDXDispatcherRuntimeConfigParamName, SMIConstants.SYNTAX_OCTET_STRING) }; MOTableIndex testConfigEntryIndex = moFactory.createIndex(testConfigEntryIndexes, false); MOColumn[] testConfigEntryColumns = new MOColumn[3]; testConfigEntryColumns[0]= moFactory.createColumn(1, SMIConstants.SYNTAX_OCTET_STRING, moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY)); // testConfigHost testConfigEntryColumns[1]= moFactory.createColumn(2, SMIConstants.SYNTAX_OCTET_STRING, moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_ONLY));// testConfigParamName testConfigEntryColumns[2]= moFactory.createColumn(3, SMIConstants.SYNTAX_OCTET_STRING, moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE)); // testConfigParamValue I use the following index logic while creating rows- int i = 1; for( ... ){ index = new OID(i); i++; addRow(rowFactory.createRow(index, values[])); //variable[] size is 3 // .. } If I have my index definition as the one below, the testConfigHost value is only getting populated in the 3rd column i.e. testConfigParamValue. //... testConfigEntryColumns = new MOColumn[1]; testConfigEntryColumns[0]= moFactory.createColumn(3, SMIConstants.SYNTAX_OCTET_STRING, moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_WRITE)); What am I missing here? Could you please elaborate as to what you mean by variable length for the index columns? Thanks and Regards Aswin -----Original Message----- From: Frank Fock [mailto:f...@agentpp.com] Sent: Monday, October 31, 2011 9:28 PM To: Aswin, Adireddy Cc: <snmp4j@agentpp.org> Subject: Re: [SNMP4J] Issues with SET on a read-write column Hi, I guess that you have chosen the wrong index for your SET operation. If you would have included the INDEX definition I could have checked it. OCTET STRING index columns have variable length and thus need an additional length sub-id if not specified otherwise for the last sub-index. Best regards Frank Am 31.10.2011 um 15:51 schrieb <adireddy.as...@rsa.com>: > Hi , > > > > I have a table with 2 indices and one read-write column. > > Here is the MIB entry- > > > > testRuntimeConfigEntry ::= SEQUENCE { > > testConfigHost OCTET STRING, > > testConfigParamName OCTET STRING, > > testConfigParamValue OCTET STRING > > } > > -- .1.3.6.1.4.1.2197.10.1.3.12.1 > > > > testConfigHost OBJECT-TYPE > > SYNTAX OCTET STRING > > ACCESS not-accessible > > STATUS current > > ::= { testConfigEntry 1 } > > > > testConfigParamName OBJECT-TYPE > > SYNTAX OCTET STRING > > ACCESS not-accessible > > STATUS current > > ::= { testConfigEntry 2 } > > > > testConfigParamValue OBJECT-TYPE > > SYNTAX OCTET STRING > > ACCESS read-write > > STATUS current > > ::= { testConfigEntry 3 } > > > > I have created a community "public". > > I'm able to do a walk on this table, no issues. > > (Currently I'm using iReasoning to get the table view) > > > > But when I do a SET, using "public" community, I get the following response > > RESPONSE[requestID=6891380, errorStatus=Unable to create object(11), > errorIndex=1, VBS[1.3.6.1.4.1.2197.10.1.3.12.1.3.1 = 30]] > > > > I have fiddled around with all possible view mappings, and I still got the > same error. > > After some digging around, I did manage to create another community "private". > > > > Now when I do a SET, using "private" community, on the read write column, I > get the following response > > RESPONSE[requestID=620227330, errorStatus=General variable binding error(5), > errorIndex=0, VBS[1.3.6.1.4.1.2197.10.1.3.12.1.3.1 = 30]] > > > > I'm using the following snippet to set the data > > //... > > pdu.add(new VariableBinding(new OID(strOID), new OctetString(valueToSet))); > > pdu.setType(PDU.SET); > > ResponseListener listener = new ResponseListener() { > > public void onResponse(ResponseEvent event) { > > ((Snmp)event.getSource()).cancel(event.getRequest(), this); > > PDU strResponse = event.getResponse(); > > if (strResponse!= null) > > System.out.println (strResponse.getErrorStatusText()); > > else > > System.out.println("Response is null"); > > }}; > > snmp.send(pdu, target, null, listener); > > snmp.close(); > > > > Here is a snippet of my view mappings and communities- > > > > //same for public community as well > > > > Variable[] com2sec1 = new Variable[] { new OctetString("private"), > //community name > > new > OctetString("cprivate"), // security name > > > getAgent().getContextEngineID(), // local engine ID > > new > OctetString("private"), // default context name > > new > OctetString(), // transport tag > > new > Integer32(StorageType.nonVolatile), // storage type > > new > Integer32(RowStatus.active) // row status > > }; > > > > MOTableRow row1 = > communityMIB.getSnmpCommunityEntry().createRow( > > new > OctetString("private").toSubIndex(true), com2sec1); > > > communityMIB.getSnmpCommunityEntry().addRow(row1); > > > > vacm.addGroup(SecurityModel.SECURITY_MODEL_SNMPv2c, > > new OctetString("cprivate"), > > new OctetString("v1v2group"), > > StorageType.nonVolatile); > > > > vacm.addAccess(new OctetString("v1v2group"), new OctetString("private"), > > SecurityModel.SECURITY_MODEL_SNMPv2c, > > SecurityLevel.NOAUTH_NOPRIV, > > MutableVACM.VACM_MATCH_EXACT, > > new OctetString("fullReadView"), > > new OctetString("fullWriteView"), > > new OctetString("fullNotifyView"), > > StorageType.nonVolatile); > > > > vacm.addViewTreeFamily(new OctetString("fullWriteView"), new > OID(".1.3.6.1.4.1.2197.10.1.3.12.1.3"), > > new OctetString(), VacmMIB.vacmViewIncluded, > > StorageType.nonVolatile); > > > > What am I missing here or what am I doing wrong here? > > Appreciate any help. > > Thanks in advance. > > > > Regards, > > Aswin > > > > _______________________________________________ > SNMP4J mailing list > SNMP4J@agentpp.org > http://lists.agentpp.org/mailman/listinfo/snmp4j _______________________________________________ SNMP4J mailing list SNMP4J@agentpp.org http://lists.agentpp.org/mailman/listinfo/snmp4j