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();
}
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 testGetSnmpAgentConfig.
public void testGetSnmpAgentConfig() throws UnknownHostException {
SnmpAgentConfig agentConfig = SnmpPeerFactory.getInstance().getAgentConfig(InetAddressUtils.addr(myLocalHost()));
assertEquals(SnmpAgentConfig.VERSION2C, agentConfig.getVersion());
}
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());
}
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);
}
Aggregations