@Override protected Integer getId(final OnmsIpInterface iface) { return iface.getId(); }
@Override protected Integer getId(final OnmsIpInterface iface) { return iface.getId(); }
@Override public ArrayList<Integer> marshal(final Set<OnmsIpInterface> ifaces) throws Exception { final ArrayList<Integer> ret = new ArrayList<>(); for (final OnmsIpInterface iface : ifaces) { ret.add(iface.getId()); } return ret; }
@Override public T createCollectionAgent(OnmsIpInterface ipInterface) { final T agent = createAgent(ipInterface.getId(), ipInterfaceDao, transMgr, null); return agent; }
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + m_ipInterface.getId().hashCode(); result = prime * result + m_locationMonitor.getId().hashCode(); return result; }
@Override public T createCollectionAgent(OnmsIpInterface ipInterface) { final T agent = createAgent(ipInterface.getId(), ipInterfaceDao, transMgr, null); return agent; }
public AvailabilityIpInterface(final OnmsIpInterface iface, final double availability) { m_id = iface.getId(); m_address = str(iface.getIpAddress()); m_availability = availability; }
public AvailabilityIpInterface(final OnmsIpInterface iface, final double availability) { m_id = iface.getId(); m_address = str(iface.getIpAddress()); m_availability = availability; }
public static IpInterfaceTopologyEntity create(OnmsIpInterface ipInterface) { return new IpInterfaceTopologyEntity( ipInterface.getId(), ipInterface.getIpAddress(), ipInterface.getIsManaged(), ipInterface.getIsSnmpPrimary(), Optional.ofNullable(ipInterface.getNode()).map(OnmsNode::getId).orElse(null), Optional.ofNullable(ipInterface.getSnmpInterface()).map(OnmsSnmpInterface::getId).orElse(null)); }
private void reinitialize(OnmsIpInterface newIface) throws CollectionInitializationException { m_spec.release(m_agent); m_agent = DefaultSnmpCollectionAgent.create(newIface.getId(), m_ifaceDao, m_transMgr); m_spec.initialize(m_agent); }
@Override public T createCollectionAgentAndOverrideLocation(String nodeCriteria, InetAddress ipAddr, String location) { final OnmsNode node = nodeDao.get(nodeCriteria); if (node == null) { throw new IllegalArgumentException(String.format("No node found with lookup criteria: %s", nodeCriteria)); } final OnmsIpInterface ipInterface = ipInterfaceDao.findByNodeIdAndIpAddress( node.getId(), InetAddressUtils.str(ipAddr)); if (ipInterface == null) { throw new IllegalArgumentException(String.format("No interface found with IP %s on node %s", InetAddressUtils.str(ipAddr), nodeCriteria)); } final T agent = createAgent(ipInterface.getId(), ipInterfaceDao, transMgr, location); return agent; }
private SnmpCollectionAgent getCollectionAgent() { return DefaultSnmpCollectionAgent.create(m_intf.getId(), m_ifDao, m_transMgr); }
private void setupInterface(OnmsIpInterface iface) { expect(m_ipIfDao.findByServiceType("SNMP")).andReturn(Collections.singletonList(iface)); expect(m_ipIfDao.load(iface.getId())).andReturn(iface).atLeastOnce(); }
@Override public void deleteObsoleteInterfaces(final Integer nodeId, final Date scanStamp) { final OnmsNode node = get(nodeId); if (node == null) return; for (final OnmsIpInterface iface : findObsoleteIpInterfaces(nodeId, scanStamp)) { LOG.debug("Deleting obsolete IP interface: {}", iface); node.getIpInterfaces().remove(iface); getIpInterfaceDao().delete(iface.getId()); } for (final OnmsSnmpInterface iface : findObsoleteSnmpInterfaces(nodeId, scanStamp)) { LOG.debug("Deleting obsolete SNMP interface: {}", iface); node.getSnmpInterfaces().remove(iface); getSnmpInterfaceDao().delete(iface.getId()); } }
@Override public void deleteObsoleteInterfaces(final Integer nodeId, final Date scanStamp) { final OnmsNode node = get(nodeId); if (node == null) return; for (final OnmsIpInterface iface : findObsoleteIpInterfaces(nodeId, scanStamp)) { LOG.debug("Deleting obsolete IP interface: {}", iface); node.getIpInterfaces().remove(iface); getIpInterfaceDao().delete(iface.getId()); } for (final OnmsSnmpInterface iface : findObsoleteSnmpInterfaces(nodeId, scanStamp)) { LOG.debug("Deleting obsolete SNMP interface: {}", iface); node.getSnmpInterfaces().remove(iface); getSnmpInterfaceDao().delete(iface.getId()); } }
private void updateParent(final OnmsMonitoredService svc) { if (svc.getIpInterface() != null && svc.getIpInterface().getId() != null) { final OnmsIpInterface iface = getIpInterfaceDao().get(svc.getIpInterface().getId()); if (iface != null && iface != svc.getIpInterface()) { LOG.debug("merging interface {} into interface {}", svc.getIpInterface(), iface); iface.mergeInterface(svc.getIpInterface(), new NullEventForwarder(), false); svc.setIpInterface(iface); } if (!svc.getIpInterface().getMonitoredServices().contains(svc)) { svc.getIpInterface().addMonitoredService(svc); } } }
private void updateParent(final OnmsMonitoredService svc) { if (svc.getIpInterface() != null && svc.getIpInterface().getId() != null) { final OnmsIpInterface iface = getIpInterfaceDao().get(svc.getIpInterface().getId()); if (iface != null && iface != svc.getIpInterface()) { LOG.debug("merging interface {} into interface {}", svc.getIpInterface(), iface); iface.mergeInterface(svc.getIpInterface(), new NullEventForwarder(), false); svc.setIpInterface(iface); } if (!svc.getIpInterface().getMonitoredServices().contains(svc)) { svc.getIpInterface().addMonitoredService(svc); } } }
@Before public void setUp() throws Exception { MockLogAppender.setupLogging(); m_rrdStrategy = new JRobinRrdStrategy(); m_fileAnticipator = new FileAnticipator(); m_intf = new OnmsIpInterface(); m_node = new OnmsNode(); m_node.setId(1); m_intf.setNode(m_node); m_intf.setIpAddress(InetAddressUtils.addr("1.1.1.1")); m_intf.setId(27); m_ifDao = EasyMock.createMock(IpInterfaceDao.class); EasyMock.expect(m_ifDao.load(m_intf.getId())).andReturn(m_intf).anyTimes(); EasyMock.replay(m_ifDao); }
protected void createAgent(int ifIndex, PrimaryType ifCollType) { m_node = new OnmsNode(); m_node.setSysObjectId(".1.2.3.4.5.6.7"); OnmsSnmpInterface snmpIface = new OnmsSnmpInterface(m_node, ifIndex); m_iface = new OnmsIpInterface(); m_iface.setId(123); m_iface.setIpAddress(myLocalHost()); m_iface.setIsSnmpPrimary(ifCollType); m_iface.setSnmpInterface(snmpIface); m_node.addIpInterface(m_iface); EasyMock.expect(m_ifaceDao.load(m_iface.getId())).andReturn(m_iface).anyTimes(); m_easyMockUtils.replayAll(); m_agent = DefaultSnmpCollectionAgent.create(m_iface.getId(), m_ifaceDao, new MockPlatformTransactionManager()); }