Thanks for the quick help Frank!
So my original implementation at used TestAgent from version 2.3.1, so I’m running into a few obstacles using the SampleAgent example from version 3.5, “\src\main\java\org\snmp4j\agent\test.”
The first issue I am having is at line 186
agent.setContext(new SecurityModels(),
new SecurityProtocols(SecurityProtocols.SecurityProtocolSet.maxCompatibility), new CounterSupport());
My ide is telling me that, “SecurityProtocolSet cannot be resolved or is not a field” I’m having a hard time finding that inside the SecurityProtocols class. Not exactly sure what I should subsituite in there at the moment, but I’ll keep digging around for answers.
Next, I understand that the protected void registerMIBs()
should be functionally the same as registerManagedObjects()
found in TestAgent
. In my use case, I’ll just need to define a MOGroup
object and register it on the module. Should be simple enough.
Another concern is that I am unsure where we are adding the User and access control settings. In the TestAgent example, we had functions to define this
protected void addViews(VacmMIB vacm)
vacm.addGroup(SecurityModel.SECURITY_MODEL_USM,
new OctetString("TEST"),
new OctetString("v3test"),
StorageType.nonVolatile);
vacm.addViewTreeFamily(new OctetString("fullReadView"), new OID("1.3"),
new OctetString(), VacmMIB.vacmViewIncluded,
StorageType.nonVolatile);
protected void addUsmUser(USM usm)
UsmUser user = new UsmUser(new OctetString("TEST"),
AuthSHA.ID,
new OctetString("maplesyrup"),
PrivDES.ID,
new OctetString("maplesyrup"));
usm.addUser(user.getSecurityName(), usm.getLocalEngineID(), user);
The closest thing I can find to this is in the main function at line 379
SecurityProtocols.getInstance().addDefaultProtocols();
Or maybe pass a new USM object to the snmpConfigurator at line 181 rather than calling getUsm()
?
protected Session createSnmpSession(MessageDispatcher dispatcher) {
Session session = super.createSnmpSession(dispatcher);
snmpConfigurator.configure(session, getUsm(), messageDispatcher, args);
return session;
}
For my simulated use case, every agent will likely have the same exact access control settings, but if I were to want them unique I’m unsure where to specify?
Once again thanks for your assistance! I’m trying my best to learn the ins and outs of your framework. I’m going to keep experimenting with this to see if I can get things running in the meantime! Any intuitions or nudges in the right direction are always appreciated!