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());
}
use of org.opennms.netmgt.snmp.SnmpAgentConfig in project opennms by OpenNMS.
the class SnmpPeerFactoryTest method testReversedRange.
/**
* This tests for ranges configured for a v2 node and community string
*
* @throws UnknownHostException
*/
public void testReversedRange() throws UnknownHostException {
SnmpPeerFactory.setInstance(new SnmpPeerFactory(new ByteArrayResource(getBadRangeSnmpConfig().getBytes())));
SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr("10.7.23.100"));
assertNotNull(agentConfig);
assertEquals(SnmpAgentConfig.VERSION2C, agentConfig.getVersion());
assertEquals("rangev2c", agentConfig.getReadCommunity());
}
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(agentConfig.getVersion(), SnmpAgentConfig.VERSION1);
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());
}
Aggregations