Beispiel #1
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
Beispiel #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