Re: [SNMP4J] Issues with SET on a read-write column

2011-11-02 Thread Frank Fock
Hi Aswin,

Your index definition proves my guess.
The index you create does not match your definition.
You can find examples in the SNMP4J-Agent code
if you search for "toSubIndex(false)". That is a method
of OctetString which creates a sub-index OID value
from an OCTET STRING.

Also read the SNMP RFCs about the INDEX SMI construct
for more details.

Best regards,
Frank


Am 02.11.2011 02:54, schrieb adireddy.as...@rsa.com:
> 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:
> 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:
>
>> 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  }
>>
>>
>>
>> testConfigParamNameOBJECT-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.
>>

Re: [SNMP4J] SampleAgent/AgentConfigManager with persistent data ?

2011-11-02 Thread Binh Le
Found that I missed the shutdown hook :).

Thanks,
Binh.

On Wed, Nov 2, 2011 at 1:23 PM, Binh Le  wrote:
> Greetings,
>
> I tried to run the SampleAgent by both indicating "-c
> persistentConfig" file and runtime  and hardcoded a value for
> configFile in SampleAgent.java, but whatever configuration I applied
> to the agent during its life were not stored and I didn't see that
> persistent file created after hitting Ctrl-C to terminate the agent.
> Can someone help to tell what I am missing?
>
> Thanks,
> Binh.
>
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


[SNMP4J] SampleAgent/AgentConfigManager with persistent data ?

2011-11-02 Thread Binh Le
Greetings,

I tried to run the SampleAgent by both indicating "-c
persistentConfig" file and runtime  and hardcoded a value for
configFile in SampleAgent.java, but whatever configuration I applied
to the agent during its life were not stored and I didn't see that
persistent file created after hitting Ctrl-C to terminate the agent.
Can someone help to tell what I am missing?

Thanks,
Binh.
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


Re: [SNMP4J] SnmpV3 Encryption Provider as Configurable parameter

2011-11-02 Thread Peter Verthez
Hi Frank,

To elaborate on this (because the context wasn't really explained in the 
original mail of Jones):

We found that in performance tests on our product (with a big number of 
agents) that there was a high thread contention for SNMPv3 managed 
agents.   A jstack showed that a lot of our threads were running in the 
following stack frame at the moment of the jstack, which indicates that 
this functionality generates a relatively big load:

"JM-282" prio=3 tid=0x00013f032800 nid=0x391 runnable 
[0xfffc89f38000]
java.lang.Thread.State: RUNNABLE
 at sun.security.pkcs11.wrapper.PKCS11.C_DestroyObject(Native Method)
 at sun.security.pkcs11.SessionKeyRef.dispose(P11Key.java:1070)
 at 
sun.security.pkcs11.SessionKeyRef.drainRefQueueBounded(P11Key.java:1046)
 at sun.security.pkcs11.SessionKeyRef.(P11Key.java:1061)
 at sun.security.pkcs11.P11Key.(P11Key.java:97)
 at sun.security.pkcs11.P11Key$P11SecretKey.(P11Key.java:374)
 at sun.security.pkcs11.P11Key.secretKey(P11Key.java:266)
 at 
sun.security.pkcs11.P11SecretKeyFactory.createKey(P11SecretKeyFactory.java:222)
 at 
sun.security.pkcs11.P11SecretKeyFactory.convertKey(P11SecretKeyFactory.java:131)
 at sun.security.pkcs11.P11Cipher.engineGetKeySize(P11Cipher.java:828)
 at javax.crypto.Cipher.b(DashoA13*..)
 at javax.crypto.Cipher.a(DashoA13*..)
 at javax.crypto.Cipher.a(DashoA13*..)
 at javax.crypto.Cipher.a(DashoA13*..)
 - locked <0xfffd81aa1ca8> (a java.lang.Object)
 at javax.crypto.Cipher.init(DashoA13*..)
 at javax.crypto.Cipher.init(DashoA13*..)
 at org.snmp4j.security.PrivDES.encrypt(PrivDES.java:111)
 at org.snmp4j.security.USM.generateResponseMessage(USM.java:461)
 at org.snmp4j.security.USM.generateRequestMessage(USM.java:215)
 at org.snmp4j.mp.MPv3.prepareOutgoingMessage(MPv3.java:767)
 at 
org.snmp4j.MessageDispatcherImpl.sendPdu(MessageDispatcherImpl.java:444)
 at org.snmp4j.Snmp.sendMessage(Snmp.java:1067)
 at org.snmp4j.Snmp.send(Snmp.java:895)
 - locked <0xfffd81aa2068> (a org.snmp4j.Snmp$SyncResponseListener)
 at org.snmp4j.Snmp.send(Snmp.java:875)

Originally, our performance team pointed in the direction of SNMP4J, 
saying that SNMP4J should probably not call Cipher.init() so much, but I 
could show them that section 8.1.1.1 in RFC 2574 requires to init the 
Cipher for each packet separately.

So then we started looking at alternatives, and we found that if we 
hacked SNMP4J to use the Apache BouncyCastle security provider, the 
thread contention was gone and our application behaved properly.   So 
presumably the Sun JCE security provider that is used by default by 
SNMP4J is not very optimally written.

Now, we would not like to have to maintain our own patch on SNMP4J, so 
that is where the question from Jones came from: we tried to change the 
default security provider that SNMP4J uses without touching SNMP4J's 
code, but Security.insertProviderAt() apparently doesn't help in that 
even if we insert the provider at position 0.

Could an API be added to permit applications to change the security 
provider that SNMP4J uses?

Best regards,
Peter.


On 24/10/2011 9:00, jones vinu wrote:
> Hi Frank,
>   We would want to change the Cipher encryption provider in our 
> application used by snmp4j since the Sun JCE provider is heavy weight . But 
> unfortunately we have not been able to change it without modifying snmp4j 
> since the Sun JCE provider is considered as the default provider even when we 
>  insert Apache bouncy castle as the first priority provider. Hence it would 
> be good if we have option to configure the provider as a Configurable 
> parameter in some property file.
>
> Security.insertProviderAt(new BouncyCastleProvider(), 0);
>  try {
>  Cipher alg = Cipher.getInstance("DESede/CBC/NoPadding");
>  System.out.println(alg.getProvider());
>  } catch (NoSuchAlgorithmException e) {
>  // TODO Auto-generated catch block
>  e.printStackTrace();
>  } catch (NoSuchPaddingException e) {
>  // TODO Auto-generated catch block
>  e.printStackTrace();
>  }
> Output :SunJCE version 1.6
>
> And using it as
>   Cipher alg = Cipher.getInstance("DESede/CBC/NoPadding","BC");
> Output :BC version 1.4
>
> Thanks
> Jones
>
> ___
> SNMP4J mailing list
> SNMP4J@agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j


-- 
Peter Verthez
Systems Engineer Network Mgt.
Alcatel-Lucent Bell NV


___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j


[SNMP4J] snmp4j v3 configuration

2011-11-02 Thread nadeesh t v
hi ,

 Regarding this I guess this is my 3rd mail.

  I am an SNMP application developer. I am using your snmp4j-2.0.2.
I am trying snmpv3 get request.If am setting all the security related
parameters
I am getting the correct values. But if am giving anything wrong
(authUsername,passwd ,protocol etc) It's not returning the error. Some time
i
am getting some garbage values and some time I am getting error response as
null.

I am using Webnms SNMP agent simulator.

Earlier everything was perfectly fine with Netsnmp5.6.1 Manager  and same
agent

I am eagerly waiting for ur reply . Because then only I can proceed whether
to use snmp4j or not.


Expecting some reply



Regards,
Nadeesh TV
___
SNMP4J mailing list
SNMP4J@agentpp.org
http://lists.agentpp.org/mailman/listinfo/snmp4j