/** * <p>addIpInterface</p> * * @param iface a {@link org.opennms.netmgt.model.OnmsIpInterface} object. */ public void addIpInterface(OnmsIpInterface iface) { iface.setSnmpInterface(this); m_ipInterfaces.add(iface); }
/** * @deprecated Create the SNMP Interface first, and then use {@link SnmpInterfaceBuilder#addIpInterface(String)} to add IP Interfaces. * @param ifIndex the ifIndex * @return an SnmpInterfaceBuilder */ @Deprecated public SnmpInterfaceBuilder addSnmpInterface(final int ifIndex) { final OnmsSnmpInterface snmpIf = new OnmsSnmpInterface(m_iface.getNode(), ifIndex); m_iface.setSnmpInterface(snmpIf); // TODO: Should this be done in setSnmpInterface? snmpIf.getIpInterfaces().add(m_iface); return new SnmpInterfaceBuilder(snmpIf); }
LOG.debug("SNMP polling {} according to policy", iface); snmpiface.setPoll("P"); iface.setSnmpInterface(snmpiface); return iface; case DISABLE_SNMP_POLL: LOG.debug("Disable SNMP polling {} according to policy", iface); snmpiface.setPoll("N"); iface.setSnmpInterface(snmpiface); return iface; case DISABLE_COLLECTION: LOG.debug("Disabled collection for {} according to policy", iface); snmpiface.setCollectionEnabled(false); iface.setSnmpInterface(snmpiface); return iface; case ENABLE_COLLECTION: LOG.debug("Enabled collection for {} according to policy", iface); snmpiface.setCollectionEnabled(true); iface.setSnmpInterface(snmpiface); return iface; default:
/** * <p>addInterface</p> * * @param ipAddr a {@link java.lang.String} object. * @param snmpInterface a {@link org.opennms.netmgt.model.OnmsSnmpInterface} object. * @return a {@link org.opennms.netmgt.model.NetworkBuilder.InterfaceBuilder} object. */ public InterfaceBuilder addInterface(final String ipAddr, final OnmsSnmpInterface snmpInterface) { m_currentIf = new OnmsIpInterface(addr(ipAddr), m_currentNode); m_currentIf.setSnmpInterface(snmpInterface); return new InterfaceBuilder(m_currentIf); }
private OnmsIpInterface createIpInterface(OnmsSnmpInterface snmp, InetAddress inetAddress) { OnmsIpInterface ip = new OnmsIpInterface(); ip.setSnmpInterface(snmp); ip.setIpLastCapsdPoll(new Date()); ip.setNode(snmp.getNode()); ip.setIpAddress(inetAddress); return ip; }
private void updateSnmpInterface(OnmsIpInterface imported, OnmsIpInterface iface) { if (nullSafeEquals(iface.getIfIndex(), imported.getIfIndex())) { // no need to change anything return; } if (imported.getSnmpInterface() == null) { // there is no longer an snmpInterface associated with the ipInterface iface.setSnmpInterface(null); } else { // locate the snmpInterface on this node that has the new ifIndex and set it // into the interface OnmsSnmpInterface snmpIface = m_node.getSnmpInterfaceWithIfIndex(imported.getIfIndex()); iface.setSnmpInterface(snmpIface); } }
/** * <p>updateSnmpInterface</p> * * @param scannedIface a {@link org.opennms.netmgt.model.OnmsIpInterface} object. */ public void updateSnmpInterface(OnmsIpInterface scannedIface) { if (!hasNewValue(scannedIface.getIfIndex(), getIfIndex())) { /* no ifIndex in currently scanned interface so don't bother * we must have failed to collect data */ return; } if (scannedIface.getSnmpInterface() == null) { // there is no longer an snmpInterface associated with the ipInterface setSnmpInterface(null); } else { // locate the snmpInterface on this node that has the new ifIndex and set it // into the interface OnmsSnmpInterface snmpIface = getNode().getSnmpInterfaceWithIfIndex(scannedIface.getIfIndex()); setSnmpInterface(snmpIface); } }
final OnmsSnmpInterface snmpInterface = scannedIface.getSnmpInterface(); if (snmpInterface != null && snmpInterface.getIfIndex() != null) { scannedIface.setSnmpInterface(updateSnmpInterfaceAttributes(nodeId, snmpInterface));
final OnmsSnmpInterface snmpInterface = scannedIface.getSnmpInterface(); if (snmpInterface != null && snmpInterface.getIfIndex() != null) { scannedIface.setSnmpInterface(updateSnmpInterfaceAttributes(nodeId, snmpInterface));
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)); } }
public OnmsIpInterface createInterfaceFromRow() { final Integer ifIndex = getIfIndex(); final String ipAddr = getIpAddress(); final Integer type = getType(); final InetAddress netMask = getNetMask(); LOG.debug("createInterfaceFromRow: ifIndex = {}, ipAddress = {}, type = {}, netmask = {}", ifIndex, ipAddr, type, netMask); if (type != IP_ADDRESS_TYPE_UNICAST || ipAddr == null) { return null; } final InetAddress inetAddress = InetAddressUtils.addr(ipAddr); final OnmsIpInterface iface = new OnmsIpInterface(inetAddress, null); iface.setNetMask(netMask); if (ifIndex != null) { final OnmsSnmpInterface snmpIface = new OnmsSnmpInterface(null, ifIndex); snmpIface.setCollectionEnabled(true); iface.setSnmpInterface(snmpIface); iface.setIfIndex(ifIndex); } String hostName = null; if (inetAddress != null) hostName = inetAddress.getHostName(); if (hostName == null) hostName = normalize(ipAddr); LOG.debug("setIpHostName: {}", hostName); iface.setIpHostName(hostName == null? ipAddr : hostName); return iface; }
public OnmsIpInterface createInterfaceFromRow() { final Integer ifIndex = getIfIndex(); final String ipAddr = getIpAddress(); final InetAddress netMask = getNetMask(); LOG.debug("createInterfaceFromRow: ifIndex = {}, ipAddress = {}, netmask = {}", ifIndex, ipAddr, netMask); if (ipAddr == null) { return null; } final InetAddress inetAddress = InetAddressUtils.addr(ipAddr); final OnmsIpInterface iface = new OnmsIpInterface(inetAddress, null); iface.setNetMask(netMask); if (ifIndex != null) { final OnmsSnmpInterface snmpIface = new OnmsSnmpInterface(null, ifIndex); snmpIface.setCollectionEnabled(true); iface.setSnmpInterface(snmpIface); iface.setIfIndex(ifIndex); } String hostName = null; if (inetAddress != null) hostName = inetAddress.getHostName(); if (hostName == null) hostName = InetAddressUtils.normalize(ipAddr); iface.setIpHostName(hostName == null? ipAddr : hostName); return iface; }
public OnmsIpInterface createInterfaceFromRow() { final Integer ifIndex = getIfIndex(); final String ipAddr = getIpAddress(); final Integer type = getType(); final InetAddress netMask = getNetMask(); LOG.debug("createInterfaceFromRow: ifIndex = {}, ipAddress = {}, type = {}, netmask = {}", ifIndex, ipAddr, type, netMask); if (type != IP_ADDRESS_TYPE_UNICAST || ipAddr == null) { return null; } final InetAddress inetAddress = InetAddressUtils.addr(ipAddr); final OnmsIpInterface iface = new OnmsIpInterface(inetAddress, null); iface.setNetMask(netMask); if (ifIndex != null) { final OnmsSnmpInterface snmpIface = new OnmsSnmpInterface(null, ifIndex); snmpIface.setCollectionEnabled(true); iface.setSnmpInterface(snmpIface); iface.setIfIndex(ifIndex); } String hostName = null; if (inetAddress != null) hostName = inetAddress.getHostName(); if (hostName == null) hostName = normalize(ipAddr); LOG.debug("setIpHostName: {}", hostName); iface.setIpHostName(hostName == null? ipAddr : hostName); return iface; }
public OnmsIpInterface createInterfaceFromRow() { final Integer ifIndex = getIfIndex(); final String ipAddr = getIpAddress(); final InetAddress netMask = getNetMask(); LOG.debug("createInterfaceFromRow: ifIndex = {}, ipAddress = {}, netmask = {}", ifIndex, ipAddr, netMask); if (ipAddr == null) { return null; } final InetAddress inetAddress = InetAddressUtils.addr(ipAddr); final OnmsIpInterface iface = new OnmsIpInterface(inetAddress, null); iface.setNetMask(netMask); if (ifIndex != null) { final OnmsSnmpInterface snmpIface = new OnmsSnmpInterface(null, ifIndex); snmpIface.setCollectionEnabled(true); iface.setSnmpInterface(snmpIface); iface.setIfIndex(ifIndex); } String hostName = null; if (inetAddress != null) hostName = inetAddress.getHostName(); if (hostName == null) hostName = InetAddressUtils.normalize(ipAddr); iface.setIpHostName(hostName == null? ipAddr : hostName); return iface; }
ipIf.setSnmpInterface(snmpIf);
ipIf.setSnmpInterface(snmpIf);
ipIf.setSnmpInterface(snmpIf);
ipIf.setSnmpInterface(snmpIf);
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()); }
ipIf.setSnmpInterface(snmpIf);