[SNMP4J] SNMPv3 Configuration
Jim Doble
jim.doble at tavve.com
Mon Jul 11 20:43:20 CEST 2005
Frank:
Thanks for the quick reply to my earlier questions. I have two followup
questions:
1) For requests, if I am using the Snmp.discoverAuthoritativeEngineID
method, I think it would make sense to see if the MPv3 instance already has
a cached engineID for a given address before calling
Snmp.discoverAuthoritativeEngineID. If there is no cached engineID, then I
would call Snmp.discoverAuthoritativeEngineID, and when it returns, I would
create and register a UsmUser with the appropriate userName, engineID, and
passwords. I am imagining something like the following (simplified):
MPv3 mpv3 = (MPv3)
snmp.getMessageProcessingModel(MessageProcessingModel.MPv3);
OctetString engineId = mpv3.getEngineID(address);
if (engineId == null) {
byte[] engineIdBytes = snmp.discoverAuthoritativeEngineID(address,
timeout);
engineId = new OctetString(engineIdBytes);
UsmUser user = new UsmUser(securityName, AuthMD5.ID, authPw, null,
null));
snmp.getUSM().addUser(securityName, engineId, user);
}
// perform the request...
Does this make sense?
2) I am wondering if a more general solution, that would also work for
traps, would be to add a listener mechanism to the MPv3 class, whereby
listeners would be notified whenever a new engineID is associated with an
address (addEngineID method) or unassociated with an address (removeEngineID
method), whether through the discovery mechanism, or by any other means.
That way, I could register a listener that would register any UsmUsers
associated with that address:
void engineIdAdded(Address address, OctetString engineId) {
// repeat the following for all securityNames associated with address
UsmUser user = new UsmUser(securityName, AuthMD5.ID, authPw, null,
null));
snmp.getUSM().addUser(securityName, engineId, user);
}
void engineIdRemoved(Address address, OctetString engineId) {
// repeat the following for all securityNames associated with address
snmp.getUSM().removeUser(securityName, engineId);
}
Does this make sense? If you decide to do this, or a similar callback
mechanism in your next release, when do you anticipate that release becoming
available?
Regards,
Jim Doble
Tavve Software Company
More information about the SNMP4J
mailing list