Ejemplo n.º 1
0
def discoveryILOs(client, hostOSH):
    vector = ObjectStateHolderVector()
    logger.debug("Try to detect iLO...")
    controllerTable = SNMP_Networking_Utils.getILOsControllerBySNMP(client)
    logger.debug("controllerTable:", controllerTable)
    controlModel = None
    if controllerTable:
        controlModel = int(controllerTable[0].cpqSm2CntlrModel)
    desc = ILO_CARD_MODEL_DESC_DICT.get(controlModel) or 'Remote Lights-Out'
    table = SNMP_Networking_Utils.getILOsTableBySNMP(client)
    if table:
        for nic in table:
            logger.debug("iLO:", nic)
            iLODesc = desc + '( ' + nic.cpqSm2NicModel + ' )'
            iLO = createILOCard(hostOSH, iLODesc, nic)
            if nic.cpqSm2NicIpAddress:
                try:
                    ipaddress = ip_addr_util.IPAddress(nic.cpqSm2NicIpAddress)
                    ipOSH = modeling.createIpOSH(ipaddress, nic.cpqSm2NicIpSubnetMask)
                    link = modeling.createLinkOSH('containment', iLO, ipOSH)
                    vector.add(ipOSH)
                    vector.add(link)
                except:
                    logger.debug('got an invalid ipaddress: %s' %nic.cpqSm2NicIpAddress)
            vector.add(iLO)

    return vector
Ejemplo n.º 2
0
 def get_interfaces(self):
     '''
     Collects info about local Network interfaces
     @type : ->[snmputils.ResultItem]
     '''
     interfaces = SNMP_Networking_Utils.discoverInterfaceData(self.client, None)
     return interfaces
Ejemplo n.º 3
0
 def get_interfaces(self):
     '''
     Collects info about local Network interfaces
     @type : ->[snmputils.ResultItem]
     '''
     interfaces = SNMP_Networking_Utils.discoverInterfaceData(
         self.client, None)
     return interfaces
Ejemplo n.º 4
0
 def getLocalInterfaces(self):
     ifList = SNMP_Networking_Utils.discoverInterfaceData(
         self.snmpClient, None)
     for interface in ifList:
         self.ifIndToInterface[interface.ifIndex] = interface
         logger.debug(
             'Found local interface: index %s; mac %s; descr %s; name %s' %
             (interface.ifIndex, interface.ifMac, interface.ifDescr,
              interface.ifName))
Ejemplo n.º 5
0
def getSNByPublicMib(client):
    entTable = SNMP_Networking_Utils.getEntPhysicalTable(client)
    if entTable:
        for row in entTable:
            #  INTEGER {other(1), unknown(2), chassis(3), backplane(4), container(5), powerSupply(6), fan(7), sensor(8),
            #  module(9), port(10), stack(11), cpu(12)}
            if (row.entPhysicalClassess.strip()):
                if int(row.entPhysicalClassess) == 3: #only get type of chassis
                    return row.entPhysicalSerialNum
    return None
Ejemplo n.º 6
0
def snmpDiscover(client, ip_address, discoverRoute, hostId, OSHVResult,
                 hostIsComplete, ucmdbversion):
    #discover snmp sysTable
    sysTable = SNMP_Networking_Utils.discoverSysTableData(client)

    if sysTable == None:
        raise ValueError, 'Failed to obtain sysTable information'
    #discover stacked switches
    switches, interfaceVector = SNMP_Networking_Utils.discoverEntityDetails(
        client)
    OSHVResult.addAll(
        SNMP_Networking_Utils.reportStackedSwithces(switches, hostId,
                                                    sysTable.sysClass))
    OSHVResult.addAll(interfaceVector)

    #discover all ips on discoveder host
    ipList = SNMP_Networking_Utils.discoverIPData(client, ip_address)

    if len(ipList) == 0:
        raise ValueError, 'Failed to obtain ip routing information'

    #discover all the interfaces of the discovered host
    ifList = SNMP_Networking_Utils.discoverInterfaceData(client, sysTable)

    #set nettype data for ip
    SNMP_Networking_Utils.setIpNetTypeData(ipList, ifList)

    #discover the route table of the discovered host
    routeList = []
    if discoverRoute is not None and (discoverRoute.lower().strip() == 'true'
                                      or discoverRoute.lower().strip() == '1'):
        routeList = SNMP_Networking_Utils.discoverRouteData(client)

    #discover all the bridges base mac addresses
    bridgeList = []
    if sysTable.isBridge == 1:
        bridgeList = SNMP_Networking_Utils.discoverBridgeData(
            ip_address, client)


#    if len(routeList) != 0 and len(ifList) != 0:
#        SNMP_Networking_Utils.setMacOnRouteData(routeList, ifList)

    createOSHVSByDiscoveredData(sysTable, ipList, ifList, routeList,
                                bridgeList, ip_address, hostId, OSHVResult,
                                hostIsComplete, ucmdbversion)
Ejemplo n.º 7
0
def discoveryDRAC(client, hostOSH):
    vector = ObjectStateHolderVector()
    dracTable = SNMP_Networking_Utils.getDRACTable(client)
    dracInterfaceTable = SNMP_Networking_Utils.getDRACInterfaceTable(client)
    if dracTable:
        for nic in dracTable:
            logger.debug("DRAC:", nic)
            mac = None
            subNet = None
            gateway = None
            ipAddress = None
            if dracInterfaceTable:
                mac, subNet, gateway, ipAddress = getDRACNicInfo(dracInterfaceTable, nic)

            drac = createDRACCard(gateway, hostOSH, mac, nic)
            ipOSH = modeling.createIpOSH(ipAddress, subNet)
            link = modeling.createLinkOSH('containment', drac, ipOSH)
            vector.add(drac)
            vector.add(ipOSH)
            vector.add(link)

    return vector
Ejemplo n.º 8
0
def snmpDiscover(client, ip_address, discoverRoute, hostId, OSHVResult, hostIsComplete, ucmdbversion):
    #discover snmp sysTable
    sysTable = SNMP_Networking_Utils.discoverSysTableData(client)
    
    if sysTable == None:
        raise ValueError, 'Failed to obtain sysTable information'
    #discover stacked switches
    switches, interfaceVector = SNMP_Networking_Utils.discoverEntityDetails(client)
    OSHVResult.addAll(SNMP_Networking_Utils.reportStackedSwithces(switches, hostId, sysTable.sysClass))
    OSHVResult.addAll(interfaceVector)

    #discover all ips on discoveder host
    ipList = SNMP_Networking_Utils.discoverIPData(client, ip_address)
    
    if len(ipList) == 0:
        raise ValueError, 'Failed to obtain ip routing information'
    
    #discover all the interfaces of the discovered host
    ifList = SNMP_Networking_Utils.discoverInterfaceData(client, sysTable)
    
    #set nettype data for ip
    SNMP_Networking_Utils.setIpNetTypeData(ipList, ifList)
    
    #discover the route table of the discovered host
    routeList = []
    if discoverRoute is not None and (discoverRoute.lower().strip() == 'true' or discoverRoute.lower().strip() == '1'):
        routeList = SNMP_Networking_Utils.discoverRouteData(client)
    
    #discover all the bridges base mac addresses
    bridgeList = []
    if sysTable.isBridge == 1:
        bridgeList = SNMP_Networking_Utils.discoverBridgeData(ip_address, client)
    
#    if len(routeList) != 0 and len(ifList) != 0:
#        SNMP_Networking_Utils.setMacOnRouteData(routeList, ifList)
    
    createOSHVSByDiscoveredData(sysTable, ipList, ifList, routeList, bridgeList, ip_address, hostId, OSHVResult, hostIsComplete, ucmdbversion)
Ejemplo n.º 9
0
def createOSHVSByDiscoveredData(sysTable, ipList, ifList, routeList, bridgeList, ip_address, hostId, OSHVResult, hostIsComplete, ucmdbversion):
    hostWithBridgeOSHV = ObjectStateHolderVector()
    
    #create ips, networks and links (member + contained)
    ipAndNetworksOSHV = SNMP_Networking_Utils.createIpsNetworksOSHV(ipList, sysTable, hostId, hostIsComplete)
    if len(bridgeList) > 0:
        hostWithBridgeOSHV = SNMP_Networking_Utils.createBridgeObjects(bridgeList, hostId)
         
    #Set the relevant ip list for every interface
    SNMP_Networking_Utils.setIpList(ifList, ipList)
    
    routeDataOSHV = SNMP_Networking_Utils.createRouteObjects(routeList, ifList, ip_address, hostId)
    interfaceDataOSHV = SNMP_Networking_Utils.createInterfaceObjects(ifList, hostId, ucmdbversion)
    
    OSHVResult.addAll(ipAndNetworksOSHV)
    OSHVResult.addAll(hostWithBridgeOSHV)
    OSHVResult.addAll(routeDataOSHV)
    OSHVResult.addAll(interfaceDataOSHV)
Ejemplo n.º 10
0
def createOSHVSByDiscoveredData(sysTable, ipList, ifList, routeList,
                                bridgeList, ip_address, hostId, OSHVResult,
                                hostIsComplete, ucmdbversion):
    hostWithBridgeOSHV = ObjectStateHolderVector()

    #create ips, networks and links (member + contained)
    ipAndNetworksOSHV = SNMP_Networking_Utils.createIpsNetworksOSHV(
        ipList, sysTable, hostId, hostIsComplete)
    if len(bridgeList) > 0:
        hostWithBridgeOSHV = SNMP_Networking_Utils.createBridgeObjects(
            bridgeList, hostId)

    #Set the relevant ip list for every interface
    SNMP_Networking_Utils.setIpList(ifList, ipList)

    routeDataOSHV = SNMP_Networking_Utils.createRouteObjects(
        routeList, ifList, ip_address, hostId)
    interfaceDataOSHV = SNMP_Networking_Utils.createInterfaceObjects(
        ifList, hostId, ucmdbversion)

    OSHVResult.addAll(ipAndNetworksOSHV)
    OSHVResult.addAll(hostWithBridgeOSHV)
    OSHVResult.addAll(routeDataOSHV)
    OSHVResult.addAll(interfaceDataOSHV)
Ejemplo n.º 11
0
def startDiscovery(Framework):
    time_start = time.time()
    initParameters(Framework)
    OSHVResult = ObjectStateHolderVector()
    source = Framework.getTriggerCIData(CollectorsConstants.DESTINATION_DATA_ID)
    logger.debug("The arp source is:", source)
    client = getClient(Framework)
    if client is None:
        logger.debug("No snmp client available")
        logger.reportWarning("No snmp client available")
        return OSHVResult
    else:
        logger.debug("Get client:", client)
    ipMacList = []
    try:
        logger.debug("Begin query...")
        startTime = time.time()
        arp4Table = SNMP_Networking_Utils.discoverIPv4NetToMediaTable(client)
        if arp4Table:
            ipv4List = processIPv4NetToMediaTable(arp4Table, source)
            logger.debug("size of ipv4 list:", len(ipv4List))
            if ipv4List:
                ipMacList.extend(ipv4List)

        arp6Table = SNMP_Networking_Utils.discoverIPv6NetToMediaTable(client)
        if arp6Table:
            ipv6List = processIPv6NetToMediaTable(arp6Table, source)
            logger.debug("size of ipv6 list:", len(ipv6List))
            if ipv6List:
                ipMacList.extend(ipv6List)

        ipNetToPhysicalTable = SNMP_Networking_Utils.discoverIPNetToPhysicalTable(client)
        if ipNetToPhysicalTable:
            ipMixList = processIpNetToPhysicalTable(ipNetToPhysicalTable, source)
            logger.debug("size of mix ip list:", len(ipMixList))
            if ipMixList:
                ipMacList.extend(ipMixList)

        ciscoIpNetToPhysicalTable = SNMP_Networking_Utils.discoverCiscoIPNetToMediaTable(client)
        if ciscoIpNetToPhysicalTable:
            cIpMacList = processCiscoIpNetToPhysicalTable(ciscoIpNetToPhysicalTable, source)
            logger.debug("size of cisco ip mac list:", len(cIpMacList))
            if cIpMacList:
                ipMacList.extend(cIpMacList)

        logger.debug("Done query.")
        logger.debug("Total valid ip records:", len(ipMacList))
        totalTime = time.time() - startTime
        logger.debug('Total time(s):', totalTime)
        if totalTime:
            logger.debug('Average speed record(s)/second:', len(ipMacList) / totalTime)
    except:
        lastExceptionStr = str(sys.exc_info()[1]).strip()
        logger.debugException('Unexpected SNMP query exception:', lastExceptionStr)
        logger.reportError()
        return OSHVResult
    finally:
        logger.debug('Closing snmp client')
        client.close()

    if ipMacList:
        service = getIPMacService()
        try:
            macs = []
            tmp = []
            [(macs.append(x.macAddress), tmp.append(x)) for x in ipMacList if x.macAddress not in macs]
            ipMacList = tmp
            reportIPMacPairs(Framework, service, ipMacList, source)
        except:
            lastExceptionStr = str(sys.exc_info()[1]).strip()
            logger.debugException('Job failed by:', lastExceptionStr)
            logger.reportError()
    logger.debug("The job finished in %ds." % int((time.time() - time_start)))
    return OSHVResult
Ejemplo n.º 12
0
 def getLocalInterfaces(self):
     ifList = SNMP_Networking_Utils.discoverInterfaceData(self.snmpClient, None)
     for interface in ifList:
         self.ifIndToInterface[interface.ifIndex] = interface
         logger.debug('Found local interface: index %s; mac %s; descr %s; name %s' % (interface.ifIndex, interface.ifMac, interface.ifDescr, interface.ifName))
Ejemplo n.º 13
0
def doSnmp(client, isClient, snmpOSH, ip_address, ip_domain, Framework, host_cmdbid, host_key, host_macs):
    '''SnmpClient, osh, str, str, Framework, str, str, list(str) -> ObjectStateHolderVector
    @deprecated
    '''
    networkList = []
    vector = ObjectStateHolderVector()
    ucmdb_version = modeling.CmdbClassModel().version()
    # system table
    snmpQuery = '1.3.6.1.2.1.1.1,1.3.6.1.2.1.1.2,string,1.3.6.1.2.1.1.2,string,1.3.6.1.2.1.1.5,string'
    table = client.executeQuery(snmpQuery)#@@CMD_PERMISION snmp protocol execution

    sysname = None
    oid = None
    description = None
    try:
        if table.next():
            description = table.getString(2)
            oid = table.getString(3)
            sysname = table.getString(4)
    except:
        logger.debugException('')

    node_description = description or ''

    sysObjId = oid
    className, vendorName, hostOsName, hostModel, serialNumberOid, serialNumberSNMPMethod = getNodeDetails(description, oid)
    logger.debug("Node details:%s, %s, %s, %s, %s, %s"%(className, vendorName, hostOsName, hostModel, serialNumberOid, serialNumberSNMPMethod))
    if className == 'netprinter':
        sysname = getNetPrinterName(client) or sysname
    hostVersion, hostRelease = getOsVersionAndBuild(hostOsName, description)

# since sysUpTime returns a time since the snmp was re-initialized, this
# time doesn't provide us correct answer, therefore this code is disabled
#    snmpQuery = '1.3.6.1.2.1.1.3,1.3.6.1.2.1.1.4,string'
#    upTime = client.executeQuery(snmpQuery)

    if oid != None:
        snmpOSH.setAttribute('snmp_oid', oid)
    if((sysname != None) and (sysname != '') and (sysname != 'unknown')):
        snmpOSH.setAttribute('snmp_sysname', sysname)
    if description != None:
        snmpOSH.setAttribute('snmp_description', description)

    logger.debug('ip_address: ', ip_address, ', sysname: ' , sysname, ', className: ', className, ', oid: ', oid, ', description: ', description)

    #dicovery arp cache available
    arp_available = SNMP_Networking_Utils.isArpCacheAvailable(client)
    snmpOSH.setBoolAttribute('arp_cache_available', arp_available)

    # indx, description & mac

    interfaceList = []
    interfaceDictionary = {}

    ifList = SNMP_Networking_Utils.discoverInterfaceData(client, None)

    for nic in ifList:
        if nic.ifType and int(nic.ifType) == 24:
            continue

        macAddress = str(nic.ifMac).upper()
        if nic.ifIndex != None and nic.ifIndex != '':
            inrfcindex = nic.ifIndex
        description = _stripVirtualMiniportInfo(nic.ifDescr)

        if interfaceDictionary.has_key(inrfcindex):
            logger.debug('this mac was already reported, skip it ... : inrfcindex: ', inrfcindex, ', descrition: ', description, ', macAddress: ', macAddress)
            continue

        logger.debug('inrfcindex: ', inrfcindex, ', description: ', description, ', macAddress: ', macAddress)

        interfaceDictionary[inrfcindex] = macAddress
        networkinterface = modeling.NetworkInterface(description, macAddress, None, None, inrfcindex)
        networkinterface.type = nic.ifType
        networkinterface.adminStatus = nic.ifAdminStatus
        networkinterface.operStatus = nic.ifOperStatus
        networkinterface.speed = nic.ifSpeed
        networkinterface.name = nic.ifName
        networkinterface.alias = nic.ifAlias
        if not networkinterface.name:
            m = re.match('(lan[\d\:\.]+)', description)
            if m:
                networkinterface.name = m.group(1)
                networkinterface.description = None
        interfaceList.append(networkinterface)

    # create the host and all the objects
    if len(interfaceList) > 0:
        macToInterfaceListMap = {}
        for interface in interfaceList:
            macToInterfaceListMap.setdefault(interface.macAddress, []).append(interface)

        for ifaceList in macToInterfaceListMap.values():
            if ifaceList and len(ifaceList) < 2:
                continue
            try:
                iface = reduce(lambda x,y: x.interfaceIndex > y.interfaceIndex and x or y, ifaceList)
                iface.role = 'aggregate_interface'
            except:
                logger.debugException('')
        hostOSH = None

        try:
            # Get the host_key - lowest mac address of the valid interface list
            hostOSH = modeling.createCompleteHostOSHByInterfaceList(className, interfaceList, None, None, None, host_cmdbid, host_key, host_macs, ucmdb_version)
            if (className in netDeviceClasses) and (sysname != None) and (sysname != '') and ((host_cmdbid in ['NA','',None]) or (host_key and (host_key.lower() == sysname.lower()))):
                # JEO @ Fidelity: use SNMP system name for host key of network devices unless its null
                hostOSH.setAttribute('host_key', sysname)

        except:
            logger.debug('Could not find a valid MAC address for key on ip : ', ip_address)
            if (className in netDeviceClasses) and (sysname != None) and (sysname != '') and (host_cmdbid in ['NA','',None]):
                logger.debug('Network device, hostkey is sysname...')
                hostOSH = modeling.createCompleteHostOSH(className, sysname)
            else:
                logger.debug('Creating incomplete host...')
                hostOSH = modeling.createHostOSH(ip_address, className)

        logger.debug('Created [' + className + '] strong key=[' + hostOSH.getAttributeValue('host_key') + ']')

        if((sysname != None) and (sysname != '') and (sysname != 'unknown')):
            hostOSH.setAttribute('snmp_sys_name', sysname)
            # set hostname to SNMP system name less domain suffix which is typical of other data sources
            hostname = sysname.split('.')[0].lower()
            hostOSH.setAttribute('name', hostname)
            logger.debug("hostname=" + hostname)

        defaultGateway = getDefaultGateway(client)
        modeling.setHostDefaultGateway(hostOSH, defaultGateway)
        modeling.setHostOsFamily(hostOSH, None, className)
        if sysObjId and sysObjId.startswith('.') != -1:
            sysObjId = "." + sysObjId
        modeling.setSNMPSysObjectId(hostOSH, sysObjId)

        if((hostOsName != None) and (hostOsName != '') and (hostOsName != 'unknown')):
            modeling.setHostOsName(hostOSH, hostOsName)
        if((vendorName != None) and (vendorName != '') and (vendorName != 'unknown')):
            hostOSH.setAttribute('discovered_os_vendor', vendorName)
        if((hostModel != None) and (hostModel != '') and (hostModel != 'unknown')):
            hostOSH.setAttribute('discovered_model', hostModel)
        if hostRelease is not None:
            hostOSH.setAttribute('host_osrelease', hostRelease)
        if hostVersion is not None:
            hostOSH.setAttribute('discovered_os_version', hostVersion)

# since sysUpTime returns a time since the snmp was re-initialized, this
# time doesn't provide us correct answer, therefore this code is disabled
#        if upTime:
#            today = Calendar.getInstance().getTime()
#            setLastBootDate(hostOSH, upTime, today, Framework)

        vector.add(modeling.finalizeHostOsh(hostOSH))
        snmpOSH.setContainer(hostOSH)
        if className == 'mainframe':
            modeling.setHostOsFamily(hostOSH, 'mainframe')

        interfaceOshToIndex = {}
        roleManager = networking_win.InterfaceRoleManager()
        try:
            reportInterfaceName = Boolean.parseBoolean(Framework.getParameter('reportInterfaceName'))
        except:
            logger.warn('Failed to parse reportInterfaceName parameter falue. Not a Boolean type.')
            reportInterfaceName = True
        for nic in interfaceList:
            if netutils.isValidMac(nic.macAddress):
                nic.osh = modeling.createInterfaceOSH(nic.macAddress, hostOSH, nic.description,
                            nic.interfaceIndex, nic.type, nic.adminStatus, nic.operStatus,
                            nic.speed, nic.name, nic.alias, reportInterfaceName)
                roleManager.assignInterfaceRole(nic)
                interfaceOshToIndex[nic.interfaceIndex] = nic.osh
                vector.add(nic.osh)
            else:
                logger.debug('MAC %s is invalid (name: %s, description: %s, index: %s)' %
                             (nic.macAddress, nic.name, nic.description, nic.interfaceIndex))

        # create the ip's
        logger.debug("create the ip's")
        snmpQuery = '1.3.6.1.2.1.4.20.1.1, 1.3.6.1.2.1.4.20.1.2, string'
        table = client.executeQuery(snmpQuery)#@@CMD_PERMISION snmp protocol execution
        ips = table.asTable()
        snmpQuery = '1.3.6.1.2.1.4.20.1.2, 1.3.6.1.2.1.4.20.1.3, string'
        table = client.executeQuery(snmpQuery)#@@CMD_PERMISION snmp protocol execution
        ifindexes = table.asTable()
        snmpQuery = '1.3.6.1.2.1.4.20.1.3, 1.3.6.1.2.1.4.20.1.4, string'
        table = client.executeQuery(snmpQuery)#@@CMD_PERMISION snmp protocol execution
        ipmasks = table.asTable()
        try:
            rfcIpV6Query = '1.3.6.1.2.1.55.1.8.1.1,1.3.6.1.2.1.55.1.8.1.5, string'
            rfcIpV6Result = client.executeQuery(rfcIpV6Query)#@@CMD_PERMISION snmp protocol execution
            results = rfcIpV6Result.asTable()
        except:
            logger.warn('Failed to get or process IPv6 MIB results.')

        #try to collect IPv6 addresses from IPv6 address table and connect them to corresponding interface
        logger.debug("Begin to discovery IPv6 related info")
        try:
            ipv6Map = {}
            ipv6AddressTable = SNMP_Networking_Utils.discoverIPv6AddressTable(client)
            if ipv6AddressTable:
                for row in ipv6AddressTable:
                    if row.ipv6AddrStatus != '1':# 1 means valid ip address in arp cache
                        continue
                    ifIndex, ipAddress = _parseIPv6FromIndex(row.ipv6AddrAddress)
                    if ifIndex and ipAddress:
                        try:
                            formatedIP = getValidIP(ipAddress)
                            if formatedIP:
                                ipv6Map[ifIndex] = formatedIP
                        except:
                            pass
            mixedIPAddressTable = SNMP_Networking_Utils.discoverMixedIPAddressTable(client)
            if mixedIPAddressTable:
                for row in mixedIPAddressTable:
                    if row.ipAddressStatus != '1' or row.ipAddressRowStatus != '1':# 1 means valid ip address in arp cache
                        continue
                    ifIndex = row.ipAddressIfIndex
                    ipAddress = _parseMixedIPFromIndex(row.ipAddressAddr)
                    if ifIndex and ipAddress:
                        try:
                            formatedIP = getValidIP(ipAddress)
                            if formatedIP and formatedIP.version == 6:
                                ipv6Map[ifIndex] = formatedIP
                        except:
                            pass

            if ipv6Map and interfaceOshToIndex:
                for ifIndex in ipv6Map.keys():
                    ipv6 = ipv6Map[ifIndex]
                    logger.debug("Discovered IPv6:", ipv6)
                    ipOSH = modeling.createIpOSH(ipv6)
                    vector.add(ipOSH)
                    interfaceOsh = interfaceOshToIndex.get(str(ifIndex))
                    if not interfaceOsh and isClient:
                        logger.info('client ip is not associated with an interface')
                        msg = "Can not find the related interface for client IP: %s" % ip_address
                        logger.reportWarningObject(errormessages.resolveError(msg, 'SNMP'))
                        continue
                    if interfaceOsh:
                        parent = modeling.createLinkOSH('containment', interfaceOsh, ipOSH)
                        vector.add(parent)
                        interfaceMacAddress = interfaceOsh.getAttributeValue('mac_address')
                        if (isClient == TRUE):
                            ipOSH.setAttribute('arp_mac', interfaceMacAddress)
                            if (
                            ipv6 == ip_addr_util.IPAddress(ip_address)):#compare ipv6 by the formatting to avoid same IPv6 with different format
                                snmpOSH.setAttribute('arp_mac', interfaceMacAddress)

                    isCompleteAttribute = hostOSH.getAttribute('host_iscomplete')
                    if isCompleteAttribute is not None and isCompleteAttribute.getBooleanValue() == 1:
                        contained = modeling.createLinkOSH('contained', hostOSH, ipOSH)
                        vector.add(contained)
        except:
            logger.debug(str(sys.exc_info()))

        index = 0
        if len(ips) > 0 and len(ifindexes) > 0:
            for ip in ips:
                try:
                    ip_addr = ip[1]
                    #logger.debug('candidate ip_addr: ', ip_addr)
                    ifIndex = ifindexes[index][1]
                    mask = ipmasks[index][1]
                    index += 1

                    interfaceOsh = interfaceOshToIndex.get(ifIndex)

                    ''' this commented out block should be removed
                    # no such thing as netmask IPs, there are broadcast IPs which have .255 in them
                    # but we would definitely want to discover and nic which was asssigned
                    # such an address -
                    #if(ip_addr.find('255.') == 0 ):
                        #exclude netmask ip
                        #continue
                    '''

                    if netutils.isValidIp(ip_addr) and (not netutils.isLocalIp(ip_addr)):
                        '''
                        netutils.isLocalIp is not finding all local addresses
                        127.0.0.0 through 127.255.255.255 are local
                        additional if clause can be removed when this is fixed
                        see http://www.tcpipguide.com/free/t_IPReservedPrivateandLoopbackAddresses.htm
                        '''
                        # ip is valid and not local (i.e. 0.0.0.0, 127.0.0.1)
                        ipOSH = modeling.createIpOSH(ip_addr, mask)
                    else:
                        # loopbacks are standard; don't complain about them in the logs
                        continue
                    logger.debug('ip_addr: ', ip_addr, ', mask: ', mask)

                    netOSH = modeling.createNetworkOSH(ip_addr, mask)

                    strNetAddr = str(netOSH.getAttribute('network_netaddr'))
                    strNetMask = str(netOSH.getAttribute('network_netMask'))
                    currNet = strNetAddr + strNetMask

                    broadcastIp = netOSH.getAttributeValue('network_broadcastaddress')
                    if ip_address == broadcastIp:
                        raise BroadcastIpDiscoveryException()
                    if not interfaceOsh and isClient:
                        logger.info('client ip is not associated with an interface')
                        msg = "Can not find the related interface for client IP: " + ip_addr
                        logger.reportWarningObject(errormessages.resolveError(msg, 'SNMP'))
                        continue
                    if interfaceOsh:
                        parent = modeling.createLinkOSH('containment', interfaceOsh, ipOSH)
                        vector.add(parent)
                        interfaceMacAddress = interfaceOsh.getAttributeValue('mac_address')
                        if (isClient == TRUE):
                            ipOSH.setAttribute('arp_mac', interfaceMacAddress)
                            if (ip_addr == ip_address):
                                snmpOSH.setAttribute('arp_mac', interfaceMacAddress)

                    member1 = modeling.createLinkOSH('member', netOSH, ipOSH)
                    member2 = modeling.createLinkOSH('member', netOSH, hostOSH)

                    if currNet in networkList:
                        pass
                    else:
                        networkList.append(currNet)
                        vector.add(netOSH)
                        vector.add(member2)

                    vector.add(ipOSH)
                    vector.add(member1)

                    # link IPs to host only in case host is complete
                    # otherwise reconciliation may fail
                    isCompleteAttribute = hostOSH.getAttribute('host_iscomplete')
                    if isCompleteAttribute is not None and isCompleteAttribute.getBooleanValue() == 1:
                        contained = modeling.createLinkOSH('contained', hostOSH, ipOSH)
                        vector.add(contained)

                    if interfaceOsh:
                        parent = modeling.createLinkOSH('containment', interfaceOsh, ipOSH)
                        vector.add(parent)
                except BroadcastIpDiscoveryException, ex:
                    raise ex
                except:
                    pass