diff options
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main')
18 files changed, 364 insertions, 370 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java index bbdcbf7ae3..a8eb791484 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java @@ -53,7 +53,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.BBObjectNotFoundException; import org.onap.so.client.exception.ExceptionBuilder; @@ -690,7 +690,7 @@ public class AAICreateTasks { if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); uri.queryParam(NETWORK_POLICY_FQDN_PARAM, fqdn); Optional<org.onap.aai.domain.yang.NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(uri); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java index 15f8c5e4ef..04f47e0306 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java @@ -39,7 +39,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.AAIObjectPlurals; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.exception.ExceptionBuilder; import org.onap.so.client.orchestration.AAIConfigurationResources; @@ -279,7 +279,7 @@ public class AAIDeleteTasks { if (fqdnCount > 0) { for (int i = 0; i < fqdnCount; i++) { String fqdn = fqdnList[i]; - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY); uri.queryParam(networkPolicyFqdnParam, fqdn); Optional<NetworkPolicies> oNetPolicies = aaiNetworkResources.getNetworkPolicies(uri); if (oNetPolicies.isPresent()) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java index 33b60a9ed3..b6ab9d0ce6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java @@ -45,9 +45,7 @@ import java.util.Map; @Component public class AAIUpdateTasks { private static final Logger logger = LoggerFactory.getLogger(AAIUpdateTasks.class); - private static final String ALACARTE = "aLaCarte"; - private static final String MULTI_STAGE_DESIGN_OFF = "false"; - private static final String MULTI_STAGE_DESIGN_ON = "true"; + @Autowired private AAIServiceInstanceResources aaiServiceInstanceResources; @Autowired @@ -128,68 +126,27 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of VolumeGroup to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) { - try { - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); - CloudRegion cloudRegion = gBBInput.getCloudRegion(); - volumeGroup.setHeatStackId(""); - aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, - OrchestrationStatus.ASSIGNED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.ASSIGNED); } /** * BPMN access method to update status of VolumeGroup to Active in AAI - * - * @param execution */ public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) { - try { - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); - CloudRegion cloudRegion = gBBInput.getCloudRegion(); - - aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, - OrchestrationStatus.ACTIVE); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.ACTIVE); } /** * BPMN access method to update status of VolumeGroup to Created in AAI - * - * @param execution */ public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) { - try { - GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); - - VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); - CloudRegion cloudRegion = gBBInput.getCloudRegion(); - - aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, - OrchestrationStatus.CREATED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVolumeGroup(execution, OrchestrationStatus.CREATED); } /** * BPMN access method to update HeatStackId and VolumeGroup in AAI - * - * @param execution */ public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) { try { @@ -211,87 +168,36 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of VfModule to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) { - try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - vfModule.setHeatStackId(""); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVfModule", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ASSIGNED); } /** * BPMN access method to update status of VfModule to PendingActivation in AAI - * - * @param execution */ public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) { - try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, - OrchestrationStatus.PENDING_ACTIVATION); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.PENDING_ACTIVATION); } /** - * BPMN access method to update status of VfModule to AssignedOrPendingActivation in AAI - * - * @param execution + * BPMN access method to update status of VfModule to Created in AAI */ - public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) { - try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - vfModule.setHeatStackId(""); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - String multiStageDesign = MULTI_STAGE_DESIGN_OFF; - if (vnf.getModelInfoGenericVnf() != null) { - multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign(); - } - boolean aLaCarte = (boolean) execution.getVariable(ALACARTE); - if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) { - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, - OrchestrationStatus.PENDING_ACTIVATION); - } else { - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); - } - } catch (Exception ex) { - logger.error( - "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule", - ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.CREATED); } /** - * BPMN access method to update status of VfModule to Created in AAI - * - * @param execution + * BPMN access method to update status of VfModule to Active in AAI */ - public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) { - try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVfModule", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { + execution.setVariable("aaiActivateVfModuleRollback", false); + updateOrchestrationStatusForVfModule(execution, OrchestrationStatus.ACTIVE); + execution.setVariable("aaiActivateVfModuleRollback", true); } /** * BPMN access method to update aaiDeactivateVfModuleRollback to true for deactivating the VfModule - * - * @param execution */ public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeactivateVfModuleRollback", false); @@ -308,9 +214,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Assigned in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) { updateNetwork(execution, OrchestrationStatus.ASSIGNED); @@ -318,9 +221,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Active in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) { updateNetwork(execution, OrchestrationStatus.ACTIVE); @@ -328,9 +228,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network to Created in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) { updateNetwork(execution, OrchestrationStatus.CREATED); @@ -365,9 +262,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of L3Network Collection to Active in AAI - * - * @param execution - * @throws BBObjectNotFoundException */ public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) { execution.setVariable("aaiNetworkCollectionActivateRollback", false); @@ -388,27 +282,7 @@ public class AAIUpdateTasks { } /** - * BPMN access method to update status of VfModule to Active in AAI - * - * @param execution - */ - public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) { - execution.setVariable("aaiActivateVfModuleRollback", false); - try { - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE); - execution.setVariable("aaiActivateVfModuleRollback", true); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateVfModule", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - - /** * BPMN access method to update HeatStackId of VfModule in AAI - * - * @param execution */ public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { try { @@ -428,9 +302,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network after it was created in cloud - * - * @param execution - * @throws Exception */ public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception { execution.setVariable("aaiNetworkActivateRollback", false); @@ -472,9 +343,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network after it was updated in cloud - * - * @param execution - * @throws Exception */ public void updateNetworkUpdated(BuildingBlockExecution execution) throws Exception { L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID); @@ -502,8 +370,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update L3Network Object - * - * @param execution */ public void updateObjectNetwork(BuildingBlockExecution execution) { try { @@ -517,8 +383,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update ServiceInstance - * - * @param execution */ public void updateServiceInstance(BuildingBlockExecution execution) { try { @@ -533,8 +397,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update Vnf Object - * - * @param execution */ public void updateObjectVnf(BuildingBlockExecution execution) { try { @@ -548,8 +410,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of VfModuleRollback as true - * - * @param execution */ public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { execution.setVariable("aaiDeleteVfModuleRollback", false); @@ -557,9 +417,6 @@ public class AAIUpdateTasks { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); vfModule.setHeatStackId(""); GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - - VfModule copiedVfModule = vfModule.shallowCopyId(); - copiedVfModule.setHeatStackId(""); aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED); execution.setVariable("aaiDeleteVfModuleRollback", true); } catch (Exception ex) { @@ -570,8 +427,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update Model of VfModule - * - * @param execution */ public void updateModelVfModule(BuildingBlockExecution execution) { try { @@ -586,8 +441,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of FabricConfiguration to Assigned in AAI - * - * @param execution */ public void updateOrchestrationStatusAssignFabricConfiguration(BuildingBlockExecution execution) { try { @@ -602,8 +455,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of FabricConfiguration to Active in AAI - * - * @param execution */ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) { try { @@ -618,8 +469,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of FabricConfiguration to deactive in AAI - * - * @param execution */ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) { try { @@ -635,8 +484,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update Ipv4OamAddress of Vnf - * - * @param execution */ public void updateIpv4OamAddressVnf(BuildingBlockExecution execution) { try { @@ -658,8 +505,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update ManagementV6Address of Vnf - * - * @param execution */ public void updateManagementV6AddressVnf(BuildingBlockExecution execution) { try { @@ -681,8 +526,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update ContrailServiceInstanceFqdn of VfModule - * - * @param execution */ public void updateContrailServiceInstanceFqdnVfModule(BuildingBlockExecution execution) { try { @@ -701,8 +544,6 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of Vnf to ConfigAssigned in AAI - * - * @param execution */ public void updateOrchestrationStatusConfigAssignedVnf(BuildingBlockExecution execution) { try { @@ -716,79 +557,16 @@ public class AAIUpdateTasks { /** * BPMN access method to update status of Vnf to Configure in AAI - * - * @param execution */ public void updateOrchestrationStatusConfigDeployConfigureVnf(BuildingBlockExecution execution) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURE); - - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfigureVnf", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURE); } /** * BPMN access method to update status of Vnf to configured in AAI - * - * @param execution */ public void updateOrchestrationStatusConfigDeployConfiguredVnf(BuildingBlockExecution execution) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGURED); - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigDeployConfiguredVnf", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - - /** - * BPMN access method to update status of VNF/VF-Module based on SO scope and action. - * - * @param execution - BuildingBlockExecution - * @param scope - SO scope (vnf/vfModule) - * @param action - action (configAssign/configDeploy/configUndeploy etc..) - */ - public void updateOrchestrationStatusForCds(BuildingBlockExecution execution, String scope, String action) { - try { - GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); - OrchestrationStatus status = getOrchestrationStatus(action); - switch (scope) { - case "vnf": - aaiVnfResources.updateOrchestrationStatusVnf(vnf, status); - break; - case "vfModule": - VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); - aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status); - break; - default: - throw new IllegalArgumentException( - "Invalid scope to update orchestration status for CDS : " + action); - } - } catch (Exception ex) { - logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusForCds", ex); - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); - } - } - - private OrchestrationStatus getOrchestrationStatus(String action) { - /** - * At this state, OrcherstationStatus enum associated with configAssign and configDeploy. I am not sure which is - * the correct approach. 1. Are we going to map each specific action to OrchestrationStauts ? 2. We will have - * only one generic status for all actions ? - */ - - switch (action) { - case "configAssign": - return OrchestrationStatus.ASSIGNED; - case "configDeploy": - return OrchestrationStatus.CONFIGURED; - default: - throw new IllegalArgumentException("Invalid action to set Orchestration status: " + action); - } + updateOrchestrationStatusForVnf(execution, OrchestrationStatus.CONFIGURED); } private void updateOrchestrationStatusForService(BuildingBlockExecution execution, OrchestrationStatus status) { @@ -824,4 +602,34 @@ public class AAIUpdateTasks { } } + private void updateOrchestrationStatusForVolumeGroup(BuildingBlockExecution execution, OrchestrationStatus status) { + try { + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID); + if (status.equals(OrchestrationStatus.ASSIGNED)) { + volumeGroup.setHeatStackId(""); + } + aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, + execution.getGeneralBuildingBlock().getCloudRegion(), status); + } catch (Exception ex) { + logger.error("Exception occurred in AAIUpdateTasks during update orchestration status to {} for " + + "volume group", status, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + + private void updateOrchestrationStatusForVfModule(BuildingBlockExecution execution, OrchestrationStatus status) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID); + if (status.equals(OrchestrationStatus.ASSIGNED)) { + vfModule.setHeatStackId(""); + } + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID); + aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, status); + } catch (Exception ex) { + logger.error( + "Exception occurred in AAIUpdateTasks during update orchestration status to {} for " + "vf module", + status, ex); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java index 9697246b03..9c55d0a922 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java @@ -1,7 +1,9 @@ package org.onap.so.bpmn.infrastructure.appc.tasks; import java.util.ArrayList; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.Optional; import org.onap.aai.domain.yang.Vserver; import org.onap.appc.client.lcm.model.Action; @@ -29,6 +31,8 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.ObjectMapper; @Component public class AppcOrchestratorPreProcessor { @@ -84,8 +88,16 @@ public class AppcOrchestratorPreProcessor { appcTaskRequest.setNewSoftwareVersion(newSoftwareVersion); String operationsTimeout = JsonUtils.getJsonValue(payload, "operations_timeout"); appcTaskRequest.setOperationsTimeout(operationsTimeout); - } + Map<String, String> configMap = new HashMap<>(); + ObjectMapper objectMapper = new ObjectMapper(); + String configParamsStr = JsonUtils.getJsonValue(payload, "configuration_parameters"); + if (configParamsStr != null) { + configMap = + objectMapper.readValue(configParamsStr, new TypeReference<HashMap<String, String>>() {}); + } + appcTaskRequest.setConfigParams(configMap); + } ControllerSelectionReference controllerSelectionReference = catalogDbClient .getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString()); String controllerType = null; @@ -229,8 +241,13 @@ public class AppcOrchestratorPreProcessor { .isEmpty()) { errorMessage = "APPC action Snapshot is missing vserverId parameter. "; } - break; } + break; + case ConfigModify: + if (appcTaskRequest.getConfigParams().isEmpty() || appcTaskRequest.getConfigParams() == null) { + errorMessage = "APPC action ConfigModify is missing Configuration parameters. "; + } + break; default: break; } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java index ed865e058f..ea3405d423 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java @@ -1,7 +1,7 @@ /*- * ============LICENSE_START======================================================= * Copyright (C) 2019 Nordix - * Modifications Copyright (C) 2020 Huawei + * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,10 +26,11 @@ import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import org.springframework.stereotype.Component; import org.camunda.bpm.engine.delegate.DelegateExecution; -import org.onap.so.bpmn.core.json.JsonUtils; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.common.SoPropertyConstants; import org.onap.so.bpmn.infrastructure.decisionpoint.impl.camunda.controller.LcmControllerDE; +import org.onap.so.client.exception.BadResponseException; +import org.onap.so.client.exception.PayloadGenerationException; import org.onap.so.client.sdnc.common.SDNCConstants; import org.onap.so.client.sdnc.lcm.*; import org.onap.so.client.sdnc.lcm.beans.*; @@ -60,26 +61,20 @@ public class SdncControllerDE extends LcmControllerDE { logger.debug("Running activity for id: {}, name: {}", execution.getCurrentActivityId(), execution.getCurrentActivityName()); - boolean result; try { LcmInput lcmInput = buildLcmInput(execution); - if (lcmInput != null) { - result = sendLcmRequest(execution, lcmInput); - } else { - logger.error("Build LCM Input error"); - result = false; - } - } catch (Exception e) { - logger.error("Call SDNC LCM Client failure: ", e); - result = false; - } + sendLcmRequest(execution, lcmInput); - if (result) { execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Success"); - } else { + } catch (Exception e) { execution.setVariable(SoPropertyConstants.CONTROLLER_STATUS, "Failure"); + + exceptionUtil.buildAndThrowWorkflowException(execution, SDNC_DELEGATE_EXECUTION_ERROR_CODE, e); } + logger.debug("Finish activity for id: {}, name: {}", execution.getCurrentActivityId(), + execution.getCurrentActivityName()); + return 0; } @@ -88,49 +83,57 @@ public class SdncControllerDE extends LcmControllerDE { return SDNC_DELEGATE_EXECUTION_ERROR_CODE; } - private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) { + private LcmOutput sendSyncRequest(String operation, LcmInput lcmInput) throws BadResponseException { SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); SDNCLcmRestClient sdncLcmRestClient; try { sdncLcmRestClient = sdncLcmClientBuilder.newSDNCLcmRestClient(operation); } catch (SDNCLcmClientBuilderException e) { logger.error("Create SDNCLcmRestClient error: ", e); - return null; + throw new BadResponseException("Can not send request to SDNC."); } - return sdncLcmRestClient.sendRequest(lcmInput); + LcmOutput lcmOutput; + try { + lcmOutput = sdncLcmRestClient.sendRequest(lcmInput); + } catch (Exception e) { + logger.error("SDNCLcmRestClient sends request failure: ", e); + throw new BadResponseException("Send request to SDNC failure."); + } + return lcmOutput; } private LcmOutput selectLcmOutputFromDmaapResponses(List<LcmDmaapResponse> lcmDmaapResponses, LcmInput lcmInput) { - String expectedCorrelationId = - lcmInput.getCommonHeader().getRequestId() + "-" + lcmInput.getCommonHeader().getSubRequestId(); + String requestId = lcmInput.getCommonHeader().getRequestId(); + String subRequestId = lcmInput.getCommonHeader().getSubRequestId(); for (LcmDmaapResponse lcmDmaapResponse : lcmDmaapResponses) { - String correlationId = lcmDmaapResponse.getCorrelationId(); - if (expectedCorrelationId.equals(correlationId)) { - return lcmDmaapResponse.getBody().getOutput(); + LcmOutput lcmOutput = lcmDmaapResponse.getBody().getOutput(); + if (requestId.equals(lcmOutput.getCommonHeader().getRequestId()) + && subRequestId.equals(lcmOutput.getCommonHeader().getSubRequestId())) { + return lcmOutput; } } return null; } - private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) { + private LcmOutput sendAsyncRequest(String operation, LcmInput lcmInput) throws BadResponseException { SDNCLcmClientBuilder sdncLcmClientBuilder = new SDNCLcmClientBuilder(); SDNCLcmDmaapClient sdncLcmDmaapClient; try { sdncLcmDmaapClient = sdncLcmClientBuilder.newSDNCLcmDmaapClient(); } catch (SDNCLcmClientBuilderException e) { logger.error("Create SDNCLcmDmaapClient error: ", e); - return null; + throw new BadResponseException("Can not send request to SDNC."); } LcmDmaapRequest lcmDmaapRequest = SDNCLcmMessageBuilder.buildLcmDmaapRequest(operation, lcmInput); try { sdncLcmDmaapClient.sendRequest(lcmDmaapRequest); } catch (Exception e) { - logger.error("SDNCLcmDmaapClient sends request error: ", e); - return null; + logger.error("SDNCLcmDmaapClient sends request failure: ", e); + throw new BadResponseException("Send request to SDNC failure."); } long timeout = sdncLcmClientBuilder.getSDNCLcmProperties().getActionTimeout(); @@ -146,8 +149,9 @@ public class SdncControllerDE extends LcmControllerDE { long stopTime = System.currentTimeMillis(); if ((stopTime - startTime) > timeout) { - logger.error("Timeout for SDNC LCM action {}", lcmInput.getAction()); - return null; + String msg = "Timeout for SDNC LCM action " + lcmInput.getAction(); + logger.error(msg); + throw new BadResponseException(msg); } } } @@ -158,7 +162,15 @@ public class SdncControllerDE extends LcmControllerDE { return lcmAction.replaceAll(regex, replacement).toLowerCase(); } - private LcmInput buildLcmInput(DelegateExecution execution) throws JsonProcessingException { + private String convertToSting(Object msgObject) throws PayloadGenerationException { + try { + return SDNCLcmPayloadBuilder.convertToSting(msgObject); + } catch (JsonProcessingException e) { + throw new PayloadGenerationException(e.getMessage()); + } + } + + private LcmInput buildLcmInput(DelegateExecution execution) throws PayloadGenerationException { String requestId = String.valueOf(execution.getVariable(REQUEST_ID)); String requestAction = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION)); String pnfName = String.valueOf(execution.getVariable(PNF_CORRELATION_ID)); @@ -176,78 +188,67 @@ public class SdncControllerDE extends LcmControllerDE { UpgradePreCheckPayload upgradePreCheckPayload; upgradePreCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePreCheckPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePreCheckPayload); + lcmPayload = convertToSting(upgradePreCheckPayload); break; case SoPropertyConstants.ACTION_DOWNLOAD_N_E_SW: lcmAction = SDNCLcmActionConstants.DOWNLOAD_N_E_SW; DownloadNESwPayload downloadNESwPayload; downloadNESwPayload = SDNCLcmPayloadBuilder.buildDownloadNESwPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(downloadNESwPayload); + lcmPayload = convertToSting(downloadNESwPayload); break; case SoPropertyConstants.ACTION_ACTIVATE_N_E_SW: lcmAction = SDNCLcmActionConstants.ACTIVATE_N_E_SW; ActivateNESwPayload activateNESwPayload; activateNESwPayload = SDNCLcmPayloadBuilder.buildActivateNESwPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(activateNESwPayload); + lcmPayload = convertToSting(activateNESwPayload); break; case SoPropertyConstants.ACTION_POST_CHECK: lcmAction = SDNCLcmActionConstants.UPGRADE_POST_CHECK; UpgradePostCheckPayload upgradePostCheckPayload; upgradePostCheckPayload = SDNCLcmPayloadBuilder.buildUpgradePostCheckPayload(execution); - lcmPayload = SDNCLcmPayloadBuilder.convertToSting(upgradePostCheckPayload); + lcmPayload = convertToSting(upgradePostCheckPayload); break; default: - logger.error("Unsupported SO Action: " + requestAction); - return null; + String msg = "Unsupported SO Action: " + requestAction; + logger.error(msg); + throw new PayloadGenerationException(msg); } - logger.debug("SDNC LCM payload for {}: {}", lcmAction, lcmPayload); - String subRequestId = UUID.randomUUID().toString(); LcmInput lcmInput = SDNCLcmMessageBuilder.buildLcmInputForPnf(requestId, subRequestId, pnfName, lcmAction, lcmPayload); ObjectMapper mapper = new ObjectMapper(); - String lcmInputMsg = mapper.writeValueAsString(lcmInput); - logger.debug("SDNC input message:\n" + lcmInputMsg); + try { + String lcmInputMsg = mapper.writeValueAsString(lcmInput); + logger.debug("SDNC input message for {}: {}", lcmAction, lcmInputMsg); + } catch (JsonProcessingException e) { + throw new PayloadGenerationException(e.getMessage()); + } return lcmInput; } - private boolean parseLcmOutput(LcmOutput lcmOutput, String lcmAction) { - if (lcmOutput == null) { - logger.error("Call SDNC LCM API failure"); - return false; - } - + private void parseLcmOutput(LcmOutput lcmOutput, String lcmAction) throws BadResponseException { LcmStatus lcmStatus = lcmOutput.getStatus(); + int lcmStatusCode = lcmStatus.getCode(); + String outputPayload = lcmOutput.getPayload(); - if (lcmStatus.getCode() == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { - logger.debug("Call SDNC LCM API success: " + lcmStatus.getMessage()); + if (lcmStatusCode == SDNCConstants.LCM_OUTPUT_SUCCESS_CODE) { + logger.debug("Call SDNC LCM API for {} success, code: {}, message: {}, payload: {}", lcmAction, + lcmStatusCode, lcmStatus.getMessage(), outputPayload); } else { - logger.error("Call SDNC LCM API failure: " + lcmStatus.getMessage()); - } - - String outputPayload = lcmOutput.getPayload(); - logger.debug("SDNC LCM action: {}, result: {}", lcmAction, outputPayload); - if (outputPayload != null) { - String result = JsonUtils.getJsonValue(outputPayload, "result"); - if ("Success".equals(result)) { - logger.debug("Run SDNC LCM action {} success", lcmAction); - return true; - } else { - String reason = JsonUtils.getJsonValue(outputPayload, "reason"); - logger.error("Run SDNC LCM action {} failure, reason: {}", lcmAction, reason); - } + String msg = String.format("Call SDNC LCM API for %s failure, code: %d, message: %s, payload: %s", + lcmAction, lcmStatusCode, lcmStatus.getMessage(), outputPayload); + logger.error(msg); + throw new BadResponseException(msg); } - - return false; } - private boolean sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) { + private void sendLcmRequest(DelegateExecution execution, LcmInput lcmInput) throws BadResponseException { String actionMode = String.valueOf(execution.getVariable(SoPropertyConstants.SO_ACTION_MODE)); String lcmOperation = toLowerHyphen(lcmInput.getAction()); @@ -258,6 +259,6 @@ public class SdncControllerDE extends LcmControllerDE { lcmOutput = sendSyncRequest(lcmOperation, lcmInput); } - return parseLcmOutput(lcmOutput, lcmInput.getAction()); + parseLcmOutput(lcmOutput, lcmInput.getAction()); } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java new file mode 100644 index 0000000000..a1e513fd47 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java @@ -0,0 +1,166 @@ +/* + * ============LICENSE_START======================================================= Copyright (C) 2020 Nokia. All rights + * reserved. ================================================================================ Licensed under the Apache + * License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain + * a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the + * specific language governing permissions and limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.flowspecific.tasks; + +import com.google.gson.JsonObject; +import org.onap.logging.filter.base.ONAPComponents; +import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; +import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; +import org.onap.so.client.cds.AbstractCDSProcessingBBUtils; +import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean; +import org.onap.so.client.cds.PayloadConstants; +import org.onap.so.client.exception.BBObjectNotFoundException; +import org.onap.so.client.exception.ExceptionBuilder; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import java.util.UUID; +import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME; +import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION; +import static org.onap.so.client.cds.PayloadConstants.RESOLUTION_KEY; +import static org.onap.so.client.cds.PayloadConstants.REQUEST; +import static org.onap.so.client.cds.PayloadConstants.SEPARATOR; +import static org.onap.so.client.cds.PayloadConstants.PROPERTIES; + +@Component +public class GenericPnfCDSControllerRunnableBB implements ControllerRunnable<BuildingBlockExecution> { + + private static final Logger logger = LoggerFactory.getLogger(GenericPnfCDSControllerRunnableBB.class); + private static final String EXECUTION_OBJECT = "executionObject"; + private static final String ORIGINATOR_ID = "SO"; + private static final String BUILDING_BLOCK = "buildingBlock"; + private static final String DEFAULT_SYNC_MODE = "sync"; + private static final String MSO_REQUEST_ID = "msoRequestId"; + + private AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils; + private ExtractPojosForBB extractPojosForBB; + private ExceptionBuilder exceptionBuilder; + + @Autowired + public GenericPnfCDSControllerRunnableBB(AbstractCDSProcessingBBUtils abstractCDSProcessingBBUtils, + ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) { + this.abstractCDSProcessingBBUtils = abstractCDSProcessingBBUtils; + this.extractPojosForBB = extractPojosForBB; + this.exceptionBuilder = exceptionBuilder; + } + + @Override + public Boolean understand(ControllerContext<BuildingBlockExecution> controllerContext) { + return PayloadConstants.CDS_ACTOR.equalsIgnoreCase(controllerContext.getControllerActor()) + && PayloadConstants.PNF_SCOPE.equalsIgnoreCase(controllerContext.getControllerScope()); + } + + @Override + public Boolean ready(ControllerContext<BuildingBlockExecution> controllerContext) { + return true; + } + + @Override + public void prepare(ControllerContext<BuildingBlockExecution> controllerContext) { + BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution(); + final AbstractCDSPropertiesBean abstractCDSPropertiesBean = + prepareAndSetCdsPropertyBean(buildingBlockExecution); + + buildingBlockExecution.setVariable(EXECUTION_OBJECT, abstractCDSPropertiesBean); + } + + @Override + public void run(ControllerContext<BuildingBlockExecution> controllerContext) { + BuildingBlockExecution buildingBlockExecution = controllerContext.getExecution(); + abstractCDSProcessingBBUtils.constructExecutionServiceInputObject(buildingBlockExecution); + abstractCDSProcessingBBUtils.sendRequestToCDSClient(buildingBlockExecution); + } + + private AbstractCDSPropertiesBean prepareAndSetCdsPropertyBean(BuildingBlockExecution buildingBlockExecution) { + final AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean(); + final String action = getAction(buildingBlockExecution); + + if (action == null) { + exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, "Action is null!", + ONAPComponents.SO); + } + + abstractCDSPropertiesBean.setRequestObject(this.buildRequestPayload(action, buildingBlockExecution)); + abstractCDSPropertiesBean.setBlueprintName(buildingBlockExecution.getVariable(PRC_BLUEPRINT_NAME)); + abstractCDSPropertiesBean.setBlueprintVersion(buildingBlockExecution.getVariable(PRC_BLUEPRINT_VERSION)); + abstractCDSPropertiesBean.setRequestId(buildingBlockExecution.getVariable(MSO_REQUEST_ID)); + abstractCDSPropertiesBean.setOriginatorId(ORIGINATOR_ID); + abstractCDSPropertiesBean.setSubRequestId(UUID.randomUUID().toString()); + abstractCDSPropertiesBean.setActionName(action); + abstractCDSPropertiesBean.setMode(DEFAULT_SYNC_MODE); + return abstractCDSPropertiesBean; + } + + private String buildRequestPayload(String action, BuildingBlockExecution execution) { + final JsonObject pnfObject = new JsonObject(); + String resolutionKey = null; + try { + final Pnf pnf = getPnf(execution); + final ServiceInstance serviceInstance = getServiceInstance(execution); + resolutionKey = pnf.getPnfName(); + + setExecutionVariable("service-instance-id", serviceInstance.getServiceInstanceId(), pnfObject); + setExecutionVariable("service-model-uuid", serviceInstance.getModelInfoServiceInstance().getModelUuid(), + pnfObject); + setExecutionVariable("pnf-id", pnf.getPnfId(), pnfObject); + setExecutionVariable("pnf-name", resolutionKey, pnfObject); + setExecutionVariable("pnf-customization-uuid", pnf.getModelInfoPnf().getModelCustomizationUuid(), + pnfObject); + + } catch (BBObjectNotFoundException exception) { + logger.error("An exception occurred when creating payload for CDS request", exception); + exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, exception); + } + final JsonObject cdsPropertyObject = new JsonObject(); + cdsPropertyObject.addProperty(RESOLUTION_KEY, resolutionKey); + cdsPropertyObject.add(action + SEPARATOR + PROPERTIES, pnfObject); + + return buildRequestJsonObject(cdsPropertyObject, action); + } + + private String buildRequestJsonObject(JsonObject cdsPropertyObject, String action) { + String requestBasedOnAction = action.concat(SEPARATOR).concat(REQUEST); + JsonObject requestObject = new JsonObject(); + requestObject.add(requestBasedOnAction, cdsPropertyObject); + return requestObject.toString(); + } + + private void setExecutionVariable(String jsonProperty, String executionProperty, JsonObject pnfObject) { + if (executionProperty != null) { + pnfObject.addProperty(jsonProperty, executionProperty); + } + } + + private String getAction(BuildingBlockExecution buildingBlockExecution) { + ExecuteBuildingBlock executeBuildingBlock = buildingBlockExecution.getVariable(BUILDING_BLOCK); + return executeBuildingBlock.getBuildingBlock().getBpmnAction(); + } + + private Pnf getPnf(BuildingBlockExecution buildingBlockExecution) throws BBObjectNotFoundException { + return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.PNF); + } + + private ServiceInstance getServiceInstance(BuildingBlockExecution buildingBlockExecution) + throws BBObjectNotFoundException { + return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID); + } +} diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java index d5423b2ff7..aa74074cf6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java @@ -22,7 +22,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import org.camunda.bpm.engine.delegate.DelegateExecution; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext; import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerRunnable; -import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.cds.AbstractCDSProcessingBBUtils; import org.onap.so.client.cds.GeneratePayloadForCds; import org.onap.so.client.cds.PayloadConstants; diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java index d9f5e65ba3..cdba6e0e2f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java @@ -173,7 +173,7 @@ public class ManualHandlingTasks { taskVariables.put(TASK_VARIABLE_DESCRIPTION, description); TaskService taskService = execution.getProcessEngineServices().getTaskService(); - taskService.setVariables(taskId, taskVariables); + taskService.setVariablesLocal(taskId, taskVariables); logger.debug("successfully created fallout task: " + taskId); } catch (BpmnError e) { logger.debug(BPMN_EXCEPTION + e.getMessage()); @@ -223,7 +223,7 @@ public class ManualHandlingTasks { taskVariables.put(TASK_VARIABLE_VALID_RESPONSES, validResponses); TaskService taskService = execution.getProcessEngineServices().getTaskService(); - taskService.setVariables(taskId, taskVariables); + taskService.setVariablesLocal(taskId, taskVariables); logger.debug("successfully created pause task: " + taskId); } catch (BpmnError e) { logger.debug(BPMN_EXCEPTION + e.getMessage()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java index f8a4d910f4..eead1761ea 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java @@ -169,12 +169,7 @@ public class WorkflowAction { } public void selectExecutionList(DelegateExecution execution) throws Exception { - final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); - final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); - final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST); - final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE); final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION); - String uri = (String) execution.getVariable(BBConstants.G_URI); final String vnfType = (String) execution.getVariable(VNF_TYPE); String serviceInstanceId = (String) execution.getVariable("serviceInstanceId"); final String createInstanceAction = "createInstance"; @@ -183,40 +178,34 @@ public class WorkflowAction { List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(BBConstants.G_ORCHESTRATION_FLOW); - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution); List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>(); List<Resource> resourceList = new ArrayList<>(); execution.setVariable("sentSyncResponse", false); execution.setVariable("homing", false); execution.setVariable("calledHoming", false); + execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true); try { - ObjectMapper mapper = new ObjectMapper(); - execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true); - ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class); + final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST); + ServiceInstancesRequest sIRequest = + new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class); RequestDetails requestDetails = sIRequest.getRequestDetails(); - boolean suppressRollback = false; - try { - suppressRollback = requestDetails.getRequestInfo().getSuppressRollback(); - } catch (Exception ex) { - logger.warn("Exception in getSuppressRollback", ex); - suppressRollback = false; - } - execution.setVariable("suppressRollback", suppressRollback); - boolean isResume = false; - if (isUriResume(uri)) { - isResume = true; - if (!aLaCarte) { - logger.debug("replacing URI {}", uri); - uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl(); - logger.debug("for RESUME with original value {}", uri); - } + execution.setVariable("suppressRollback", requestDetails.getRequestInfo().getSuppressRollback()); + String uri = (String) execution.getVariable(BBConstants.G_URI); + final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID); + final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE); + boolean isResume = isUriResume(uri); + if (!aLaCarte && isResume) { + logger.debug("replacing URI {}", uri); + uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl(); + logger.debug("for RESUME with original value {}", uri); } Resource resource = extractResourceIdAndTypeFromUri(uri); WorkflowType resourceType = resource.getResourceType(); execution.setVariable("resourceName", resourceType.toString()); String resourceId = ""; + final String requestAction = (String) execution.getVariable(BBConstants.G_ACTION); if (resource.isGenerated() && requestAction.equalsIgnoreCase(createInstanceAction) && sIRequest.getRequestDetails().getRequestInfo().getInstanceName() != null) { resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType, @@ -230,7 +219,7 @@ public class WorkflowAction { } execution.setVariable("resourceId", resourceId); execution.setVariable("resourceType", resourceType); - + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) { flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId); if (flowsToExecute == null) { diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java index 9de8e184f2..614401d32a 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java @@ -22,18 +22,33 @@ package org.onap.so.client.aai.mapper; -import org.modelmapper.ModelMapper; -import org.modelmapper.PropertyMap; -import org.onap.aai.domain.yang.RouteTargets; -import org.onap.so.bpmn.servicedecomposition.bbobjects.*; -import org.springframework.stereotype.Component; import java.util.List; import org.modelmapper.Converter; +import org.modelmapper.ModelMapper; +import org.modelmapper.PropertyMap; import org.modelmapper.spi.MappingContext; +import org.onap.aai.domain.yang.RouteTargets; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; +import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; +import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.HostRoute; +import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy; +import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf; +import org.onap.so.bpmn.servicedecomposition.bbobjects.Project; +import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTarget; import org.onap.so.bpmn.servicedecomposition.bbobjects.SegmentationAssignment; -import org.onap.so.bpmn.servicedecomposition.bbobjects.CtagAssignment; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; +import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription; import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; +import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; +import org.springframework.stereotype.Component; @Component public class AAIObjectMapper { @@ -46,6 +61,7 @@ public class AAIObjectMapper { protected void configure() { map().setServiceType(source.getModelInfoServiceInstance().getServiceType()); map().setServiceRole(source.getModelInfoServiceInstance().getServiceRole()); + map().setServiceFunction(source.getModelInfoServiceInstance().getServiceFunction()); map().setModelInvariantId(source.getModelInfoServiceInstance().getModelInvariantUuid()); map().setModelVersionId(source.getModelInfoServiceInstance().getModelUuid()); map().setEnvironmentContext(source.getModelInfoServiceInstance().getEnvironmentContext()); @@ -178,6 +194,7 @@ public class AAIObjectMapper { private Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets> convertSubnets = new Converter<List<Subnet>, org.onap.aai.domain.yang.Subnets>() { + @Override public org.onap.aai.domain.yang.Subnets convert( MappingContext<List<Subnet>, org.onap.aai.domain.yang.Subnets> context) { return mapToAAISubNets(context.getSource()); @@ -186,6 +203,7 @@ public class AAIObjectMapper { private Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> convertCtagAssignments = new Converter<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments>() { + @Override public org.onap.aai.domain.yang.CtagAssignments convert( MappingContext<List<CtagAssignment>, org.onap.aai.domain.yang.CtagAssignments> context) { return mapToAAICtagAssignmentList(context.getSource()); @@ -194,6 +212,7 @@ public class AAIObjectMapper { private Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> convertSegmentationAssignments = new Converter<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments>() { + @Override public org.onap.aai.domain.yang.SegmentationAssignments convert( MappingContext<List<SegmentationAssignment>, org.onap.aai.domain.yang.SegmentationAssignments> context) { return mapToAAISegmentationAssignmentList(context.getSource()); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java index 8b939940fa..47be2f5bd6 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java @@ -24,7 +24,6 @@ import java.util.Optional; import javax.ws.rs.core.UriBuilder; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration; -import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.uri.AAIResourceUri; @@ -239,10 +238,4 @@ public class AAIConfigurationResources { injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration); } - public boolean checkConfigurationNameInUse(String configurationName) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION) - .queryParam("configuration-name", configurationName); - return injectionHelper.getAaiClient().exists(uri); - } - } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java index 296d052315..12c1d5572f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java @@ -28,6 +28,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIEdgeLabel; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @@ -87,7 +88,7 @@ public class AAIInstanceGroupResources { } public boolean checkInstanceGroupNameInUse(String instanceGroupName) { - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP) .queryParam("instance-group-name", instanceGroupName); return injectionHelper.getAaiClient().exists(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java index 3af65815a6..f040627155 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java @@ -38,6 +38,8 @@ import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.entities.AAIEdgeLabel; import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @@ -103,11 +105,11 @@ public class AAINetworkResources { return injectionHelper.getAaiClient().get(netBindingUri.depth(Depth.TWO)).asBean(VpnBinding.class); } - public Optional<NetworkPolicy> getNetworkPolicy(AAIResourceUri netPolicyUri) { + public Optional<NetworkPolicy> getNetworkPolicy(AAIBaseResourceUri netPolicyUri) { return injectionHelper.getAaiClient().get(netPolicyUri).asBean(NetworkPolicy.class); } - public Optional<NetworkPolicies> getNetworkPolicies(AAIResourceUri netPoliciesUri) { + public Optional<NetworkPolicies> getNetworkPolicies(AAIBaseResourceUri netPoliciesUri) { return injectionHelper.getAaiClient().get(netPoliciesUri).asBean(NetworkPolicies.class); } @@ -227,7 +229,7 @@ public class AAINetworkResources { } public boolean checkNetworkNameInUse(String networkName) { - AAIResourceUri uri = + AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", networkName); return injectionHelper.getAaiClient().exists(uri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java index 9b104f3250..0879e24bfb 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java @@ -35,6 +35,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIResourcesClient; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @@ -115,7 +116,7 @@ public class AAIServiceInstanceResources { } public boolean existsOwningEntityName(String owningEntityName) { - AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) + AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) .queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); return aaiRC.exists(owningEntityUri); @@ -123,7 +124,7 @@ public class AAIServiceInstanceResources { public org.onap.aai.domain.yang.OwningEntity getOwningEntityByName(String owningEntityName) throws AAIEntityNotFoundException { - AAIResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) + AAIPluralResourceUri owningEntityUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.OWNING_ENTITY) .queryParam("owning-entity-name", owningEntityName); AAIResourcesClient aaiRC = injectionHelper.getAaiClient(); Optional<OwningEntities> owningEntities = aaiRC.get(OwningEntities.class, owningEntityUri); @@ -178,7 +179,7 @@ public class AAIServiceInstanceResources { } public boolean checkInstanceServiceNameInUse(ServiceInstance serviceInstance) { - AAIResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) + AAIPluralResourceUri uriSI = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE) .queryParam("service-instance-name", serviceInstance.getServiceInstanceName()); return injectionHelper.getAaiClient().exists(uriSI); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java index 4d1a6dce38..f750cf2453 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java @@ -23,7 +23,6 @@ package org.onap.so.client.orchestration; import java.util.Optional; -import org.onap.aai.domain.yang.VfModules; import org.onap.so.bpmn.common.InjectionHelper; import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion; import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; @@ -31,13 +30,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -114,9 +111,9 @@ public class AAIVfModuleResources { public boolean checkNameInUse(VfModule vfModule) { boolean nameInUse = false; - AAIResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) + AAIPluralResourceUri vfModuleUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VF_MODULE) .queryParam("vf-module-name", vfModule.getVfModuleName()); - AAIResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", + AAIPluralResourceUri vfModuleUriWithCustomization = vfModuleUri.clone().queryParam("model-customization-id", vfModule.getModelInfoVfModule().getModelCustomizationUUID()); if (injectionHelper.getAaiClient().exists(vfModuleUriWithCustomization)) { // assume it's a resume case and return false diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java index 7ad74a6d86..cd0a584218 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java @@ -36,6 +36,7 @@ import org.onap.so.client.aai.AAIObjectType; import org.onap.so.client.aai.AAIRestClientImpl; import org.onap.so.client.aai.AAIValidatorImpl; import org.onap.so.client.aai.entities.AAIResultWrapper; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @@ -159,7 +160,7 @@ public class AAIVnfResources { } public boolean checkNameInUse(String vnfName) { - AAIResourceUri vnfUri = + AAIPluralResourceUri vnfUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", vnfName); return injectionHelper.getAaiClient().exists(vnfUri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java index b9e4aeb888..152dd0dad2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java @@ -28,12 +28,11 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf; import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; import org.onap.so.db.catalog.beans.OrchestrationStatus; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -96,7 +95,7 @@ public class AAIVolumeGroupResources { } public boolean checkNameInUse(VolumeGroup volumeGroup) { - AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) + AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP) .queryParam("volume-group-name", volumeGroup.getVolumeGroupName()); return injectionHelper.getAaiClient().exists(volumeGroupUri); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java index 168d370521..4cdb5adfd4 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java @@ -27,6 +27,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer; import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding; import org.onap.so.client.aai.AAIObjectPlurals; import org.onap.so.client.aai.AAIObjectType; +import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri; import org.onap.so.client.aai.entities.uri.AAIResourceUri; import org.onap.so.client.aai.entities.uri.AAIUriFactory; import org.onap.so.client.aai.mapper.AAIObjectMapper; @@ -55,7 +56,7 @@ public class AAIVpnBindingResources { * @return */ public Optional<VpnBindings> getVpnBindingByCustomerVpnId(String customerVpnId) { - AAIResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING) + AAIPluralResourceUri aaiVpnBindingsResourceUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VPN_BINDING) .queryParam("customer-vpn-id", customerVpnId); return injectionHelper.getAaiClient().get(VpnBindings.class, aaiVpnBindingsResourceUri); |