summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/so-bpmn-tasks')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java43
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java33
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java66
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java2
-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/SDNCNetworkResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIVnfResourcesTest.java2
39 files changed, 701 insertions, 245 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index f1fd23fe82..f10b503ed3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -162,14 +162,14 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO);
}
}
@@ -214,15 +214,15 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
"Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
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 18ba91263b..15f8c5e4ef 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
@@ -80,6 +80,16 @@ public class AAIDeleteTasks {
@Autowired
private AAIInstanceGroupResources aaiInstanceGroupResources;
+ /**
+ * BPMN access method to delete the VfModule from A&AI.
+ *
+ * It will extract the genericVnf & VfModule from the BBObject.
+ *
+ * Before deleting it set the aaiVfModuleRollback as false & then it will delete the VfModule.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
@@ -89,10 +99,21 @@ public class AAIDeleteTasks {
aaiVfModuleResources.deleteVfModule(vfModule, genericVnf);
execution.setVariable("aaiVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVfModule process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Vnf from A&AI.
+ *
+ * It will extract the genericVnf from the BBObject.
+ *
+ * Before deleting it set the aaiVnfRollback as false & then it will delete the Vnf.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVnf(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -101,79 +122,154 @@ public class AAIDeleteTasks {
aaiVnfResources.deleteVnf(genericVnf);
execution.setVariable("aaiVnfRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the ServiceInstance from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteServiceInstance(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiSIResources.deleteServiceInstance(serviceInstance);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteServiceInstance process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the l3network from A&AI.
+ *
+ * It will extract the l3network from the BBObject.
+ *
+ * After deleting the l3network it set the isRollbackNeeded as true.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteNetwork(BuildingBlockExecution execution) throws Exception {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.deleteNetwork(l3network);
execution.setVariable("isRollbackNeeded", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteNetwork process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Collection from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * Then it will get the collection from serviceinstance.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteCollection(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteCollection(serviceInstance.getCollection());
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteCollection process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the InstanceGroup from A&AI.
+ *
+ * It will extract the serviceInstance from the BBObject.
+ *
+ * Then it will get the Instance group from serviceInstance.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteInstanceGroup(BuildingBlockExecution execution) throws Exception {
try {
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiNetworkResources.deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroup process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the VolumeGroup from A&AI.
+ *
+ * It will extract the volumeGroup from the BBObject and cloudRegion from execution object .
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ * @throws Exception
+ */
public void deleteVolumeGroup(BuildingBlockExecution execution) {
try {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
CloudRegion cloudRegion = execution.getGeneralBuildingBlock().getCloudRegion();
aaiVolumeGroupResources.deleteVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteVolumeGroup process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the Configuration from A&AI.
+ *
+ * It will extract the configuration from the BBObject.
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ */
public void deleteConfiguration(BuildingBlockExecution execution) {
try {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.deleteConfiguration(configuration);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteConfiguration process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * BPMN access method to delete the InstanceGroupVnf from A&AI.
+ *
+ * It will extract the instanceGroup from the BBObject.
+ *
+ * Then it will delete from A&AI.
+ *
+ * @param execution
+ */
public void deleteInstanceGroupVnf(BuildingBlockExecution execution) {
try {
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
aaiInstanceGroupResources.deleteInstanceGroup(instanceGroup);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIDeleteTasks deleteInstanceGroupVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
public void deleteNetworkPolicies(BuildingBlockExecution execution) {
try {
String fqdns = execution.getVariable(contrailNetworkPolicyFqdnList);
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 20f4443291..86645391b4 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
@@ -92,6 +92,7 @@ public class AAIUpdateTasks {
OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiServiceInstanceRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedService", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -108,6 +109,7 @@ public class AAIUpdateTasks {
aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance,
OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveService", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -122,6 +124,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -136,6 +139,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -155,6 +159,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -174,6 +179,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -193,6 +199,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion,
OrchestrationStatus.CREATED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusCreatedVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -215,6 +222,7 @@ public class AAIUpdateTasks {
aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVolumeGroup", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -231,6 +239,7 @@ public class AAIUpdateTasks {
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);
}
}
@@ -247,6 +256,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf,
OrchestrationStatus.PENDING_ACTIVATION);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusPendingActivationVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -273,6 +283,9 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
}
} catch (Exception ex) {
+ logger.error(
+ "Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignedOrPendingActivationVfModule",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -281,7 +294,7 @@ public class AAIUpdateTasks {
* BPMN access method to update status of VfModule to Created in AAI
*
* @param execution
- *
+ *
*/
public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {
try {
@@ -289,6 +302,7 @@ public class AAIUpdateTasks {
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);
}
}
@@ -307,6 +321,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.CREATED);
execution.setVariable("aaiDeactivateVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -346,6 +361,7 @@ public class AAIUpdateTasks {
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
updateNetworkAAI(l3Network, status);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -386,6 +402,7 @@ public class AAIUpdateTasks {
aaiCollectionResources.updateCollection(copiedNetworkCollection);
execution.setVariable("aaiNetworkCollectionActivateRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActiveNetworkCollection", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -403,6 +420,7 @@ public class AAIUpdateTasks {
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);
}
}
@@ -423,6 +441,7 @@ public class AAIUpdateTasks {
vfModule.setHeatStackId(heatStackId);
aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateHeatStackIdVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -466,6 +485,7 @@ public class AAIUpdateTasks {
execution.setVariable("aaiNetworkActivateRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetworkCreated", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -495,6 +515,7 @@ public class AAIUpdateTasks {
}
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateNetworkUpdated", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -509,6 +530,7 @@ public class AAIUpdateTasks {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
aaiNetworkResources.updateNetwork(l3network);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateObjectNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -524,6 +546,7 @@ public class AAIUpdateTasks {
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -538,6 +561,7 @@ public class AAIUpdateTasks {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateObjectVnf(genericVnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateObjectVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -559,6 +583,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ASSIGNED);
execution.setVariable("aaiDeleteVfModuleRollback", true);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeleteVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -574,6 +599,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateModelVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -589,6 +615,7 @@ public class AAIUpdateTasks {
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusAssignFabricConfiguration", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -603,6 +630,8 @@ public class AAIUpdateTasks {
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusActivateFabricConfiguration",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -618,6 +647,8 @@ public class AAIUpdateTasks {
aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,
OrchestrationStatus.ASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusDeactivateFabricConfiguration",
+ ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -640,6 +671,7 @@ public class AAIUpdateTasks {
aaiVnfResources.updateObjectVnf(copiedGenericVnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateIpv4OamAddressVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -662,6 +694,7 @@ public class AAIUpdateTasks {
aaiVnfResources.updateObjectVnf(copiedGenericVnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateManagementV6AddressVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -681,6 +714,7 @@ public class AAIUpdateTasks {
aaiVfModuleResources.updateContrailServiceInstanceFqdnVfModule(vfModule, vnf);
}
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateContrailServiceInstanceFqdnVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -695,6 +729,7 @@ public class AAIUpdateTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
aaiVnfResources.updateOrchestrationStatusVnf(vnf, OrchestrationStatus.CONFIGASSIGNED);
} catch (Exception ex) {
+ logger.error("Exception occurred in AAIUpdateTasks updateOrchestrationStatusConfigAssignedVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
@@ -704,12 +739,13 @@ public class AAIUpdateTasks {
*
* @param execution
*/
- public void updateOrchestrationStausConfigDeployConfigureVnf(BuildingBlockExecution 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);
}
@@ -720,12 +756,13 @@ public class AAIUpdateTasks {
*
* @param execution
*/
- public void updateOrchestrationStausConfigDeployConfiguredVnf(BuildingBlockExecution 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);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index 9340609ffc..d9c6857ef1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -33,6 +33,7 @@ import org.camunda.bpm.engine.delegate.JavaDelegate;
import org.camunda.bpm.engine.runtime.ProcessInstanceWithVariables;
import org.camunda.bpm.engine.variable.VariableMap;
import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBTasks;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -79,6 +80,8 @@ public class ExecuteActivity implements JavaDelegate {
@Autowired
private ExceptionBuilder exceptionBuilder;
@Autowired
+ private WorkflowActionBBFailure workflowActionBBFailure;
+ @Autowired
private WorkflowActionBBTasks workflowActionBBTasks;
@Override
@@ -178,13 +181,15 @@ public class ExecuteActivity implements JavaDelegate {
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue(), msg, ex);
- execution.setVariable("ExecuteActivityErrorMessage", msg);
+ execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
protected void buildAndThrowException(DelegateExecution execution, String msg) {
logger.error(msg);
execution.setVariable(EXECUTE_ACTIVITY_ERROR_MESSAGE, msg);
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index e9d33f46ab..2705d00d6b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.onap.so.utils.Components;
@Component
public class NetworkAdapterRestV1 {
@@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK);
}
}
@@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
+ "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 127d21c0ed..9c72d229b2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -60,6 +60,8 @@ public class AppcRunTasks {
public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop";
public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock";
public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic";
+ public static final String CONTROLLER_TYPE_DEFAULT = "APPC";
+ public static final String GENERIC_APPC_ERROR_CODE = "1002";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -139,7 +141,12 @@ public class AppcRunTasks {
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = controllerSelectionReference.getControllerName();
+ String controllerType = null;
+ if (controllerSelectionReference != null) {
+ controllerType = controllerSelectionReference.getControllerName();
+ } else {
+ controllerType = CONTROLLER_TYPE_DEFAULT;
+ }
String vfModuleId = null;
VfModule vfModule = null;
@@ -153,7 +160,7 @@ public class AppcRunTasks {
HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList,
vserverIdList, identityUrl, vfModuleId);
- Optional<String> payload = null;
+ Optional<String> payload = Optional.empty();
RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
if (requestParameters != null) {
String pay = requestParameters.getPayload();
@@ -169,7 +176,9 @@ public class AppcRunTasks {
mapRollbackVariables(execution, action, appcCode);
} catch (Exception e) {
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(),
+ "Error on request to APPC", e);
+ appcCode = GENERIC_APPC_ERROR_CODE;
appcMessage = e.getMessage();
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
index bc71fc6f67..9413e8ef2e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 TechMahindra.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* 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.
@@ -20,8 +21,10 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -33,15 +36,15 @@ import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf;
import org.onap.so.client.cds.beans.ConfigAssignRequestVnf;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- *
* Get vnf related data and config assign
- *
*/
@Component
public class ConfigAssignVnf {
@@ -51,48 +54,42 @@ public class ConfigAssignVnf {
private static final String ACTION_NAME = "config-assign";
private static final String MODE = "sync";
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionBuilder;
+
@Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ public ConfigAssignVnf(ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ this.extractPojosForBB = extractPojosForBB;
+ this.exceptionBuilder = exceptionBuilder;
+ }
/**
* Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the
* subprocess.
- *
- * @param execution
*/
public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
logger.info("Start preProcessAbstractCDSProcessing ");
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- List<Map<String, Object>> userParams =
- execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams();
-
ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
configAssignPropertiesForVnf
.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
configAssignPropertiesForVnf
- .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
- configAssignPropertiesForVnf.setVnfId(vnf.getVnfId());
- configAssignPropertiesForVnf.setVnfName(vnf.getVnfName());
-
- for (Map<String, Object> params : userParams) {
- for (Map.Entry<String, Object> entry : params.entrySet()) {
- configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue());
- }
- }
-
+ .setVnfCustomizationUuid(genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configAssignPropertiesForVnf.setVnfId(genericVnf.getVnfId());
+ configAssignPropertiesForVnf.setVnfName(genericVnf.getVnfName());
+ setUserParamsInConfigAssignPropertiesForVnf(configAssignPropertiesForVnf,
+ execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(),
+ genericVnf);
ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
- configAssignRequestVnf.setResolutionKey(vnf.getVnfName());
+ configAssignRequestVnf.setResolutionKey(genericVnf.getVnfName());
configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
- String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName();
- String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion();
+ String blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName();
+ String blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion();
logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion);
AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
@@ -109,9 +106,48 @@ public class ConfigAssignVnf {
abstractCDSPropertiesBean.setActionName(ACTION_NAME);
abstractCDSPropertiesBean.setMode(MODE);
execution.setVariable("executionObject", abstractCDSPropertiesBean);
-
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ logger.error("An exception occurred when creating ConfigAssignPropertiesForVnf for CDS request", ex);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void setUserParamsInConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignProperties,
+ List<Map<String, Object>> userParamsFromRequest, GenericVnf vnf) throws Exception {
+ Service service = getServiceFromRequestUserParams(userParamsFromRequest);
+ List<Map<String, String>> instanceParamsList =
+ getInstanceParamForVnf(service, vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ instanceParamsList
+ .forEach(instanceParamsMap -> instanceParamsMap.forEach(configAssignProperties::setUserParam));
+ }
+
+ private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
+ Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst()
+ .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
+ return convertServiceFromJsonToServiceObject((String) serviceMap.get("service"));
+ }
+
+ private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception {
+ try {
+ return new ObjectMapper().readValue(serviceFromJson, Service.class);
+ } catch (Exception e) {
+ logger.error(String.format(
+ "An exception occurred while converting json object to Service object. The json is: %s",
+ serviceFromJson), e);
+ throw e;
+ }
+ }
+
+ private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid)
+ throws Exception {
+ Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream()
+ .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(genericVnfModelCustomizationUuid))
+ .findFirst();
+ if (foundedVnf.isPresent()) {
+ return foundedVnf.get().getInstanceParams();
+ } else {
+ throw new Exception(String.format("Can not find vnf for genericVnfModelCustomizationUuid: %s",
+ genericVnfModelCustomizationUuid));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
index cdbe0db57c..6a8058938f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigDeployVnf.java
@@ -62,7 +62,7 @@ public class ConfigDeployVnf {
* @param execution
*/
public void updateAAIConfigure(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ aaiUpdateTask.updateOrchestrationStatusConfigDeployConfigureVnf(execution);
}
@@ -129,7 +129,7 @@ public class ConfigDeployVnf {
* @param execution
*/
public void updateAAIConfigured(BuildingBlockExecution execution) {
- aaiUpdateTask.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ aaiUpdateTask.updateOrchestrationStatusConfigDeployConfiguredVnf(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
index e51774c12c..0afca71b99 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignVnf.java
@@ -30,12 +30,15 @@ import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoInstanceGroup;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component()
public class UnassignVnf {
+ private static final Logger logger = LoggerFactory.getLogger(UnassignVnf.class);
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -45,6 +48,17 @@ public class UnassignVnf {
@Autowired
private AAIObjectInstanceNameGenerator aaiObjectInstanceNameGenerator;
+ /**
+ * BPMN access method to deleting instanceGroup in AAI.
+ *
+ * It will extract the vnf from BBobject ,It will get the instance group from the vnf and add it into a list.
+ *
+ * Then iterate that list and check the ModelInfoInstanceGroup type.
+ *
+ * Then it will delete that.
+ *
+ * @param execution
+ */
public void deleteInstanceGroups(BuildingBlockExecution execution) {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
@@ -56,6 +70,7 @@ public class UnassignVnf {
}
}
} catch (Exception ex) {
+ logger.error("Exception occurred in UnassignVnf deleteInstanceGroups", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
index b85e33144f..f61b40ad23 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCActivateTasks.java
@@ -52,6 +52,7 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCActivateTasks extends AbstractSDNCTask {
+ private static final Logger logger = LoggerFactory.getLogger(SDNCActivateTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCVnfResources sdncVnfResources;
@@ -66,6 +67,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for activate the vnf.
+ *
+ * @param execution
+ */
public void activateVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -82,13 +90,14 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCActivateTasks activateVnf process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to perform Assign action on SDNC for L3Network
- *
+ *
* @param execution
* @throws BBObjectNotFoundException
*/
@@ -112,6 +121,13 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for activate the activateVfModule.
+ *
+ * @param execution
+ */
public void activateVfModule(BuildingBlockExecution execution) {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
@@ -131,6 +147,7 @@ public class SDNCActivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCActivateTasks activateVfModule process", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
index 3c42f76d73..96b656ff95 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCDeactivateTasks.java
@@ -53,6 +53,7 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCDeactivateTasks extends AbstractSDNCTask {
+ private static final Logger logger = LoggerFactory.getLogger(SDNCDeactivateTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCNetworkResources sdncNetworkResources;
@@ -69,6 +70,12 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object. Which is used for deactivate
+ * VfModule.
+ *
+ * @param execution
+ */
public void deactivateVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -86,13 +93,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to perform Service Topology Deactivate action on SDNC for Vnf
- *
+ *
* @param execution
* @throws Exception
*/
@@ -113,15 +121,16 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/*
* BPMN access method to perform Service Topology Deactivate action on SDNC for Service Instance
- *
+ *
* @param execution
- *
+ *
* @throws Exception
*/
public void deactivateServiceInstance(BuildingBlockExecution execution) throws Exception {
@@ -138,13 +147,14 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.SERVICE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
/**
* BPMN access method to invoke deactivate on a L3Network object
- *
+ *
* @param execution
*/
public void deactivateNetwork(BuildingBlockExecution execution) {
@@ -163,6 +173,7 @@ public class SDNCDeactivateTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCDeactivateTasks deactivateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 080d6d34b1..192cb3fc90 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,13 +80,13 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -121,9 +121,9 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred for BadResponse ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
@@ -158,18 +158,18 @@ public class SDNCQueryTasks {
// module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO);
}
} catch (BadResponseException ex) {
logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 03714db943..3383fde0a8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -80,19 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
+ "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
+ "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
@@ -123,17 +123,17 @@ public class SDNCRequestTasks {
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
} catch (Exception e) {
logger.error("Error processing SDNC callback", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
+ "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
index e3c9785ab2..4817ba8b61 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCUnassignTasks.java
@@ -53,6 +53,7 @@ import org.springframework.stereotype.Component;
@Component
public class SDNCUnassignTasks extends AbstractSDNCTask {
+ private static final Logger logger = LoggerFactory.getLogger(SDNCUnassignTasks.class);
public static final String SDNC_REQUEST = "SDNCRequest";
@Autowired
private SDNCServiceInstanceResources sdncSIResources;
@@ -69,6 +70,13 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
@Autowired
private Environment env;
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the ServiceInstance.
+ *
+ * @param execution
+ */
public void unassignServiceInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -83,10 +91,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.SERVICE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignServiceInstance", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the VfModule.
+ *
+ * @param execution
+ */
public void unassignVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -102,10 +118,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the Vnf.
+ *
+ * @param execution
+ */
public void unassignVnf(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -122,10 +146,18 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.VNF);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignVnf", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ /**
+ * This method is used to prepare a SDNC request and set it to the execution Object.
+ *
+ * Which is used for unassign the Network.
+ *
+ * @param execution
+ */
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
@@ -144,6 +176,7 @@ public class SDNCUnassignTasks extends AbstractSDNCTask {
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
+ logger.error("Exception occurred in SDNCUnassignTasks unassignNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 8822bc39dd..64f0072991 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -153,16 +153,6 @@ public class OrchestrationStatusValidator {
.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(),
orchestrationStatus, buildingBlockDetail.getTargetAction());
- if (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
- && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
- && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
- previousOrchestrationStatusValidationResult, genericVnf,
- orchestrationStatusStateTransitionDirective);
- }
-
if (orchestrationStatusStateTransitionDirective
.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) {
throw new OrchestrationStatusValidationException(
@@ -187,23 +177,4 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
- BuildingBlockExecution execution,
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
- .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
}
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 e6dd38ee1e..1f07166b60 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
@@ -93,6 +93,7 @@ public class WorkflowAction {
private static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
private static final String SERVICE_INSTANCES = "serviceInstances";
+ private static final String SERVICE_INSTANCE = "serviceInstance";
private static final String VF_MODULES = "vfModules";
private static final String WORKFLOW_ACTION_WAS_UNABLE_TO_VERIFY_IF_THE_INSTANCE_NAME_ALREADY_EXIST_IN_AAI =
"WorkflowAction was unable to verify if the instance name already exist in AAI.";
@@ -107,7 +108,7 @@ public class WorkflowAction {
private static final String ASSIGNINSTANCE = "assignInstance";
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
- private static final String supportedTypes =
+ private static final String SUPPORTEDTYPES =
"vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups";
private static final String HOMINGSOLUTION = "Homing_Solution";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
@@ -123,6 +124,8 @@ public class WorkflowAction {
private static final String NAME_EXISTS_WITH_DIFF_CUSTOMIZATION_ID =
"(%s), same parent and different customization id (%s)";
private static final String NAME_EXISTS_WITH_DIFF_PARENT = "(%s) id (%s) and different parent relationship";
+ private static final String CREATENETWORKBB = "CreateNetworkBB";
+ private static final String ACTIVATENETWORKBB = "ActivateNetworkBB";
@Autowired
protected BBInputSetup bbInputSetup;
@@ -183,12 +186,14 @@ public class WorkflowAction {
try {
cloudOwner = requestDetails.getCloudConfiguration().getCloudOwner();
} catch (Exception ex) {
+ logger.error("Exception in getCloundOwner", ex);
cloudOwner = environment.getProperty(defaultCloudOwner);
}
boolean suppressRollback = false;
try {
suppressRollback = requestDetails.getRequestInfo().getSuppressRollback();
} catch (Exception ex) {
+ logger.error("Exception in getSuppressRollback", ex);
suppressRollback = false;
}
execution.setVariable("suppressRollback", suppressRollback);
@@ -209,7 +214,7 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
- if ((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE) {
+ if ((serviceInstanceId == null || serviceInstanceId.isEmpty()) && resourceType == WorkflowType.SERVICE) {
serviceInstanceId = resourceId;
}
execution.setVariable("resourceId", resourceId);
@@ -300,9 +305,9 @@ public class WorkflowAction {
traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
} else if (resourceType == WorkflowType.SERVICE
- && (requestAction.equalsIgnoreCase("activateInstance")
- || requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("deleteInstance")
+ && ("activateInstance".equalsIgnoreCase(requestAction)
+ || "unassignInstance".equalsIgnoreCase(requestAction)
+ || "deleteInstance".equalsIgnoreCase(requestAction)
|| requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
// SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
// SERVICE-MACRO-DELETE
@@ -310,10 +315,10 @@ public class WorkflowAction {
// to query the SI in AAI to find related instances.
traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
} else if (resourceType == WorkflowType.SERVICE
- && requestAction.equalsIgnoreCase("deactivateInstance")) {
+ && "deactivateInstance".equalsIgnoreCase(requestAction)) {
resourceCounter.add(new Resource(WorkflowType.SERVICE, "", false));
- } else if (resourceType == WorkflowType.VNF && (requestAction.equalsIgnoreCase("replaceInstance")
- || (requestAction.equalsIgnoreCase("recreateInstance")))) {
+ } else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction)
+ || ("recreateInstance".equalsIgnoreCase(requestAction)))) {
traverseAAIVnf(execution, resourceCounter, workflowResourceIds.getServiceInstanceId(),
workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
@@ -363,7 +368,7 @@ public class WorkflowAction {
sIRequest.getRequestDetails().getRequestParameters().getUserParams();
for (Map<String, Object> params : userParams) {
if (params.containsKey(HOMINGSOLUTION)) {
- if (params.get(HOMINGSOLUTION).equals("none")) {
+ if ("none".equals(params.get(HOMINGSOLUTION))) {
execution.setVariable("homing", false);
} else {
execution.setVariable("homing", true);
@@ -447,7 +452,7 @@ public class WorkflowAction {
protected boolean isConfiguration(List<OrchestrationFlow> orchFlows) {
for (OrchestrationFlow flow : orchFlows) {
- if (flow.getFlowName().contains("Configuration") && !flow.getFlowName().equals("ConfigurationScaleOutBB")) {
+ if (flow.getFlowName().contains(CONFIGURATION) && !"ConfigurationScaleOutBB".equals(flow.getFlowName())) {
return true;
}
}
@@ -715,7 +720,7 @@ public class WorkflowAction {
protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration,
AAIResultWrapper configWrapper) throws VrfBondingServiceException {
- if (vrfConfiguration.getConfigurationType().equalsIgnoreCase("VRF-ENTRY")) {
+ if ("VRF-ENTRY".equalsIgnoreCase(vrfConfiguration.getConfigurationType())) {
Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships();
if (relationshipsConfigOp.isPresent()) {
Optional<VpnBinding> relatedInfraVpnBindingOp =
@@ -752,7 +757,7 @@ public class WorkflowAction {
if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
String toscaNodeType = collectionResourceCustomization.getCollectionResource()
.getInstanceGroup().getToscaNodeType();
- if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
+ if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) {
int minNetworks = 0;
org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
collectionResourceCustomization.getCollectionResource().getInstanceGroup();
@@ -885,6 +890,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in traverseAAIService", ex);
buildAndThrowException(execution,
"Could not find existing Service Instance or related Instances to execute the request on.");
}
@@ -926,6 +932,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in traverseAAIVnf", ex);
buildAndThrowException(execution,
"Could not find existing Vnf or related Instances to execute the request on.");
}
@@ -953,6 +960,7 @@ public class WorkflowAction {
}
}
} catch (Exception ex) {
+ logger.error("Exception in findConfigurationsInsideVfModule", ex);
buildAndThrowException(execution, "Failed to find Configuration object from the vfModule.");
}
}
@@ -1015,8 +1023,8 @@ public class WorkflowAction {
vfModuleCustomizationUUID =
vfModule.getModelInfo().getModelCustomizationUuid();
}
- if (!vnfCustomizationUUID.equals("")
- && !vfModuleCustomizationUUID.equals("")) {
+ if (!vnfCustomizationUUID.isEmpty()
+ && !vfModuleCustomizationUUID.isEmpty()) {
List<CvnfcConfigurationCustomization> configs =
traverseCatalogDbForConfiguration(
validate.getModelInfo().getModelVersionId(),
@@ -1110,7 +1118,7 @@ public class WorkflowAction {
protected Resource extractResourceIdAndTypeFromUri(String uri) {
Pattern patt = Pattern.compile(
- "[vV]\\d+.*?(?:(?:/(?<type>" + supportedTypes + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
+ "[vV]\\d+.*?(?:(?:/(?<type>" + SUPPORTEDTYPES + ")(?:/(?<id>[^/]+))?)(?:/(?<action>[^/]+))?)?$");
Matcher m = patt.matcher(uri);
Boolean generated = false;
@@ -1123,15 +1131,15 @@ public class WorkflowAction {
throw new IllegalArgumentException("Uri could not be parsed. No type found. " + uri);
}
if (action == null) {
- if (type.equals(SERVICE_INSTANCES) && (id == null || id.equals("assign"))) {
+ if (type.equals(SERVICE_INSTANCES) && (id == null || "assign".equals(id))) {
id = UUID.randomUUID().toString();
generated = true;
- } else if (type.equals(VF_MODULES) && id.equals("scaleOut")) {
+ } else if (type.equals(VF_MODULES) && "scaleOut".equals(id)) {
id = UUID.randomUUID().toString();
generated = true;
}
} else {
- if (action.matches(supportedTypes)) {
+ if (action.matches(SUPPORTEDTYPES)) {
id = UUID.randomUUID().toString();
generated = true;
type = action;
@@ -1159,7 +1167,7 @@ public class WorkflowAction {
.equalsIgnoreCase(reqDetails.getModelInfo().getModelVersionId())) {
return serviceInstanceAAI.get().getServiceInstanceId();
} else {
- throw new DuplicateNameException("serviceInstance",
+ throw new DuplicateNameException(SERVICE_INSTANCE,
String.format(NAME_EXISTS_WITH_DIFF_VERSION_ID, instanceName,
reqDetails.getModelInfo().getModelVersionId()));
}
@@ -1170,7 +1178,7 @@ public class WorkflowAction {
if (aaiServiceInstances.getServiceInstance() != null
&& !aaiServiceInstances.getServiceInstance().isEmpty()) {
if (aaiServiceInstances.getServiceInstance().size() > 1) {
- throw new DuplicateNameException("serviceInstance",
+ throw new DuplicateNameException(SERVICE_INSTANCE,
String.format(NAME_EXISTS_MULTIPLE, instanceName));
} else {
ServiceInstance si =
@@ -1178,7 +1186,7 @@ public class WorkflowAction {
Map<String, String> keys =
bbInputSetupUtils.getURIKeysFromServiceInstance(si.getServiceInstanceId());
- throw new DuplicateNameException("serviceInstance",
+ throw new DuplicateNameException(SERVICE_INSTANCE,
String.format(NAME_EXISTS_WITH_DIFF_COMBINATION, instanceName,
keys.get("global-customer-id"), keys.get("service-type"),
si.getModelVersionId()));
@@ -1295,7 +1303,7 @@ public class WorkflowAction {
}
protected String convertTypeFromPlural(String type) {
- if (!type.matches(supportedTypes)) {
+ if (!type.matches(SUPPORTEDTYPES)) {
return type;
} else {
if (type.equals(SERVICE_INSTANCES)) {
@@ -1317,31 +1325,31 @@ public class WorkflowAction {
String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
sortedOrchFlows.add(ebb);
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
- if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
&& ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
sortedOrchFlows.add(ebb2);
break;
}
}
for (ExecuteBuildingBlock ebb2 : orchFlows) {
- if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (!isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)
&& ebb2.getBuildingBlock().getKey().equalsIgnoreCase(key)) {
sortedOrchFlows.add(ebb2);
break;
}
- if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")
+ if (isVirtualLink && ebb2.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)
&& ebb2.getBuildingBlock().getVirtualLinkKey().equalsIgnoreCase(virtualLinkKey)) {
sortedOrchFlows.add(ebb2);
break;
}
}
- } else if (ebb.getBuildingBlock().getBpmnFlowName().equals("CreateNetworkBB")
- || ebb.getBuildingBlock().getBpmnFlowName().equals("ActivateNetworkBB")) {
+ } else if (ebb.getBuildingBlock().getBpmnFlowName().equals(CREATENETWORKBB)
+ || ebb.getBuildingBlock().getBpmnFlowName().equals(ACTIVATENETWORKBB)) {
continue;
} else if (!ebb.getBuildingBlock().getBpmnFlowName().equals("")) {
sortedOrchFlows.add(ebb);
@@ -1424,7 +1432,7 @@ public class WorkflowAction {
}
} else if (orchFlow.getFlowName().contains(VFMODULE)) {
List<Resource> vfModuleResourcesSorted = null;
- if (requestAction.equals("createInstance") || requestAction.equals("assignInstance")
+ if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)
|| requestAction.equals("activateInstance")) {
vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceCounter.stream()
.filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 073dead8b3..d5798150d1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -40,7 +40,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
-import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
@@ -65,6 +64,9 @@ public class WorkflowActionBBTasks {
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String ASSIGN_FABRIC_CONFIGURATION_BB = "AssignFabricConfigurationBB";
private static final String ACTIVATE_FABRIC_CONFIGURATION_BB = "ActivateFabricConfigurationBB";
+ private static final String COMPLETED = "completed";
+ private static final String HANDLINGCODE = "handlingCode";
+ private static final String ROLLBACKTOCREATED = "RollbackToCreated";
protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@@ -98,9 +100,9 @@ public class WorkflowActionBBTasks {
execution.setVariable("buildingBlock", ebb);
currentSequence++;
if (currentSequence >= flowsToExecute.size()) {
- execution.setVariable("completed", true);
+ execution.setVariable(COMPLETED, true);
} else {
- execution.setVariable("completed", false);
+ execution.setVariable(COMPLETED, false);
}
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
@@ -114,7 +116,8 @@ public class WorkflowActionBBTasks {
}
} catch (Exception ex) {
logger.warn(
- "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.");
+ "Bpmn Flow Statistics was unable to update Request Db with the new completion percentage. Competion percentage may be invalid.",
+ ex);
}
}
@@ -236,7 +239,7 @@ public class WorkflowActionBBTasks {
}
public void checkRetryStatus(DelegateExecution execution) {
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
String requestId = (String) execution.getVariable(G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
@@ -244,11 +247,11 @@ public class WorkflowActionBBTasks {
try {
envMaxRetries = Integer.parseInt(this.environment.getProperty(maxRetries));
} catch (Exception ex) {
- logger.error("Could not read maxRetries from config file. Setting max to 5 retries");
+ logger.error("Could not read maxRetries from config file. Setting max to 5 retries", ex);
envMaxRetries = 5;
}
int nextCount = retryCount + 1;
- if (handlingCode.equals("Retry")) {
+ if ("Retry".equals(handlingCode)) {
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
try {
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
@@ -259,8 +262,8 @@ public class WorkflowActionBBTasks {
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
if (retryCount < envMaxRetries) {
- int currSequence = (int) execution.getVariable("gCurrentSequence");
- execution.setVariable("gCurrentSequence", currSequence - 1);
+ int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1);
execution.setVariable(RETRY_COUNT, nextCount);
} else {
workflowAction.buildAndThrowException(execution,
@@ -287,12 +290,12 @@ public class WorkflowActionBBTasks {
flowsToExecute.remove(i);
} else {
String flowName = flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName();
- if (flowName.contains("Assign")) {
- flowName = "Unassign" + flowName.substring(6, flowName.length());
- } else if (flowName.contains("Create")) {
- flowName = "Delete" + flowName.substring(6, flowName.length());
- } else if (flowName.contains("Activate")) {
- flowName = "Deactivate" + flowName.substring(8, flowName.length());
+ if (flowName.startsWith("Assign")) {
+ flowName = flowName.replaceFirst("Assign", "Unassign");
+ } else if (flowName.startsWith("Create")) {
+ flowName = flowName.replaceFirst("Create", "Delete");
+ } else if (flowName.startsWith("Activate")) {
+ flowName = flowName.replaceFirst("Activate", "Deactivate");
} else {
continue;
}
@@ -301,15 +304,15 @@ public class WorkflowActionBBTasks {
}
}
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
rollbackFlowsFiltered.addAll(rollbackFlows);
- if (handlingCode.equals("RollbackToAssigned") || handlingCode.equals("RollbackToCreated")) {
+ if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
for (int i = 0; i < rollbackFlows.size(); i++) {
if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
- && handlingCode.equals("RollbackToCreated")) {
+ && ROLLBACKTOCREATED.equals(handlingCode)) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
}
}
@@ -321,9 +324,9 @@ public class WorkflowActionBBTasks {
else
execution.setVariable("isRollbackNeeded", true);
execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
- execution.setVariable("handlingCode", "PreformingRollback");
+ execution.setVariable(HANDLINGCODE, "PreformingRollback");
execution.setVariable("isRollback", true);
- execution.setVariable("gCurrentSequence", 0);
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
execution.setVariable(RETRY_COUNT, 0);
} else {
workflowAction.buildAndThrowException(execution,
@@ -354,6 +357,7 @@ public class WorkflowActionBBTasks {
}
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
+ logger.error("Exception in updateInstanceId", ex);
workflowAction.buildAndThrowException(execution, "Failed to update Request db with instanceId");
}
}
@@ -361,12 +365,12 @@ public class WorkflowActionBBTasks {
public void postProcessingExecuteBB(DelegateExecution execution) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- String handlingCode = (String) execution.getVariable("handlingCode");
+ String handlingCode = (String) execution.getVariable(HANDLINGCODE);
final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
- if (bbFlowName.equalsIgnoreCase("ActivateVfModuleBB") && aLaCarte && handlingCode.equalsIgnoreCase("Success")) {
+ if ("ActivateVfModuleBB".equalsIgnoreCase(bbFlowName) && aLaCarte && "Success".equalsIgnoreCase(handlingCode)) {
postProcessingExecuteBBActivateVfModule(execution, ebb, flowsToExecute);
}
}
@@ -410,16 +414,16 @@ public class WorkflowActionBBTasks {
.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
executeBB.getBuildingBlock().getBpmnFlowName()));
execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("completed", false);
+ execution.setVariable(COMPLETED, false);
} else {
- logger.debug("No cvnfcCustomization found for customizationId: " + modelCustomizationId);
+ logger.debug("No cvnfcCustomization found for customizationId: {}", modelCustomizationId);
}
}
} catch (EntityNotFoundException e) {
- logger.debug(e.getMessage() + " Will not be running Fabric Config Building Blocks");
+ logger.debug("Will not be running Fabric Config Building Blocks", e);
} catch (Exception e) {
String errorMessage = "Error occurred in post processing of Vf Module create";
- execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable(HANDLINGCODE, ROLLBACKTOCREATED);
execution.setVariable("WorkflowActionErrorMessage", errorMessage);
logger.error(errorMessage, e);
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
index e24e86285c..9af2128f63 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -33,11 +33,16 @@ import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class VnfAdapterClientImpl implements VnfAdapterClient {
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterClientImpl.class);
+
private static final String VF_MODULES = "/vf-modules/";
private VnfAdapterRestProperties props;
@@ -57,6 +62,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req,
CreateVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in createVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -69,6 +75,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req,
RollbackVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in rollbackVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -80,6 +87,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
.delete(req, DeleteVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in deleteVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -91,6 +99,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
.put(req, UpdateVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in updateVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -122,6 +131,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get();
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in queryVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
index 2af4d5f1fa..c5e8bf7416 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
@@ -7,9 +7,9 @@
* 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.
@@ -34,11 +34,15 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.client.RestClient;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
+ private static final Logger logger = LoggerFactory.getLogger(VnfVolumeAdapterClientImpl.class);
+
private final VnfVolumeAdapterRestProperties props;
public VnfVolumeAdapterClientImpl() {
@@ -50,6 +54,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("").post(req, CreateVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in createVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -60,6 +65,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("/" + aaiVolumeGroupId).delete(req, DeleteVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in deleteVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -71,6 +77,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
return this.getAdapterRestClient("/" + aaiVolumeGroupId + "/rollback").delete(req,
RollbackVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in rollbackVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -81,6 +88,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("/" + aaiVolumeGroupId).put(req, UpdateVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in updateVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -94,6 +102,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
requestId, serviceInstanceId);
return this.getAdapterRestClient(path).get(QueryVolumeGroupResponse.class).get();
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in queryVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
index 6daed56675..6278d48e03 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
@@ -23,10 +23,10 @@ package org.onap.so.client.adapter.vnf.mapper;
import java.io.Serializable;
public class AttributeNameValue implements Serializable {
- private final static long serialVersionUID = -5215028275587848311L;
+ private static final long serialVersionUID = -5215028275587848311L;
private String attributeName;
- private Object attributeValue;
+ private transient Object attributeValue;
public AttributeNameValue(String attributeName, Object attributeValue) {
this.attributeName = attributeName;
@@ -51,7 +51,7 @@ public class AttributeNameValue implements Serializable {
@Override
public String toString() {
- return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName.toString())
+ return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName)
.append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}").toString();
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 5c69987a54..8c13c9be97 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -33,7 +33,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
@@ -76,10 +75,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
-import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -481,7 +480,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
}
sbInterfaceRoutePrefixes.append("]");
- if (interfaceRoutePrefixesList.size() > 0) {
+ if (!interfaceRoutePrefixesList.isEmpty()) {
paramsMap.put(key + UNDERSCORE + networkKey + "_route_prefixes",
sbInterfaceRoutePrefixes.toString());
}
@@ -508,7 +507,7 @@ public class VnfAdapterVfModuleObjectMapper {
sriovFilterBuf.append(heatVlanFilterValue);
}
}
- if (heatVlanFiltersList.size() > 0) {
+ if (!heatVlanFiltersList.isEmpty()) {
paramsMap.put(networkKey + "_ATT_VF_VLAN_FILTER", sriovFilterBuf.toString());
}
}
@@ -540,7 +539,7 @@ public class VnfAdapterVfModuleObjectMapper {
String ipVersion = ipAddress.getIpVersion();
for (int b = 0; b < ipsList.size(); b++) {
String ipAddressValue = ipsList.get(b);
- if (ipVersion.equals("ipv4")) {
+ if ("ipv4".equals(ipVersion)) {
if (b != ipsList.size() - 1) {
sbIpv4Ips.append(ipAddressValue + ",");
} else {
@@ -548,7 +547,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
paramsMap.put(key + UNDERSCORE + networkKey + IP + UNDERSCORE + b,
ipAddressValue);
- } else if (ipVersion.equals("ipv6")) {
+ } else if ("ipv6".equals(ipVersion)) {
if (b != ipsList.size() - 1) {
sbIpv6Ips.append(ipAddressValue + ",");
} else {
@@ -897,6 +896,7 @@ public class VnfAdapterVfModuleObjectMapper {
try {
json = mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
+ logger.error("JsonProcessingException in convertToString", e);
json = "{}";
}
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 867d80a4ea..8b939940fa 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
@@ -52,7 +52,7 @@ public class AAIConfigurationResources {
AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
configuration.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
- injectionHelper.getAaiClient().create(configurationURI, aaiConfiguration);
+ injectionHelper.getAaiClient().createIfNotExists(configurationURI, Optional.of(aaiConfiguration));
}
/**
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 63bde79b3f..7ad74a6d86 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
@@ -33,6 +33,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Platform;
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.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -151,6 +152,8 @@ public class AAIVnfResources {
.get(org.onap.aai.domain.yang.GenericVnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId))
.orElse(new org.onap.aai.domain.yang.GenericVnf());
+ AAIRestClientImpl client = new AAIRestClientImpl();
+ aaiValidatorImpl.setClient(client);
return aaiValidatorImpl.isPhysicalServerLocked(vnf.getVnfId());
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
index d4a4cfbd8a..0123eb67be 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -32,8 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
index b3ea18df58..01511eaccc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -37,14 +37,11 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class SDNCVfModuleResources {
- private static final Logger logger = LoggerFactory.getLogger(SDNCVfModuleResources.class);
@Autowired
private VfModuleTopologyOperationRequestMapper sdncRM;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 6434bfb176..27edeed02a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -36,8 +36,6 @@ import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
index 62d6a110f6..6a15ca321a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/VnfAdapterVfModuleResources.java
@@ -34,8 +34,6 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 2e7877fe3b..07f448e5e1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -29,8 +29,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index b8146b5504..2c8bdd931c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
@@ -36,7 +36,7 @@ public class SDNCRequest implements Serializable {
private SDNCTopology topology;
private String correlationValue = UUID.randomUUID().toString();
private String correlationName = "SDNCCallback";
- private Object sdncPayload;
+ private transient Object sdncPayload;
public String getTimeOut() {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index d07574a1ad..c63cbc0b68 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -37,7 +37,6 @@ import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
@Component
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 905f244278..c337f7f1b5 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
@@ -733,7 +733,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CONFIGURE);
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfigureVnf(execution);
+ aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfigureVnf(execution);
}
@Test
@@ -741,6 +741,6 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
doNothing().when(aaiVfModuleResources).updateOrchestrationStatusVfModule(vfModule, genericVnf,
OrchestrationStatus.CONFIGURED);
- aaiUpdateTasks.updateOrchestrationStausConfigDeployConfiguredVnf(execution);
+ aaiUpdateTasks.updateOrchestrationStatusConfigDeployConfiguredVnf(execution);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index 56ff813e73..c0056291ef 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -22,22 +22,41 @@ package org.onap.so.bpmn.infrastructure.activity;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doReturn;
import java.nio.file.Files;
import java.nio.file.Paths;
+import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.core.WorkflowException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionBBFailure;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.springframework.beans.factory.annotation.Autowired;
+import org.onap.so.client.exception.ExceptionBuilder;
public class ExecuteActivityTest extends BaseTaskTest {
@InjectMocks
protected ExecuteActivity executeActivity = new ExecuteActivity();
+ @InjectMocks
+ @Spy
+ private ExceptionBuilder exceptionBuilder;
+
+ @Mock
+ private WorkflowActionBBFailure workflowActionBBFailure;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
private DelegateExecution execution;
@Before
@@ -72,4 +91,17 @@ public class ExecuteActivityTest extends BaseTaskTest {
assertEquals(ebb.getBuildingBlock(), bb);
}
+ @Test
+ public void buildAndThrowException_Test() throws Exception {
+ doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
+ doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
+ thrown.expect(BpmnError.class);
+ executeActivity.buildAndThrowException(execution, "TEST EXCEPTION MSG");
+ String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage");
+ assertEquals(errorMessage, "TEST EXCEPTION MSG");
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(workflowException.getErrorMessage(), "TEST EXCEPTION MSG");
+ assertEquals(workflowException.getErrorCode(), 7000);
+ }
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 8aea2d2650..3994208d23 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ONAPComponents;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
- any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+ any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class));
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
@@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"), eq(TargetEntity.OPENSTACK));
+ eq("test error message"), eq(Components.OPENSTACK));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
index 7d96a18305..468bc7d8f6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 TechMahindra.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* 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.
@@ -20,57 +21,139 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doThrow;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.util.UUID;
-import org.camunda.bpm.engine.delegate.BpmnError;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.ArgumentMatchers;
-import org.mockito.InjectMocks;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+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.ExceptionBuilder;
-public class ConfigAssignVnfTest extends BaseTaskTest {
- @InjectMocks
- private ConfigAssignVnf configAssignVnf = new ConfigAssignVnf();
+public class ConfigAssignVnfTest {
- private GenericVnf genericVnf;
- private ServiceInstance serviceInstance;
- private RequestContext requestContext;
- private String msoRequestId;
+ private static final String GENERIC_VNF_ID = "vnfId_configVnfTest";
+ private static final String GENERIC_VNF_NAME = "vnfName_configVnfTest";
+ private static final String VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+ private static final String SERVICE_INSTANCE_ID = "serviceInst_configTest";
+ private static final String SERVICE_MODEL_UUID = "5af91c26-8418-4d3f-944c-965842deda94";
+ private static final String TARGET_VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
+ private static final int THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES = 8;
+
+ private static final String USER_PARAMS_FROM_REQUEST = "{\"resources\":{\"vnfs\":["
+ + "{\"modelInfo\":{\"modelCustomizationId\":\"" + VNF_MODEL_CUSTOMIZATION_UUID + "\"},"
+ + "\"instanceParams\":[{\"paramName1\":\"paramValue1\",\"paramName2\":\"paramValue2\"},{\"paramName3\":\"paramValue3\"}]},"
+ + "{\"modelInfo\":{\"modelCustomizationId\":\"2d1ac656-377e-467b-be50-6ce65f66a7ca\"},"
+ + "\"instanceParams\":[{\"parName4\":\"parValue4\",\"parName5\":\"parValue5\"}]}]}}\n";
+
+
+ private ConfigAssignVnf testedObject;
+
+ private BuildingBlockExecution buildingBlockExecution;
+ private ExtractPojosForBB extractPojosForBB;
@Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- serviceInstance = setServiceInstance();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- gBBInput.setRequestContext(requestContext);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
- .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
- .thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
- .thenReturn(serviceInstance);
+ public void setup() {
+ buildingBlockExecution = createBuildingBlockExecution();
+ extractPojosForBB = mock(ExtractPojosForBB.class);
+ testedObject = new ConfigAssignVnf(extractPojosForBB, new ExceptionBuilder());
}
@Test
- public void preProcessAbstractCDSProcessingTest() throws Exception {
+ public void prepareAbstractCDSPropertiesBean_success() throws Exception {
+ // given
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID))
+ .thenReturn(createGenericVnf());
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID))
+ .thenReturn(createServiceInstance());
+ // when
+ testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution);
+ // then
+ verifyConfigAssignPropertiesJsonContent();
+ }
- configAssignVnf.preProcessAbstractCDSProcessing(execution);
+ private void verifyConfigAssignPropertiesJsonContent() throws Exception {
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = buildingBlockExecution.getVariable("executionObject");
+ String payload = abstractCDSPropertiesBean.getRequestObject();
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode configAssignPropertiesNode = payloadJson.findValue("config-assign-properties");
+ assertThat(configAssignPropertiesNode.size()).isEqualTo(THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES);
+ assertThat(configAssignPropertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(configAssignPropertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ assertThat(configAssignPropertiesNode.get("vnf-name").asText()).isEqualTo(GENERIC_VNF_NAME);
+ assertThat(configAssignPropertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(configAssignPropertiesNode.get("vnf-customization-uuid").asText())
+ .isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID);
+ assertThat(configAssignPropertiesNode.has("paramName1")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName1").asText()).isEqualTo("paramValue1");
+ assertThat(configAssignPropertiesNode.has("paramName2")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName2").asText()).isEqualTo("paramValue2");
+ assertThat(configAssignPropertiesNode.has("paramName3")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName3").asText()).isEqualTo("paramValue3");
+ }
- assertTrue(true);
+ private BuildingBlockExecution createBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
}
+ private ServiceInstance createServiceInstance() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(SERVICE_MODEL_UUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ return serviceInstance;
+ }
+
+ private GenericVnf createGenericVnf() {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(GENERIC_VNF_ID);
+ genericVnf.setVnfName(GENERIC_VNF_NAME);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelCustomizationUuid(TARGET_VNF_MODEL_CUSTOMIZATION_UUID);
+ modelInfoGenericVnf.setBlueprintName("blueprintTest");
+ modelInfoGenericVnf.setBlueprintVersion("blueprintVerTest");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ return genericVnf;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams());
+ requestContext.setRequestParameters(requestParameters);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", USER_PARAMS_FROM_REQUEST);
+ userParams.add(userParamMap);
+ return userParams;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 0ba9237aaf..e158925568 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.ONAPComponents;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
vfModule = setVfModule();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(
- any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class));
+ any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index 0fc33fe5ce..e435909f59 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index b371e3a48a..ffe48876c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -50,7 +51,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.beans.factory.annotation.Autowired;
-@Ignore
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,6 +72,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
@@ -115,6 +122,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -134,6 +148,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.getVariable("orchestrationStatusValidationResult"));
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -147,6 +162,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
expectedException.expect(BpmnError.class);
@@ -178,6 +194,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -228,8 +245,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
- execution.getVariable("orchestrationStatusValidationResult"));
+ assertNull(execution.getVariable("orchestrationStatusValidationResult"));
}
@Test
@@ -247,6 +263,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -257,7 +279,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
orchestrationStatusStateTransitionDirective.setId(1);
orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
@@ -288,6 +310,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -338,6 +366,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -380,6 +414,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -422,6 +462,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -464,6 +510,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -482,4 +534,39 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
}
+
+ @Test
+ public void continueValidationActivatedTest() throws Exception {
+ String flowToBeCalled = "DeactivateVnfBB";
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(flowToBeCalled);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE);
+ when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE);
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
+ OrchestrationAction.DEACTIVATE);
+
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
}
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 68f3d20c82..9855c8587a 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
@@ -96,14 +96,12 @@ public class AAIConfigurationResourcesTest extends TestDataSetup {
public void createConfigurationTest() {
doReturn(new org.onap.aai.domain.yang.Configuration()).when(MOCK_aaiObjectMapper)
.mapConfiguration(configuration);
- doNothing().when(MOCK_aaiResourcesClient).create(isA(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
-
+ doReturn(MOCK_aaiResourcesClient).when(MOCK_aaiResourcesClient).createIfNotExists(isA(AAIResourceUri.class),
+ any(Optional.class));
aaiConfigurationResources.createConfiguration(configuration);
assertEquals(OrchestrationStatus.INVENTORIED, configuration.getOrchestrationStatus());
- verify(MOCK_aaiResourcesClient, times(1)).create(any(AAIResourceUri.class),
- isA(org.onap.aai.domain.yang.Configuration.class));
+ verify(MOCK_aaiResourcesClient, times(1)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
@Test
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 3680eaac81..425b595686 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
@@ -53,6 +53,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.AAIRestClientImpl;
import org.onap.so.client.aai.AAIValidatorImpl;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
@@ -234,6 +235,7 @@ public class AAIVnfResourcesTest extends TestDataSetup {
boolean isVnfPserversLockedFlag = aaiVnfResources.checkVnfPserversLockedFlag("vnfId");
verify(MOCK_aaiResourcesClient, times(1)).get(eq(org.onap.aai.domain.yang.GenericVnf.class),
isA(AAIResourceUri.class));
+ verify(MOCK_aaiValidatorImpl, times(1)).setClient(isA(AAIRestClientImpl.class));
verify(MOCK_aaiValidatorImpl, times(1)).isPhysicalServerLocked(isA(String.class));
assertTrue(isVnfPserversLockedFlag);
}