summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks/src')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java284
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/decisionpoint/impl/camunda/controller/sdnc/SdncControllerDE.java133
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBB.java166
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDE.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java41
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java31
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIInstanceGroupResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAINetworkResources.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIServiceInstanceResources.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVfModuleResources.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVnfResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVolumeGroupResources.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIVpnBindingResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java156
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java24
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json13
35 files changed, 622 insertions, 490 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);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index a8f47fc763..6f96331e7f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -64,6 +64,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoVfModule;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -586,7 +587,7 @@ public class AAICreateTasksTest extends BaseTaskTest {
execution.setVariable("heatStackId", "testHeatStackId");
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
NetworkPolicy networkPolicy = new NetworkPolicy();
- doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIResourceUri.class));
+ doReturn(Optional.of(networkPolicy)).when(aaiNetworkResources).getNetworkPolicy(any(AAIBaseResourceUri.class));
doNothing().when(aaiNetworkResources).createNetworkPolicy(any(NetworkPolicy.class));
aaiCreateTasks.createNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).createNetworkPolicy(any(NetworkPolicy.class));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
index 855d935ae1..41589af067 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -40,7 +40,6 @@ import org.mockito.ArgumentMatchers;
import org.mockito.Captor;
import org.mockito.InjectMocks;
import org.onap.aai.domain.yang.NetworkPolicies;
-import org.onap.aai.domain.yang.NetworkPolicy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -53,7 +52,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.client.aai.entities.uri.AAIBaseResourceUri;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -223,7 +222,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
NetworkPolicies networkPolicies1 = aaiResultWrapper1.asBean(NetworkPolicies.class).get();
doReturn(Optional.of(networkPolicies0), Optional.of(networkPolicies1)).when(aaiNetworkResources)
- .getNetworkPolicies(any(AAIResourceUri.class));
+ .getNetworkPolicies(any(AAIBaseResourceUri.class));
doNothing().when(aaiNetworkResources).deleteNetworkPolicy(any(String.class));
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(2)).deleteNetworkPolicy(stringCaptor.capture());
@@ -235,7 +234,7 @@ public class AAIDeleteTasksTest extends BaseTaskTest {
public void deleteNetworkPolicyNeedToDeleteNoneTest() throws Exception {
execution.setVariable("contrailNetworkPolicyFqdnList", "ABC123");
Optional<NetworkPolicies> networkPolicies = Optional.empty();
- doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIResourceUri.class));
+ doReturn(networkPolicies).when(aaiNetworkResources).getNetworkPolicies(any(AAIBaseResourceUri.class));
aaiDeleteTasks.deleteNetworkPolicies(execution);
verify(aaiNetworkResources, times(0)).deleteNetworkPolicy(any(String.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index e26009a1de..e5b003a437 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -40,7 +40,6 @@ 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.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import java.util.HashMap;
@@ -258,60 +257,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleNoMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("false");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleMultiStageButNotAlacarteTest()
- throws Exception {
- execution.setVariable("aLaCarte", false);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.ASSIGNED);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleWithMultiStageTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
- modelInfoGenericVnf.setMultiStageDesign("true");
- genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
- doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- verify(aaiVfModuleResources, times(1)).updateOrchestrationStatusVfModule(vfModule, genericVnf,
- OrchestrationStatus.PENDING_ACTIVATION);
- assertEquals("", vfModule.getHeatStackId());
- }
-
- @Test
- public void updateOrchestrationStatusAssignedOrPendingActivationVfModuleExceptionTest() throws Exception {
- execution.setVariable("aLaCarte", true);
- doThrow(RuntimeException.class).when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule,
- genericVnf, OrchestrationStatus.ASSIGNED);
-
- expectedException.expect(BpmnError.class);
-
- aaiUpdateTasks.updateOrchestrationStatusAssignedOrPendingActivationVfModule(execution);
- }
-
- @Test
public void updateOrchestrationStatusCreatedVfModuleTest() throws Exception {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CREATED);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index c78b652bd0..ea1f7b47ad 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -45,6 +45,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
@@ -163,4 +164,46 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
genericVnf.setIpv4OamAddress("127.0.0.1");
return genericVnf;
}
+
+ @Test
+ public void buildAppcTaskRequestConfigModifyTest() throws Exception {
+ final String expectedRequestJson =
+ new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "appcTaskRequestConfigModify.json")));
+ ApplicationControllerTaskRequest expectedTaskRequest =
+ mapper.readValue(expectedRequestJson, ApplicationControllerTaskRequest.class);
+ execution.getLookupMap().put(ResourceKey.GENERIC_VNF_ID, "-TEST");
+ fillRequiredAppcExecutionFieldsConfigModify();
+ GenericVnf genericVnf = getTestGenericVnf();
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.GENERIC_VNF_ID))).thenReturn(genericVnf);
+ mockReferenceResponseForConfigModify();
+ execution.getLookupMap().put(ResourceKey.VF_MODULE_ID, "VF-MODULE-ID-TEST");
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("VF-MODULE-ID");
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+ appcOrchestratorPreProcessor.buildAppcTaskRequest(execution, "ConfigModify");
+ ApplicationControllerTaskRequest actualTaskRequest = execution.getVariable("appcOrchestratorRequest");
+ assertThat(actualTaskRequest, sameBeanAs(expectedTaskRequest));
+ }
+
+ private void fillRequiredAppcExecutionFieldsConfigModify() {
+ RequestContext context = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setPayload(
+ "{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
+ context.setRequestParameters(requestParameters);
+ context.setMsoRequestId("TEST-MSO-ID");
+ execution.setVariable("aicIdentity", "AIC-TEST");
+ execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
+ execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
+ execution.setVariable("identityUrl", "IDENTITY-URL-TEST");
+ execution.getGeneralBuildingBlock().setRequestContext(context);
+ }
+
+ private void mockReferenceResponseForConfigModify() {
+ ControllerSelectionReference reference = new ControllerSelectionReference();
+ reference.setControllerName("APPC");
+ when(catalogDbClient.getControllerSelectionReferenceByVnfTypeAndActionCategory(eq("TEST-VNF-TYPE"),
+ eq(Action.ConfigModify.toString()))).thenReturn(reference);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
new file mode 100644
index 0000000000..d6a28cba25
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSControllerRunnableBBTest.java
@@ -0,0 +1,156 @@
+/*
+ * ============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 org.camunda.bpm.engine.impl.pvm.runtime.ExecutionImpl;
+import org.json.JSONObject;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.EXECUTION_OBJECT;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.MSO_REQUEST_ID;
+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.SCOPE;
+
+@RunWith(MockitoJUnitRunner.class)
+public class GenericPnfCDSControllerRunnableBBTest {
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+
+ @InjectMocks
+ private GenericPnfCDSControllerRunnableBB genericPnfCDSControllerRunnableBB;
+
+ private ControllerContext<BuildingBlockExecution> controllerContext;
+ private BuildingBlockExecution execution;
+
+ private final static String blueprintName = "blueprint_name";
+ private final static String blueprintVersion = "blueprint_version";
+ private final static String msoRequestId = "mso_request_id";
+ private final static String pnfID = "5df8b6de-2083-11e7-93ae-92361f002671";
+ private final static String serviceInstanceID = "test_service_id";
+ private final static String pnfName = "PNFDemo";
+ private final static String serviceModelUUID = "6bc0b04d-1873-4721-b53d-6615225b2a28";
+ private final static String pnfCustomizationUUID = "9acb3a83-8a52-412c-9a45-901764938144";
+ private final static String action = "action";
+
+ @Before
+ public void setUp() {
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+
+ buildingBlock.setBpmnAction(action);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+
+ execution = new DelegateExecutionImpl(new ExecutionImpl());
+ execution.setVariable("buildingBlock", executeBuildingBlock);
+ execution.setVariable(PRC_BLUEPRINT_NAME, blueprintName);
+ execution.setVariable(PRC_BLUEPRINT_VERSION, blueprintVersion);
+ execution.setVariable(MSO_REQUEST_ID, msoRequestId);
+ execution.setVariable(SCOPE, "scope");
+
+ controllerContext = new ControllerContext<>();
+ controllerContext.setExecution(execution);
+ }
+
+ @Test
+ public void understandTest() {
+ // given
+ controllerContext.setControllerScope("pnf");
+ controllerContext.setControllerActor("cds");
+
+ // when, then
+ assertTrue(genericPnfCDSControllerRunnableBB.understand(controllerContext));
+ }
+
+ @Test
+ public void readyTest() {
+ // when, then
+ assertTrue(genericPnfCDSControllerRunnableBB.ready(controllerContext));
+ }
+
+ @Test
+ public void prepareTest() throws BBObjectNotFoundException {
+ // given
+ prepareData();
+
+ // when
+ genericPnfCDSControllerRunnableBB.prepare(controllerContext);
+
+ // then
+ final AbstractCDSPropertiesBean abstractCDSPropertiesBean = execution.getVariable(EXECUTION_OBJECT);
+ final JSONObject actionProperties = new JSONObject(abstractCDSPropertiesBean.getRequestObject())
+ .getJSONObject("action-request").getJSONObject("action-properties");
+
+ assertThat(abstractCDSPropertiesBean).isNotNull();
+ assertThat(abstractCDSPropertiesBean.getRequestObject()).isNotNull();
+ assertThat(abstractCDSPropertiesBean.getRequestObject()).isInstanceOf(String.class);
+
+ assertEquals(blueprintName, abstractCDSPropertiesBean.getBlueprintName());
+ assertEquals(blueprintVersion, abstractCDSPropertiesBean.getBlueprintVersion());
+ assertEquals(msoRequestId, abstractCDSPropertiesBean.getRequestId());
+ assertEquals(action, abstractCDSPropertiesBean.getActionName());
+ assertEquals("sync", abstractCDSPropertiesBean.getMode());
+ assertEquals("SO", abstractCDSPropertiesBean.getOriginatorId());
+
+ assertEquals(pnfID, actionProperties.get("pnf-id"));
+ assertEquals(serviceInstanceID, actionProperties.get("service-instance-id"));
+ assertEquals(serviceModelUUID, actionProperties.get("service-model-uuid"));
+ assertEquals(pnfName, actionProperties.get("pnf-name"));
+ assertEquals(pnfCustomizationUUID, actionProperties.get("pnf-customization-uuid"));
+ }
+
+ private void prepareData() throws BBObjectNotFoundException {
+ Pnf pnf = new Pnf();
+ ServiceInstance serviceInstance = new ServiceInstance();
+
+ pnf.setPnfName(pnfName);
+ pnf.setPnfId(pnfID);
+ ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+ modelInfoPnf.setModelCustomizationUuid(pnfCustomizationUUID);
+ pnf.setModelInfoPnf(modelInfoPnf);
+
+ serviceInstance.setServiceInstanceId(serviceInstanceID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(serviceModelUUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.PNF))).thenReturn(pnf);
+ when(extractPojosForBB.extractByKey(eq(execution), eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
index 583e139edd..ae5f4370e6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfCDSProcessingDETest.java
@@ -20,7 +20,6 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
-import org.junit.Before;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
@@ -33,9 +32,6 @@ import org.onap.so.bpmn.infrastructure.decisionpoint.api.ControllerContext;
import org.onap.so.client.cds.AbstractCDSProcessingBBUtils;
import org.onap.so.client.cds.GeneratePayloadForCds;
import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
-import org.onap.so.client.exception.ExceptionBuilder;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.rules.SpringClassRule;
import org.springframework.test.context.junit4.rules.SpringMethodRule;
import java.util.Arrays;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
index b6dcd96534..e3bbd11cc4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/manualhandling/tasks/ManualHandlingTasksTest.java
@@ -100,7 +100,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setFalloutTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
@@ -110,7 +110,7 @@ public class ManualHandlingTasksTest extends BaseTaskTest {
when(mockExecution.getProcessEngineServices()).thenReturn(processEngineServices);
when(processEngineServices.getTaskService()).thenReturn(taskService);
manualHandlingTasks.setPauseTaskVariables(task);
- verify(taskService, times(1)).setVariables(any(String.class), any(Map.class));
+ verify(taskService, times(1)).setVariablesLocal(any(String.class), any(Map.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index dc64e4ee48..1e58a83f0a 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -138,6 +138,7 @@ public class AAIObjectMapperTest {
ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
modelInfoServiceInstance.setServiceType("SITYPE");
modelInfoServiceInstance.setServiceRole("SIROLE");
+ modelInfoServiceInstance.setServiceFunction("SIFUNCTION");
modelInfoServiceInstance.setModelInvariantUuid("MIUUID");
modelInfoServiceInstance.setModelUuid("MUUID");
modelInfoServiceInstance.setEnvironmentContext("EC");
@@ -163,6 +164,8 @@ public class AAIObjectMapperTest {
serviceInstance.getModelInfoServiceInstance().getEnvironmentContext());
assertEquals(AAIServiceInstance.getWorkloadContext(),
serviceInstance.getModelInfoServiceInstance().getWorkloadContext());
+ assertEquals(AAIServiceInstance.getServiceFunction(),
+ serviceInstance.getModelInfoServiceInstance().getServiceFunction());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index 9855c8587a..8b08afdb44 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -20,8 +20,6 @@
package org.onap.so.client.orchestration;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
@@ -37,8 +35,8 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
@@ -46,7 +44,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceProxy;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
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.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
@@ -54,7 +51,6 @@ 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.onap.so.bpmn.common.data.TestDataSetup;
@RunWith(MockitoJUnitRunner.Silent.class)
@@ -242,22 +238,4 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
any(org.onap.aai.domain.yang.Configuration.class));
}
- @Test
- public void checkConfigurationNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
- .queryParam("configuration-name", "configurationName");
- doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
- boolean nameInUse = aaiConfigurationResources.checkConfigurationNameInUse("configurationName");
- assertTrue(nameInUse);
- }
-
- @Test
- public void checkConfigurationNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.CONFIGURATION)
- .queryParam("configuration-name", "configurationName");
- doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
- boolean nameInUse = aaiConfigurationResources.checkConfigurationNameInUse("configurationName");
- assertFalse(nameInUse);
- }
-
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
index cb5683d9d8..0995af058e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIInstanceGroupResourcesTest.java
@@ -20,11 +20,10 @@
package org.onap.so.client.orchestration;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
@@ -37,8 +36,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -46,10 +45,10 @@ 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.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;
-import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@@ -136,7 +135,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", "instanceGroupName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
@@ -145,7 +144,7 @@ public class AAIInstanceGroupResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
+ AAIPluralResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.INSTANCE_GROUP)
.queryParam("instance-group-name", "instanceGroupName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiInstanceGroupResources.checkInstanceGroupNameInUse("instanceGroupName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
index b6161d7669..e744e7d0df 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAINetworkResourcesTest.java
@@ -61,6 +61,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIEdgeLabel;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
+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;
@@ -203,11 +204,11 @@ public class AAINetworkResourcesTest extends TestDataSetup {
new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "queryAaiNetworkPolicies.json")));
AAIResultWrapper aaiResultWrapper = new AAIResultWrapper(content);
Optional<org.onap.aai.domain.yang.NetworkPolicies> oNetPolicies = Optional.empty();
- AAIResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
+ AAIPluralResourceUri netPoliciesUri = AAIUriFactory.createResourceUri(AAIObjectPlurals.NETWORK_POLICY);
- doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIResourceUri.class));
+ doReturn(aaiResultWrapper).when(MOCK_aaiResourcesClient).get(isA(AAIPluralResourceUri.class));
oNetPolicies = aaiNetworkResources.getNetworkPolicies(netPoliciesUri);
- verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIResourceUri.class));
+ verify(MOCK_aaiResourcesClient, times(1)).get(any(AAIPluralResourceUri.class));
if (oNetPolicies.isPresent()) {
org.onap.aai.domain.yang.NetworkPolicies networkPolicies = oNetPolicies.get();
assertThat(aaiResultWrapper.asBean(org.onap.aai.domain.yang.NetworkPolicies.class).get(),
@@ -428,7 +429,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseTrueTest() throws Exception {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
@@ -437,7 +438,7 @@ public class AAINetworkResourcesTest extends TestDataSetup {
@Test
public void checkInstanceGroupNameInUseFalseTest() throws Exception {
- AAIResourceUri uri =
+ AAIPluralResourceUri uri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.L3_NETWORK).queryParam("network-name", "networkName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiNetworkResources.checkNetworkNameInUse("networkName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
index ea98ee0169..d2a1f77922 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIServiceInstanceResourcesTest.java
@@ -24,8 +24,8 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
@@ -39,8 +39,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.OwningEntity;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Project;
@@ -48,6 +48,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.client.aai.AAIObjectPlurals;
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;
@@ -194,7 +195,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseTrueTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
@@ -203,7 +204,7 @@ public class AAIServiceInstanceResourcesTest extends TestDataSetup {
@Test
public void checkInstanceServiceNameInUseFalseTest() throws Exception {
- AAIResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
+ AAIPluralResourceUri uri = AAIUriFactory.createNodesUri(AAIObjectPlurals.SERVICE_INSTANCE)
.queryParam("service-instance-name", serviceInstance.getServiceInstanceName());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(uri));
boolean nameInUse = aaiServiceInstanceResources.checkInstanceServiceNameInUse(serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
index 9e3bc4f552..7bae50a0a9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVfModuleResourcesTest.java
@@ -38,14 +38,15 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
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.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;
@@ -162,9 +163,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() throws Exception {
- 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());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUri));
@@ -174,9 +175,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseIsResumeTest() throws Exception {
- 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());
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
boolean nameInUse = aaiVfModuleResources.checkNameInUse(vfModule);
@@ -185,9 +186,9 @@ public class AAIVfModuleResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() throws Exception {
- 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());
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUriWithCustomization));
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vfModuleUri));
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
index 425b595686..b1bacb8add 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java
@@ -43,8 +43,8 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -56,6 +56,7 @@ import org.onap.so.client.aai.AAIResourcesClient;
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;
@@ -243,7 +244,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
@@ -252,7 +253,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIResourceUri vnfUri =
+ AAIPluralResourceUri vnfUri =
AAIUriFactory.createResourceUri(AAIObjectPlurals.GENERIC_VNF).queryParam("vnf-name", "vnfName");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(vnfUri));
boolean nameInUse = aaiVnfResources.checkNameInUse("vnfName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
index 5772cab995..31a0e34a26 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVolumeGroupResourcesTest.java
@@ -37,14 +37,14 @@ import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.common.InjectionHelper;
+import org.onap.so.bpmn.common.data.TestDataSetup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
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.AAIResourcesClient;
-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;
@@ -155,7 +155,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseTrueTest() {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(true).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
@@ -164,7 +164,7 @@ public class AAIVolumeGroupResourcesTest extends TestDataSetup {
@Test
public void checkNameInUseFalseTest() {
- AAIResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
+ AAIPluralResourceUri volumeGroupUri = AAIUriFactory.createNodesUri(AAIObjectPlurals.VOLUME_GROUP)
.queryParam("volume-group-name", "testVolumeGroupName1");
doReturn(false).when(MOCK_aaiResourcesClient).exists(eq(volumeGroupUri));
boolean nameInUse = aaiVolumeGroupResources.checkNameInUse(volumeGroup);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
index 0cbdee396f..2688b33e51 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVpnBindingResourcesTest.java
@@ -37,6 +37,7 @@ import org.onap.aai.domain.yang.VpnBindings;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
+import org.onap.so.client.aai.entities.uri.AAIPluralResourceUri;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -90,12 +91,12 @@ public class AAIVpnBindingResourcesTest extends BaseTaskTest {
@Test
public void getVpnBindingByCustomerVpnIdTest() {
- when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIResourceUri.class)))
+ when(MOCK_aaiResourcesClient.get(eq(VpnBindings.class), isA(AAIPluralResourceUri.class)))
.thenReturn(Optional.of(new VpnBindings()));
Optional<VpnBindings> vpnBindings = aaiVpnBindingResources.getVpnBindingByCustomerVpnId("testCustomerVpnId");
assertNotNull(vpnBindings.get());
verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.VpnBindings.class),
- isA(AAIResourceUri.class));
+ isA(AAIPluralResourceUri.class));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
new file mode 100644
index 0000000000..040c680d1c
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -0,0 +1,13 @@
+{
+ "ApplicationControllerTaskRequest": {
+ "controllerType": "APPC",
+ "action": "ConfigModify",
+ "identityUrl": "IDENTITY-URL-TEST",
+ "applicationControllerVnf": {
+ "vnfId": "TEST-VNF-ID",
+ "vnfName": "TEST-VNF-NAME",
+ "vnfHostIpAddress": "127.0.0.1"
+ },
+ "configParams": {"name1":"value1", "name2":"value2"}
+}
+}