Search in sources :

Example 81 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class SDNCQueryTasks method queryVfModuleForVolumeGroup.

/**
 * BPMN access method to query the SDNC for fetching the VfModuleForVolumeGroup details.
 *
 * It will get the vnf details according to Vf module id.
 *
 * @param execution @throws
 */
public void queryVfModuleForVolumeGroup(BuildingBlockExecution execution) {
    try {
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        if (vfModule.getSelflink() != null && !vfModule.getSelflink().isEmpty()) {
            String response = sdncVfModuleResources.queryVfModule(vfModule);
            execution.setVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId(), response);
        } else {
            throw new Exception("Vf Module " + vfModule.getVfModuleId() + " exists in gBuildingBlock but does not have a selflink value");
        }
    } catch (BBObjectNotFoundException bbException) {
        logger.error("Error occurred if bb object not found in SDNCQueryTasks queryVfModuleForVolumeGroup ", bbException);
        // the error as normal
        if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO);
        }
    } catch (BadResponseException ex) {
        logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
        if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
        } else {
            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
        }
    } catch (Exception ex) {
        logger.error("Exception occurred", ex);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
    }
}
Also used : BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException) BadResponseException(org.onap.so.client.exception.BadResponseException) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) BadResponseException(org.onap.so.client.exception.BadResponseException) BBObjectNotFoundException(org.onap.so.client.exception.BBObjectNotFoundException)

Example 82 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class DeleteVFModule method createInventoryVariable.

public void createInventoryVariable(BuildingBlockExecution execution) {
    try {
        VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
        GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
        GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
        CloudInformation cloudInformation = new CloudInformation();
        cloudInformation.setOwner(gBBInput.getCloudRegion().getCloudOwner());
        cloudInformation.setRegionId(gBBInput.getCloudRegion().getLcpCloudRegionId());
        cloudInformation.setTenantId(gBBInput.getTenant().getTenantId());
        cloudInformation.setTenantName(gBBInput.getTenant().getTenantName());
        cloudInformation.setTenantContext(gBBInput.getTenant().getTenantContext());
        cloudInformation.setTemplateInstanceId(vfModule.getHeatStackId());
        cloudInformation.setVnfName(vnf.getVnfName());
        cloudInformation.setVnfId(vnf.getVnfId());
        cloudInformation.setVfModuleId(vfModule.getVfModuleId());
        execution.setVariable("cloudInformation", cloudInformation);
    } catch (Exception e) {
        logger.error("Error building CloudInformation Object for NC Inventory", e);
        exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
    }
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) GeneralBuildingBlock(org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock) CloudInformation(org.onap.so.cloud.resource.beans.CloudInformation) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 83 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class OrchestrationStatusValidator method getOrchestrationStatus.

private OrchestrationStatus getOrchestrationStatus(BuildingBlockExecution execution, String buildingBlockFlowName, BuildingBlockDetail buildingBlockDetail) throws BBObjectNotFoundException, OrchestrationStatusValidationException {
    OrchestrationStatus orchestrationStatus = null;
    switch(buildingBlockDetail.getResourceType()) {
        case SERVICE:
            ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
            orchestrationStatus = serviceInstance.getOrchestrationStatus();
            break;
        case VNF:
            GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
            orchestrationStatus = genericVnf.getOrchestrationStatus();
            break;
        case VF_MODULE:
            VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
            orchestrationStatus = vfModule.getOrchestrationStatus();
            break;
        case VOLUME_GROUP:
            VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
            orchestrationStatus = volumeGroup.getOrchestrationStatus();
            break;
        case NETWORK:
            L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
            orchestrationStatus = network.getOrchestrationStatus();
            break;
        case NETWORK_COLLECTION:
            Collection networkCollection = getNetworkCollection(execution);
            orchestrationStatus = networkCollection.getOrchestrationStatus();
            break;
        case CONFIGURATION:
            Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
            orchestrationStatus = configuration.getOrchestrationStatus();
            break;
        case INSTANCE_GROUP:
            InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
            orchestrationStatus = instanceGroup.getOrchestrationStatus();
            break;
        case NO_VALIDATE:
            // short circuit and exit method
            execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
            break;
        default:
            // code
            throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
    }
    return orchestrationStatus;
}
Also used : L3Network(org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network) GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) Configuration(org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration) VolumeGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup) ServiceInstance(org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance) Collection(org.onap.so.bpmn.servicedecomposition.bbobjects.Collection) OrchestrationStatusValidationException(org.onap.so.client.exception.OrchestrationStatusValidationException) OrchestrationStatus(org.onap.so.db.catalog.beans.OrchestrationStatus) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule) InstanceGroup(org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup)

Example 84 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class ServiceEBBLoader method traverseVnfModules.

private void traverseVnfModules(List<Resource> resourceList, Resource vnfResource, List<Pair<WorkflowType, String>> aaiResourceIds, org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
    if (vnf.getVfModules() == null) {
        return;
    }
    for (VfModule vfModule : vnf.getVfModules()) {
        aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
        Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource);
        org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId());
        resource.setModelCustomizationId(aaiVfModule.getModelCustomizationId());
        resource.setModelInvariantId(aaiVfModule.getModelInvariantId());
        resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
        resourceList.add(resource);
    }
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Example 85 with VfModule

use of org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule in project so by onap.

the class VnfEBBLoader method processVfModules.

private void processVfModules(GenericVnf vnf, List<Pair<WorkflowType, String>> aaiResourceIds, List<Resource> resourceList, Resource vnfResource, DelegateExecution execution) {
    if (vnf.getVfModules() != null) {
        for (VfModule vfModule : vnf.getVfModules()) {
            aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
            Resource vfModuleResource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false, vnfResource);
            org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModule.getVfModuleId());
            vfModuleResource.setModelInvariantId(aaiVfModule.getModelInvariantId());
            vfModuleResource.setModelCustomizationId(aaiVfModule.getModelCustomizationId());
            vfModuleResource.setBaseVfModule(aaiVfModule.isIsBaseVfModule());
            resourceList.add(vfModuleResource);
            findConfigurationsInsideVfModule(execution, aaiVfModule, resourceList, vfModuleResource, aaiResourceIds);
        }
    }
}
Also used : Resource(org.onap.so.bpmn.infrastructure.workflow.tasks.Resource) VfModule(org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)

Aggregations

VfModule (org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule)97 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)74 ServiceInstance (org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance)53 Test (org.junit.Test)46 ModelInfoVfModule (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule)45 RequestContext (org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext)37 CloudRegion (org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion)35 ModelInfoServiceInstance (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance)30 GeneralBuildingBlock (org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock)27 ModelInfoGenericVnf (org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf)27 HashMap (java.util.HashMap)22 VolumeGroup (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup)20 OrchestrationContext (org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext)18 CreateVfModuleRequest (org.onap.so.adapters.vnfrest.CreateVfModuleRequest)14 ModelInfo (org.onap.so.serviceinstancebeans.ModelInfo)14 BBObjectNotFoundException (org.onap.so.client.exception.BBObjectNotFoundException)13 ResourceKey (org.onap.so.bpmn.servicedecomposition.entities.ResourceKey)12 Service (org.onap.so.db.catalog.beans.Service)12 Map (java.util.Map)11 Customer (org.onap.so.bpmn.servicedecomposition.bbobjects.Customer)11