Search in sources :

Example 61 with SnmpAgentConfig

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

the class SnmpPeerFactoryTest method testGetv3ConfigWithContextNameAndMore.

/**
 * This tests for context-name configured for v3 node
 * @throws UnknownHostException
 */
public void testGetv3ConfigWithContextNameAndMore() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("1.1.1.101"));
    assertNotNull(agentConfig);
    assertEquals(SnmpAgentConfig.VERSION3, agentConfig.getVersion());
    assertEquals("opennmsContextUser", agentConfig.getSecurityName());
    assertEquals("testContext", agentConfig.getContextName());
    assertEquals("testEngineId", agentConfig.getEngineId());
    assertEquals("testContextEngineId", agentConfig.getContextEngineId());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 62 with SnmpAgentConfig

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

the class SnmpPeerFactoryTest method testGetTargetFromPatterns.

public void testGetTargetFromPatterns() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("77.5.5.255"));
    assertEquals("ipmatch", agentConfig.getReadCommunity());
    assertEquals(128, agentConfig.getMaxVarsPerPdu());
    agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("77.15.80.255"));
    assertEquals("ipmatch", agentConfig.getReadCommunity());
    assertEquals(7, agentConfig.getMaxRepetitions());
    // should be default community "public" because of 4
    agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("77.4.5.255"));
    assertEquals("public", agentConfig.getReadCommunity());
    // should be default community because of 0
    agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("77.6.0.255"));
    assertEquals("public", agentConfig.getReadCommunity());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 63 with SnmpAgentConfig

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

the class SnmpPeerFactoryTest method testNoMatchedDefinitionWithLocationMatch.

public void testNoMatchedDefinitionWithLocationMatch() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("192.160.0.50"), "MINION");
    assertNotNull(agentConfig);
    assertEquals(SnmpAgentConfig.VERSION1, agentConfig.getVersion());
    assertEquals("public", agentConfig.getReadCommunity());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 64 with SnmpAgentConfig

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

the class SnmpPeerFactoryTest method testGetV2cConfig.

/**
 * This tests for a specifically defined v2c agentConfig
 *
 * @throws UnknownHostException
 */
public void testGetV2cConfig() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("192.168.0.50"));
    assertNotNull(agentConfig);
    assertEquals(agentConfig.getVersion(), SnmpAgentConfig.VERSION2C);
    assertEquals("specificv2c", agentConfig.getReadCommunity());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

Example 65 with SnmpAgentConfig

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

the class SnmpPeerFactoryTest method testGetv3ConfigInRange.

/**
 * This tests for ranges configured for v3 node and security name
 * @throws UnknownHostException
 */
public void testGetv3ConfigInRange() throws UnknownHostException {
    SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("1.1.1.50"));
    assertNotNull(agentConfig);
    assertEquals(SnmpAgentConfig.VERSION3, agentConfig.getVersion());
    assertEquals("opennmsRangeUser", agentConfig.getSecurityName());
}
Also used : SnmpAgentConfig(org.opennms.netmgt.snmp.SnmpAgentConfig)

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