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());
}
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());
}
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());
}
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());
}
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());
}
Aggregations