org.opennms.mock.snmp
Class MockSnmpAgent

java.lang.Object
  extended by org.snmp4j.agent.BaseAgent
      extended by org.opennms.mock.snmp.MockSnmpAgent
All Implemented Interfaces:
Runnable

public class MockSnmpAgent
extends org.snmp4j.agent.BaseAgent
implements Runnable


Field Summary
 
Fields inherited from class org.snmp4j.agent.BaseAgent
agent, agentState, bootCounterFile, configFileURI, defaultContext, defaultPersistenceProvider, defaultProxyForwarder, dispatcher, mpv3, notificationOriginator, server, session, snmp4jConfigMIB, snmp4jLogMIB, snmpCommunityMIB, snmpFrameworkMIB, snmpNotificationMIB, snmpProxyMIB, snmpTargetMIB, snmpv2MIB, STATE_CREATED, STATE_INIT_FINISHED, STATE_INIT_STARTED, STATE_RUNNING, STATE_STOPPED, sysDescr, sysOID, sysServices, transportMappings, usm, usmMIB, vacmMIB
 
Constructor Summary
MockSnmpAgent(File bootFile, File confFile, org.springframework.core.io.Resource moFile, String bindAddress)
           
 
Method Summary
protected  void addCommunities(org.snmp4j.agent.mo.snmp.SnmpCommunityMIB communityMIB)
           
protected  void addNotificationTargets(org.snmp4j.agent.mo.snmp.SnmpTargetMIB targetMIB, org.snmp4j.agent.mo.snmp.SnmpNotificationMIB notificationMIB)
           
protected  void addUsmUser(org.snmp4j.security.USM usm)
           
protected  void addViews(org.snmp4j.agent.mo.snmp.VacmMIB vacm)
           
static MockSnmpAgent createAgentAndRun(org.springframework.core.io.Resource moFile, String bindAddress)
           
protected  List<org.snmp4j.agent.ManagedObject> createMockMOs()
           
protected  void initTransportMappings()
           
 boolean isRunning()
           
 boolean isStopped()
           
static void main(String[] args)
           
protected  void registerManagedObjects()
           
protected  void registerSnmpMIBs()
           
 void run()
           
 void shutDown()
           
 void shutDownAndWait()
           
protected  void unregisterManagedObjects()
           
protected  void unregisterSnmpMIBs()
           
 void updateCounter32Value(String oid, int val)
           
 void updateCounter64Value(String oid, long val)
           
 void updateIntValue(String oid, int val)
           
 void updateStringValue(String oid, String val)
           
 void updateValue(org.snmp4j.smi.OID oid, org.snmp4j.smi.Variable value)
           
 void updateValue(String oid, org.snmp4j.smi.Variable value)
           
 
Methods inherited from class org.snmp4j.agent.BaseAgent
addShutdownHook, finishInit, getAgent, getAgentState, getBootCounterFile, getConfigFile, getContext, getDefaultContext, getDefaultProxyForwarder, getEngineBoots, getMPv3, getNotificationOriginator, getServer, getSession, getSnmp4jConfigMIB, getSnmp4jLogMIB, getSnmpCommunityMIB, getSnmpFrameworkMIB, getSnmpNotificationMIB, getSnmpProxyMIB, getSnmpTargetMIB, getSnmpv2MIB, getSysDescr, getSysOID, getSysServices, getUsm, getUsmMIB, getVacmMIB, init, initConfigMIB, initMessageDispatcher, initSnmpSession, loadConfig, saveConfig, sendColdStartNotification, setAgent, setBootCounterFile, setConfigFile, setDefaultContext, setDefaultProxyForwarder, setEngineBoots, setSysDescr, setSysOID, setSysServices, setupDefaultProxyForwarder, stop, updateEngineBoots, updateSession
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MockSnmpAgent

public MockSnmpAgent(File bootFile,
                     File confFile,
                     org.springframework.core.io.Resource moFile,
                     String bindAddress)
Method Detail

createAgentAndRun

public static MockSnmpAgent createAgentAndRun(org.springframework.core.io.Resource moFile,
                                              String bindAddress)
                                       throws InterruptedException
Throws:
InterruptedException

main

public static void main(String[] args)

shutDownAndWait

public void shutDownAndWait()
                     throws InterruptedException
Throws:
InterruptedException

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class org.snmp4j.agent.BaseAgent

shutDown

public void shutDown()

isRunning

public boolean isRunning()

isStopped

public boolean isStopped()

addCommunities

protected void addCommunities(org.snmp4j.agent.mo.snmp.SnmpCommunityMIB communityMIB)
Specified by:
addCommunities in class org.snmp4j.agent.BaseAgent

addViews

protected void addViews(org.snmp4j.agent.mo.snmp.VacmMIB vacm)
Specified by:
addViews in class org.snmp4j.agent.BaseAgent

addNotificationTargets

protected void addNotificationTargets(org.snmp4j.agent.mo.snmp.SnmpTargetMIB targetMIB,
                                      org.snmp4j.agent.mo.snmp.SnmpNotificationMIB notificationMIB)
Specified by:
addNotificationTargets in class org.snmp4j.agent.BaseAgent

addUsmUser

protected void addUsmUser(org.snmp4j.security.USM usm)
Specified by:
addUsmUser in class org.snmp4j.agent.BaseAgent

initTransportMappings

protected void initTransportMappings()
                              throws IOException
Overrides:
initTransportMappings in class org.snmp4j.agent.BaseAgent
Throws:
IOException

registerSnmpMIBs

protected void registerSnmpMIBs()
Overrides:
registerSnmpMIBs in class org.snmp4j.agent.BaseAgent

unregisterSnmpMIBs

protected void unregisterSnmpMIBs()
Overrides:
unregisterSnmpMIBs in class org.snmp4j.agent.BaseAgent

registerManagedObjects

protected void registerManagedObjects()
Specified by:
registerManagedObjects in class org.snmp4j.agent.BaseAgent

unregisterManagedObjects

protected void unregisterManagedObjects()
Specified by:
unregisterManagedObjects in class org.snmp4j.agent.BaseAgent

createMockMOs

protected List<org.snmp4j.agent.ManagedObject> createMockMOs()

updateValue

public void updateValue(org.snmp4j.smi.OID oid,
                        org.snmp4j.smi.Variable value)

updateValue

public void updateValue(String oid,
                        org.snmp4j.smi.Variable value)

updateIntValue

public void updateIntValue(String oid,
                           int val)

updateStringValue

public void updateStringValue(String oid,
                              String val)

updateCounter32Value

public void updateCounter32Value(String oid,
                                 int val)

updateCounter64Value

public void updateCounter64Value(String oid,
                                 long val)


Copyright © 2008. All Rights Reserved.