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; }
setIfIndex(scannedIface.getIfIndex());