Search in sources :

Example 46 with SnmpAgentConfig

use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.

the class SnmpPeerFactoryTest method testProxiedAgent.

public void testProxiedAgent() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("10.0.0.3"));
    assertEquals("10.0.0.3", InetAddressUtils.str(agentConfig.getProxyFor()));
    assertEquals("127.0.0.1", InetAddressUtils.str(agentConfig.getAddress()));
    agentConfig.toString();
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 47 with SnmpAgentConfig

use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.

the class SnmpPeerFactoryTest method testDefaultMaxVarsPerPdu.

public void testDefaultMaxVarsPerPdu() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr(myLocalHost()));
    assertEquals(23, agentConfig.getMaxVarsPerPdu());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 48 with SnmpAgentConfig

use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.

the class SnmpPeerFactoryTest method testGetSnmpAgentConfig.

public void testGetSnmpAgentConfig() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr(myLocalHost()));
    assertEquals(SnmpAgentConfig.VERSION2C, agentConfig.getVersion());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 49 with SnmpAgentConfig

use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.

the class SnmpPeerFactoryTest method testSnmpv3WithNoAuthNoPriv.

public void testSnmpv3WithNoAuthNoPriv() throws Exception {
    SnmpPeerFactory.setInstance(new SnmpPeerFactory(new ByteArrayResource(getSnmpConfig().getBytes())));
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("10.11.12.13"));
    assertEquals("opennmsuser1", agentConfig.getSecurityName());
    assertEquals("VF:2", agentConfig.getContextName());
    assertNull(agentConfig.getAuthProtocol());
    assertNull(agentConfig.getPrivProtocol());
    assertNull(agentConfig.getAuthPassPhrase());
    assertNull(agentConfig.getPrivPassPhrase());
    assertEquals(1, agentConfig.getSecurityLevel());
    agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("10.11.12.14"));
    assertEquals("opennmsuser2", agentConfig.getSecurityName());
    assertEquals("VF:3", agentConfig.getContextName());
    assertEquals("", agentConfig.getAuthProtocol());
    assertEquals("", agentConfig.getPrivProtocol());
    assertEquals("", agentConfig.getAuthPassPhrase());
    assertEquals("", agentConfig.getPrivPassPhrase());
    assertEquals(1, agentConfig.getSecurityLevel());
    agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr(myLocalHost()));
    assertEquals(3, agentConfig.getSecurityLevel());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) ByteArrayResource(org.springframework.core.io.ByteArrayResource)

Example 50 with SnmpAgentConfig

use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.

the class SiblingColumnStorageStrategyTest method setUp.

@Before
public void setUp() throws Exception {
    // Create Mocks
    service = EasyMock.createMock(StorageStrategyService.class);
    SnmpAgentConfig agentConfig = new SnmpAgentConfig(InetAddressUtils.addr("127.0.0.1"));
    agentConfig.setPort(1161);
    EasyMock.expect(service.getAgentConfig()).andReturn(agentConfig).anyTimes();
    EasyMock.replay(service);
    // Create Strategy and set for hrStorageTable
    strategy = new SiblingColumnStorageStrategy();
    strategy.setStorageStrategyService(service);
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig) StorageStrategyService(org.opennms.netmgt.collection.api.StorageStrategyService) Before(org.junit.Before)

Aggregations

SnmpAgentConfig (org.opennms.netmgt.snmp.SnmpAgentConfig)120 InetAddress (java.net.InetAddress)31 Test (org.junit.Test)31 JUnitSnmpAgents (org.opennms.core.test.snmp.annotations.JUnitSnmpAgents)23 ArrayList (java.util.ArrayList)22 SnmpObjId (org.opennms.netmgt.snmp.SnmpObjId)21 SnmpValue (org.opennms.netmgt.snmp.SnmpValue)21 SnmpInstId (org.opennms.netmgt.snmp.SnmpInstId)16 PollStatus (org.opennms.netmgt.poller.PollStatus)14 Map (java.util.Map)11 ExecutionException (java.util.concurrent.ExecutionException)9 ParameterMap (org.opennms.core.utils.ParameterMap)9 SnmpWalker (org.opennms.netmgt.snmp.SnmpWalker)8 Date (java.util.Date)7 LldpLink (org.opennms.netmgt.model.LldpLink)7 OnmsNode (org.opennms.netmgt.model.OnmsNode)7 HashMap (java.util.HashMap)6 List (java.util.List)5 LldpLocPortGetter (org.opennms.netmgt.enlinkd.snmp.LldpLocPortGetter)4 LldpRemTableTracker (org.opennms.netmgt.enlinkd.snmp.LldpRemTableTracker)4