public InterfaceBuilder setIsSnmpPrimary(final String isSnmpPrimary) { m_iface.setIsSnmpPrimary(PrimaryType.get(isSnmpPrimary)); return this; }
svcIface.setIsSnmpPrimary(PrimaryType.PRIMARY); m_ipInterfaceDao.saveOrUpdate(svcIface); m_ipInterfaceDao.flush(); primaryIface= svcIface; } else { svcIface.setIsSnmpPrimary(PrimaryType.SECONDARY); m_ipInterfaceDao.saveOrUpdate(svcIface); m_ipInterfaceDao.flush();
svcIface.setIsSnmpPrimary(PrimaryType.PRIMARY); m_ipInterfaceDao.saveOrUpdate(svcIface); m_ipInterfaceDao.flush(); primaryIface= svcIface; } else { svcIface.setIsSnmpPrimary(PrimaryType.SECONDARY); m_ipInterfaceDao.saveOrUpdate(svcIface); m_ipInterfaceDao.flush();
m_currentInterface.setIsSnmpPrimary(primaryType);
m_currentInterface.setIsSnmpPrimary(primaryType);
scannedPrimaryIf = iface; }else if(iface.isPrimary()){ iface.setIsSnmpPrimary(PrimaryType.SECONDARY); dbIface.visit(new DeleteEventVisitor(eventForwarder)); }else if(scannedPrimaryIf != null && dbIface.isPrimary()){ dbIface.setIsSnmpPrimary(PrimaryType.SECONDARY); oldPrimaryInterface = dbIface; dbIface.setIsSnmpPrimary(PrimaryType.SECONDARY); oldPrimaryInterface = dbIface;
/** {@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); }
@Override protected OnmsNode doInsert() { final Date now = new Date(); OnmsMonitoringLocation location = createLocationIfNecessary(locationString); // Associate the location with the node final OnmsNode node = new OnmsNode(location); final String hostname = getHostnameResolver().getHostname(addr(ipAddress), locationString); if (hostname == null || ipAddress.equals(hostname)) { node.setLabel(ipAddress); node.setLabelSource(NodeLabelSource.ADDRESS); } else { node.setLabel(hostname); node.setLabelSource(NodeLabelSource.HOSTNAME); } node.setForeignSource(effectiveForeignSource); node.setType(NodeType.ACTIVE); node.setLastCapsdPoll(now); final OnmsIpInterface iface = new OnmsIpInterface(InetAddressUtils.addr(ipAddress), node); iface.setIsManaged("M"); iface.setIpHostName(hostname); iface.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); iface.setIpLastCapsdPoll(now); m_nodeDao.save(node); m_nodeDao.flush(); return node; } }.execute();
@Override protected OnmsNode doInsert() { final Date now = new Date(); OnmsMonitoringLocation location = createLocationIfNecessary(locationString); // Associate the location with the node final OnmsNode node = new OnmsNode(location); final String hostname = getHostnameResolver().getHostname(addr(ipAddress), locationString); if (hostname == null || ipAddress.equals(hostname)) { node.setLabel(ipAddress); node.setLabelSource(NodeLabelSource.ADDRESS); } else { node.setLabel(hostname); node.setLabelSource(NodeLabelSource.HOSTNAME); } node.setForeignSource(effectiveForeignSource); node.setType(NodeType.ACTIVE); node.setLastCapsdPoll(now); final OnmsIpInterface iface = new OnmsIpInterface(InetAddressUtils.addr(ipAddress), node); iface.setIsManaged("M"); iface.setIpHostName(hostname); iface.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); iface.setIpLastCapsdPoll(now); m_nodeDao.save(node); m_nodeDao.flush(); return node; } }.execute();
iface1_1.setIsSnmpPrimary(PrimaryType.PRIMARY); iface1_2.setIsSnmpPrimary(PrimaryType.SECONDARY); iface1_3.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE);
private void update(OnmsIpInterface imported, OnmsIpInterface iface, List<Event> events) { if (!nullSafeEquals(iface.getIsManaged(), imported.getIsManaged())) iface.setIsManaged(imported.getIsManaged()); if (!nullSafeEquals(iface.getIsSnmpPrimary(), imported.getIsSnmpPrimary())) { iface.setIsSnmpPrimary(imported.getIsSnmpPrimary()); // TODO: send snmpPrimary event } if (isSnmpDataForInterfacesUpToDate()) { updateSnmpInterface(imported, iface); } if (!nullSafeEquals(iface.getIpHostName(), imported.getIpHostName())) iface.setIpHostName(imported.getIpHostName()); updateServices(iface, imported, events); }
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_1.setIsSnmpPrimary(PrimaryType.PRIMARY); iface1_2.setIsSnmpPrimary(PrimaryType.SECONDARY); iface1_3.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE); iface2_1.setIsSnmpPrimary(PrimaryType.PRIMARY); iface2_2.setIsSnmpPrimary(PrimaryType.SECONDARY); iface2_3.setIsSnmpPrimary(PrimaryType.NOT_ELIGIBLE);
setIsSnmpPrimary(scannedIface.getIsSnmpPrimary());