def parseDbLink2Res(dbLink2Res):
        if dbLink2Res:
            rows = dbLink2Res.getRowCount()
            cols = dbLink2Res.getColumnCount()
            if mam_utils.isDebugEnabled():
                mam_utils.debug('########## sql-statement: rwos,columns' ,dbLink2, rows, cols)
            for row in range(rows):
                ###################################################
                ### map discovered values to variables
                ###################################################
                parent_name           = dbLink2Res.getCell(row, 5)
                child_name            = dbLink2Res.getCell(row, 2)
                sequence              = dbLink2Res.getCell(row, 8)
                ####################################################
                ### define object stateholder for discovered CI
                ### ObjectStateHolder([CI-TYPE],6)
                ####################################################
                dbparentOSH        = ObjectStateHolder(ci_type, 6)
                dbchildOSH         = ObjectStateHolder(child_ci_type, 6)
                ####################################################
                ### map variables to CI attributes 0=overwrite 1=insert
                ####################################################
                dbparentOSH.setAttribute(AttributeStateHolder('data_name', parent_name, 1,'String'))
                # dbparentOSH.setContainer('root_container', businessOSH)
                dbchildOSH.setAttribute(AttributeStateHolder('data_name', child_name, 1,'String'))
                if mam_utils.isDebugEnabled():
                    mam_utils.debug('########## found the following attributes: parent,child,sequence' ,dbLink2,parent_name ,child_name,sequence)
                ####################################################
                ### add link to CMDB
                ####################################################
                linkOSH = HostKeyUtil.getLink(relation_2, dbparentOSH, dbchildOSH)
                linkOSH.setAttribute(AttributeStateHolder('sequence', sequence, 0,'String'))
                OSHVSResult.add(linkOSH)
def parseDbRelation(dbRelationRes):
    if dbRelationRes:
        rows = dbRelationRes.getRowCount()
        cols = dbRelationRes.getColumnCount()
        if mam_utils.isDebugEnabled():
            mam_utils.debug('----- Number of Relations: ', rows)
        for row in range(rows):
            parentType = dbRelationRes.getCell(row, 0)
            parentType = parentType.replace(' ', '_')
            parentID = dbRelationRes.getCell(row, 1)
            parentName = dbRelationRes.getCell(row, 2)
            relationID = dbRelationRes.getCell(row, 3)
            relationName = dbRelationRes.getCell(row, 4)
            relationName = relationName.replace(' ', '_')
            childType = dbRelationRes.getCell(row, 5)
            childType = childType.replace(' ', '_')
            childID = dbRelationRes.getCell(row, 6)
            childName = dbRelationRes.getCell(row, 7)

            sap_transactionOSH.setAttribute(
                AttributeStateHolder('data_name', parentName, 0, 'String'))
            ##test=sap_transactionOSH.getAttributeValue('data_name')
            ##mam_utils.debug('----- sap_transaction_Name ' , test)
            ##sap_transactionOSH.setContainer('root_container', 'sap_resource')
            mam_utils.debug('----- sap_transactionOSH ', sap_transactionOSH)
            dbChildOSH = ObjectStateHolder(childType, 6)
            dbChildOSH.setAttribute(
                AttributeStateHolder('data_name', childName, 0, 'String'))
            mam_utils.debug('----- dbChildOSH: ', dbChildOSH)
            linkOSH = HostKeyUtil.getLink('IS_TRANSACTION', sap_transactionOSH,
                                          dbChildOSH)
            OSHVSResult.add(linkOSH)
def parseDbRelation(dbRelationRes):
		if dbRelationRes:
			rows = dbRelationRes.getRowCount()
			cols = dbRelationRes.getColumnCount()
			if mam_utils.isDebugEnabled():
				mam_utils.debug('----- Number of Relations: ' , rows)
			for row in range(rows):
				parentType		= dbRelationRes.getCell(row, 0)
				parentType=parentType.replace(' ','_')
				parentID		= dbRelationRes.getCell(row, 1)
				parentName		= dbRelationRes.getCell(row, 2)
				relationID		= dbRelationRes.getCell(row, 3)
				relationName		= dbRelationRes.getCell(row, 4)
				relationName=relationName.replace(' ','_')
				childType		= dbRelationRes.getCell(row, 5)
				childType=childType.replace(' ','_')
				childID		= dbRelationRes.getCell(row, 6)
				childName		= dbRelationRes.getCell(row, 7)

				sap_transactionOSH.setAttribute(AttributeStateHolder('data_name', parentName, 0, 'String'))
				##test=sap_transactionOSH.getAttributeValue('data_name')
				##mam_utils.debug('----- sap_transaction_Name ' , test)
				##sap_transactionOSH.setContainer('root_container', 'sap_resource')
				mam_utils.debug('----- sap_transactionOSH ' , sap_transactionOSH)
				dbChildOSH		= ObjectStateHolder(childType,6)	
				dbChildOSH.setAttribute(AttributeStateHolder('data_name', childName, 0,'String'))
				mam_utils.debug('----- dbChildOSH: ' , dbChildOSH)
				linkOSH = HostKeyUtil.getLink('IS_TRANSACTION', sap_transactionOSH, dbChildOSH)
				OSHVSResult.add(linkOSH)
def parseDbLink3Res(dbLink3Res):
    if dbLink3Res:
        rows = dbLink3Res.getRowCount()
        cols = dbLink3Res.getColumnCount()
        if mam_utils.isDebugEnabled():
            mam_utils.debug('########## sql-statement: rows,cols', dbLink3,
                            rows, cols)
        for row in range(rows):
            ###################################################
            ### map discovered values to variables
            ###################################################
            request_type = dbLink3Res.getCell(row, 0)
            parent_name = dbLink3Res.getCell(row, 1)
            child_name = dbLink3Res.getCell(row, 2)
            data_description = dbLink3Res.getCell(row, 2)
            ### sequence              = dbLink3Res.getCell(row, 8)
            ####################################################
            ### define object stateholder for discovered CI
            ### ObjectStateHolder([CI-TYPE],6)
            ####################################################
            dbparentOSH = ObjectStateHolder('SAPCCM_ALM_Request', 6)
            dbchildOSH = ObjectStateHolder('SAPCCM_ALM_BusService', 6)
            dbObjOSH = ObjectStateHolder('SAPCCM_ALM_Request', 6)
            ####################################################
            ### map variables to CI attributes 0=overwrite 1=insert
            ####################################################
            dbparentOSH.setAttribute(
                AttributeStateHolder('request_type', request_type, 1,
                                     'String'))
            dbparentOSH.setAttribute(
                AttributeStateHolder('data_name', parent_name, 0, 'String'))
            dbObjOSH.setAttribute(
                AttributeStateHolder('data_name', parent_name, 1, 'String'))
            dbObjOSH.setAttribute(
                AttributeStateHolder('data_description', data_description, 1,
                                     'String'))
            dbchildOSH.setAttribute(
                AttributeStateHolder('data_name', child_name, 1, 'String'))
            if mam_utils.isDebugEnabled():
                mam_utils.debug(
                    '########## found the following attributes: type,parent,child,desscription',
                    dbLink3, request_type, parent_name, child_name,
                    data_description)
            ####################################################
            ### set root_container; needs an defined CMDB GUID f.e. by an object stateholder
            ####################################################
            dbObjOSH.setContainer('root_container', businessOSH)
            ####################################################
            ### add object stateholder with all attributes to CMDB
            ####################################################
            OSHVSResult.add(dbObjOSH)
            ####################################################
            ### add link to CMDB
            ####################################################
            linkOSH = HostKeyUtil.getLink('IS_REQUEST', dbparentOSH,
                                          dbchildOSH)
            OSHVSResult.add(linkOSH)
def parseDbRelation(dbRelationRes):
		if dbRelationRes:
			rows = dbRelationRes.getRowCount()
			cols = dbRelationRes.getColumnCount()
			for row in range(rows):
				cmdbID 		= dbRelationRes.getCell(row, 0)
				transactionName	= dbRelationRes.getCell(row, 1)
				programName	= dbRelationRes.getCell(row, 2)
				dbChildOSH		= ObjectStateHolder('SAPCCM_ALM_Program',6)	
				dbChildOSH.setAttribute(AttributeStateHolder('data_name', programName, 0,'String'))
				##dbChildOSH.setContainer('root_container', oracleOSH)
				linkOSH = HostKeyUtil.getLink('IS_PROGRAM', dbChildOSH,sap_transactionOSH)
				OSHVSResult.add(linkOSH)
def parseDbLink3Res(dbLink3Res):
        if dbLink3Res:
            rows = dbLink3Res.getRowCount()
            cols = dbLink3Res.getColumnCount()
            if mam_utils.isDebugEnabled():
                mam_utils.debug('########## sql-statement: rows,cols' ,dbLink3, rows, cols)
            for row in range(rows):
                ###################################################
                ### map discovered values to variables
                ###################################################
                request_type           = dbLink3Res.getCell(row, 0)
                parent_name           = dbLink3Res.getCell(row, 1)
                child_name            = dbLink3Res.getCell(row, 2)
                data_description            = dbLink3Res.getCell(row, 2)
                ### sequence              = dbLink3Res.getCell(row, 8)
                ####################################################
                ### define object stateholder for discovered CI
                ### ObjectStateHolder([CI-TYPE],6)
                ####################################################
                dbparentOSH        = ObjectStateHolder('SAPCCM_ALM_Request', 6)
                dbchildOSH         = ObjectStateHolder('SAPCCM_ALM_BusService', 6)
                dbObjOSH       = ObjectStateHolder('SAPCCM_ALM_Request', 6)
                ####################################################
                ### map variables to CI attributes 0=overwrite 1=insert
                ####################################################
                dbparentOSH.setAttribute(AttributeStateHolder('request_type', request_type, 1,'String'))
                dbparentOSH.setAttribute(AttributeStateHolder('data_name', parent_name, 0,'String'))
                dbObjOSH.setAttribute(AttributeStateHolder('data_name', parent_name, 1,'String'))
                dbObjOSH.setAttribute(AttributeStateHolder('data_description',data_description, 1,'String'))
                dbchildOSH.setAttribute(AttributeStateHolder('data_name', child_name, 1,'String'))
                if mam_utils.isDebugEnabled():
                    mam_utils.debug('########## found the following attributes: type,parent,child,desscription' ,dbLink3,request_type,parent_name,child_name,data_description)
                ####################################################
                ### set root_container; needs an defined CMDB GUID f.e. by an object stateholder
                ####################################################
                dbObjOSH.setContainer('root_container', businessOSH)
                ####################################################
                ### add object stateholder with all attributes to CMDB
                ####################################################
                OSHVSResult.add(dbObjOSH)
                ####################################################
                ### add link to CMDB
                ####################################################
                linkOSH = HostKeyUtil.getLink('IS_REQUEST', dbparentOSH, dbchildOSH)
                OSHVSResult.add(linkOSH)
Exemplo n.º 7
0
def parseDbLink2Res(dbLink2Res):
    if dbLink2Res:
        rows = dbLink2Res.getRowCount()
        cols = dbLink2Res.getColumnCount()
        if mam_utils.isDebugEnabled():
            mam_utils.debug('########## sql-statement: rwos,columns', dbLink2,
                            rows, cols)
        for row in range(rows):
            ###################################################
            ### map discovered values to variables
            ###################################################
            parent_name = dbLink2Res.getCell(row, 5)
            child_name = dbLink2Res.getCell(row, 2)
            sequence = dbLink2Res.getCell(row, 8)
            ####################################################
            ### define object stateholder for discovered CI
            ### ObjectStateHolder([CI-TYPE],6)
            ####################################################
            dbparentOSH = ObjectStateHolder(ci_type, 6)
            dbchildOSH = ObjectStateHolder(child_ci_type, 6)
            ####################################################
            ### map variables to CI attributes 0=overwrite 1=insert
            ####################################################
            dbparentOSH.setAttribute(
                AttributeStateHolder('data_name', parent_name, 1, 'String'))
            # dbparentOSH.setContainer('root_container', businessOSH)
            dbchildOSH.setAttribute(
                AttributeStateHolder('data_name', child_name, 1, 'String'))
            if mam_utils.isDebugEnabled():
                mam_utils.debug(
                    '########## found the following attributes: parent,child,sequence',
                    dbLink2, parent_name, child_name, sequence)
            ####################################################
            ### add link to CMDB
            ####################################################
            linkOSH = HostKeyUtil.getLink(relation_2, dbparentOSH, dbchildOSH)
            linkOSH.setAttribute(
                AttributeStateHolder('sequence', sequence, 0, 'String'))
            OSHVSResult.add(linkOSH)
def parseDbRelation(dbRelationRes):
		if dbRelationRes:
			rows = dbRelationRes.getRowCount()
			cols = dbRelationRes.getColumnCount()
			if mam_utils.isDebugEnabled():
				mam_utils.debug('----- Number of Relations: ' , rows)
			for row in range(rows):
				parentType		= dbRelationRes.getCell(row, 0)
				parentType=parentType.replace(' ','_')
				parentID		= dbRelationRes.getCell(row, 1)
				parentName		= dbRelationRes.getCell(row, 2)
				hier		= dbRelationRes.getCell(row, 3)
				childID		= dbRelationRes.getCell(row, 4)
				childName		= dbRelationRes.getCell(row, 5)
				childType		= dbRelationRes.getCell(row, 6)
				childType=childType.replace(' ','_')
				tag		= dbRelationRes.getCell(row, 7)
				seq		= dbRelationRes.getCell(row, 8)
				relationID		= dbRelationRes.getCell(row, 9)
				relationName		= dbRelationRes.getCell(row, 10)
				relationName=relationName.replace(' ','_')
				#################################################
				## source link end
				#################################################
				sap_transactionOSH 	= ObjectStateHolder('sap_transaction', 6)
				sap_transactionOSH.setAttribute(AttributeStateHolder('data_name', childName, 0, 'String'))
				sap_transactionOSH.setContainer('sap_resource_list', siteOSH)
				#################################################
				## target link end
				#################################################
				dbChildOSH		= ObjectStateHolder(parentType,6)	
				dbChildOSH.setAttribute(AttributeStateHolder('data_name', parentName, 1,'String'))
				#################################################
				## link
				#################################################
				linkOSH = HostKeyUtil.getLink('IS_TRANSACTION',sap_transactionOSH, dbChildOSH)
				OSHVSResult.add(linkOSH)