private void addNewInterfaces(List<Event> events) { for (OnmsIpInterface iface : getNewInterfaces()) { m_node.addIpInterface(iface); if (iface.getIfIndex() != null) { iface.setSnmpInterface(m_node.getSnmpInterfaceWithIfIndex(iface.getIfIndex())); } iface.visit(new AddEventVisitor(events)); } }
m_node.addIpInterface(m_currentInterface);
m_node.addIpInterface(m_currentInterface);
/** {@inheritDoc} */ public void foundInterface(final String ipAddr, final Object descr, final InterfaceSnmpPrimaryType snmpPrimary, final boolean managed, final int status) { if ("".equals(ipAddr)) { log().error("Found interface on node "+m_node.getLabel()+" with an empty ipaddr! Ignoring!"); // create a bogus OnmsIpInterface and set it to current to services we run across get ignored as well m_currentInterface = new OnmsIpInterface(); return; } m_currentInterface = new OnmsIpInterface(ipAddr, m_node); m_currentInterface.setIsManaged(status == 3 ? "U" : "M"); m_currentInterface.setIsSnmpPrimary(PrimaryType.get(snmpPrimary.toString())); //m_currentInterface.setIpStatus(status == 3 ? new Integer(3) : new Integer(1)); if (InterfaceSnmpPrimaryType.P.equals(snmpPrimary)) { final InetAddress addr = InetAddressUtils.addr(ipAddr); if (addr == null) { LogUtils.errorf(this, "Unable to resolve address of snmpPrimary interface for node %s", m_node.getLabel()); } m_collector = new IfSnmpCollector(addr); } //FIXME: verify this doesn't conflict with constructor. The constructor already adds this //interface to the node. m_node.addIpInterface(m_currentInterface); }
addIpInterface(iface); if (iface.getIfIndex() != null) { iface.setSnmpInterface(getSnmpInterfaceWithIfIndex(iface.getIfIndex()));
private void updateParent(final OnmsIpInterface iface) { OnmsNode node = null; if (iface.getNodeId() != null) { node = getNodeDao().get(iface.getNodeId()); } else if (iface.getNode() != null) { node = getNodeDao().findByForeignId(iface.getNode().getForeignSource(), iface.getNode().getForeignId()); if (node == null) { node = getNodeDao().findByForeignId(iface.getNode().getForeignSource(), iface.getNode().getForeignId()); } } if (node != null && node != iface.getNode()) { LOG.debug("merging node {} into node {}", iface.getNode(), node); node.mergeNode(iface.getNode(), new NullEventForwarder(), false); iface.setNode(node); } if (!iface.getNode().getIpInterfaces().contains(iface)) { LOG.debug("adding IP interface to node {}: {}", iface.getNode().getId(), iface); iface.getNode().addIpInterface(iface); } }
private void updateParent(final OnmsIpInterface iface) { OnmsNode node = null; if (iface.getNodeId() != null) { node = getNodeDao().get(iface.getNodeId()); } else if (iface.getNode() != null) { node = getNodeDao().findByForeignId(iface.getNode().getForeignSource(), iface.getNode().getForeignId()); if (node == null) { node = getNodeDao().findByForeignId(iface.getNode().getForeignSource(), iface.getNode().getForeignId()); } } if (node != null && node != iface.getNode()) { LOG.debug("merging node {} into node {}", iface.getNode(), node); node.mergeNode(iface.getNode(), new NullEventForwarder(), false); iface.setNode(node); } if (!iface.getNode().getIpInterfaces().contains(iface)) { LOG.debug("adding IP interface to node {}: {}", iface.getNode().getId(), iface); iface.getNode().addIpInterface(iface); } }
iface1_3.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); node1.addIpInterface(iface1_1); node1.addIpInterface(iface1_2); node1.addIpInterface(iface1_3);
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()); }
iface1_3.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); node1.addIpInterface(iface1_1); node1.addIpInterface(iface1_2); node1.addIpInterface(iface1_3); iface2_3.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); node2.addIpInterface(iface2_1); node2.addIpInterface(iface2_2); node2.addIpInterface(iface2_3);