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);
}
}
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);
}
}
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;
}
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);
}
}
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);
}
}
}
Aggregations