Esempio n. 1
0
def DiscoveryMain(Framework):

    logger.info('Start Phase 2 ... Apply Mapping transformation to Atrium CIs')

    userExtUcmdbDir = CollectorsParameters.BASE_PROBE_MGR_DIR + CollectorsParameters.getDiscoveryResourceFolder() + '\\TQLExport\\Atrium\\'

    inputFilesDirectory = File(userExtUcmdbDir + 'inter\\')
    inputFiles = inputFilesDirectory.listFiles()

    filePathDir = userExtUcmdbDir + 'results\\'
    directory = File(filePathDir)
    files = directory.listFiles()

    ## Clean up the existing result XML files
    if (files != None):
        for file in files:
            file.delete()

    ## Make sure we have XML files in the intermediate directory
    xmlFileInIntermediatesDirectory = 0
    for inputFile in inputFiles:
        inputFileName = inputFile.getName()
        if inputFileName[len(inputFileName)-4:].lower() == '.xml' and inputFile.length() > 0:
            xmlFileInIntermediatesDirectory = 1
    if not xmlFileInIntermediatesDirectory:
        logger.warn('Intermediate XML not found or invalid. Perhaps no data was received from Atrium or an error occurred in the atrium_query script.')
        return

    ## Generate the output XML files in results directory
    ip = CollectorsParameters.getValue(CollectorsParameters.KEY_SERVER_NAME)
    integrationAPI = IntegrationAPI(ip, "atrium_map.py")
    integrationAPI.processDir(userExtUcmdbDir)

    logger.info('End Phase 2 ... Apply Mapping transformation to Atrium CIs')
Esempio n. 2
0
def getMapping(mappingFileName):
	try:
		objectTypeList = []
		relationshipList = []

		integrationAPI = IntegrationAPI(theFramework.getDestinationAttribute('ip_address'), "Pull_From_ARIS.py")
		integrationObjectList = integrationAPI.getMapping(mappingFileName)

		if not integrationObjectList:
			logger.warn('Unable to retrieve a list of objects from the mapping XML!')
			return
		else:
			debugPrint(4, '[' + SCRIPT_NAME + ':getMapping] Got <%s> objects and links from mapping XML' % len(integrationObjectList))

		for integrationObject in integrationObjectList:
			attList = []
			childList = []
			parentList = []
			## Pull attribute list
			attributeMap = integrationObject.getAttributeMap()
			attributeList = attributeMap.getAttributeList()
			for attribute in attributeList:
				attList.append(attribute)
			## Pull child list
			childHashMap = attributeMap.getChildList()
			for childName in childHashMap.keySet():
				childList.append([childName, childHashMap[childName]])
			## Pull parent list
			parentHashMap = attributeMap.getParentList()
			for parentName in parentHashMap.keySet():
				parentList.append([parentName, parentHashMap[parentName]])

			if integrationObject.isLink():
				relationshipList.append(SourceLinks(integrationObject.getObjectName(), integrationObject.getEnd1Object(), integrationObject.getEnd2Object(), None, None, attList))
			else:
				objectTypeList.append(SourceObjects(integrationObject.getObjectName(), None, None, attList, childList, parentList))

		if objectTypeList:
			debugPrint(3, '[' + SCRIPT_NAME + ':getMapping] Got <%s> objects from mapping XML' % len(objectTypeList))
		if relationshipList:
			debugPrint(3, '[' + SCRIPT_NAME + ':getMapping] Got <%s> links from mapping XML' % len(relationshipList))
		return (objectTypeList, relationshipList)
	except:
		excInfo = logger.prepareJythonStackTrace('')
		logger.warn('[' + SCRIPT_NAME + ':getMapping] Exception: <%s>' % excInfo)
		pass
Esempio n. 3
0
def DiscoveryMain(Framework):

    logger.info('Start Phase 2 ... Apply Mapping transformation to Atrium CIs')

    userExtUcmdbDir = CollectorsParameters.BASE_PROBE_MGR_DIR + CollectorsParameters.getDiscoveryResourceFolder(
    ) + '\\TQLExport\\Atrium\\'

    inputFilesDirectory = File(userExtUcmdbDir + 'inter\\')
    inputFiles = inputFilesDirectory.listFiles()

    filePathDir = userExtUcmdbDir + 'results\\'
    directory = File(filePathDir)
    files = directory.listFiles()

    ## Clean up the existing result XML files
    if (files != None):
        for file in files:
            file.delete()

    ## Make sure we have XML files in the intermediate directory
    xmlFileInIntermediatesDirectory = 0
    for inputFile in inputFiles:
        inputFileName = inputFile.getName()
        if inputFileName[len(inputFileName) -
                         4:].lower() == '.xml' and inputFile.length() > 0:
            xmlFileInIntermediatesDirectory = 1
    if not xmlFileInIntermediatesDirectory:
        logger.warn(
            'Intermediate XML not found or invalid. Perhaps no data was received from Atrium or an error occurred in the atrium_query script.'
        )
        return

    ## Generate the output XML files in results directory
    ip = CollectorsParameters.getValue(CollectorsParameters.KEY_SERVER_NAME)
    integrationAPI = IntegrationAPI(ip, "atrium_map.py")
    integrationAPI.processDir(userExtUcmdbDir)

    logger.info('End Phase 2 ... Apply Mapping transformation to Atrium CIs')
def exportTQL (ip, userExtDir):
	integrationAPI = IntegrationAPI (ip, "exportTQL_for_SIM_to_UCMDB.py")
	integrationAPI.processDir(userExtDir)
Esempio n. 5
0
def exportTQL(ip, userExtDir):
    integrationAPI = IntegrationAPI(ip, "exportTQL_for_SIM_to_UCMDB.py")
    integrationAPI.processDir(userExtDir)
def exportTQL (ip, userExtDir):
    integrationAPI = IntegrationAPI ()
    integrationAPI.processDir(userExtDir)
Esempio n. 7
0
def getMapping(mappingFileName):
    try:
        objectTypeList = []
        relationshipList = []

        integrationAPI = IntegrationAPI(
            theFramework.getDestinationAttribute('ip_address'),
            "Pull_From_ARIS.py")
        integrationObjectList = integrationAPI.getMapping(mappingFileName)

        if not integrationObjectList:
            logger.warn(
                'Unable to retrieve a list of objects from the mapping XML!')
            return
        else:
            debugPrint(
                4, '[' + SCRIPT_NAME +
                ':getMapping] Got <%s> objects and links from mapping XML' %
                len(integrationObjectList))

        for integrationObject in integrationObjectList:
            attList = []
            childList = []
            parentList = []
            ## Pull attribute list
            attributeMap = integrationObject.getAttributeMap()
            attributeList = attributeMap.getAttributeList()
            for attribute in attributeList:
                attList.append(attribute)
            ## Pull child list
            childHashMap = attributeMap.getChildList()
            for childName in childHashMap.keySet():
                childList.append([childName, childHashMap[childName]])
            ## Pull parent list
            parentHashMap = attributeMap.getParentList()
            for parentName in parentHashMap.keySet():
                parentList.append([parentName, parentHashMap[parentName]])

            if integrationObject.isLink():
                relationshipList.append(
                    SourceLinks(integrationObject.getObjectName(),
                                integrationObject.getEnd1Object(),
                                integrationObject.getEnd2Object(), None, None,
                                attList))
            else:
                objectTypeList.append(
                    SourceObjects(integrationObject.getObjectName(), None,
                                  None, attList, childList, parentList))

        if objectTypeList:
            debugPrint(
                3, '[' + SCRIPT_NAME +
                ':getMapping] Got <%s> objects from mapping XML' %
                len(objectTypeList))
        if relationshipList:
            debugPrint(
                3, '[' + SCRIPT_NAME +
                ':getMapping] Got <%s> links from mapping XML' %
                len(relationshipList))
        return (objectTypeList, relationshipList)
    except:
        excInfo = logger.prepareJythonStackTrace('')
        logger.warn('[' + SCRIPT_NAME +
                    ':getMapping] Exception: <%s>' % excInfo)
        pass
def exportTQL(ip, userExtDir):
    integrationAPI = IntegrationAPI()
    integrationAPI.processDir(userExtDir)