def process(self, device, results, log):
        """process snmp information for components from this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        # These models contain OTU100G amplifiers to look for network ports on
        componentModels = [
            '10TCC-PCTN-10G+100GB', '10TCC-PCTN-10G+100GC',
            '10TCE-PCN-10G+100G', '10TCE-PCN-10G+100G-GF', 'WCC-PCTN-100GA',
            'WCC-PCTN-100GB'
        ]

        # SNMP table
        getdata, tabledata = results

        # cached data from device modeler
        inventoryTable = entityTable = opticalIfDiagTable = False
        containsOPRModules = {}
        gotCache, inventoryTable, entityTable, opticalIfDiagTable, \
            containsOPRModules = getCache(device.id, self.name(), log)
        if not gotCache:
            log.debug('Could not get cache for %s' % self.name())
            return

        # relationship mapping
        rm = self.relMap()

        # look for blades containing 100G Muxponder in inventory table
        for bladeEntityIndex in inventoryTable:
            bladeInv = inventoryTable[bladeEntityIndex]['inventoryUnitName']
            bladeIndexAid = entityTable[bladeEntityIndex]['entityIndexAid']
            if not bladeInv in componentModels:
                continue
            log.info('found 100G Muxponder OTU matching model %s' % bladeInv)

            # find ports from entityContainedIn for 100G OTU entityIndex
            portEntityIndex,portEntityIndexAid = \
                self.__findPort(log,bladeEntityIndex,entityTable)
            if portEntityIndex is False:
                continue

            om = self.objectMap()
            om.EntityIndex = int(portEntityIndex)
            om.inventoryUnitName = bladeInv
            if 'interfaceConfigIdentifier' in entityTable[portEntityIndex]:
                om.interfaceConfigId = \
                   entityTable[portEntityIndex]['interfaceConfigIdentifier']
            om.entityIndexAid = entityTable[portEntityIndex]['entityIndexAid']
            om.entityAssignmentState = \
                entityTable[portEntityIndex]['entityAssignmentState']
            om.id = self.prepId(om.entityIndexAid)
            om.title = om.entityIndexAid
            om.snmpindex = int(portEntityIndex)
            log.info('Found 100Gig Muxponder OTU at: %s inventoryUnitName: %s',
                     om.entityIndexAid, om.inventoryUnitName)

            rm.append(om)

        return rm
    def process(self, device, results, log):
        """process snmp information for containers for this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        # tabledata is not used (get tables from cache pickle file created
        # in FSP3000R7Device modeler)
        getdata = {}
        getdata['setHWTag'] = False
        getdata, tabledata = results
        if not getdata['setHWTag']:
            log.info("Couldn't get system name from Adva shelf.")

        inventoryTable = entityTable = opticalIfDiagTable = False
        containsModules = {}
        gotCache, inventoryTable, entityTable, opticalIfDiagTable, \
            containsModules = getCache(device.id, self.name(), log)
        if not gotCache:
            log.debug('Could not get cache for %s' % self.name())
            return

        # relationship mapping
        rm = self.relMap()

        # pick up MOD-* containers from entityTable
        for entityIndex, attributes in entityTable.items():
            # Power Supply, NCU and Fan models are already top level containers
            if entityIndex not in inventoryTable:
                continue
            inventoryUnitName = inventoryTable[entityIndex][
                'inventoryUnitName']
            if inventoryUnitName in FanorNCUorPSModels:
                continue

            entityIndexAid = attributes['entityIndexAid']

            if entityIndexAid.startswith('MOD-') or entityIndexAid.startswith(
                    'MODC-'):
                om = self.objectMap()
                om.EntityIndex = int(entityIndex)
                om.inventoryUnitName = inventoryUnitName
                om.entityIndexAid = entityIndexAid
                om.entityAssignmentState = attributes['entityAssignmentState']
                om.interfaceConfigId = ''
                om.sortKey = '000000000'
                om.entityAssignmentState = 'Not set by modeler'
                om.containedIn = 'Chassis'
                om.id = self.prepId(om.entityIndexAid)
                om.title = om.entityIndexAid
                om.snmpindex = int(entityIndex)
                log.info('Found module at: %s inventoryUnitName: %s',
                         om.entityIndexAid, om.inventoryUnitName)
                rm.append(om)

        return rm
    def process(self, device, results, log):
        """process snmp information for containers for this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        # tabledata is not used (get tables from cache pickle file created
        # in FSP3000R7Device modeler)
        getdata = {}
        getdata['setHWTag'] = False
        getdata, tabledata = results
        if not getdata['setHWTag']:
            log.info("Couldn't get system name from Adva shelf.")

        inventoryTable = entityTable = opticalIfDiagTable = False
        containsModules = {}
        gotCache, inventoryTable, entityTable, opticalIfDiagTable, \
            containsModules = getCache(device.id, self.name(), log)
        if not gotCache:
            log.debug('Could not get cache for %s' % self.name())
            return

        # relationship mapping
        rm = self.relMap()

        # pick up MOD-* containers from entityTable
        for entityIndex in entityTable:
            # Power Supply, NCU and Fan models are already top level containers
            if not (entityIndex in inventoryTable):
                continue
            inventoryUnitName = inventoryTable[entityIndex]['inventoryUnitName']
            if inventoryUnitName in FanorNCUorPSModels:
                continue
            if entityTable[entityIndex]['entityIndexAid'].startswith('MOD-'):
                om = self.objectMap()
                om.EntityIndex = int(entityIndex)
                om.inventoryUnitName = inventoryUnitName
                om.entityIndexAid = entityTable[entityIndex]['entityIndexAid']
                om.entityAssignmentState = \
                    entityTable[entityIndex]['entityAssignmentState']
                om.interfaceConfigId     = ''
                om.sortKey               = '000000000'
                om.entityAssignmentState = 'Not set by modeler'
                om.containedIn = 'Chassis'
                om.id = self.prepId(om.entityIndexAid)
                om.title = om.entityIndexAid
                om.snmpindex = int(entityIndex)
                log.info('Found module at: %s inventoryUnitName: %s',
                         om.entityIndexAid, om.inventoryUnitName)
                rm.append(om)

        return rm
    def process(self, device, results, log):
        """process snmp information for components from this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        # tabledata is not used (get tables from cache pickle file created
        # in FSP3000R7Device modeler)
        getdata = {}
        getdata['setHWTag'] = False
        getdata, tabledata = results
        if not getdata['setHWTag']:
            log.info("Couldn't get system name from Adva shelf.")

        inventoryTable = entityTable = opticalIfDiagTable = False
        containsOPRModules = {}
        gotCache, inventoryTable, entityTable, opticalIfDiagTable, \
            containsOPRModules = getCache(device.id, self.name(), log)
        if not gotCache:
            log.debug('Could not get cache for %s' % self.name())
            return

        # relationship mapping
        rm = self.relMap()

        for entityIndex, inventoryUnitName in inventoryTable.items():
            entityIndex_str = str(entityIndex)
            invName = inventoryUnitName['inventoryUnitName']
            modName = entityTable[entityIndex]['entityIndexAid']
            # if model name matches, assigned and equiped:
            if self.__model_match(invName, self.componentModels) \
              and entityIndex in entityTable \
              and 'entityAssignmentState' in entityTable[entityIndex] \
              and 'entityEquipmentState' in entityTable[entityIndex] \
              and entityTable[entityIndex]['entityAssignmentState'] == 1 \
              and entityTable[entityIndex]['entityEquipmentState'] == 1:
                # only add MOD name if power supply, fan or NCU
                if self.__class__.__name__ in ['FSP3000R7PowerSupplyMib',
                                               'FSP3000R7FanMib',
                                               'FSP3000R7NCUMib']:
                  om = self.objectMap()
                  om.EntityIndex = int(entityIndex)
                  om.inventoryUnitName = invName
                  # Add comment (e.g. 'RAMAN from Niles') if one exists
                  if 'interfaceConfigIdentifier' in entityTable[entityIndex]:
                      om.interfaceConfigId = \
                          entityTable[entityIndex]['interfaceConfigIdentifier']
                  om.entityIndexAid = modName
                  om.sortKey = self.__make_sort_key(modName)
                  om.entityAssignmentState = \
                      entityTable[entityIndex]['entityAssignmentState']
                  om.id = self.prepId(modName)
                  om.title = modName 
                  om.snmpindex = int(entityIndex)
                  log.info('Found component at: %s inventoryUnitName: %s',
                           modName, invName)
                  rm.append(om)

                # Now find sub-organizers that respond to OPR
                if modName not in containsOPRModules:
                    continue
                for entityIndex in containsOPRModules[modName]:
                    # skip non-production components
                    if not (entityIndex in entityTable
                      and 'entityAssignmentState' in entityTable[entityIndex]
                      and entityTable[entityIndex]['entityAssignmentState']==1):
                        continue;
                    om = self.objectMap()
                    om.EntityIndex = int(entityIndex)
                    om.inventoryUnitName = invName
                    if 'interfaceConfigIdentifier' in entityTable[entityIndex]:
                        om.interfaceConfigId = \
                           entityTable[entityIndex]['interfaceConfigIdentifier']
                    om.entityIndexAid=entityTable[entityIndex]['entityIndexAid']
                    om.sortKey = self.__make_sort_key(om.entityIndexAid)
                    om.entityAssignmentState = \
                        entityTable[entityIndex]['entityAssignmentState']
                    om.id = self.prepId(om.entityIndexAid)
                    om.title = om.entityIndexAid
                    om.snmpindex = int(entityIndex)
                    log.info('Found component at: %s inventoryUnitName: %s',
                             om.entityIndexAid, om.inventoryUnitName)

                    rm.append(om)

        return rm
    def process(self, device, results, log):
        """process snmp information for components from this device"""
        log.info("processing %s for device %s", self.name(), device.id)

        # These models contain OTU100G amplifiers to look for network ports on
        componentModels = [
            "10TCC-PCTN-10G+100GB",
            "10TCC-PCTN-10G+100GC",
            "10TCE-PCN-10G+100G",
            "10TCE-PCN-10G+100G-GF",
            "WCC-PCTN-100GA",
            "WCC-PCTN-100GB",
        ]

        # SNMP table
        getdata, tabledata = results

        # cached data from device modeler
        inventoryTable = entityTable = opticalIfDiagTable = False
        containsOPRModules = {}
        gotCache, inventoryTable, entityTable, opticalIfDiagTable, containsOPRModules = getCache(
            device.id, self.name(), log
        )
        if not gotCache:
            log.debug("Could not get cache for %s" % self.name())
            return

        # relationship mapping
        rm = self.relMap()

        # look for blades containing 100G Muxponder in inventory table
        for bladeEntityIndex in inventoryTable:
            bladeInv = inventoryTable[bladeEntityIndex]["inventoryUnitName"]
            bladeIndexAid = entityTable[bladeEntityIndex]["entityIndexAid"]
            if not bladeInv in componentModels:
                continue
            log.info("found 100G Muxponder OTU matching model %s" % bladeInv)

            # find ports from entityContainedIn for 100G OTU entityIndex
            portEntityIndex, portEntityIndexAid = self.__findPort(log, bladeEntityIndex, entityTable)
            if portEntityIndex is False:
                continue

            om = self.objectMap()
            om.EntityIndex = int(portEntityIndex)
            om.inventoryUnitName = bladeInv
            if "interfaceConfigIdentifier" in entityTable[portEntityIndex]:
                om.interfaceConfigId = entityTable[portEntityIndex]["interfaceConfigIdentifier"]
            om.entityIndexAid = entityTable[portEntityIndex]["entityIndexAid"]
            om.entityAssignmentState = entityTable[portEntityIndex]["entityAssignmentState"]
            om.id = self.prepId(om.entityIndexAid)
            om.title = om.entityIndexAid
            om.snmpindex = int(portEntityIndex)
            log.info("Found 100Gig Muxponder OTU at: %s inventoryUnitName: %s", om.entityIndexAid, om.inventoryUnitName)

            rm.append(om)

        return rm
    def process(self, device, results, log):
        """process snmp information for components from this device"""
        log.info('processing %s for device %s', self.name(), device.id)

        # tabledata is not used (get tables from cache pickle file created
        # in FSP3000R7Device modeler)
        getdata = {}
        getdata['setHWTag'] = False
        getdata, tabledata = results
        if not getdata['setHWTag']:
            log.info("Couldn't get system name from Adva shelf.")

        inventoryTable = entityTable = opticalIfDiagTable = False
        containsOPRModules = {}
        gotCache, inventoryTable, entityTable, opticalIfDiagTable, \
            containsOPRModules = getCache(device.id, self.name(), log)
        if not gotCache:
            log.debug('Could not get cache for %s' % self.name())
            return

        # relationship mapping
        rm = self.relMap()

        for entityIndex, inventoryUnitName in inventoryTable.items():
            entityIndex_str = str(entityIndex)
            invName = inventoryUnitName['inventoryUnitName']
            modName = entityTable[entityIndex]['entityIndexAid']
            # if model name matches, assigned and equiped:
            if self.__model_match(invName, self.componentModels) \
              and entityIndex in entityTable \
              and 'entityAssignmentState' in entityTable[entityIndex] \
              and 'entityEquipmentState' in entityTable[entityIndex] \
              and entityTable[entityIndex]['entityAssignmentState'] == 1 \
              and entityTable[entityIndex]['entityEquipmentState'] == 1:
                # only add MOD name if power supply, fan or NCU
                if self.__class__.__name__ in ['FSP3000R7PowerSupplyMib',
                                               'FSP3000R7FanMib',
                                               'FSP3000R7NCUMib']:
                  om = self.objectMap()
                  om.EntityIndex = int(entityIndex)
                  om.inventoryUnitName = invName
                  # Add comment (e.g. 'RAMAN from Niles') if one exists
                  if 'interfaceConfigIdentifier' in entityTable[entityIndex]:
                      om.interfaceConfigId = \
                          entityTable[entityIndex]['interfaceConfigIdentifier']
                  om.entityIndexAid = modName
                  om.sortKey = self.__make_sort_key(modName)
                  om.entityAssignmentState = \
                      entityTable[entityIndex]['entityAssignmentState']
                  om.id = self.prepId(modName)
                  om.title = modName 
                  om.snmpindex = int(entityIndex)
                  log.info('Found component at: %s inventoryUnitName: %s',
                           modName, invName)
                  rm.append(om)

                # Now find sub-organizers that respond to OPR
                if modName not in containsOPRModules:
                    continue
                for entityIndex in containsOPRModules[modName]:
                    # skip non-production components
                    if not (entityIndex in entityTable
                      and 'entityAssignmentState' in entityTable[entityIndex]
                      and entityTable[entityIndex]['entityAssignmentState']==1):
                        continue;
                    om = self.objectMap()
                    om.EntityIndex = int(entityIndex)
                    om.inventoryUnitName = invName
                    if 'interfaceConfigIdentifier' in entityTable[entityIndex]:
                        om.interfaceConfigId = \
                           entityTable[entityIndex]['interfaceConfigIdentifier']
                    om.entityIndexAid=entityTable[entityIndex]['entityIndexAid']
                    om.sortKey = self.__make_sort_key(om.entityIndexAid)
                    om.entityAssignmentState = \
                        entityTable[entityIndex]['entityAssignmentState']
                    om.id = self.prepId(om.entityIndexAid)
                    om.title = om.entityIndexAid
                    om.snmpindex = int(entityIndex)
                    log.info('Found component at: %s inventoryUnitName: %s',
                             om.entityIndexAid, om.inventoryUnitName)

                    rm.append(om)

        return rm