diff options
author | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-08-10 17:19:31 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@us.att.com> | 2018-08-10 17:28:44 -0400 |
commit | cf90f6988c717eb609f5da7d1aee04c668b21fe9 (patch) | |
tree | afbf9e7daee643994259e9eed11ab2f2b5055ecb /bpmn/so-bpmn-tasks/src/main/java/org | |
parent | 6f6ff2d81cde79a129e40846f1e3bd33848595d8 (diff) |
Casablana bugfixes
updated mock in unassignnetworkbbtest instead of base
added mock to extract pojos method in unassignnetwork
Return gBuildingBlockExecution from calls to VnfAdapter subprocess
Correct JUnit data to expect modelInfoVfModule
Enable Spring Security for logging of unauthorized/bad credentials
errors
Fix handling of a case of no VF Modules in a VNF resource.
fix populating lookupKeyMap with resource ids
removed unnecessary test resources
Issue-ID: SO-848
Change-Id: Id89f075dcac4042bf8fb1e207e66d289d079171f
Signed-off-by: Benjamin, Max (mb388a) <mb388a@us.att.com>
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java/org')
6 files changed, 59 insertions, 5 deletions
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 074652e221..9c1fba62e9 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 @@ -141,6 +141,19 @@ public class AAIUpdateTasks { } } + public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) { + try { + GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock(); + + VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID)); + CloudRegion cloudRegion = gBBInput.getCloudRegion(); + + aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) { try { VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); @@ -281,6 +294,16 @@ public class AAIUpdateTasks { } } + public void updateHeatStackIdVfModule(BuildingBlockExecution execution) { + try { + VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID)); + GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID)); + aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf); + } catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex); + } + } + /** * BPMN access method to update L3Network after it was created in AIC * @param execution diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java index f94b967643..c45a47bc12 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java @@ -23,8 +23,12 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks; import java.util.Optional; import org.onap.so.bpmn.common.BuildingBlockExecution; +import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network; +import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey; +import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB; import org.onap.so.client.aai.entities.AAIResultWrapper; import org.onap.so.client.exception.ExceptionBuilder; +import org.onap.so.client.orchestration.AAINetworkResources; import org.onap.so.logger.MsoLogger; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @@ -42,6 +46,12 @@ public class UnassignNetworkBB { @Autowired private NetworkBBUtils networkBBUtils; + + @Autowired + private ExtractPojosForBB extractPojosForBB; + + @Autowired + private AAINetworkResources aaiNetworkResources; /** * BPMN access method to prepare overall error messages. @@ -54,9 +64,11 @@ public class UnassignNetworkBB { public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) throws Exception { try { - AAIResultWrapper aaiResultWrapper = execution.getVariable("l3NetworkAAIResultWrapper"); - Optional<org.onap.aai.domain.yang.L3Network> l3network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); - if (networkBBUtils.isRelationshipRelatedToExists(l3network, relatedToValue)) { + L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, + execution.getLookupMap().get(ResourceKey.NETWORK_ID)); + AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network); + Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class); + if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) { String msg = MESSAGE_CANNOT_PERFORM_UNASSIGN + relatedToValue; execution.setVariable("ErrorUnassignNetworkBB", msg); exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg); diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java index 5f922e0c99..1d87b70754 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java @@ -187,7 +187,9 @@ public class VnfAdapterVfModuleObjectMapper { paramsMap.put("vf_module_id", vfModule.getVfModuleId()); paramsMap.put("vf_module_name", vfModule.getVfModuleName()); paramsMap.put("environment_context",serviceInstance.getModelInfoServiceInstance().getEnvironmentContext()); + paramsMap.putIfAbsent("environment_context", ""); paramsMap.put("workload_context", serviceInstance.getModelInfoServiceInstance().getWorkloadContext()); + paramsMap.putIfAbsent("workload_context", ""); Integer vfModuleIndex = vfModule.getModuleIndex(); if (vfModuleIndex != null) { paramsMap.put("vf_module_index", vfModuleIndex.toString()); 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 7fef56d965..a641d43ba3 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 @@ -67,6 +67,15 @@ public class AAIVfModuleResources { injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); } + public void updateHeatStackIdVfModule(VfModule vfModule, GenericVnf vnf) { + AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); + VfModule copiedVfModule = vfModule.shallowCopyId(); + + copiedVfModule.setHeatStackId(vfModule.getHeatStackId()); + org.onap.aai.domain.yang.VfModule aaiVfModule = aaiObjectMapper.mapVfModule(copiedVfModule); + injectionHelper.getAaiClient().update(vfModuleURI, aaiVfModule); + } + public void changeAssignVfModule(VfModule vfModule, GenericVnf vnf) { AAIResourceUri vfModuleURI = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnf.getVnfId(), vfModule.getVfModuleId()); org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule); 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 70c6724921..af97e55c14 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 @@ -74,4 +74,12 @@ public class AAIVolumeGroupResources { AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); injectionHelper.getAaiClient().delete(uri); } + + public void updateHeatStackIdVolumeGroup(VolumeGroup volumeGroup, CloudRegion cloudRegion) { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VOLUME_GROUP, cloudRegion.getCloudOwner(), cloudRegion.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()); + VolumeGroup copiedVolumeGroup = volumeGroup.shallowCopyId(); + + copiedVolumeGroup.setHeatStackId(volumeGroup.getHeatStackId()); + injectionHelper.getAaiClient().update(uri, aaiObjectMapper.mapVolumeGroup(copiedVolumeGroup)); + } } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java index 20c95dd55e..5b23707cb9 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java @@ -54,7 +54,7 @@ public class ServiceTopologyOperationMapper{ GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true); GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput(); - servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceId()); + servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName()); servOpInput.setSdncRequestHeader(sdncRequestHeader); servOpInput.setRequestInformation(reqInfo); @@ -64,7 +64,7 @@ public class ServiceTopologyOperationMapper{ if(requestContext.getUserParams()!=null){ for (Map.Entry<String, String> entry : requestContext.getUserParams().entrySet()) { GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput(); - serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceId()); + serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName()); GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam(); GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam(); paramItem.setName(entry.getKey()); |