From OpenNMS
Contents |
Vision
Develop a SNMP Agent (MockSNMPAgent) that responds with test data for use in validating, scanning, collection, and topology code. Combine it with the MockNetwork code to provide an entire test harness. Use SNMP4J-Agent for this; see SNMP4J-Agent Notes
Approach
- Use the org.snmp4j.agent.test.TestAgent class as a starting point.
- Replace the registerManagedObjects method
- Remove the createStaticIfTable method
- Create a new MockSnmpMOLoader interface
- Classes that load mock SNMP managed objects (MOs) implement this interface
- Initial implementing class will load mock MOs from properties files
- Code to the interface to allow for other mock MO storage mechanisms down the road
Initial Implementation
Where to find it
In package org.opennms.netmgt.snmp.mock. In Eclipse, look in opennms-services/src/test/java for this package. First appears in Subversion revision 3817.
Cast of Characters
Class SnmpMockAgent
Implements a generic mock agent that answers enterprises.5813 (The OpenNMS Group enterprise number) for sysObjectID. The constructor takes three Files and a String. See MockSnmpAgentTest for a usage example. Useless on its own without a MockSnmpMOLoader implementation and some MO (managed object) data.
Interface MockSnmpMOLoader
Class PropsMockSnmpMOLoaderImpl
Class SnmpMockAgentTest
Version History/Availability
- This feature was added in version 1.3.2






