Reputation: 1
First I have to mention I have to use SNMP4J version 1.7.6a for specific reasons.
In our application, we have to deal with 2 different SNMP v3 agents, each with a specific security name / auth/priv. We need to make requests to one, and catch traps coming from the other one, all in the same JVM.
When setting up only one or the other, it works, but when setting both, the first one fail. Here how we do it :
this.snmp = new Snmp(new DefaultUdpTransportMapping());
final OctetString osLocalEngineID = new OctetString(MPv3.createLocalEngineID());
final USM usm = new USM(SecurityProtocols.getInstance(), osLocalEngineID, 0);
SecurityModels.getInstance().addSecurityModel(usm);
this.snmp.listen();
final OctetString sName = new OctetString(securityName);
final OctetString authPass = new OctetString(authPassPhrase);
final OctetString privPass = new OctetString(privacyPassPhrase);
final UsmUser user = new UsmUser(sName, AuthSHA.ID, authPass, PrivDES.ID, privPass);
usm.addUser(sName, user);
I assume the problem come from the fact we create 2 different USM with their USMUser, when there’s only one SecurityProtocol.getInstance / SecurityModels.getInstance(). Is there no way to manage different devices in the same JVM ? Seems unlikely. I saw there was in more recent version a way to pass a scecific USM to a SNMP instance, via MPv3(USM usm) constructor, but is there a way to do it in 1.7.6a where such constructor doesn’t exist ?
When looking at the sources of SNMP4J, it seems there's only one USM used at once, overrided by multiple call to addSecurityModel(usm); I fail to see how it works.
Thanks for your help
Upvotes: 0
Views: 52