aboutsummaryrefslogtreecommitdiffstats
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/pom.xml29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java61
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java174
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java81
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java100
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java699
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java9
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java84
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java98
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java49
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java110
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java100
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java74
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java135
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java107
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java73
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java72
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java2
-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/SDNCServiceInstanceResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java2
-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/sdnc/SDNCClient.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java168
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java57
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java97
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java167
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java128
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java83
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java77
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java90
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java183
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java197
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java112
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java128
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java118
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java138
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java71
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java103
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java62
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java70
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java54
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java76
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java66
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java98
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java64
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java)81
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java)3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java130
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java285
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java633
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListenerTest.java59
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListenerTest.java122
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java219
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java104
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java79
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java124
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java158
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json40
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json23
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json23
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json25
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json17
115 files changed, 2062 insertions, 6502 deletions
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index 2a9d7fa714..f7eb2c09c7 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -3,7 +3,7 @@
<parent>
<groupId>org.onap.so</groupId>
<artifactId>bpmn</artifactId>
- <version>1.6.0-SNAPSHOT</version>
+ <version>1.7.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>so-bpmn-tasks</artifactId>
@@ -11,8 +11,6 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <maven.compiler.target>1.8</maven.compiler.target>
- <maven.compiler.source>1.8</maven.compiler.source>
<grpc.version>1.17.1</grpc.version>
</properties>
<build>
@@ -121,7 +119,7 @@
</execute>
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
@@ -134,7 +132,7 @@
<execute />
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
@@ -204,17 +202,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>generic-resource-api-client</artifactId>
- <version>${sdnc.northbound.version}</version>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>
<version>2.2.3</version>
@@ -246,5 +233,15 @@
<version>${grpc.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-optimization-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-sdn-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
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 f10b503ed3..71ea9fa719 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
@@ -440,7 +440,8 @@ public class SniroHomingV2 {
if (!candidates.isEmpty()) {
for (Candidate c : candidates) {
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifierType(
+ org.onap.so.client.sniro.beans.CandidateType.valueOf(c.getIdentifierType().name()));
can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
candidateList.add(can);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index e3181c3e91..55edf0bb6c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -260,7 +260,7 @@ public class AAICreateTasks {
public void createPnf(BuildingBlockExecution execution) {
try {
Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
- aaiPnfResources.checkIfPnfExistsInAaiAndCanBeUsed(pnf.getPnfName());
+ aaiPnfResources.checkIfPnfExistsInAaiAndCanBeUsed(pnf);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiPnfResources.createPnfAndConnectServiceInstance(pnf, serviceInstance);
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 cc630232c2..6c989093ab 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
@@ -90,6 +90,13 @@ public class AAIUpdateTasks {
}
/**
+ * BPMN access method to update status of Pnf to Inventoried in AAI
+ */
+ public void updateOrchestrationStatusInventoriedPnf(BuildingBlockExecution execution) {
+ updateOrchestrationStatusForPnf(execution, OrchestrationStatus.INVENTORIED);
+ }
+
+ /**
* BPMN access method to update status of Pnf to Active in AAI
*/
public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
index 6831a656a8..92ed61df67 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/SdncInputParametersProvider.java
@@ -50,11 +50,8 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class SdncInputParametersProvider extends AbstractInputParametersProvider<GenericVnf> {
private static final Logger LOGGER = LoggerFactory.getLogger(SdncInputParametersProvider.class);
-
private static final String VNF_PARAMETERS_PATH = "$..vnf-parameters";
-
private final SDNCClient sdncClient;
-
private final ObjectMapper mapper;
@Autowired
@@ -68,34 +65,12 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider
final String vnfName = genericVnf.getVnfName();
final String vnfType = getVnfType(genericVnf);
final String url = getPreloadVnfsUrl(vnfName, vnfType);
+ final InputParameter inputParameter = parseInputParametersUsingUrl(url);
- try {
- LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
- final String jsonResponse = sdncClient.get(url);
- final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null);
-
- try {
-
- if (json != null) {
- final List<VnfParameter> vnfParametersArray =
- mapper.readValue(json, new TypeReference<List<VnfParameter>>() {});
- final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray);
- final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
- final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
- final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
- LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
- return inputParameter;
- }
-
- } catch (final IOException exception) {
- LOGGER.error("Unable to parse vnf parameters : {}", json, exception);
- }
- } catch (final Exception exception) {
- LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
- }
+ if (inputParameter != null)
+ return inputParameter;
LOGGER.warn("No input parameters found ...");
return NullInputParameter.NULL_INSTANCE;
-
}
private List<ExternalVirtualLink> getExtVirtualLinks(final Map<String, String> vnfParametersMap) {
@@ -109,19 +84,18 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider
private Map<String, String> getAdditionalParameters(final Map<String, String> vnfParametersMap) {
final String additionalParamsString = vnfParametersMap.get(ADDITIONAL_PARAMS);
+
if (additionalParamsString != null && !additionalParamsString.isEmpty()) {
return parseAdditionalParameters(additionalParamsString);
}
return Collections.emptyMap();
}
-
private Map<String, String> getVnfParameterMap(final List<VnfParameter> array) {
if (array != null) {
return array.stream().filter(vnfParam -> vnfParam.getName() != null && vnfParam.getValue() != null)
.collect(Collectors.toMap(VnfParameter::getName, VnfParameter::getValue));
}
-
return Collections.emptyMap();
}
@@ -131,10 +105,43 @@ public class SdncInputParametersProvider extends AbstractInputParametersProvider
private String getVnfType(final GenericVnf genericVnf) {
final ModelInfoGenericVnf modelInfoGenericVnf = genericVnf.getModelInfoGenericVnf();
- if (modelInfoGenericVnf != null && modelInfoGenericVnf.getModelName() != null) {
+ if (modelInfoGenericVnf != null) {
return modelInfoGenericVnf.getModelName();
}
return genericVnf.getVnfType();
}
+ private InputParameter parseInputParametersUsingUrl(String url) {
+ try {
+ LOGGER.debug("Will query sdnc for input parameters using url: {}", url);
+ final String jsonResponse = sdncClient.get(url);
+ final String json = JsonPathUtil.getInstance().locateResult(jsonResponse, VNF_PARAMETERS_PATH).orElse(null);
+ final InputParameter inputParameter = parseVnfParameters(json);
+
+ if (inputParameter != null)
+ return inputParameter;
+ } catch (final Exception exception) {
+ LOGGER.error("Unable to retrieve/parse input parameters using URL: {} ", url, exception);
+ }
+ return null;
+ }
+
+ private InputParameter parseVnfParameters(String json) {
+ try {
+ if (json != null) {
+ final List<VnfParameter> vnfParametersArray =
+ mapper.readValue(json, new TypeReference<List<VnfParameter>>() {});
+ final Map<String, String> vnfParametersMap = getVnfParameterMap(vnfParametersArray);
+ final Map<String, String> additionalParameters = getAdditionalParameters(vnfParametersMap);
+ final List<ExternalVirtualLink> extVirtualLinks = getExtVirtualLinks(vnfParametersMap);
+ final InputParameter inputParameter = new InputParameter(additionalParameters, extVirtualLinks);
+ LOGGER.info("InputParameter found in sdnc response : {}", inputParameter);
+ return inputParameter;
+ }
+
+ } catch (final IOException exception) {
+ LOGGER.error("Unable to parse vnf parameters : {}", json, exception);
+ }
+ return null;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java
index ac939d04ec..bdd738b031 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/UserParamInputParametersProvider.java
@@ -40,12 +40,12 @@ public class UserParamInputParametersProvider extends AbstractInputParametersPro
final InputParameter inputParameter = new InputParameter();
final Object additionalParams = userParams.get(ADDITIONAL_PARAMS);
- if (additionalParams != null && additionalParams instanceof String) {
+ if (additionalParams instanceof String) {
inputParameter.setAdditionalParams(parseAdditionalParameters(additionalParams.toString()));
}
final Object extVirtualLinks = userParams.get(EXT_VIRTUAL_LINKS);
- if (extVirtualLinks != null && extVirtualLinks instanceof String) {
+ if (extVirtualLinks instanceof String) {
inputParameter.setExtVirtualLinks(parseExternalVirtualLinks(extVirtualLinks.toString()));
}
LOGGER.info("InputParameter found in userParams : {}", inputParameter);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
index 0d45dad6fe..2491c99bc4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnfm/tasks/utils/VnfParameter.java
@@ -35,30 +35,18 @@ public class VnfParameter {
@JsonProperty("vnf-parameter-value")
private String value;
- /**
- * @return the name
- */
public String getName() {
return name;
}
- /**
- * @param name the name to set
- */
public void setName(final String name) {
this.name = name;
}
- /**
- * @return the value
- */
public String getValue() {
return value;
}
- /**
- * @param value the value to set
- */
public void setValue(final String value) {
this.value = value;
}
@@ -66,10 +54,9 @@ public class VnfParameter {
@Override
public int hashCode() {
final int prime = 31;
- int result = 1;
- result = prime * result + ((name == null) ? 0 : name.hashCode());
- result = prime * result + ((value == null) ? 0 : value.hashCode());
- return Objects.hash(name, value);
+ int nameResult = prime + ((name == null) ? 0 : name.hashCode());
+ int valueResult = prime + ((value == null) ? 0 : value.hashCode());
+ return Objects.hash(nameResult, valueResult);
}
@Override
@@ -78,7 +65,6 @@ public class VnfParameter {
VnfParameter other = (VnfParameter) obj;
return Objects.equals(name, other.name) && Objects.equals(value, other.value);
}
-
return false;
}
@@ -86,5 +72,4 @@ public class VnfParameter {
public String toString() {
return "VnfParameter [name=" + name + ", value=" + value + "]";
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index b337564dab..1f05522011 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -78,6 +78,9 @@ public class AppcOrchestratorPreProcessor {
String identityUrl = execution.getVariable("identityUrl");
appcTaskRequest.setIdentityUrl(identityUrl);
+ String requestorId = gBBInput.getRequestContext().getRequestorId();
+ appcTaskRequest.setRequestorId(requestorId);
+
if (gBBInput.getRequestContext().getRequestParameters() != null) {
String payload = gBBInput.getRequestContext().getRequestParameters().getPayload();
if (payload == null) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
index 754c377914..c56ab3e71d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ControllerExecution.java
@@ -23,18 +23,24 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.BBNameSelectionReference;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_NAME;
+import static org.onap.so.client.cds.PayloadConstants.PRC_BLUEPRINT_VERSION;
+
@Component
public class ControllerExecution {
@@ -44,6 +50,8 @@ public class ControllerExecution {
private static final String SCOPE = "scope";
private static final String ACTION = "action";
private static final String BBNAME = "bbName";
+ private static final String MSO_REQUEST_ID = "msoRequestId";
+
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -57,26 +65,43 @@ public class ControllerExecution {
* @param execution - BuildingBlockExecution object
*/
public void setControllerActorScopeAction(BuildingBlockExecution execution) {
+
+ ExecuteBuildingBlock executeBuildingBlock = execution.getVariable(BUILDING_BLOCK);
+ BuildingBlock buildingBlock = executeBuildingBlock.getBuildingBlock();
+
+ String scope = Optional.ofNullable(buildingBlock.getBpmnScope()).orElseThrow(
+ () -> new NullPointerException("BPMN Scope is NULL in the orchestration_flow_reference table "));
+ String action = Optional.ofNullable(buildingBlock.getBpmnAction()).orElseThrow(
+ () -> new NullPointerException("BPMN Action is NULL in the orchestration_flow_reference table "));
+ String controllerActor;
+
try {
- GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- String modelUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
- VnfResourceCustomization vnfResourceCustomization =
- catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelUuid);
-
- // Fetching Controller Actor at VNF level if null then Controller Actor is set as "APPC"
- String controllerActor = Optional.ofNullable(vnfResourceCustomization.getControllerActor()).orElse("APPC");
- ExecuteBuildingBlock executeBuildingBlock = execution.getVariable(BUILDING_BLOCK);
- BuildingBlock buildingBlock = executeBuildingBlock.getBuildingBlock();
- String scope = Optional.ofNullable(buildingBlock.getBpmnScope()).orElseThrow(
- () -> new NullPointerException("BPMN Scope is NULL in the orchestration_flow_reference table "));
- String action = Optional.ofNullable(buildingBlock.getBpmnAction()).orElseThrow(
- () -> new NullPointerException("BPMN Action is NULL in the orchestration_flow_reference table "));
+ if (String.valueOf(scope).equals("pnf")) {
+ Pnf pnf = getPnf(execution);
+ String pnfModelUUID = pnf.getModelInfoPnf().getModelCustomizationUuid();
+ PnfResourceCustomization pnfResourceCustomization =
+ catalogDbClient.getPnfResourceCustomizationByModelCustomizationUUID(pnfModelUUID);
+
+ controllerActor = Optional.ofNullable(pnfResourceCustomization.getControllerActor()).orElse("APPC");
+ execution.setVariable(MSO_REQUEST_ID,
+ execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId());
+ execution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
+ execution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
+ } else {
+ GenericVnf genericVnf = getGenericVnf(execution);
+ String modelUuid = genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid();
+ VnfResourceCustomization vnfResourceCustomization =
+ catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelUuid);
+
+ controllerActor = Optional.ofNullable(vnfResourceCustomization.getControllerActor()).orElse("APPC");
+ }
+
execution.setVariable(SCOPE, scope);
execution.setVariable(ACTION, action);
execution.setVariable(CONTROLLER_ACTOR, controllerActor);
+
logger.debug("Executing Controller Execution for ControllerActor: {}, Scope: {} , Action: {}",
controllerActor, scope, action);
-
} catch (Exception ex) {
logger.error("An exception occurred while fetching Controller Actor,Scope and Action ", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
@@ -106,4 +131,12 @@ public class ControllerExecution {
}
}
+
+ private Pnf getPnf(BuildingBlockExecution buildingBlockExecution) throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.PNF);
+ }
+
+ private GenericVnf getGenericVnf(BuildingBlockExecution buildingBlockExecution) throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java
new file mode 100644
index 0000000000..72a8590ad5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
+
+/**
+ * This implementation of {@link JavaDelegate} is used to populate the execution object for pnf actions
+ */
+@Component
+public class GenericPnfDispatcher implements JavaDelegate {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+ private static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ private static final String BPMN_REQUEST = "bpmnRequest";
+ private static final String RESOURCE_CUSTOMIZATION_UUID_PARAM = "resource_customization_uuid";
+ private static final String PNF_NAME = "pnfName";
+
+ // ERROR CODE for variable not found in the delegation Context
+ private static final int ERROR_CODE = 601;
+
+ @Autowired
+ private PnfManagement pnfManagement;
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ @Override
+ public void execute(DelegateExecution delegateExecution) throws Exception {
+ logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(),
+ delegateExecution.getCurrentActivityName());
+
+ RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
+
+ final String serviceInstanceName = bpmnRequestDetails.getRequestInfo().getInstanceName();
+ final String pnfName;
+ if (delegateExecution.getVariable(PNF_NAME) == null
+ || String.valueOf(delegateExecution.getVariable(PNF_NAME)).trim().isEmpty()) {
+ pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
+ } else {
+ pnfName = String.valueOf(delegateExecution.getVariable(PNF_NAME));
+ }
+ final String serviceModelUuid = bpmnRequestDetails.getModelInfo().getModelUuid();
+ final List<Map<String, Object>> userParams = bpmnRequestDetails.getRequestParameters().getUserParams();
+ final Pnf pnf = getPnfByPnfName(delegateExecution, pnfName);
+ final List<PnfResourceCustomization> pnfCustomizations =
+ getPnfResourceCustomizations(delegateExecution, serviceModelUuid);
+ final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
+ final String payload = bpmnRequestDetails.getRequestParameters().getPayload();
+
+ populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName,
+ pnfName, serviceModelUuid, userParams, payload);
+
+ logger.trace("Completed dispatcher request for PNF.");
+ }
+
+ private RequestDetails requestVerification(DelegateExecution delegateExecution) throws IOException {
+ RequestDetails bpmnRequestDetails = mapper.readValue(
+ JsonUtils.getJsonValue(String.valueOf(delegateExecution.getVariable(BPMN_REQUEST)), "requestDetails"),
+ RequestDetails.class);
+
+ throwIfNull(delegateExecution, bpmnRequestDetails.getModelInfo(), SERVICE_MODEL_INFO);
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestInfo(), "RequestInfo");
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters(), "RequestParameters");
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters().getUserParams(), "UserParams");
+
+ return bpmnRequestDetails;
+ }
+
+ private void populateExecution(DelegateExecution delegateExecution, RequestDetails bpmnRequestDetails,
+ PnfResourceCustomization pnfResourceCustomization, Pnf pnf, String serviceInstanceName, String pnfName,
+ String serviceModelUuid, List<Map<String, Object>> userParams, String payload) {
+
+ delegateExecution.setVariable(SERVICE_MODEL_INFO, bpmnRequestDetails.getModelInfo());
+ delegateExecution.setVariable(SERVICE_INSTANCE_NAME, serviceInstanceName);
+ delegateExecution.setVariable(PNF_CORRELATION_ID, pnfName);
+ delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
+ delegateExecution.setVariable(PNF_UUID, pnf.getPnfId());
+ delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
+ delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
+ delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(RESOURCE_CUSTOMIZATION_UUID_PARAM,
+ pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName());
+ delegateExecution.setVariable(PRC_CONTROLLER_ACTOR, pnfResourceCustomization.getControllerActor());
+
+ for (Map<String, Object> param : userParams) {
+ if (param.containsKey("name") && param.containsKey("value")) {
+ delegateExecution.setVariable(param.get("name").toString(), param.get("value").toString());
+ }
+ }
+
+ delegateExecution.setVariable(REQUEST_PAYLOAD, payload);
+ }
+
+ private Pnf getPnfByPnfName(DelegateExecution delegateExecution, String pnfName) {
+ Optional<Pnf> pnfOptional = Optional.empty();
+ try {
+ pnfOptional = pnfManagement.getEntryFor(pnfName);
+ } catch (IOException e) {
+ throwExceptionWithWarn(delegateExecution, "Unable to fetch from AAI" + e.getMessage());
+ }
+ if (!pnfOptional.isPresent()) {
+ throwExceptionWithWarn(delegateExecution, "AAI entry for PNF: " + pnfName + " does not exist");
+ }
+ return pnfOptional.get();
+ }
+
+ private List<PnfResourceCustomization> getPnfResourceCustomizations(DelegateExecution delegateExecution,
+ String serviceModelUuid) {
+ List<PnfResourceCustomization> pnfCustomizations =
+ catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
+
+ if (pnfCustomizations == null || pnfCustomizations.isEmpty()) {
+ throwExceptionWithWarn(delegateExecution,
+ "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
+ }
+ return pnfCustomizations;
+ }
+
+ private void throwIfNull(DelegateExecution delegateExecution, Object obj, String param) {
+ if (obj == null) {
+ throwExceptionWithWarn(delegateExecution,
+ "Unable to find the parameter: " + param + " in the execution context");
+ }
+ }
+
+ private void throwExceptionWithWarn(DelegateExecution delegateExecution, String exceptionMsg) {
+ logger.warn(exceptionMsg);
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, exceptionMsg);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapper.java
index 6af8c2f9c5..5b6043f303 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.util.UUID;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapper.java
index a9611cbde5..48a384c48a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.util.List;
import java.util.Map;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
index b1c95154c6..593c15d6cc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapper.java
index b5957b3009..69606393c3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index f6642ab76a..901187e231 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.util.Map;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapper.java
index fd0af3a4dd..c2dcb8f290 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.util.ArrayList;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java
new file mode 100644
index 0000000000..36db549486
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/AbstractServiceLevelPreparable.java
@@ -0,0 +1,81 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.service.level;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Abstract class for Service level upgrade Execution, it should be extended for service level upgrade tasks.
+ */
+public abstract class AbstractServiceLevelPreparable {
+
+ protected static final String WORKFLOW_TO_INVOKE = "healthCheckWorkflow";
+ protected static final String GENERIC_PNF_HEALTH_CHECK_WORKFLOW = "GenericPnfHealthCheck";
+ protected static final String GENERIC_PNF_SOFTWARE_UPGRADE_WORKFLOW = "GenericPnfSoftwareUpgrade";
+ protected static final String RESOURCE_TYPE = "RESOURCE_TYPE";
+ protected static final int ERROR_CODE = 601;
+
+ // TODO This value needs to be updated once vnf health check workflow is available
+ protected static final String GENERIC_VNF_HEALTH_CHECK_WORKFLOW = "GenericVNFHealthCheck";
+
+ protected static final Logger LOG = LoggerFactory.getLogger(AbstractServiceLevelPreparable.class);
+
+ @Autowired
+ protected ExceptionBuilder exceptionBuilder;
+
+ /**
+ * This method fetches workflow names to be invoked based on the controller scope .
+ *
+ * @param scope Controller scope
+ * @return String value of Workflow name
+ */
+ protected abstract String fetchWorkflowUsingScope(DelegateExecution execution, final String scope);
+
+ /**
+ * This method validates the execution parameters to be passed for health check workflow.
+ *
+ * @param execution Delegate execution obj
+ * @param scope Controller scope * Throws workflow exception if validation fails
+ */
+ protected void validateParamsWithScope(DelegateExecution execution, final String scope, List<String> params)
+ throws Exception {
+ List<String> invalidVariables = new ArrayList<>();
+ for (String param : params) {
+ if (!execution.hasVariable(param) || execution.getVariable(param) == null
+ || String.valueOf(execution.getVariable(param)).isEmpty()) {
+ invalidVariables.add(param);
+ }
+ }
+ if (invalidVariables.size() > 0) {
+ LOG.error("Validation error for the {} health check attributes: {}", scope, invalidVariables);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ERROR_CODE,
+ "Validation of health check workflow parameters failed for the scope: " + scope);
+ }
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
new file mode 100644
index 0000000000..52521ce16b
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/service/level/impl/ServiceLevelPreparation.java
@@ -0,0 +1,77 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.service.level.impl;
+
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable;
+import org.springframework.stereotype.Component;
+import java.util.Arrays;
+import java.util.List;
+
+
+/**
+ * Fetches health check workflow based on the controller_scope. Invoke the corresponding health check workflow after
+ * validation.
+ */
+@Component("ServiceLevelPreparation")
+public class ServiceLevelPreparation extends AbstractServiceLevelPreparable implements JavaDelegate {
+
+ // Health check parameters to be validated for pnf resource
+ private static final List<String> PNF_HC_PARAMS = Arrays.asList("SERVICE_MODEL_INFO", "SERVICE_INSTANCE_NAME",
+ "PNF_CORRELATION_ID", "MODEL_UUID", "PNF_UUID", "PRC_BLUEPRINT_NAME", "PRC_BLUEPRINT_VERSION",
+ "PRC_CUSTOMIZATION_UUID", "RESOURCE_CUSTOMIZATION_UUID_PARAM", "PRC_INSTANCE_NAME", "PRC_CONTROLLER_ACTOR",
+ "REQUEST_PAYLOAD");
+
+ @Override
+ public void execute(DelegateExecution execution) throws Exception {
+ if (execution.hasVariable(RESOURCE_TYPE) && execution.getVariable(RESOURCE_TYPE) != null) {
+ final String controllerScope = (String) execution.getVariable(RESOURCE_TYPE);
+ LOG.debug("Scope retrieved from delegate execution: " + controllerScope);
+ final String wflName = fetchWorkflowUsingScope(execution, controllerScope);
+ LOG.debug("Health check workflow fetched for the scope: {}", wflName);
+ validateParamsWithScope(execution, controllerScope, PNF_HC_PARAMS);
+ LOG.info("Parameters validated successfully for {}", wflName);
+ execution.setVariable(WORKFLOW_TO_INVOKE, wflName);
+ } else {
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ERROR_CODE,
+ "Controller scope not found to invoke resource level health check");
+ }
+ }
+
+ @Override
+ public String fetchWorkflowUsingScope(DelegateExecution execution, final String scope) {
+ String wflName = null;
+ switch (scope.toLowerCase()) {
+ case "pnf":
+ wflName = GENERIC_PNF_HEALTH_CHECK_WORKFLOW;
+ break;
+ case "vnf":
+ wflName = GENERIC_VNF_HEALTH_CHECK_WORKFLOW;
+ break;
+ default:
+ exceptionBuilder.buildAndThrowWorkflowException(execution, ERROR_CODE,
+ "No valid health check work flow retrieved for the scope: " + scope);
+ }
+ return wflName;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
index 1852485083..7f754e3f13 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -20,27 +20,24 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.List;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlockBase;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import java.io.Serializable;
+import java.util.List;
-public class ConfigBuildingBlocksDataObject {
+public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuildingBlocksDataObject>
+ implements Serializable {
- private ServiceInstancesRequest sIRequest;
+ private static final long serialVersionUID = 3L;
+ private DelegateExecution execution;
private List<OrchestrationFlow> orchFlows;
- private String requestId;
private Resource resourceKey;
- private String apiVersion;
- private String resourceId;
- private String requestAction;
- private boolean aLaCarte;
- private String vnfType;
- private WorkflowResourceIds workflowResourceIds;
- private RequestDetails requestDetails;
- private DelegateExecution execution;
+ private ServiceInstancesRequest sIRequest;
+ private ReplaceInstanceRelatedInformation replaceInformation;
public ServiceInstancesRequest getsIRequest() {
return sIRequest;
@@ -60,15 +57,6 @@ public class ConfigBuildingBlocksDataObject {
return this;
}
- public String getRequestId() {
- return requestId;
- }
-
- public ConfigBuildingBlocksDataObject setRequestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
public Resource getResourceKey() {
return resourceKey;
}
@@ -78,75 +66,21 @@ public class ConfigBuildingBlocksDataObject {
return this;
}
- public String getApiVersion() {
- return apiVersion;
- }
-
- public ConfigBuildingBlocksDataObject setApiVersion(String apiVersion) {
- this.apiVersion = apiVersion;
- return this;
- }
-
- public String getResourceId() {
- return resourceId;
- }
-
- public ConfigBuildingBlocksDataObject setResourceId(String resourceId) {
- this.resourceId = resourceId;
- return this;
- }
-
- public String getRequestAction() {
- return requestAction;
- }
-
- public ConfigBuildingBlocksDataObject setRequestAction(String requestAction) {
- this.requestAction = requestAction;
- return this;
- }
-
- public boolean isaLaCarte() {
- return aLaCarte;
- }
-
- public ConfigBuildingBlocksDataObject setaLaCarte(boolean aLaCarte) {
- this.aLaCarte = aLaCarte;
- return this;
- }
-
- public String getVnfType() {
- return vnfType;
- }
-
- public ConfigBuildingBlocksDataObject setVnfType(String vnfType) {
- this.vnfType = vnfType;
- return this;
- }
-
- public WorkflowResourceIds getWorkflowResourceIds() {
- return workflowResourceIds;
- }
-
- public ConfigBuildingBlocksDataObject setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
- this.workflowResourceIds = workflowResourceIds;
- return this;
- }
-
- public RequestDetails getRequestDetails() {
- return requestDetails;
+ public DelegateExecution getExecution() {
+ return execution;
}
- public ConfigBuildingBlocksDataObject setRequestDetails(RequestDetails requestDetails) {
- this.requestDetails = requestDetails;
+ public ConfigBuildingBlocksDataObject setExecution(DelegateExecution execution) {
+ this.execution = execution;
return this;
}
- public DelegateExecution getExecution() {
- return execution;
+ public ReplaceInstanceRelatedInformation getReplaceInformation() {
+ return replaceInformation;
}
- public ConfigBuildingBlocksDataObject setExecution(DelegateExecution execution) {
- this.execution = execution;
+ public ConfigBuildingBlocksDataObject setReplaceInformation(ReplaceInstanceRelatedInformation replaceInformation) {
+ this.replaceInformation = replaceInformation;
return this;
}
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 e2dd73f9ec..f233de2baa 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
@@ -11,9 +11,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.
@@ -24,9 +24,15 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.EnumSet;
-import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -45,6 +51,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
+import java.util.EnumSet;
+import java.util.Set;
@Component
public class OrchestrationStatusValidator {
@@ -57,9 +65,6 @@ public class OrchestrationStatusValidator {
private static final String ORCHESTRATION_VALIDATION_FAIL =
"Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
private static final String RESOURCE_EXIST_STATUS_MESSAGE =
"The %s was found to already exist, thus no new %s was created in the cloud via this request";
private static final String RESOURCE_NOT_EXIST_STATUS_MESSAGE =
@@ -79,20 +84,11 @@ public class OrchestrationStatusValidator {
/**
* This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType
- *
- * @param execution
*/
public void validateOrchestrationStatus(BuildingBlockExecution execution) {
try {
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
- execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
-
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
-
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
-
String buildingBlockFlowName = execution.getFlowToBeCalled();
-
BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName);
if (buildingBlockDetail == null) {
@@ -100,63 +96,10 @@ public class OrchestrationStatusValidator {
String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName));
}
- OrchestrationStatus orchestrationStatus;
-
- switch (buildingBlockDetail.getResourceType()) {
- case SERVICE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- orchestrationStatus = serviceInstance.getOrchestrationStatus();
- break;
- case VNF:
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatus = genericVnf.getOrchestrationStatus();
- break;
- case VF_MODULE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
- extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- orchestrationStatus = vfModule.getOrchestrationStatus();
- break;
- case VOLUME_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
- extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- orchestrationStatus = volumeGroup.getOrchestrationStatus();
- break;
- case NETWORK:
- org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network =
- extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- orchestrationStatus = network.getOrchestrationStatus();
- break;
- case NETWORK_COLLECTION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection =
- serviceInst.getCollection();
- orchestrationStatus = networkCollection.getOrchestrationStatus();
- break;
- case CONFIGURATION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
- extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- orchestrationStatus = configuration.getOrchestrationStatus();
- break;
- case INSTANCE_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup =
- extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- orchestrationStatus = instanceGroup.getOrchestrationStatus();
- break;
- case NO_VALIDATE:
- // short circuit and exit method
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
- OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
- return;
- default:
- // can't currently get here, so not tested. Added in case enum is expanded
- // without a change to this
- // code
- throw new OrchestrationStatusValidationException(
- String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
- buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ OrchestrationStatus orchestrationStatus =
+ getOrchestrationStatus(execution, buildingBlockFlowName, buildingBlockDetail);
+ if (buildingBlockDetail.getResourceType().equals(ResourceType.NO_VALIDATE)) {
+ return;
}
if (orchestrationStatus == null) {
@@ -199,6 +142,66 @@ public class OrchestrationStatusValidator {
}
}
+ private OrchestrationStatus getOrchestrationStatus(BuildingBlockExecution execution, String buildingBlockFlowName,
+ BuildingBlockDetail buildingBlockDetail)
+ throws BBObjectNotFoundException, OrchestrationStatusValidationException {
+ OrchestrationStatus orchestrationStatus = null;
+
+ switch (buildingBlockDetail.getResourceType()) {
+ case SERVICE:
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ orchestrationStatus = serviceInstance.getOrchestrationStatus();
+ break;
+ case VNF:
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ orchestrationStatus = genericVnf.getOrchestrationStatus();
+ break;
+ case VF_MODULE:
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ orchestrationStatus = vfModule.getOrchestrationStatus();
+ break;
+ case VOLUME_GROUP:
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ orchestrationStatus = volumeGroup.getOrchestrationStatus();
+ break;
+ case NETWORK:
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ orchestrationStatus = network.getOrchestrationStatus();
+ break;
+ case NETWORK_COLLECTION:
+ Collection networkCollection = getNetworkCollection(execution);
+ orchestrationStatus = networkCollection.getOrchestrationStatus();
+ break;
+ case CONFIGURATION:
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ orchestrationStatus = configuration.getOrchestrationStatus();
+ break;
+ case INSTANCE_GROUP:
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ orchestrationStatus = instanceGroup.getOrchestrationStatus();
+ break;
+ case NO_VALIDATE:
+ // short circuit and exit method
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
+ break;
+ default:
+ // can't currently get here, so not tested. Added in case enum is expanded
+ // without a change to this
+ // code
+ throw new OrchestrationStatusValidationException(
+ String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
+ buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ }
+ return orchestrationStatus;
+ }
+
+ private Collection getNetworkCollection(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ return serviceInst.getCollection();
+ }
+
private void updatedResourceStatus(BuildingBlockExecution execution, BuildingBlockDetail buildingBlockDetail) {
if (cloudResources.contains(buildingBlockDetail.getResourceType())) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java
new file mode 100644
index 0000000000..d9e8fa55fa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java
@@ -0,0 +1,16 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+public class ReplaceInstanceRelatedInformation {
+
+ private String oldVolumeGroupName;
+
+ public String getOldVolumeGroupName() {
+ return oldVolumeGroupName;
+ }
+
+ public ReplaceInstanceRelatedInformation setOldVolumeGroupName(String oldVolumeGroupName) {
+ this.oldVolumeGroupName = oldVolumeGroupName;
+ return this;
+ }
+
+}
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 b4eb97a187..44a99b88c5 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
@@ -37,6 +37,7 @@ import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.SerializationUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.aai.domain.yang.GenericVnf;
@@ -75,6 +76,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
@@ -143,6 +145,8 @@ public class WorkflowAction {
private static final String VOLUMEGROUP_DELETE_PATTERN = "(Un|De)(.*)Volume(.*)";
private static final String VOLUMEGROUP_CREATE_PATTERN = "(A|C)(.*)Volume(.*)";
private static final String CONTROLLER = "Controller";
+ private static final String DEFAULT_CLOUD_OWNER = "org.onap.so.cloud-owner";
+ private static final String HOMING = "homing";
@Autowired
protected BBInputSetup bbInputSetup;
@@ -158,10 +162,8 @@ public class WorkflowAction {
private WorkflowActionExtractResourcesAAI workflowActionUtils;
@Autowired
private VrfValidation vrfValidation;
-
@Autowired
private Environment environment;
- private String defaultCloudOwner = "org.onap.so.cloud-owner";
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
@@ -176,30 +178,33 @@ public class WorkflowAction {
final String bpmnRequest = (String) execution.getVariable(BBConstants.G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest =
new ObjectMapper().readValue(bpmnRequest, ServiceInstancesRequest.class);
- RequestDetails requestDetails = sIRequest.getRequestDetails();
- String uri = (String) execution.getVariable(BBConstants.G_URI);
+
final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
- final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+
+ String uri = (String) execution.getVariable(BBConstants.G_URI);
boolean isResume = isUriResume(uri);
- String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
+
+ final boolean isALaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ Resource resource = getResource(bbInputSetupUtils, isResume, isALaCarte, uri, requestId);
+
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
- Resource resource = getResource(bbInputSetupUtils, isResume, aLaCarte, uri, requestId);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
String resourceId = getResourceId(resource, requestAction, requestDetails, workflowResourceIds);
WorkflowType resourceType = resource.getResourceType();
+
String serviceInstanceId = getServiceInstanceId(execution, resourceId, resourceType);
+
fillExecution(execution, requestDetails.getRequestInfo().getSuppressRollback(), resourceId, resourceType);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
- if (isRequestMacroServiceResume(aLaCarte, resourceType, requestAction, serviceInstanceId)) {
- flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
- if (flowsToExecute == null) {
- buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
- }
- } else if (aLaCarte && isResume) {
- flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
- if (flowsToExecute == null) {
- buildAndThrowException(execution,
- "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
- }
+
+ if (isRequestMacroServiceResume(isALaCarte, resourceType, requestAction, serviceInstanceId)) {
+ String errorMessage = "Could not resume Macro flow. Error loading execution path.";
+ flowsToExecute = loadExecuteBuildingBlocks(execution, requestId, errorMessage);
+ } else if (isALaCarte && isResume) {
+ String errorMessage =
+ "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found";
+ flowsToExecute = loadExecuteBuildingBlocks(execution, requestId, errorMessage);
} else {
String vnfType = (String) execution.getVariable(VNF_TYPE);
String cloudOwner = getCloudOwner(requestDetails.getCloudConfiguration());
@@ -208,51 +213,42 @@ public class WorkflowAction {
final String apiVersion = (String) execution.getVariable(BBConstants.G_APIVERSION);
final String serviceType =
Optional.ofNullable((String) execution.getVariable(BBConstants.G_SERVICE_TYPE)).orElse("");
- if (aLaCarte) {
+ if (isALaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, true,
cloudOwner, serviceType);
}
- String key = "";
- ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
- if (modelInfo != null) {
- if (modelInfo.getModelType().equals(ModelType.service)) {
- key = modelInfo.getModelVersionId();
- } else {
- key = modelInfo.getModelCustomizationId();
- }
- }
- boolean isConfiguration = isConfiguration(orchFlows);
- Resource resourceKey = new Resource(resourceType, key, true);
- if (isConfiguration && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(
- new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
- .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
- .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
- .setRequestDetails(requestDetails).setExecution(execution));
-
- flowsToExecute.addAll(configBuildingBlocks);
- }
- orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
- .collect(Collectors.toList());
+ Resource resourceKey = getResourceKey(sIRequest, resourceType);
+ ReplaceInstanceRelatedInformation replaceInfo = new ReplaceInstanceRelatedInformation();
if ((requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS))
&& resourceType.equals(WorkflowType.VFMODULE)) {
logger.debug("Build a BB list for replacing BB modules");
- orchFlows = getVfModuleReplaceBuildingBlocks(
- new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
- .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
- .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(true)
- .setVnfType(vnfType).setWorkflowResourceIds(workflowResourceIds)
- .setRequestDetails(requestDetails).setExecution(execution));
- }
- for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
- apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
- requestDetails, false, null, null, false);
- flowsToExecute.add(ebb);
+ ConfigBuildingBlocksDataObject cbbdo = createConfigBuildingBlocksDataObject(execution,
+ sIRequest, requestId, workflowResourceIds, requestDetails, requestAction, resourceId,
+ vnfType, orchFlows, apiVersion, resourceKey, replaceInfo);
+ orchFlows = getVfModuleReplaceBuildingBlocks(cbbdo);
+
+ createBuildingBlocksForOrchFlows(execution, sIRequest, requestId, workflowResourceIds,
+ requestDetails, requestAction, resourceId, flowsToExecute, vnfType, orchFlows,
+ apiVersion, resourceKey, replaceInfo);
+ } else {
+ if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
+ addConfigBuildingBlocksToFlowsToExecuteList(execution, sIRequest, requestId,
+ workflowResourceIds, requestDetails, requestAction, resourceId, flowsToExecute,
+ vnfType, apiVersion, resourceKey, replaceInfo, orchFlows);
+ }
+ orchFlows =
+ orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
+ .collect(Collectors.toList());
+
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
+ requestDetails, false, null, null, false, replaceInfo);
+ flowsToExecute.add(ebb);
+ }
}
} else {
boolean foundRelated = false;
@@ -263,13 +259,7 @@ public class WorkflowAction {
// SERVICE-MACRO-ASSIGN will always get user params with a
// service.
if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams =
- sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> params : userParams) {
- if (params.containsKey(USERPARAMSERVICE)) {
- containsService = true;
- }
- }
+ containsService = isContainsService(sIRequest);
if (containsService) {
traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
}
@@ -285,13 +275,7 @@ public class WorkflowAction {
// queries the SI and finds a VNF, macro fails.
if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams =
- sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- for (Map<String, Object> params : userParams) {
- if (params.containsKey(USERPARAMSERVICE)) {
- containsService = true;
- }
- }
+ containsService = isContainsService(sIRequest);
}
if (containsService) {
foundRelated = traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
@@ -312,43 +296,41 @@ public class WorkflowAction {
} else if (resourceType == WorkflowType.SERVICE
&& "deactivateInstance".equalsIgnoreCase(requestAction)) {
resourceList.add(new Resource(WorkflowType.SERVICE, "", false));
- } else if (resourceType == WorkflowType.VNF && ("replaceInstance".equalsIgnoreCase(requestAction)
+ } else if (resourceType == WorkflowType.VNF && (REPLACEINSTANCE.equalsIgnoreCase(requestAction)
|| ("recreateInstance".equalsIgnoreCase(requestAction)))) {
traverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
workflowResourceIds.getVnfId(), aaiResourceIds);
} else {
buildAndThrowException(execution, "Current Macro Request is not supported");
}
- String foundObjects = "";
+ StringBuilder foundObjects = new StringBuilder();
for (WorkflowType type : WorkflowType.values()) {
- foundObjects = foundObjects + type + " - " + resourceList.stream()
- .filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size()
- + " ";
+ foundObjects.append(type).append(" - ").append(
+ (int) resourceList.stream().filter(x -> type.equals(x.getResourceType())).count())
+ .append(" ");
}
logger.info("Found {}", foundObjects);
if (orchFlows == null || orchFlows.isEmpty()) {
- orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte,
+ orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, isALaCarte,
cloudOwner, serviceType);
}
boolean vnfReplace = false;
- if (resourceType.equals(WorkflowType.VNF) && ("replaceInstance".equalsIgnoreCase(requestAction)
- || "replaceInstanceRetainAssignments".equalsIgnoreCase(requestAction))) {
+ if (resourceType.equals(WorkflowType.VNF) && (REPLACEINSTANCE.equalsIgnoreCase(requestAction)
+ || REPLACEINSTANCERETAINASSIGNMENTS.equalsIgnoreCase(requestAction))) {
vnfReplace = true;
}
flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceList, requestId, apiVersion,
resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace);
- if (!resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).isEmpty()) {
+ if (isNetworkCollectionInTheResourceList(resourceList)) {
logger.info("Sorting for Vlan Tagging");
flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
}
// By default, enable homing at VNF level for CREATEINSTANCE and ASSIGNINSTANCE
if (resourceType == WorkflowType.SERVICE
&& (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceList.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType()))
- .collect(Collectors.toList()).isEmpty()) {
- execution.setVariable("homing", true);
+ && resourceList.stream().anyMatch(x -> WorkflowType.VNF.equals(x.getResourceType()))) {
+ execution.setVariable(HOMING, true);
execution.setVariable("calledHoming", false);
}
if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)
@@ -364,15 +346,10 @@ public class WorkflowAction {
// enable it.
if (sIRequest.getRequestDetails().getRequestParameters() != null
&& sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams =
- sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ List<Map<String, Object>> userParams = getListOfUserParams(sIRequest);
for (Map<String, Object> params : userParams) {
if (params.containsKey(HOMINGSOLUTION)) {
- if ("none".equals(params.get(HOMINGSOLUTION))) {
- execution.setVariable("homing", false);
- } else {
- execution.setVariable("homing", true);
- }
+ execution.setVariable(HOMING, !"none".equals(params.get(HOMINGSOLUTION)));
}
}
}
@@ -392,12 +369,7 @@ public class WorkflowAction {
if (!isResume) {
bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute);
}
- execution.setVariable("flowNames", flowNames);
- execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
- execution.setVariable("retryCount", 0);
- execution.setVariable("isRollback", false);
- execution.setVariable("flowsToExecute", flowsToExecute);
- execution.setVariable("isRollbackComplete", false);
+ setExecutionVariables(execution, flowsToExecute, flowNames);
} catch (Exception ex) {
if (!(execution.hasVariable("WorkflowException")
@@ -409,12 +381,104 @@ public class WorkflowAction {
}
}
+ private void setExecutionVariables(DelegateExecution execution, List<ExecuteBuildingBlock> flowsToExecute,
+ List<String> flowNames) {
+ execution.setVariable("flowNames", flowNames);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
+ execution.setVariable("retryCount", 0);
+ execution.setVariable("isRollback", false);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("isRollbackComplete", false);
+ }
+
+ private boolean isContainsService(ServiceInstancesRequest sIRequest) {
+ boolean containsService;
+ List<Map<String, Object>> userParams = getListOfUserParams(sIRequest);
+ containsService = userParams.stream().anyMatch(param -> param.containsKey(USERPARAMSERVICE));
+ return containsService;
+ }
+
+ private List<Map<String, Object>> getListOfUserParams(ServiceInstancesRequest sIRequest) {
+ return sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ }
+
+ private List<ExecuteBuildingBlock> loadExecuteBuildingBlocks(DelegateExecution execution, String requestId,
+ String errorMessage) {
+ List<ExecuteBuildingBlock> flowsToExecute;
+ flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
+ if (flowsToExecute == null) {
+ buildAndThrowException(execution, errorMessage);
+ }
+ return flowsToExecute;
+ }
+
+ private ConfigBuildingBlocksDataObject createConfigBuildingBlocksDataObject(DelegateExecution execution,
+ ServiceInstancesRequest sIRequest, String requestId, WorkflowResourceIds workflowResourceIds,
+ RequestDetails requestDetails, String requestAction, String resourceId, String vnfType,
+ List<OrchestrationFlow> orchFlows, String apiVersion, Resource resourceKey,
+ ReplaceInstanceRelatedInformation replaceInfo) {
+
+ return new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest).setOrchFlows(orchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion).setResourceId(resourceId)
+ .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails).setExecution(execution)
+ .setReplaceInformation(replaceInfo);
+ }
+
+ private void createBuildingBlocksForOrchFlows(DelegateExecution execution, ServiceInstancesRequest sIRequest,
+ String requestId, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
+ String requestAction, String resourceId, List<ExecuteBuildingBlock> flowsToExecute, String vnfType,
+ List<OrchestrationFlow> orchFlows, String apiVersion, Resource resourceKey,
+ ReplaceInstanceRelatedInformation replaceInfo) throws Exception {
+
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ List<OrchestrationFlow> configOrchFlows = new ArrayList<>();
+ configOrchFlows.add(orchFlow);
+ addConfigBuildingBlocksToFlowsToExecuteList(execution, sIRequest, requestId, workflowResourceIds,
+ requestDetails, requestAction, resourceId, flowsToExecute, vnfType, apiVersion, resourceKey,
+ replaceInfo, configOrchFlows);
+ } else {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion,
+ resourceId, requestAction, true, vnfType, workflowResourceIds, requestDetails, false, null,
+ null, false, replaceInfo);
+ flowsToExecute.add(ebb);
+ }
+ }
+ }
+
+ private void addConfigBuildingBlocksToFlowsToExecuteList(DelegateExecution execution,
+ ServiceInstancesRequest sIRequest, String requestId, WorkflowResourceIds workflowResourceIds,
+ RequestDetails requestDetails, String requestAction, String resourceId,
+ List<ExecuteBuildingBlock> flowsToExecute, String vnfType, String apiVersion, Resource resourceKey,
+ ReplaceInstanceRelatedInformation replaceInfo, List<OrchestrationFlow> configOrchFlows) throws Exception {
+
+ ConfigBuildingBlocksDataObject cbbdo = createConfigBuildingBlocksDataObject(execution, sIRequest, requestId,
+ workflowResourceIds, requestDetails, requestAction, resourceId, vnfType, configOrchFlows, apiVersion,
+ resourceKey, replaceInfo);
+ List<ExecuteBuildingBlock> configBuildingBlocks = getConfigBuildingBlocks(cbbdo);
+ flowsToExecute.addAll(configBuildingBlocks);
+ }
+
+ private Resource getResourceKey(ServiceInstancesRequest sIRequest, WorkflowType resourceType) {
+ String resourceId = "";
+ ModelInfo modelInfo = sIRequest.getRequestDetails().getModelInfo();
+ if (modelInfo != null) {
+ if (modelInfo.getModelType().equals(ModelType.service)) {
+ resourceId = modelInfo.getModelVersionId();
+ } else {
+ resourceId = modelInfo.getModelCustomizationId();
+ }
+ }
+ return new Resource(resourceType, resourceId, true);
+ }
+
private String getCloudOwner(CloudConfiguration cloudConfiguration) {
if (cloudConfiguration != null && cloudConfiguration.getCloudOwner() != null) {
return cloudConfiguration.getCloudOwner();
}
logger.warn("cloud owner value not found in request details, it will be set as default");
- return environment.getProperty(defaultCloudOwner);
+ return environment.getProperty(DEFAULT_CLOUD_OWNER);
}
protected <T> List<T> getRelatedResourcesInVfModule(String vnfId, String vfModuleId, Class<T> resultClass,
@@ -436,9 +500,8 @@ public class WorkflowAction {
return vnfcs;
}
- protected <T> List<T> getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) {
-
- List<T> configurations = new ArrayList<>();
+ protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) throws Exception {
+ T configuration = null;
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
@@ -448,12 +511,19 @@ public class WorkflowAction {
Relationships relationships = relationshipsOp.get();
List<AAIResultWrapper> configurationResultWrappers =
this.getResultWrappersFromRelationships(relationships, type);
- for (AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
- Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
- configurationOp.ifPresent(configurations::add);
+ if (configurationResultWrappers.size() > 1) {
+ String multipleRelationshipsError =
+ "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
+ throw new Exception(multipleRelationshipsError);
+ }
+ if (!configurationResultWrappers.isEmpty()) {
+ Optional<T> configurationOp = configurationResultWrappers.get(0).asBean(resultClass);
+ if (configurationOp.isPresent()) {
+ configuration = configurationOp.get();
+ }
}
}
- return configurations;
+ return configuration;
}
protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships,
@@ -480,7 +550,7 @@ public class WorkflowAction {
String vfModuleId = dataObj.getWorkflowResourceIds().getVfModuleId();
String vnfCustomizationUUID = bbInputSetupUtils.getAAIGenericVnf(vnfId).getModelCustomizationId();
- String vfModuleCustomizationUUID = "";
+ String vfModuleCustomizationUUID;
org.onap.aai.domain.yang.VfModule aaiVfModule = bbInputSetupUtils.getAAIVfModule(vnfId, vfModuleId);
if (aaiVfModule == null) {
@@ -495,32 +565,26 @@ public class WorkflowAction {
List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
- List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVnfc(vnfc,
+ WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds());
+ org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc,
org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- if (configurations.size() > 1) {
- String multipleRelationshipsError =
- "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(dataObj.getExecution(), "Exception in getConfigBuildingBlock: ",
- new Exception(multipleRelationshipsError));
- }
- for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
- dataObj.getWorkflowResourceIds().setConfigurationId(configuration.getConfigurationId());
- for (OrchestrationFlow orchFlow : result) {
- dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
- dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
- dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
- String vnfcName = getVnfcNameForConfiguration(configuration);
- if (vnfcName == null || vnfcName.isEmpty()) {
- buildAndThrowException(dataObj.getExecution(), "Exception in create execution list "
- + ": VnfcName does not exist or is null while there is a configuration for the vfModule",
- new Exception("Vnfc and Configuration do not match"));
- }
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
- dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
- dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(),
- dataObj.getWorkflowResourceIds(), dataObj.getRequestDetails(), false, null, vnfcName, true);
- flowsToExecuteConfigs.add(ebb);
+ workflowIdsCopy.setConfigurationId(configuration.getConfigurationId());
+ for (OrchestrationFlow orchFlow : result) {
+ dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
+ dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
+ String vnfcName = vnfc.getVnfcName();
+ if (vnfcName == null || vnfcName.isEmpty()) {
+ buildAndThrowException(dataObj.getExecution(), "Exception in create execution list "
+ + ": VnfcName does not exist or is null while there is a configuration for the vfModule",
+ new Exception("Vnfc and Configuration do not match"));
}
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
+ dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
+ dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), workflowIdsCopy,
+ dataObj.getRequestDetails(), false, null, vnfcName, true, null);
+ flowsToExecuteConfigs.add(ebb);
+
}
}
return flowsToExecuteConfigs;
@@ -541,17 +605,18 @@ public class WorkflowAction {
boolean rebuildVolumeGroups = false;
if (dataObj.getRequestDetails().getRequestParameters() != null
&& dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups() != null) {
- rebuildVolumeGroups =
- dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups().booleanValue();
+ rebuildVolumeGroups = dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups();
}
-
+ String volumeGroupName = "";
Optional<VolumeGroup> volumeGroupFromVfModule =
bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, vfModuleId);
if (volumeGroupFromVfModule.isPresent()) {
String volumeGroupId = volumeGroupFromVfModule.get().getVolumeGroupId();
+ volumeGroupName = volumeGroupFromVfModule.get().getVolumeGroupName();
logger.debug("Volume group id of the existing volume group is: " + volumeGroupId);
volumeGroupExisted = true;
dataObj.getWorkflowResourceIds().setVolumeGroupId(volumeGroupId);
+ dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
}
List<OrchestrationFlow> orchFlows = dataObj.getOrchFlows();
@@ -564,6 +629,7 @@ public class WorkflowAction {
if (!volumeGroupExisted) {
String newVolumeGroupId = UUID.randomUUID().toString();
dataObj.getWorkflowResourceIds().setVolumeGroupId(newVolumeGroupId);
+ dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
logger.debug("newVolumeGroupId: " + newVolumeGroupId);
}
}
@@ -586,23 +652,6 @@ public class WorkflowAction {
return orchFlows;
}
- protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
- AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
- Optional<Relationships> relationshipsOp = wrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for Configuration in AAI");
- return null;
- }
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
- logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
- }
- Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
- return vnfcOp.map(Vnfc::getVnfcName).orElse(null);
-
- }
-
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
int count = 0;
for (Resource resource : vfModuleResources) {
@@ -633,11 +682,10 @@ public class WorkflowAction {
logger.debug(pair.getValue0() + ", " + pair.getValue1());
}
- Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
- .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
- retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId));
- });
+ Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
+ .forEach(type -> resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
+ retrieveAAIResourceId(aaiResourceIds, type), null, serviceInstanceId)));
}
private String retrieveAAIResourceId(List<Pair<WorkflowType, String>> aaiResourceIds, WorkflowType resource) {
@@ -654,11 +702,10 @@ public class WorkflowAction {
private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList,
String serviceInstanceId) {
- Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
- resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
- .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null,
- resource.getVirtualLinkKey(), serviceInstanceId));
- });
+ Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE))
+ .forEach(type -> resourceList.stream().filter(resource -> type.equals(resource.getResourceType()))
+ .forEach(resource -> updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(),
+ null, resource.getVirtualLinkKey(), serviceInstanceId)));
}
protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resourceType,
@@ -799,88 +846,125 @@ public class WorkflowAction {
protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
org.onap.so.db.catalog.beans.Service service) {
- if (service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty()) {
- List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
- if (customizations.isEmpty()) {
- logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
- } else {
- CollectionResourceCustomization collectionResourceCustomization =
- findCatalogNetworkCollection(execution, service);
- if (collectionResourceCustomization != null) {
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- collectionResourceCustomization.getModelCustomizationUUID(), false));
- logger.debug("Found a network collection");
- if (collectionResourceCustomization.getCollectionResource() != null) {
- if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() != null) {
- String toscaNodeType = collectionResourceCustomization.getCollectionResource()
- .getInstanceGroup().getToscaNodeType();
- if (toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION)) {
- int minNetworks = 0;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
- .getCollectionInstanceGroupCustomizations()) {
- if (collectionInstanceGroupTemp.getModelCustomizationUUID().equalsIgnoreCase(
- collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if (collectionInstCust != null
- && collectionInstCust.getSubInterfaceNetworkQuantity() != null) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}", minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
- .getCollectionNetworkResourceCustomizations()) {
- if (collectionNetworkTemp.getNetworkResourceCustomization()
- .getModelCustomizationUUID().equalsIgnoreCase(
- collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
- break;
- }
- }
- for (int i = 0; i < minNetworks; i++) {
- if (collectionNetworkResourceCust != null && collectionInstCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
- collectionNetworkResourceCust.getModelCustomizationUUID(), false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceList.add(resource);
- }
- }
- } else {
- logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}",
- toscaNodeType);
- }
- } else {
- logger.debug("No Instance Group found for network collection.");
- }
- } else {
- logger.debug("No Network Collection found. collectionResource is null");
- }
- } else {
- logger.debug("No Network Collection Customization found");
+ if (isVnfCustomizationsInTheService(service)) {
+ buildAndThrowException(execution,
+ "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
+ }
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
+ } else {
+ CollectionResourceCustomization collectionResourceCustomization =
+ findCatalogNetworkCollection(execution, service);
+ traverseNetworkCollectionResourceCustomization(resourceList, collectionResourceCustomization);
+ }
+ traverseNetworkCollectionCustomization(resourceList, service);
+ }
+
+ private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList,
+ CollectionResourceCustomization collectionResourceCustomization) {
+ if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, collectionResourceCustomization))
+ return;
+ int minNetworks = 0;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
+ break;
}
}
- if (resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).isEmpty()) {
- if (service.getNetworkCustomizations() == null) {
- logger.debug("No networks were found on this service model");
- } else {
- for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
- resourceList.add(new Resource(WorkflowType.NETWORK,
- service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
- }
- }
+ if (interfaceNetworkQuantityIsAvailableInCollection(collectionInstCust)) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
}
- } else {
- buildAndThrowException(execution,
- "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
}
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust =
+ getCollectionNetworkResourceCustomization(collectionResourceCustomization, instanceGroup);
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceList.add(resource);
+ }
+ }
+ }
+
+ private CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomization(
+ CollectionResourceCustomization collectionResourceCustomization, InstanceGroup instanceGroup) {
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
+ return collectionNetworkResourceCust;
+ }
+
+ private boolean collectionResourceCustomizationShouldNotBeProcessed(List<Resource> resourceList,
+ CollectionResourceCustomization collectionResourceCustomization) {
+ if (collectionResourceCustomization == null) {
+ logger.debug("No Network Collection Customization found");
+ return true;
+ }
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ collectionResourceCustomization.getModelCustomizationUUID(), false));
+ logger.debug("Found a network collection");
+ if (collectionResourceCustomization.getCollectionResource() == null) {
+ logger.debug("No Network Collection found. collectionResource is null");
+ return true;
+ }
+ if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
+ logger.debug("No Instance Group found for network collection.");
+ return true;
+ }
+ String toscaNodeType =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
+ if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
+ return true;
+ }
+ return false;
+ }
+
+ private boolean interfaceNetworkQuantityIsAvailableInCollection(
+ CollectionResourceInstanceGroupCustomization collectionInstCust) {
+ return collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null;
+ }
+
+ private boolean toscaNodeTypeHasNetworkCollection(String toscaNodeType) {
+ return toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION);
+ }
+
+ private void traverseNetworkCollectionCustomization(List<Resource> resourceList,
+ org.onap.so.db.catalog.beans.Service service) {
+ if (isNetworkCollectionInTheResourceList(resourceList)) {
+ return;
+ }
+ if (service.getNetworkCustomizations() == null) {
+ logger.debug("No networks were found on this service model");
+ return;
+ }
+ for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
+ resourceList.add(new Resource(WorkflowType.NETWORK,
+ service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
+ }
+ }
+
+ private boolean isNetworkCollectionInTheResourceList(List<Resource> resourceList) {
+ return resourceList.stream().anyMatch(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType());
+ }
+
+ private boolean isVnfCustomizationsInTheService(org.onap.so.db.catalog.beans.Service service) {
+ return !(service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty());
}
protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId,
@@ -890,28 +974,8 @@ public class WorkflowAction {
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
- if (serviceInstanceMSO.getVnfs() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
- resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
- if (vnf.getVfModules() != null) {
- for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
- Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
- resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
- resourceList.add(resource);
- }
- }
- if (vnf.getVolumeGroups() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
- .getVolumeGroups()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
- resourceList
- .add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
- }
- }
- }
- }
+ traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
+ traverseServiceInstanceMSOPnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
.getNetworks()) {
@@ -950,6 +1014,50 @@ public class WorkflowAction {
}
}
+ private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getVnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ traverseVnfModules(resourceList, aaiResourceIds, vnf);
+ if (vnf.getVolumeGroups() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
+ }
+ }
+ }
+ }
+
+ private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getPnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId()));
+ resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false));
+ }
+ }
+
+ private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
+ if (vnf.getVfModules() == null) {
+ return;
+ }
+ for (VfModule vfModule : vnf.getVfModules()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
+ resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
+ resourceList.add(resource);
+ }
+ }
+
private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId,
String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
@@ -1023,7 +1131,7 @@ public class WorkflowAction {
String vnfCustomizationUUID = "";
String vfModuleCustomizationUUID = "";
if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ List<Map<String, Object>> userParams = getListOfUserParams(sIRequest);
for (Map<String, Object> params : userParams) {
if (params.containsKey(USERPARAMSERVICE)) {
ObjectMapper obj = new ObjectMapper();
@@ -1051,23 +1159,18 @@ public class WorkflowAction {
&& vfModuleCustomization.getVolumeHeatEnv() != null) {
resourceList.add(new Resource(WorkflowType.VOLUMEGROUP,
vfModuleCustomization.getModelCustomizationUUID(), false));
- foundRelated = true;
foundVfModuleOrVG = true;
}
if (vfModuleCustomization.getVfModule() != null
&& vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null
&& vfModuleCustomization.getHeatEnvironment() != null) {
- foundRelated = true;
foundVfModuleOrVG = true;
Resource resource = new Resource(WorkflowType.VFMODULE,
vfModuleCustomization.getModelCustomizationUUID(), false);
- if (vfModuleCustomization.getVfModule().getIsBase() != null
- && vfModuleCustomization.getVfModule().getIsBase()) {
- resource.setBaseVfModule(true);
- } else {
- resource.setBaseVfModule(false);
- }
+ resource.setBaseVfModule(
+ vfModuleCustomization.getVfModule().getIsBase() != null
+ && vfModuleCustomization.getVfModule().getIsBase());
resourceList.add(resource);
if (vfModule.getModelInfo() != null
&& vfModule.getModelInfo().getModelCustomizationUuid() != null) {
@@ -1322,7 +1425,7 @@ public class WorkflowAction {
resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType))
.forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration)));
+ isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null)));
}
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
@@ -1343,7 +1446,8 @@ public class WorkflowAction {
addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VNF, orchFlow, requestId,
apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
false);
- } else if (orchFlow.getFlowName().contains(PNF)) {
+ } else if (orchFlow.getFlowName().contains(PNF) || (orchFlow.getFlowName().contains(CONTROLLER)
+ && (PNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.PNF, orchFlow, requestId,
apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false,
false);
@@ -1357,7 +1461,7 @@ public class WorkflowAction {
true, false);
} else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER)
&& (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) {
- List<Resource> vfModuleResourcesSorted = null;
+ List<Resource> vfModuleResourcesSorted;
if (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE)
|| requestAction.equals("activateInstance")) {
vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceList.stream()
@@ -1366,10 +1470,10 @@ public class WorkflowAction {
vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream()
.filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
}
- for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i),
- apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- false, null, null, false));
+ for (Resource resource : vfModuleResourcesSorted) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+ requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null,
+ false, null));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
if (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
@@ -1389,8 +1493,9 @@ public class WorkflowAction {
requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
false, true);
} else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
- requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, false));
+ flowsToExecute
+ .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction,
+ false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null));
}
}
return flowsToExecute;
@@ -1399,15 +1504,19 @@ public class WorkflowAction {
protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId,
Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte,
String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
- boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration) {
+ boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration,
+ ReplaceInstanceRelatedInformation replaceInfo) {
BuildingBlock buildingBlock =
new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString())
.setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey)
.setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse(""));
- Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(action -> buildingBlock.setBpmnAction(action));
- Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(scope -> buildingBlock.setBpmnScope(scope));
-
+ Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction);
+ Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope);
+ String oldVolumeGroupName = "";
+ if (replaceInfo != null) {
+ oldVolumeGroupName = replaceInfo.getOldVolumeGroupName();
+ }
if (resource != null
&& (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) {
@@ -1418,19 +1527,24 @@ public class WorkflowAction {
ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion)
.setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType)
.setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock)
- .setRequestDetails(requestDetails);
+ .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName);
if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- Optional.ofNullable(vnfcName).ifPresent(name -> configurationResourceKeys.setVnfcName(name));
- configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
- configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
- configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName);
executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
}
return executeBuildingBlock;
}
+ private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) {
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName);
+ configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
+ configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
+ configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ return configurationResourceKeys;
+ }
+
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
@@ -1439,7 +1553,7 @@ public class WorkflowAction {
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
WorkflowType resourceName, boolean aLaCarte, String cloudOwner, String serviceType) {
List<OrchestrationFlow> listToExecute = new ArrayList<>();
- NorthBoundRequest northBoundRequest = null;
+ NorthBoundRequest northBoundRequest;
if (serviceType.equalsIgnoreCase(SERVICE_TYPE_TRANSPORT)
|| serviceType.equalsIgnoreCase(SERVICE_TYPE_BONDING)) {
northBoundRequest =
@@ -1520,7 +1634,7 @@ public class WorkflowAction {
}
protected String validateServiceResourceIdInAAI(String generatedResourceId, String instanceName,
- RequestDetails reqDetails) throws DuplicateNameException, MultipleObjectsFoundException {
+ RequestDetails reqDetails) throws DuplicateNameException {
String globalCustomerId = reqDetails.getSubscriberInfo().getGlobalSubscriberId();
String serviceType = reqDetails.getRequestParameters().getSubscriptionServiceType();
if (instanceName != null) {
@@ -1584,8 +1698,7 @@ public class WorkflowAction {
}
protected String validateVnfResourceIdInAAI(String generatedResourceId, String instanceName,
- RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds)
- throws DuplicateNameException, MultipleObjectsFoundException {
+ RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
Optional<GenericVnf> vnf = bbInputSetupUtils
.getRelatedVnfByNameFromServiceInstance(workflowResourceIds.getServiceInstanceId(), instanceName);
if (vnf.isPresent()) {
@@ -1629,8 +1742,7 @@ public class WorkflowAction {
}
protected String validateVolumeGroupResourceIdInAAI(String generatedResourceId, String instanceName,
- RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds)
- throws DuplicateNameException, MultipleObjectsFoundException {
+ RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
Optional<VolumeGroup> volumeGroup =
bbInputSetupUtils.getRelatedVolumeGroupByNameFromVnf(workflowResourceIds.getVnfId(), instanceName);
if (volumeGroup.isPresent()) {
@@ -1648,8 +1760,7 @@ public class WorkflowAction {
}
protected String validateConfigurationResourceIdInAAI(String generatedResourceId, String instanceName,
- RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds)
- throws DuplicateNameException, MultipleObjectsFoundException {
+ RequestDetails reqDetails, WorkflowResourceIds workflowResourceIds) throws DuplicateNameException {
Optional<org.onap.aai.domain.yang.Configuration> configuration =
bbInputSetupUtils.getRelatedConfigurationByNameFromServiceInstance(
workflowResourceIds.getServiceInstanceId(), instanceName);
@@ -1671,7 +1782,7 @@ public class WorkflowAction {
private void fillExecution(DelegateExecution execution, boolean suppressRollback, String resourceId,
WorkflowType resourceType) {
execution.setVariable("sentSyncResponse", false);
- execution.setVariable("homing", false);
+ execution.setVariable(HOMING, false);
execution.setVariable("calledHoming", false);
execution.setVariable(BBConstants.G_ISTOPLEVELFLOW, true);
execution.setVariable("suppressRollback", suppressRollback);
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 0ddafa0b44..7420df144a 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
@@ -20,20 +20,12 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import javax.persistence.EntityNotFoundException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.InstanceGroup;
-import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.VfModule;
-import org.onap.aai.domain.yang.Vnfc;
-import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.*;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.Configuration;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
@@ -44,8 +36,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.Configuration;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -58,8 +48,13 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.persistence.EntityNotFoundException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.stream.Collectors;
@Component
public class WorkflowActionBBTasks {
@@ -74,6 +69,8 @@ public class WorkflowActionBBTasks {
private static final String COMPLETED = "completed";
private static final String HANDLINGCODE = "handlingCode";
private static final String ROLLBACKTOCREATED = "RollbackToCreated";
+ private static final String REPLACEINSTANCE = "replaceInstance";
+ private static final String VFMODULE = "VfModule";
protected String maxRetries = "mso.rainyDay.maxRetries";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBTasks.class);
@@ -106,11 +103,7 @@ public class WorkflowActionBBTasks {
execution.setVariable("buildingBlock", ebb);
currentSequence++;
- if (currentSequence >= flowsToExecute.size()) {
- execution.setVariable(COMPLETED, true);
- } else {
- execution.setVariable(COMPLETED, false);
- }
+ execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size());
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
@@ -150,7 +143,7 @@ public class WorkflowActionBBTasks {
protected Long getPercentProgress(int completedBBs, int totalBBs) {
double ratio = (completedBBs / (totalBBs * 1.0));
int percentProgress = (int) (ratio * 95);
- return new Long(percentProgress + 5);
+ return (long) (percentProgress + 5);
}
protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
@@ -220,7 +213,7 @@ public class WorkflowActionBBTasks {
final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
final String resourceName = (String) execution.getVariable("resourceName");
String statusMessage = (String) execution.getVariable("StatusMessage");
- String macroAction = "";
+ String macroAction;
if (statusMessage == null) {
if (aLaCarte) {
macroAction = "ALaCarte-" + resourceName + "-" + action + " request was executed correctly.";
@@ -235,7 +228,7 @@ public class WorkflowActionBBTasks {
request.setEndTime(endTime);
request.setFlowStatus("Successfully completed all Building Blocks");
request.setStatusMessage(macroAction);
- request.setProgress(Long.valueOf(100));
+ request.setProgress(100L);
request.setRequestStatus("COMPLETE");
request.setLastModifiedBy("CamundaBPMN");
requestsDbListener.post(request, new DelegateExecutionImpl(execution));
@@ -286,12 +279,20 @@ public class WorkflowActionBBTasks {
* working on.
*/
public void rollbackExecutionPath(DelegateExecution execution) {
+ final String action = (String) execution.getVariable(G_ACTION);
+ final String resourceName = (String) execution.getVariable("resourceName");
if (!(boolean) execution.getVariable("isRollback")) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
+
+ List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = flowsToExecute.stream()
+ .filter(buildingBlock -> buildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change"))
+ .collect(Collectors.toList());
+
+ List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>();
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
int listSize = flowsToExecute.size();
+
for (int i = listSize - 1; i >= 0; i--) {
if (i > currentSequence - 1) {
flowsToExecute.remove(i);
@@ -326,25 +327,34 @@ public class WorkflowActionBBTasks {
}
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
- List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
- rollbackFlowsFiltered.addAll(rollbackFlows);
+ List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
- for (int i = 0; i < rollbackFlows.size(); i++) {
- if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign") && !rollbackFlows
- .get(i).getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
- } else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
+ for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
+ if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign")
+ && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
+ rollbackFlowsFiltered.remove(rollbackFlow);
+ } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete")
+ && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
&& ROLLBACKTOCREATED.equals(handlingCode)) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ rollbackFlowsFiltered.remove(rollbackFlow);
}
}
}
+ List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList<>();
+ if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) {
+ for (ExecuteBuildingBlock executeBuildingBlock : rollbackFlowsFiltered) {
+ if (!executeBuildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) {
+ rollbackFlowsFilteredNonChangeBBs.add(executeBuildingBlock);
+ }
+ }
+ rollbackFlowsFiltered.clear();
+ rollbackFlowsFiltered.addAll(flowsToExecuteChangeBBs);
+ rollbackFlowsFiltered.addAll(rollbackFlowsFilteredNonChangeBBs);
+ }
+
workflowActionBBFailure.updateRequestErrorStatusMessage(execution);
- if (rollbackFlows.isEmpty())
- execution.setVariable("isRollbackNeeded", false);
- else
- execution.setVariable("isRollbackNeeded", true);
+ execution.setVariable("isRollbackNeeded", !rollbackFlows.isEmpty());
execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
execution.setVariable(HANDLINGCODE, "PreformingRollback");
execution.setVariable("isRollback", true);
@@ -431,9 +441,8 @@ public class WorkflowActionBBTasks {
ExecuteBuildingBlock addConfigBB = getExecuteBBForConfig(ADD_FABRIC_CONFIGURATION_BB, ebb,
configurationId, configurationResourceKeys);
flowsToExecute.add(addConfigBB);
- flowsToExecute.stream()
- .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
- executeBB.getBuildingBlock().getBpmnFlowName()));
+ flowsToExecute.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
+ executeBB.getBuildingBlock().getBpmnFlowName()));
execution.setVariable("flowsToExecute", flowsToExecute);
execution.setVariable(COMPLETED, false);
} else {
@@ -450,11 +459,10 @@ public class WorkflowActionBBTasks {
}
}
- protected String getConfigurationId(Vnfc vnfc) {
- List<Configuration> configurations =
+ protected String getConfigurationId(Vnfc vnfc) throws Exception {
+ Configuration configuration =
workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
- if (!configurations.isEmpty()) {
- Configuration configuration = configurations.get(0);
+ if (configuration != null) {
return configuration.getConfigurationId();
} else {
return UUID.randomUUID().toString();
@@ -466,14 +474,12 @@ public class WorkflowActionBBTasks {
BuildingBlock buildingBlock =
new BuildingBlock().setBpmnFlowName(bbName).setMsoId(UUID.randomUUID().toString());
- WorkflowResourceIds workflowResourceIds = ebb.getWorkflowResourceIds();
+ WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds(ebb.getWorkflowResourceIds());
workflowResourceIds.setConfigurationId(configurationId);
- ExecuteBuildingBlock configBB = new ExecuteBuildingBlock().setaLaCarte(ebb.isaLaCarte())
- .setApiVersion(ebb.getApiVersion()).setRequestAction(ebb.getRequestAction())
- .setVnfType(ebb.getVnfType()).setRequestId(ebb.getRequestId())
+ return new ExecuteBuildingBlock().setaLaCarte(ebb.isaLaCarte()).setApiVersion(ebb.getApiVersion())
+ .setRequestAction(ebb.getRequestAction()).setVnfType(ebb.getVnfType()).setRequestId(ebb.getRequestId())
.setRequestDetails(ebb.getRequestDetails()).setBuildingBlock(buildingBlock)
.setWorkflowResourceIds(workflowResourceIds).setConfigurationResourceKeys(configurationResourceKeys);
- return configBB;
}
protected void setInstanceName(String resourceId, WorkflowType resourceType, InfraActiveRequests request) {
@@ -497,9 +503,7 @@ public class WorkflowActionBBTasks {
} else if (resourceType == WorkflowType.VOLUMEGROUP && request.getVolumeGroupName() == null) {
Optional<VolumeGroup> volumeGroup =
bbInputSetupUtils.getRelatedVolumeGroupByIdFromVnf(request.getVnfId(), resourceId);
- if (volumeGroup.isPresent()) {
- request.setVolumeGroupName(volumeGroup.get().getVolumeGroupName());
- }
+ volumeGroup.ifPresent(group -> request.setVolumeGroupName(group.getVolumeGroupName()));
} else if (resourceType == WorkflowType.NETWORK && request.getNetworkName() == null) {
L3Network network = bbInputSetupUtils.getAAIL3Network(resourceId);
if (network != null) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
index 6254aae029..bc32489944 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListener.java
@@ -39,13 +39,12 @@ public class HomingListener implements FlowManipulator {
public void run(List<ExecuteBuildingBlock> flowsToExecute, ExecuteBuildingBlock currentBB,
BuildingBlockExecution execution) {
- boolean homing = (boolean) execution.getVariable("homing");
- boolean calledHoming = (boolean) execution.getVariable("calledHoming");
+ boolean homing = execution.getVariable("homing");
+ boolean calledHoming = execution.getVariable("calledHoming");
if (homing && !calledHoming) {
currentBB.setHoming(true);
execution.setVariable("calledHoming", true);
}
}
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
index 772fca0841..6589ae77f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java
@@ -13,8 +13,11 @@ import org.springframework.stereotype.Component;
@Component
public class SkipConfigVnfListener implements FlowManipulator {
- @Autowired
- private CatalogDbClient catalogDbClient;
+ private final CatalogDbClient catalogDbClient;
+
+ public SkipConfigVnfListener(CatalogDbClient catalogDbClient) {
+ this.catalogDbClient = catalogDbClient;
+ }
@Override
public boolean shouldRunFor(String currentBBName, boolean isFirst, BuildingBlockExecution execution) {
@@ -39,6 +42,4 @@ public class SkipConfigVnfListener implements FlowManipulator {
}
}
-
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
deleted file mode 100644
index 8b0cf69f6c..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
+++ /dev/null
@@ -1,84 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof;
-
-
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.onap.so.client.BaseClient;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.oof.beans.OofProperties;
-import org.onap.so.client.oof.beans.OofRequest;
-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;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import java.util.LinkedHashMap;
-
-@Component
-public class OofClient {
-
- private static final Logger logger = LoggerFactory.getLogger(OofClient.class);
- public static final String X_MINOR_VERSION = "X-MinorVersion";
- public static final String X_PATCH_VERSION = "X-PatchVersion";
- public static final String X_LATEST_VERSION = "X-LatestVersion";
-
- @Autowired
- private OofProperties oofProperties;
-
- @Autowired
- private OofValidator validator;
-
-
- /**
- * Makes a rest call to oof to perform homing and licensing for a list of demands
- *
- * @param homingRequest
- * @return
- * @throws JsonProcessingException
- * @throws BpmnError
- */
- public void postDemands(OofRequest homingRequest) throws BadResponseException, JsonProcessingException {
- logger.trace("Started oof Client Post Demands");
- String url = oofProperties.getHost() + oofProperties.getUri();
- logger.debug("Post demands url: " + url);
- logger.debug("Post demands payload: " + homingRequest.toJsonString());
-
- HttpHeaders header = new HttpHeaders();
- header.setContentType(MediaType.APPLICATION_JSON);
- header.set(HttpHeaders.AUTHORIZATION, oofProperties.getHeaders().get("auth"));
- header.set(X_PATCH_VERSION, oofProperties.getHeaders().get("patchVersion"));
- header.set(X_MINOR_VERSION, oofProperties.getHeaders().get("minorVersion"));
- header.set(X_LATEST_VERSION, oofProperties.getHeaders().get("latestVersion"));
- BaseClient<String, LinkedHashMap<?, ?>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<?, ?> response =
- baseClient.post(homingRequest.toJsonString(), new ParameterizedTypeReference<LinkedHashMap<?, ?>>() {});
- validator.validateDemandsResponse(response);
- logger.trace("Completed OOF Client Post Demands");
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
deleted file mode 100644
index abbf52e38c..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof;
-
-
-import org.json.JSONObject;
-import org.onap.so.client.exception.BadResponseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import java.util.LinkedHashMap;
-import static org.apache.commons.lang.StringUtils.isNotBlank;
-
-
-@Component
-public class OofValidator {
-
- private static final Logger logger = LoggerFactory.getLogger(OofValidator.class);
-
- /**
- * Validates the synchronous homing response from oof
- *
- * @throws BadResponseException
- */
- public void validateDemandsResponse(LinkedHashMap<?, ?> response) throws BadResponseException {
- logger.debug("Validating oofs synchronous response");
- if (!response.isEmpty()) {
- JSONObject jsonResponse = new JSONObject(response);
- if (jsonResponse.has("requestStatus")) {
- String status = jsonResponse.getString("requestStatus");
- if (status.equals("accepted")) {
- logger.debug("oofs synchronous response indicates accepted");
- } else {
- String message = jsonResponse.getString("statusMessage");
- if (isNotBlank(message)) {
- logger.debug("oofs response indicates failed: " + message);
- } else {
- logger.debug("oofs response indicates failed: no status message provided");
- message = "error message not provided";
- }
- throw new BadResponseException("oofs synchronous response indicates failed: " + message);
- }
- } else {
- logger.debug("oofs synchronous response does not contain: request status");
- throw new BadResponseException("oofs synchronous response does not contain: request status");
- }
- } else {
- logger.debug("oofs synchronous response is empty");
- throw new BadResponseException("oofs synchronous response i is empty");
- }
- }
-
- /**
- * Validates the asynchronous/callback response from oof which contains the homing and licensing solutions
- *
- * @throws BadResponseException
- */
- public void validateSolution(String response) throws BadResponseException {
- logger.debug("Validating oofs asynchronous callback response");
- if (isNotBlank(response)) {
- JSONObject jsonResponse = new JSONObject(response);
- if (!jsonResponse.has("serviceException")) {
- logger.debug("oofs asynchronous response is valid");
- } else {
- String message = jsonResponse.getJSONObject("serviceException").getString("text");
- if (isNotBlank(message)) {
- logger.debug("oofs response contains a service exception: " + message);
- } else {
- logger.debug("oofs response contains a service exception: no service exception text provided");
- message = "error message not provided";
- }
- throw new BadResponseException("oofs asynchronous response contains a service exception: " + message);
- }
- } else {
- logger.debug("oofs asynchronous response is empty");
- throw new BadResponseException("oofs asynchronous response is empty");
- }
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java
deleted file mode 100644
index e64a5450b5..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"resourceModuleName", "serviceResourceId", "tenantId", "resourceModelInfo"})
-@JsonRootName("licenseDemand")
-public class LicenseDemand implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("resourceModuleName")
- private String resourceModuleName;
- @JsonProperty("serviceResourceId")
- private String serviceResourceId;
- @JsonProperty("tenantId")
- private String tenantId;
- @JsonProperty("resourceModelInfo")
- private ResourceModelInfo resourceModelInfo;
-
- @JsonProperty("resourceModuleName")
- public String getResourceModuleName() {
- return resourceModuleName;
- }
-
- @JsonProperty("resourceModuleName")
- public void setResourceModuleName(String resourceModuleName) {
- this.resourceModuleName = resourceModuleName;
- }
-
- @JsonProperty("serviceResourceId")
- public String getServiceResourceId() {
- return serviceResourceId;
- }
-
- @JsonProperty("serviceResourceId")
- public void setServiceResourceId(String serviceResourceId) {
- this.serviceResourceId = serviceResourceId;
- }
-
- @JsonProperty("tenantId")
- public String getTenantId() {
- return tenantId;
- }
-
- @JsonProperty("tenantId")
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-
- @JsonProperty("resourceModelInfo")
- public ResourceModelInfo getResourceModelInfo() {
- return resourceModelInfo;
- }
-
- @JsonProperty("resourceModelInfo")
- public void setResourceModelInfo(ResourceModelInfo resourceModelInfo) {
- this.resourceModelInfo = resourceModelInfo;
- }
-
- public void setResourceModelInfo(ModelInfo modelInfo) {
- ResourceModelInfo localResourceModelInfo = new ResourceModelInfo();
- localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId());
- localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId());
- localResourceModelInfo.setModelVersion(modelInfo.getModelVersion());
- localResourceModelInfo.setModelName(modelInfo.getModelName());
- localResourceModelInfo.setModelType(modelInfo.getModelType());
- localResourceModelInfo.setModelInvariantId(modelInfo.getModelInvariantId());
- localResourceModelInfo.setModelCustomizationName(modelInfo.getModelCustomizationName());
- this.resourceModelInfo = localResourceModelInfo;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java
deleted file mode 100644
index 74ff9339d3..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2019 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-import java.util.ArrayList;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonRootName("licenseInfo")
-public class LicenseInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("licenseDemands")
- private ArrayList<LicenseDemand> licenseDemands = new ArrayList<>();
-
-
- @JsonProperty("licenseDemands")
- public ArrayList<LicenseDemand> getLicenseDemands() {
- return licenseDemands;
- }
-
- @JsonProperty("licenseDemands")
- public void setLicenseDemands(ArrayList<LicenseDemand> licenseDemands) {
- this.licenseDemands = licenseDemands;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
deleted file mode 100644
index 433de22aba..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"modelType", "modelInvariantId", "modelVersionId", "modelName", "modelVersion",
- "modelCustomizationName"})
-@JsonRootName("modelInfo")
-public class ModelInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("modelType")
- private String modelType;
- @JsonProperty("modelInvariantId")
- private String modelInvariantId;
- @JsonProperty("modelVersionId")
- private String modelVersionId;
- @JsonProperty("modelName")
- private String modelName;
- @JsonProperty("modelVersion")
- private String modelVersion;
- @JsonProperty("modelCustomizationName")
- private String modelCustomizationName;
-
- @JsonProperty("modelType")
- public String getModelType() {
- return modelType;
- }
-
- @JsonProperty("modelType")
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
- @JsonProperty("modelInvariantId")
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- @JsonProperty("modelInvariantId")
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- @JsonProperty("modelVersionId")
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- @JsonProperty("modelVersionId")
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-
- @JsonProperty("modelName")
- public String getModelName() {
- return modelName;
- }
-
- @JsonProperty("modelName")
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- @JsonProperty("modelVersion")
- public String getModelVersion() {
- return modelVersion;
- }
-
- @JsonProperty("modelVersion")
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- @JsonProperty("modelCustomizationName")
- public String getModelCustomizationName() {
- return modelCustomizationName;
- }
-
- @JsonProperty("modelCustomizationName")
- public void setModelCustomizationName(String modelCustomizationName) {
- this.modelCustomizationName = modelCustomizationName;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
deleted file mode 100644
index 84e29b6f2d..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-import java.util.Map;
-
-@Configuration
-@ConfigurationProperties(prefix = "oof")
-public class OofProperties {
-
- private String host;
- private String uri;
-
- private Map<String, String> headers;
-
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public Map<String, String> getHeaders() {
- return headers;
- }
-
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
deleted file mode 100644
index f8896240ba..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import java.io.Serializable;
-
-
-public class OofRequest implements Serializable {
-
- private static final long serialVersionUID = -1541132882892163132L;
- private static final Logger logger = LoggerFactory.getLogger(OofRequest.class);
-
-
- @JsonProperty("requestInfo")
- private RequestInfo requestInformation;
-
- @JsonProperty("serviceInfo")
- private ServiceInfo serviceInformation;
-
- @JsonProperty("placementInfo")
- private PlacementInfo placementInformation;
-
- @JsonProperty("licenseInfo")
- private LicenseInfo licenseInformation;
-
-
- public RequestInfo getRequestInformation() {
- return requestInformation;
- }
-
- public void setRequestInformation(RequestInfo requestInformation) {
- this.requestInformation = requestInformation;
- }
-
- public ServiceInfo getServiceInformation() {
- return serviceInformation;
- }
-
- public void setServiceInformation(ServiceInfo serviceInformation) {
- this.serviceInformation = serviceInformation;
- }
-
- public PlacementInfo getPlacementInformation() {
- return placementInformation;
- }
-
- public void setPlacementInformation(PlacementInfo placementInformation) {
- this.placementInformation = placementInformation;
- }
-
- public LicenseInfo getLicenseInformation() {
- return licenseInformation;
- }
-
- public void setLicenseInformation(LicenseInfo licenseInformation) {
- this.licenseInformation = licenseInformation;
- }
-
-
- @JsonInclude(Include.NON_NULL)
- public String toJsonString() {
- String json = "";
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
- try {
- json = ow.writeValueAsString(this);
- } catch (Exception e) {
- logger.error("Unable to convert oofRequest to string", e);
- }
- return json.replaceAll("\\\\", "");
- }
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
deleted file mode 100644
index 6c9e45c787..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"customerLatitude", "customerLongitude", "customerName"})
-@JsonRootName("requestParameters")
-public class OofRequestParameters implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
-
- @JsonProperty("customerLatitude")
- private String customerLatitude;
- @JsonProperty("customerLongitude")
- private String customerLongitude;
- @JsonProperty("customerName")
- private String customerName;
-
- @JsonProperty("customerLatitude")
- public String getCustomerLatitude() {
- return customerLatitude;
- }
-
- @JsonProperty("customerLatitude")
- public void setCustomerLatitude(String customerLatitude) {
- this.customerLatitude = customerLatitude;
- }
-
- @JsonProperty("customerLongitude")
- public String getCustomerLongitude() {
- return customerLongitude;
- }
-
- @JsonProperty("customerLongitude")
- public void setCustomerLongitude(String customerLongitude) {
- this.customerLongitude = customerLongitude;
- }
-
- @JsonProperty("customerName")
- public String getCustomerName() {
- return customerName;
- }
-
- @JsonProperty("customerName")
- public void setCustomerName(String customerName) {
- this.customerName = customerName;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
deleted file mode 100644
index 631b3707d4..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"resourceModuleName", "serviceResourceId", "tenantId", "resourceModelInfo"})
-@JsonRootName("placementDemand")
-public class PlacementDemand implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("resourceModuleName")
- private String resourceModuleName;
- @JsonProperty("serviceResourceId")
- private String serviceResourceId;
- @JsonProperty("tenantId")
- private String tenantId;
- @JsonProperty("resourceModelInfo")
- private ResourceModelInfo resourceModelInfo;
-
- @JsonProperty("resourceModuleName")
- public String getResourceModuleName() {
- return resourceModuleName;
- }
-
- @JsonProperty("resourceModuleName")
- public void setResourceModuleName(String resourceModuleName) {
- this.resourceModuleName = resourceModuleName;
- }
-
- @JsonProperty("serviceResourceId")
- public String getServiceResourceId() {
- return serviceResourceId;
- }
-
- @JsonProperty("serviceResourceId")
- public void setServiceResourceId(String serviceResourceId) {
- this.serviceResourceId = serviceResourceId;
- }
-
- @JsonProperty("tenantId")
- public String getTenantId() {
- return tenantId;
- }
-
- @JsonProperty("tenantId")
- public void setTenantId(String tenantId) {
- this.tenantId = tenantId;
- }
-
- @JsonProperty("resourceModelInfo")
- public ResourceModelInfo getResourceModelInfo() {
- return resourceModelInfo;
- }
-
- @JsonProperty("resourceModelInfo")
- public void setResourceModelInfo(ResourceModelInfo resourceModelInfo) {
- this.resourceModelInfo = resourceModelInfo;
- }
-
- public void setResourceModelInfo(ModelInfo modelInfo) {
- ResourceModelInfo localResourceModelInfo = new ResourceModelInfo();
- localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId());
- localResourceModelInfo.setModelVersionId(modelInfo.getModelVersionId());
- localResourceModelInfo.setModelVersion(modelInfo.getModelVersion());
- localResourceModelInfo.setModelName(modelInfo.getModelName());
- localResourceModelInfo.setModelType(modelInfo.getModelType());
- localResourceModelInfo.setModelInvariantId(modelInfo.getModelInvariantId());
- localResourceModelInfo.setModelCustomizationName(modelInfo.getModelCustomizationName());
- this.resourceModelInfo = localResourceModelInfo;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
deleted file mode 100644
index 7519e8c87e..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"requestParameters", "subscriberInfo", "placementDemands"})
-@JsonRootName("placementInfo")
-public class PlacementInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("requestParameters")
- private OofRequestParameters requestParameters;
- @JsonProperty("subscriberInfo")
- private SubscriberInfo subscriberInfo;
- @JsonProperty("placementDemands")
- private ArrayList<PlacementDemand> placementDemands = new ArrayList<>();
-
- @JsonProperty("requestParameters")
- public OofRequestParameters getRequestParameters() {
- return requestParameters;
- }
-
- @JsonProperty("requestParameters")
- public void setRequestParameters(OofRequestParameters requestParameters) {
- this.requestParameters = requestParameters;
- }
-
- @JsonProperty("subscriberInfo")
- public SubscriberInfo getSubscriberInfo() {
- return subscriberInfo;
- }
-
- @JsonProperty("subscriberInfo")
- public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
- this.subscriberInfo = subscriberInfo;
- }
-
- @JsonProperty("placementDemands")
- public ArrayList<PlacementDemand> getPlacementDemands() {
- return placementDemands;
- }
-
- @JsonProperty("placementDemands")
- public void setPlacementDemands(ArrayList<PlacementDemand> placementDemands) {
- this.placementDemands = placementDemands;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
deleted file mode 100644
index 0132ed56e9..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import java.io.Serializable;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"transactionId", "requestId", "callbackUrl", "sourceId", "requestType", "numSolutions",
- "optimizers", "timeout"})
-@JsonRootName("requestInfo")
-public class RequestInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("transactionId")
- private String transactionId;
- @JsonProperty("requestId")
- private String requestId;
- @JsonProperty("callbackUrl")
- private String callbackUrl;
- @JsonProperty("sourceId")
- private String sourceId;
- @JsonProperty("requestType")
- private String requestType;
- @JsonProperty("numSolutions")
- private Integer numSolutions;
- @JsonProperty("optimizers")
- private List<String> optimizers = null;
- @JsonProperty("timeout")
- private Long timeout;
-
- @JsonProperty("transactionId")
- public String getTransactionId() {
- return transactionId;
- }
-
- @JsonProperty("transactionId")
- public void setTransactionId(String transactionId) {
- this.transactionId = transactionId;
- }
-
- @JsonProperty("requestId")
- public String getRequestId() {
- return requestId;
- }
-
- @JsonProperty("requestId")
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- @JsonProperty("callbackUrl")
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- @JsonProperty("callbackUrl")
- public void setCallbackUrl(String callbackUrl) {
- this.callbackUrl = callbackUrl;
- }
-
- @JsonProperty("sourceId")
- public String getSourceId() {
- return sourceId;
- }
-
- @JsonProperty("sourceId")
- public void setSourceId(String sourceId) {
- this.sourceId = sourceId;
- }
-
- @JsonProperty("requestType")
- public String getRequestType() {
- return requestType;
- }
-
- @JsonProperty("requestType")
- public void setRequestType(String requestType) {
- this.requestType = requestType;
- }
-
- @JsonProperty("numSolutions")
- public Integer getNumSolutions() {
- return numSolutions;
- }
-
- @JsonProperty("numSolutions")
- public void setNumSolutions(Integer numSolutions) {
- this.numSolutions = numSolutions;
- }
-
- @JsonProperty("optimizers")
- public List<String> getOptimizers() {
- return optimizers;
- }
-
- @JsonProperty("optimizers")
- public void setOptimizers(List<String> optimizers) {
- this.optimizers = optimizers;
- }
-
- @JsonProperty("timeout")
- public Long getTimeout() {
- return timeout;
- }
-
- @JsonProperty("timeout")
- public void setTimeout(Long timeout) {
- this.timeout = timeout;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
deleted file mode 100644
index 8d44c63571..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-import java.io.Serializable;
-
-public class Resource implements Serializable {
-
- private static final long serialVersionUID = 5949861520571440421L;
-
- @JsonProperty("service-resource-id")
- private String serviceResourceId;
- @JsonProperty("status")
- private String status;
-
-
- public String getServiceResourceId() {
- return serviceResourceId;
- }
-
- public void setServiceResourceId(String serviceResourceId) {
- this.serviceResourceId = serviceResourceId;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
deleted file mode 100644
index 9d0352525d..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonRootName("resourceModelInfo")
-public class ResourceModelInfo extends ModelInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("modelInvariantId")
- private String modelInvariantId;
- @JsonProperty("modelVersionId")
- private String modelVersionId;
- @JsonProperty("modelName")
- private String modelName;
- @JsonProperty("modelType")
- private String modelType;
- @JsonProperty("modelVersion")
- private String modelVersion;
- @JsonProperty("modelCustomizationName")
- private String modelCustomizationName;
-
- @JsonProperty("modelInvariantId")
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- @JsonProperty("modelInvariantId")
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- @JsonProperty("modelVersionId")
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- @JsonProperty("modelVersionId")
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-
- @JsonProperty("modelName")
- public String getModelName() {
- return modelName;
- }
-
- @JsonProperty("modelName")
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- @JsonProperty("modelType")
- public String getModelType() {
- return modelType;
- }
-
- @JsonProperty("modelType")
- public void setModelType(String modelType) {
- this.modelType = modelType;
- }
-
- @JsonProperty("modelVersion")
- public String getModelVersion() {
- return modelVersion;
- }
-
- @JsonProperty("modelVersion")
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
- @JsonProperty("modelCustomizationName")
- public String getModelCustomizationName() {
- return modelCustomizationName;
- }
-
- @JsonProperty("modelCustomizationName")
- public void setModelCustomizationName(String modelCustomizationName) {
- this.modelCustomizationName = modelCustomizationName;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
deleted file mode 100644
index db0e2acd60..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"serviceInstanceId", "serviceName", "modelInfo"})
-@JsonRootName("serviceInfo")
-public class ServiceInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("serviceInstanceId")
- private String serviceInstanceId;
- @JsonProperty("serviceName")
- private String serviceName;
- @JsonProperty("modelInfo")
- private ModelInfo modelInfo;
-
- @JsonProperty("serviceInstanceId")
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- @JsonProperty("serviceInstanceId")
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- @JsonProperty("serviceName")
- public String getServiceName() {
- return serviceName;
- }
-
- @JsonProperty("serviceName")
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- @JsonProperty("modelInfo")
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- @JsonProperty("modelInfo")
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
deleted file mode 100644
index 8fef4c45e7..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-import java.io.Serializable;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"globalSubscriberId", "subscriberName", "subscriberCommonSiteId"})
-@JsonRootName("subscriberInfo")
-public class SubscriberInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("globalSubscriberId")
- private String globalSubscriberId;
- @JsonProperty("subscriberName")
- private String subscriberName;
- @JsonProperty("subscriberCommonSiteId")
- private String subscriberCommonSiteId;
-
- @JsonProperty("globalSubscriberId")
- public String getGlobalSubscriberId() {
- return globalSubscriberId;
- }
-
- @JsonProperty("globalSubscriberId")
- public void setGlobalSubscriberId(String globalSubscriberId) {
- this.globalSubscriberId = globalSubscriberId;
- }
-
- @JsonProperty("subscriberName")
- public String getSubscriberName() {
- return subscriberName;
- }
-
- @JsonProperty("subscriberName")
- public void setSubscriberName(String subscriberName) {
- this.subscriberName = subscriberName;
- }
-
- @JsonProperty("subscriberCommonSiteId")
- public String getSubscriberCommonSiteId() {
- return subscriberCommonSiteId;
- }
-
- @JsonProperty("subscriberCommonSiteId")
- public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
- this.subscriberCommonSiteId = subscriberCommonSiteId;
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
index 3b22cd9d81..3da17194ff 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
@@ -22,6 +22,7 @@ package org.onap.so.client.orchestration;
import com.google.common.base.Strings;
import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.onap.aai.domain.yang.RelatedToProperty;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
@@ -68,11 +69,39 @@ public class AAIPnfResources {
injectionHelper.getAaiClient().update(pnfURI, aaiObjectMapper.mapPnf(pnfCopy));
}
- public void checkIfPnfExistsInAaiAndCanBeUsed(String pnfName) throws Exception {
- Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai = injectionHelper.getAaiClient()
- .get(org.onap.aai.domain.yang.Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName));
+ public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception {
+ Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai =
+ injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()));
if (pnfFromAai.isPresent()) {
checkIfPnfCanBeUsed(pnfFromAai.get());
+ updatePnfInAAI(pnf, pnfFromAai.get());
+ }
+ }
+
+ private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
+ updatePnfFields(pnf, pnfFromAai);
+ injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()),
+ pnfFromAai);
+ logger.debug("updatePnfInAAI: {}", pnfFromAai);
+ }
+
+ private void updatePnfFields(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
+ if (pnf.getModelInfoPnf() != null
+ && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelCustomizationUuid())) {
+ pnfFromAai.setModelCustomizationId(pnf.getModelInfoPnf().getModelCustomizationUuid());
+ }
+ if (pnf.getModelInfoPnf() != null && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelInvariantUuid())) {
+ pnfFromAai.setModelInvariantId(pnf.getModelInfoPnf().getModelInvariantUuid());
+ }
+ if (pnf.getModelInfoPnf() != null && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelUuid())) {
+ pnfFromAai.setModelVersionId(pnf.getModelInfoPnf().getModelUuid());
+ }
+ if (pnf.getOrchestrationStatus() != null && StringUtils.isNotBlank(pnf.getOrchestrationStatus().toString())) {
+ pnfFromAai.setOrchestrationStatus(pnf.getOrchestrationStatus().toString());
+ }
+ if (StringUtils.isNotBlank(pnf.getRole())) {
+ pnfFromAai.setNfRole(pnf.getRole());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
index 4aa6a1026a..da675bb498 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
@@ -21,6 +21,7 @@
package org.onap.so.client.orchestration;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -29,7 +30,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.net.URI;
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 0123eb67be..dc59969492 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
@@ -24,6 +24,7 @@ package org.onap.so.client.orchestration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -31,7 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
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.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/SDNCServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
index 960efea2f0..54efd23bf9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
@@ -22,6 +22,7 @@ package org.onap.so.client.orchestration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.ServiceTopologyOperationMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -29,7 +30,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
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 01511eaccc..c500374dc1 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
@@ -24,6 +24,7 @@ package org.onap.so.client.orchestration;
import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -36,7 +37,6 @@ import org.onap.so.client.exception.MapperException;
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.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/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 27edeed02a..d198756b1e 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
@@ -25,6 +25,7 @@ package org.onap.so.client.orchestration;
import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -35,7 +36,6 @@ import org.onap.so.client.exception.MapperException;
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.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
deleted file mode 100644
index 7d2fc10d0b..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc;
-
-import java.util.LinkedHashMap;
-import javax.ws.rs.core.UriBuilder;
-import org.onap.so.client.BaseClient;
-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.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.ParameterizedTypeReference;
-import org.springframework.http.HttpHeaders;
-import org.springframework.stereotype.Component;
-
-@Component
-public class SDNCClient {
-
- @Autowired
- private SDNCProperties properties;
- @Autowired
- private SdnCommonTasks sdnCommonTasks;
-
- /**
- *
- * @param request - takes in a generated object from sdnc client - creates a json request string and sends it to
- * sdnc - receives and validates the linkedhashmap sent back from sdnc
- * @throws MapperException
- * @throws BadResponseException
- */
- public String post(Object request, SDNCTopology topology) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = properties.getHost() + properties.getPath() + ":" + topology.toString() + "/";
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
-
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), true);
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output =
- STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNResponse(output);
- }
-
-
- public String post(Object request, String url) throws MapperException, BadResponseException {
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
- STOClient.setTargetUrl(url);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), true);
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output =
- STOClient.post(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNResponse(output);
- }
-
- /**
- *
- * @param queryLink - takes in a link to topology that needs to be queried - creates a json request string and sends
- * it to sdnc - receives and validates the linkedhashmap sent back from sdnc *
- * @throws MapperException
- * @throws BadResponseException
- */
- public String get(String queryLink) throws MapperException, BadResponseException {
- String request = "";
- String jsonRequest = sdnCommonTasks.buildJsonRequest(request);
- String targetUrl = UriBuilder.fromUri(properties.getHost()).path(queryLink).build().toString();
- BaseClient<String, LinkedHashMap<String, Object>> STOClient = new BaseClient<>();
- STOClient.setTargetUrl(targetUrl);
- HttpHeaders httpHeader = sdnCommonTasks.getHttpHeaders(properties.getAuth(), false);
- STOClient.setHttpHeader(httpHeader);
- LinkedHashMap<String, Object> output =
- STOClient.get(jsonRequest, new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- return sdnCommonTasks.validateSDNGetResponse(output);
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
deleted file mode 100644
index 01ac675d83..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc;
-
-import java.util.ArrayList;
-import java.util.LinkedHashMap;
-import java.util.List;
-import org.onap.so.logger.LoggingAnchor;
-import org.apache.commons.lang.StringUtils;
-import org.apache.http.HttpStatus;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.exception.MapperException;
-import org.onap.logging.filter.base.ErrorCode;
-import org.onap.so.logger.MessageEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Component
-public class SdnCommonTasks {
-
- private static final Logger logger = LoggerFactory.getLogger(SDNCClient.class);
- private static final String RESPONSE_CODE = "response-code";
- private static final String RESPONSE_MESSAGE = "response-message";
- private static final String NO_RESPONSE_FROM_SDNC = "Error did not receive a response from SDNC.";
- private static final String BAD_RESPONSE_FROM_SDNC = "Error received a bad response from SDNC.";
- private static final String SDNC_CODE_NOT_0_OR_IN_200_299 = "Error from SDNC: %s";
- private static final String COULD_NOT_CONVERT_SDNC_POJO_TO_JSON =
- "ERROR: Could not convert SDNC pojo to json string.";
- private static final String BRACKETS = LoggingAnchor.FIVE;
-
- /***
- *
- * @param request
- * @return
- * @throws MapperException
- */
- public String buildJsonRequest(Object request) throws MapperException {
- String jsonRequest;
- ObjectMapper objMapper = new ObjectMapper();
- objMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
- try {
- jsonRequest = objMapper.writerWithDefaultPrettyPrinter().writeValueAsString(request);
- } catch (JsonProcessingException e) {
- logger.error(BRACKETS, MessageEnum.JAXB_EXCEPTION.toString(), COULD_NOT_CONVERT_SDNC_POJO_TO_JSON, "BPMN",
- ErrorCode.DataError.getValue(), e.getMessage());
- throw new MapperException(COULD_NOT_CONVERT_SDNC_POJO_TO_JSON);
- }
- jsonRequest = "{\"input\":" + jsonRequest + "}";
- logger.info(jsonRequest);
- return jsonRequest;
- }
-
- /***
- *
- * @param auth
- * @return
- */
- public HttpHeaders getHttpHeaders(String auth, boolean includeContentType) {
- HttpHeaders httpHeader = new HttpHeaders();
- httpHeader.set("Authorization", auth);
- if (includeContentType) {
- httpHeader.setContentType(MediaType.APPLICATION_JSON);
- }
- List<MediaType> acceptMediaTypes = new ArrayList<>();
- acceptMediaTypes.add(MediaType.APPLICATION_JSON);
- httpHeader.setAccept(acceptMediaTypes);
- return httpHeader;
- }
-
- /***
- *
- * @param output
- * @return
- * @throws BadResponseException
- */
- public String validateSDNResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
- if (CollectionUtils.isEmpty(output)) {
- logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
- throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
- }
- LinkedHashMap<String, Object> embeddedResponse = (LinkedHashMap<String, Object>) output.get("output");
- String responseCode = "";
- String responseMessage = "";
- if (embeddedResponse != null) {
- responseCode = (String) embeddedResponse.get(RESPONSE_CODE);
- responseMessage = (String) embeddedResponse.get(RESPONSE_MESSAGE);
- }
- ObjectMapper objMapper = new ObjectMapper();
- String jsonResponse;
- try {
- jsonResponse = objMapper.writeValueAsString(output);
- logger.debug(jsonResponse);
- } catch (JsonProcessingException e) {
- logger.warn("Could not convert SDNC Response to String", e);
- jsonResponse = "";
- }
- logger.info("ResponseCode: {} ResponseMessage: {}", responseCode, responseMessage);
- int code = StringUtils.isNotEmpty(responseCode) ? Integer.parseInt(responseCode) : 0;
- if (isHttpCodeSuccess(code)) {
- logger.info("Successful Response from SDNC");
- return jsonResponse;
- } else {
- String errorMessage = String.format(SDNC_CODE_NOT_0_OR_IN_200_299, responseMessage);
- logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), errorMessage, "BPMN",
- ErrorCode.DataError.getValue(), errorMessage);
- throw new BadResponseException(errorMessage);
- }
- }
-
- /***
- *
- * @param output
- * @return
- * @throws BadResponseException
- */
- public String validateSDNGetResponse(LinkedHashMap<String, Object> output) throws BadResponseException {
- if (CollectionUtils.isEmpty(output)) {
- logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), NO_RESPONSE_FROM_SDNC, "BPMN",
- ErrorCode.UnknownError.getValue(), NO_RESPONSE_FROM_SDNC);
- throw new BadResponseException(NO_RESPONSE_FROM_SDNC);
- }
- ObjectMapper objMapper = new ObjectMapper();
- logger.debug("Using object mapper");
- String stringOutput = "";
- try {
- stringOutput = objMapper.writeValueAsString(output);
- } catch (Exception e) {
- logger.error(BRACKETS, MessageEnum.RA_RESPONSE_FROM_SDNC.toString(), BAD_RESPONSE_FROM_SDNC, "BPMN",
- ErrorCode.UnknownError.getValue(), BAD_RESPONSE_FROM_SDNC);
- throw new BadResponseException(BAD_RESPONSE_FROM_SDNC);
- }
- logger.debug("Received from GET request: {}", stringOutput);
- return stringOutput;
- }
-
-
- private boolean isHttpCodeSuccess(int code) {
- return code >= HttpStatus.SC_OK && code < HttpStatus.SC_MULTIPLE_CHOICES || code == 0;
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
deleted file mode 100644
index 15076fa45a..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc.beans;
-
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConfigurationProperties(prefix = "sdnc")
-public class SDNCProperties {
-
- private String host;
- private String path;
- private String auth;
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getPath() {
- return path;
- }
-
- public void setPath(String path) {
- this.path = path;
- }
-
- public String getAuth() {
- return auth;
- }
-
- public void setAuth(String auth) {
- this.auth = auth;
- }
-}
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
deleted file mode 100644
index 2c8bdd931c..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc.beans;
-
-import java.io.Serializable;
-import java.util.UUID;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.apache.commons.lang3.builder.HashCodeBuilder;
-import org.apache.commons.lang3.builder.EqualsBuilder;
-
-public class SDNCRequest implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = 4679678988657593282L;
- private String timeOut = "PT1H";
- private SDNCTopology topology;
- private String correlationValue = UUID.randomUUID().toString();
- private String correlationName = "SDNCCallback";
- private transient Object sdncPayload;
-
-
- public String getTimeOut() {
- return timeOut;
- }
-
- public void setTimeOut(String timeOut) {
- this.timeOut = timeOut;
- }
-
- public SDNCTopology getTopology() {
- return topology;
- }
-
- public void setTopology(SDNCTopology topology) {
- this.topology = topology;
- }
-
- public String getCorrelationValue() {
- return correlationValue;
- }
-
- public void setCorrelationValue(String correlationValue) {
- this.correlationValue = correlationValue;
- }
-
- public String getCorrelationName() {
- return correlationName;
- }
-
- public void setCorrelationName(String correlationName) {
- this.correlationName = correlationName;
- }
-
- public Object getSDNCPayload() {
- return sdncPayload;
- }
-
- public void setSDNCPayload(Object sDNCPayload) {
- this.sdncPayload = sDNCPayload;
- }
-
- @Override
- public boolean equals(final Object other) {
- if (!(other instanceof SDNCRequest)) {
- return false;
- }
- SDNCRequest castOther = (SDNCRequest) other;
- return new EqualsBuilder().append(correlationValue, castOther.correlationValue)
- .append(correlationName, castOther.correlationName).isEquals();
- }
-
- @Override
- public int hashCode() {
- return new HashCodeBuilder().append(correlationValue).append(correlationName).toHashCode();
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
deleted file mode 100644
index d6216c509d..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc.beans;
-
-import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration;
-
-public enum SDNCSvcAction {
- ACTIVATE("activate", GenericResourceApiSvcActionEnumeration.ACTIVATE),
- DELETE("delete", GenericResourceApiSvcActionEnumeration.DELETE),
- ASSIGN("assign", GenericResourceApiSvcActionEnumeration.ASSIGN),
- ROLLBACK("rollback", GenericResourceApiSvcActionEnumeration.ROLLBACK),
- UNASSIGN("unassign", GenericResourceApiSvcActionEnumeration.UNASSIGN),
- DEACTIVATE("deactivate", GenericResourceApiSvcActionEnumeration.DEACTIVATE),
- CHANGE_DELETE("changedelete", GenericResourceApiSvcActionEnumeration.CHANGEDELETE),
- CHANGE_ASSIGN("changeassign", GenericResourceApiSvcActionEnumeration.CHANGEASSIGN),
- CREATE("create", GenericResourceApiSvcActionEnumeration.CREATE),
- ENABLE("enable", GenericResourceApiSvcActionEnumeration.ENABLE),
- DISABLE("disable", GenericResourceApiSvcActionEnumeration.DISABLE);
-
- private final String name;
-
- private GenericResourceApiSvcActionEnumeration sdncApiAction;
-
- private SDNCSvcAction(String name, GenericResourceApiSvcActionEnumeration sdncApiAction) {
- this.name = name;
- this.sdncApiAction = sdncApiAction;
- }
-
- public GenericResourceApiSvcActionEnumeration getSdncApiAction() {
- return this.sdncApiAction;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
deleted file mode 100644
index 4edbf37bad..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc.beans;
-
-public enum SDNCSvcOperation {
-
- VF_MODULE_TOPOLOGY_OPERATION("vf-module-topology-operation"),
- NETWORK_TOPOLOGY_OPERATION("network-topology-operation"),
- VNF_TOPOLOGY_OPERATION("vnf-topology-operation"),
- CONTRAIL_ROUTE_TOPOLOGY_OPERATION("contrail-route-topology-operation"),
- SECURITY_ZONE_TOPOLOGY_OPERATION("security-zone-topology-operation"),
- PORT_MIRROR_TOPOLOGY_OPERATION("port-mirror-topology-operation"),
- SERVICE_TOPOLOGY_OPERATION("service-topology-operation"),
- GENERIC_CONFIGURATION_TOPOLOGY_OPERATION("generic-configuration-topology-operation");
-
- private final String name;
-
- private SDNCSvcOperation(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return name;
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
deleted file mode 100644
index ae9fe6ad70..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc.endpoint;
-
-public enum SDNCTopology {
-
- SERVICE("service-topology-operation"),
- VNF("vnf-topology-operation"),
- VFMODULE("vf-module-topology-operation"),
- CONTRAILROUTE("contrail-route-topology-operation"),
- PORTMIRROR("port-mirror-topology-operation"),
- NETWORK("network-topology-operation"),
- SECURITYZONE("security-zone-topology-operation"),
- CONFIGURATION("generic-configuration-topology-operation");
-
- private final String topology;
-
- private SDNCTopology(String topology) {
- this.topology = topology;
- }
-
- @Override
- public String toString() {
- return this.topology;
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
deleted file mode 100644
index 9b857dc08c..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.Optional;
-import org.onap.so.client.dmaap.DmaapConsumer;
-import org.onap.so.client.dmaap.DmaapPublisher;
-import org.onap.so.client.sdno.beans.AAIParamList;
-import org.onap.so.client.sdno.beans.Body;
-import org.onap.so.client.sdno.beans.Input;
-import org.onap.so.client.sdno.beans.RequestHdCustom;
-import org.onap.so.client.sdno.beans.SDNO;
-import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class SDNOHealthCheckClient {
-
- private static final String NODE_TYPE = "VROUTER";
- private static final String API_OPERATION_TYPE = "health-diagnostic-custom";
- private static final String MIRRORING_CHECK = "mirroring_check";
- private static final String CLIENT_NAME = "MSO";
- private static final String PRE_CHECK_CODE = "VROUTER000003";
- private static final String POST_CHECK_CODE = "VROUTER000004";
- private static final String LPORT_MIRRORING_CHECK = "lport_mirroring_check";
- private static final String CONFIGURATION_ID = "configuration-id";
-
-
- public boolean lPortMirrorHealthPreCheck(String userId, String requestId, Optional<String> clliCode,
- String configurationId, String interfaceId) throws Exception {
- String request = buildLPortMirrorCheckPreRequest(userId, requestId, clliCode, configurationId, interfaceId);
- return this.execute(requestId, request);
- }
-
- public boolean lPortMirrorHealthPostCheck(String userId, String requestId, Optional<String> clliCode,
- String configurationId, String interfaceId) throws Exception {
- String request = buildLPortMirrorCheckPostRequest(userId, requestId, clliCode, configurationId, interfaceId);
- return this.execute(requestId, request);
- }
-
- public boolean portMirrorHealthPreCheck(String userId, String requestId, Optional<String> clliCode,
- String configurationId) throws Exception {
- final String request = this.buildPortMirrorPreCheckRequest(userId, requestId, clliCode, configurationId);
- return this.execute(requestId, request);
- }
-
- public boolean portMirrorHealthPostCheck(String userId, String requestId, Optional<String> clliCode,
- String configurationId) throws Exception {
- final String request = this.buildPortMirrorPostCheckRequest(userId, requestId, clliCode, configurationId);
- return this.execute(requestId, request);
- }
-
- protected String buildLPortMirrorCheckPreRequest(String userId, String requestId, Optional<String> clliCode,
- String configurationId, String interfaceId) throws JsonProcessingException {
- return this.buildLPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, interfaceId,
- PRE_CHECK_CODE);
- }
-
- protected String buildLPortMirrorCheckPostRequest(String userId, String requestId, Optional<String> clliCode,
- String configurationId, String interfaceId) throws JsonProcessingException {
- return this.buildLPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, interfaceId,
- POST_CHECK_CODE);
- }
-
- protected String buildPortMirrorPreCheckRequest(String userId, String requestId, Optional<String> clliCode,
- String configurationId) throws JsonProcessingException {
- return this.buildPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, PRE_CHECK_CODE);
- }
-
- protected String buildPortMirrorPostCheckRequest(String userId, String requestId, Optional<String> clliCode,
- String configurationId) throws JsonProcessingException {
- return this.buildPortMirrorCheckRequest(userId, requestId, clliCode, configurationId, POST_CHECK_CODE);
- }
-
- protected String buildPortMirrorCheckRequest(String userId, String requestId, Optional<String> clliCode,
- String configurationId, String diagnosticCode) throws JsonProcessingException {
- final AAIParamList list = new AAIParamList();
- list.setKey(CONFIGURATION_ID);
- list.setValue(configurationId);
-
- return this.buildRequest(userId, requestId, clliCode, diagnosticCode, MIRRORING_CHECK,
- Collections.singletonList(list));
- }
-
- protected String buildLPortMirrorCheckRequest(String userId, String requestId, Optional<String> clliCode,
- String configurationId, String interfaceId, String diagnosticCode) throws JsonProcessingException {
-
- final AAIParamList configurationIdParam = new AAIParamList();
- configurationIdParam.setKey(CONFIGURATION_ID);
- configurationIdParam.setValue(configurationId);
- final AAIParamList interfaceIdParam = new AAIParamList();
- interfaceIdParam.setKey("interface-id");
- interfaceIdParam.setValue(interfaceId);
- final List<AAIParamList> list = new ArrayList<>();
- list.add(configurationIdParam);
- list.add(interfaceIdParam);
- return this.buildRequest(userId, requestId, clliCode, diagnosticCode, LPORT_MIRRORING_CHECK, list);
- }
-
-
- protected String buildRequest(String userId, String requestId, Optional<String> clliCode, String diagnosticCode,
- String operationType, List<AAIParamList> paramList) throws JsonProcessingException {
-
- final RequestHdCustom hdCustom = new RequestHdCustom();
- hdCustom.withRequestUserId(userId).withRequestId(requestId).withRequestClientName(CLIENT_NAME)
- .withHealthDiagnosticCode(diagnosticCode).withOperationType(operationType).withAaiParamList(paramList);
-
- final Input input = new Input();
- input.setRequestHdCustom(hdCustom);
- final Body body = new Body();
- body.setInput(input);
- final SDNO request = new SDNO();
- request.withBody(body).withOperation(API_OPERATION_TYPE).withNodeType(NODE_TYPE);
- if (clliCode.isPresent()) {
- request.setNodeLoc(clliCode.get());
- }
- return this.getJson(request);
-
- }
-
- protected String getJson(SDNO obj) throws JsonProcessingException {
- final ObjectMapper mapper = new ObjectMapper();
- return mapper.writeValueAsString(obj);
- }
-
- protected DmaapPublisher getPublisher() throws FileNotFoundException, IOException {
- return new SDNOHealthCheckDmaapPublisher();
- }
-
- protected DmaapConsumer getConsumer(String requestId) throws FileNotFoundException, IOException {
- return new SDNOHealthCheckDmaapConsumer(requestId);
- }
-
- protected boolean execute(String requestId, String request) throws Exception {
- final DmaapPublisher publisher = this.getPublisher();
- publisher.send(request);
-
- final DmaapConsumer consumer = this.getConsumer(requestId);
-
- return consumer.consume();
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
deleted file mode 100644
index 83624dec63..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno;
-
-import java.io.IOException;
-import java.util.UUID;
-import org.onap.aai.domain.yang.GenericVnf;
-
-public interface SDNOValidator {
-
- /**
- * Issues a health diagnostic request for a given vnf to SDN-O
- *
- * @param vnfId
- * @param uuid
- * @param requestingUserId
- * @return diagnostic result
- * @throws IOException
- * @throws Exception
- */
- public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
-
-
- /**
- * Issues a health diagnostic request for a given GenericVnf to SDN-O
- *
- * @param genericVnf
- * @param uuid
- * @param requestingUserId
- * @return diagnostic result
- * @throws IOException
- * @throws Exception
- */
- public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId)
- throws IOException, Exception;
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
deleted file mode 100644
index 9fc95a6f3f..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Optional;
-import java.util.UUID;
-import javax.ws.rs.NotFoundException;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.AAIResourcesClient;
-import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
-import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.dmaap.DmaapConsumer;
-import org.onap.so.client.dmaap.DmaapPublisher;
-import org.onap.so.client.sdno.beans.Body;
-import org.onap.so.client.sdno.beans.Input;
-import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
-import org.onap.so.client.sdno.beans.SDNO;
-import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapPublisher;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class SDNOValidatorImpl implements SDNOValidator {
-
- private final static String clientName = "MSO";
- private final static String HEALTH_DIAGNOSTIC_CODE_DEFAULT = "default";
-
- @Override
- public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception {
-
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
- AAIResourcesClient client = new AAIResourcesClient();
- GenericVnf vnf = client.get(GenericVnf.class, uri)
- .orElseThrow(() -> new NotFoundException(vnfId + " not found in A&AI"));
-
- SDNO requestDiagnostic = buildRequestDiagnostic(vnf, uuid, requestingUserId);
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(requestDiagnostic);
- this.submitRequest(json);
- boolean status = this.pollForResponse(uuid.toString());
- return status;
- }
-
- @Override
- public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId)
- throws IOException, Exception {
-
- SDNO requestDiagnostic = buildRequestDiagnostic(genericVnf, uuid, requestingUserId);
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(requestDiagnostic);
- this.submitRequest(json);
- boolean status = this.pollForResponse(uuid.toString());
- return status;
- }
-
- protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) {
-
- Optional<String> nfRole;
- if (vnf.getNfRole() == null) {
- nfRole = Optional.empty();
- } else {
- nfRole = Optional.of(vnf.getNfRole());
- }
- Input input = new Input();
- SDNO parentRequest = new SDNO();
- Body body = new Body();
- parentRequest.setBody(body);
- parentRequest.setNodeType(nfRole.orElse("NONE").toUpperCase());
- parentRequest.setOperation("health-diagnostic");
-
- body.setInput(input);
-
- RequestHealthDiagnostic request = new RequestHealthDiagnostic();
-
- request.setRequestClientName(clientName);
- request.setRequestNodeName(vnf.getVnfName());
- request.setRequestNodeUuid(vnf.getVnfId());
- request.setRequestNodeType(nfRole.orElse("NONE").toUpperCase());
- request.setRequestNodeIp(vnf.getIpv4OamAddress()); // generic-vnf oam ip
- request.setRequestUserId(requestingUserId); // mech id?
- request.setRequestId(uuid.toString()); // something to identify this request by for polling
- request.setHealthDiagnosticCode(HEALTH_DIAGNOSTIC_CODE_DEFAULT);
-
- input.setRequestHealthDiagnostic(request);
-
- return parentRequest;
- }
-
- protected void submitRequest(String json) throws FileNotFoundException, IOException, InterruptedException {
-
- DmaapPublisher publisher = new SDNOHealthCheckDmaapPublisher();
- publisher.send(json);
- }
-
- protected boolean pollForResponse(String uuid) throws Exception {
- DmaapConsumer consumer = this.getConsumer(uuid);
- return consumer.consume();
- }
-
-
-
- protected DmaapConsumer getConsumer(String uuid) throws FileNotFoundException, IOException {
- return new SDNOHealthCheckDmaapConsumer(uuid);
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
deleted file mode 100644
index 7e98355b4d..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"key", "value"})
-public class AAIParamList {
-
- @JsonProperty("key")
- private String key;
- @JsonProperty("value")
- private String value;
-
- /**
- * No args constructor for use in serialization
- *
- */
- public AAIParamList() {}
-
- /**
- *
- * @param value
- * @param key
- */
- public AAIParamList(String key, String value) {
- super();
- this.key = key;
- this.value = value;
- }
-
- @JsonProperty("key")
- public String getKey() {
- return key;
- }
-
- @JsonProperty("key")
- public void setKey(String key) {
- this.key = key;
- }
-
- public AAIParamList withKey(String key) {
- this.key = key;
- return this;
- }
-
- @JsonProperty("value")
- public String getValue() {
- return value;
- }
-
- @JsonProperty("value")
- public void setValue(String value) {
- this.value = value;
- }
-
- public AAIParamList withValue(String value) {
- this.value = value;
- return this;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java
deleted file mode 100644
index 8c40b749a6..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"input"})
-public class Body implements Serializable {
-
- @JsonProperty("input")
- private Input input;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
- private static final long serialVersionUID = 9101706044452851559L;
-
- @JsonProperty("input")
- public Input getInput() {
- return input;
- }
-
- @JsonProperty("input")
- public void setInput(Input input) {
- this.input = input;
- }
-
- public Body withInput(Input input) {
- this.input = input;
- return this;
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
- }
-
- public Body withAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- return this;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java
deleted file mode 100644
index c8122c06f6..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"request-healthdiagnostic", "request-hd-custom"})
-public class Input implements Serializable {
-
- @JsonProperty("request-healthdiagnostic")
- private RequestHealthDiagnostic RequestHealthDiagnostic;
- @JsonProperty("request-hd-custom")
- private RequestHdCustom requestHdCustom;
-
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
- private final static long serialVersionUID = 7155546785389227528L;
-
- @JsonProperty("request-healthdiagnostic")
- public RequestHealthDiagnostic getRequestHealthDiagnostic() {
- return RequestHealthDiagnostic;
- }
-
- @JsonProperty("request-healthdiagnostic")
- public void setRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) {
- this.RequestHealthDiagnostic = RequestHealthDiagnostic;
- }
-
- @JsonProperty("request-hd-custom")
- public RequestHdCustom getRequestHdCustom() {
- return requestHdCustom;
- }
-
- @JsonProperty("request-hd-custom")
- public void setRequestHdCustom(RequestHdCustom requestHdCustom) {
- this.requestHdCustom = requestHdCustom;
- }
-
- public Input withRequestHealthDiagnostic(RequestHealthDiagnostic RequestHealthDiagnostic) {
- this.RequestHealthDiagnostic = RequestHealthDiagnostic;
- return this;
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
- }
-
- public Input withAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- return this;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
deleted file mode 100644
index 485f64673f..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"request-client-name", "request-user-id", "request-id", "health-diagnostic-code", "operation-type",
- "send-detailed-cmd-response", "aai-param-list"})
-public class RequestHdCustom implements Serializable {
-
- /**
- *
- */
- private static final long serialVersionUID = -206110458275127710L;
- @JsonProperty("request-client-name")
- private String requestClientName;
- @JsonProperty("request-user-id")
- private String requestUserId;
- @JsonProperty("request-id")
- private String requestId;
- @JsonProperty("health-diagnostic-code")
- private String healthDiagnosticCode;
- @JsonProperty("operation-type")
- private String operationType;
- @JsonProperty("send-detailed-cmd-response")
- private String sendDetailedCmdResponse = "false";
- @JsonProperty("aai-param-list")
- private List<AAIParamList> aaiParamList = new ArrayList<>();
-
- /**
- * No args constructor for use in serialization
- *
- */
- public RequestHdCustom() {}
-
- /**
- *
- * @param requestClientName
- * @param operationType
- * @param requestId
- * @param healthDiagnosticCode
- * @param aaiParamList
- * @param requestUserId
- */
- public RequestHdCustom(String requestClientName, String requestUserId, String requestId,
- String healthDiagnosticCode, String operationType, List<AAIParamList> aaiParamList) {
- super();
- this.requestClientName = requestClientName;
- this.requestUserId = requestUserId;
- this.requestId = requestId;
- this.healthDiagnosticCode = healthDiagnosticCode;
- this.operationType = operationType;
- this.aaiParamList = aaiParamList;
- }
-
- @JsonProperty("request-client-name")
- public String getRequestClientName() {
- return requestClientName;
- }
-
- @JsonProperty("request-client-name")
- public void setRequestClientName(String requestClientName) {
- this.requestClientName = requestClientName;
- }
-
- public RequestHdCustom withRequestClientName(String requestClientName) {
- this.requestClientName = requestClientName;
- return this;
- }
-
- @JsonProperty("request-user-id")
- public String getRequestUserId() {
- return requestUserId;
- }
-
- @JsonProperty("request-user-id")
- public void setRequestUserId(String requestUserId) {
- this.requestUserId = requestUserId;
- }
-
- public RequestHdCustom withRequestUserId(String requestUserId) {
- this.requestUserId = requestUserId;
- return this;
- }
-
- @JsonProperty("request-id")
- public String getRequestId() {
- return requestId;
- }
-
- @JsonProperty("request-id")
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public RequestHdCustom withRequestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
- @JsonProperty("health-diagnostic-code")
- public String getHealthDiagnosticCode() {
- return healthDiagnosticCode;
- }
-
- @JsonProperty("health-diagnostic-code")
- public void setHealthDiagnosticCode(String healthDiagnosticCode) {
- this.healthDiagnosticCode = healthDiagnosticCode;
- }
-
- public RequestHdCustom withHealthDiagnosticCode(String healthDiagnosticCode) {
- this.healthDiagnosticCode = healthDiagnosticCode;
- return this;
- }
-
- @JsonProperty("operation-type")
- public String getOperationType() {
- return operationType;
- }
-
- @JsonProperty("operation-type")
- public void setOperationType(String operationType) {
- this.operationType = operationType;
- }
-
- public RequestHdCustom withOperationType(String operationType) {
- this.operationType = operationType;
- return this;
- }
-
- public void setSendDetailedCmdResponse(String sendDetailedCmdResponse) {
- this.sendDetailedCmdResponse = sendDetailedCmdResponse;
- }
-
- public String getSendDetailedCmdResponse() {
- return sendDetailedCmdResponse;
- }
-
- public RequestHdCustom withSendDetailedCmdResponse(String sendDetailedCmdResponse) {
- this.sendDetailedCmdResponse = sendDetailedCmdResponse;
- return this;
- }
-
- @JsonProperty("aai-param-list")
- public List<AAIParamList> getAaiParamList() {
- return aaiParamList;
- }
-
- @JsonProperty("aai-param-list")
- public void setAaiParamList(List<AAIParamList> aaiParamList) {
- this.aaiParamList = aaiParamList;
- }
-
- public RequestHdCustom withAaiParamList(List<AAIParamList> aaiParamList) {
- this.aaiParamList = aaiParamList;
- return this;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
deleted file mode 100644
index b1b75ab412..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"request-client-name", "request-node-name", "request-node-uuid", "request-node-ip", "request-id",
- "request-user-id", "request-node-type", "health-diagnostic-code"})
-public class RequestHealthDiagnostic implements Serializable {
-
- @JsonProperty("request-client-name")
- private String requestClientName;
- @JsonProperty("request-node-name")
- private String requestNodeName;
- @JsonProperty("request-node-uuid")
- private String requestNodeUuid;
- @JsonProperty("request-node-ip")
- private String requestNodeIp;
- @JsonProperty("request-id")
- private String requestId;
- @JsonProperty("request-user-id")
- private String requestUserId;
- @JsonProperty("request-node-type")
- private String requestNodeType;
- @JsonProperty("health-diagnostic-code")
- private String healthDiagnosticCode;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
- private static final long serialVersionUID = 1166788526178388021L;
-
- @JsonProperty("request-client-name")
- public String getRequestClientName() {
- return requestClientName;
- }
-
- @JsonProperty("request-client-name")
- public void setRequestClientName(String requestClientName) {
- this.requestClientName = requestClientName;
- }
-
- public RequestHealthDiagnostic withRequestClientName(String requestClientName) {
- this.requestClientName = requestClientName;
- return this;
- }
-
- @JsonProperty("request-node-name")
- public String getRequestNodeName() {
- return requestNodeName;
- }
-
- @JsonProperty("request-node-name")
- public void setRequestNodeName(String requestNodeName) {
- this.requestNodeName = requestNodeName;
- }
-
- public RequestHealthDiagnostic withRequestNodeName(String requestNodeName) {
- this.requestNodeName = requestNodeName;
- return this;
- }
-
- @JsonProperty("request-node-uuid")
- public String getRequestNodeUuid() {
- return requestNodeUuid;
- }
-
- @JsonProperty("request-node-uuid")
- public void setRequestNodeUuid(String requestNodeUuid) {
- this.requestNodeUuid = requestNodeUuid;
- }
-
- public RequestHealthDiagnostic withRequestNodeUuid(String requestNodeUuid) {
- this.requestNodeUuid = requestNodeUuid;
- return this;
- }
-
- @JsonProperty("request-node-ip")
- public String getRequestNodeIp() {
- return requestNodeIp;
- }
-
- @JsonProperty("request-node-ip")
- public void setRequestNodeIp(String requestNodeIp) {
- this.requestNodeIp = requestNodeIp;
- }
-
- public RequestHealthDiagnostic withRequestNodeIp(String requestNodeIp) {
- this.requestNodeIp = requestNodeIp;
- return this;
- }
-
- @JsonProperty("request-id")
- public String getRequestId() {
- return requestId;
- }
-
- @JsonProperty("request-id")
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public RequestHealthDiagnostic withRequestId(String requestId) {
- this.requestId = requestId;
- return this;
- }
-
- @JsonProperty("request-user-id")
- public String getRequestUserId() {
- return requestUserId;
- }
-
- @JsonProperty("request-user-id")
- public void setRequestUserId(String requestUserId) {
- this.requestUserId = requestUserId;
- }
-
- public RequestHealthDiagnostic withRequestUserId(String requestUserId) {
- this.requestUserId = requestUserId;
- return this;
- }
-
- @JsonProperty("request-node-type")
- public String getRequestNodeType() {
- return requestNodeType;
- }
-
- @JsonProperty("request-node-type")
- public void setRequestNodeType(String requestNodeType) {
- this.requestNodeType = requestNodeType;
- }
-
- public RequestHealthDiagnostic withRequestNodeType(String requestNodeType) {
- this.requestNodeType = requestNodeType;
- return this;
- }
-
- @JsonProperty("health-diagnostic-code")
- public String getHealthDiagnosticCode() {
- return healthDiagnosticCode;
- }
-
- @JsonProperty("health-diagnostic-code")
- public void setHealthDiagnosticCode(String healthDiagnosticCode) {
- this.healthDiagnosticCode = healthDiagnosticCode;
- }
-
- public RequestHealthDiagnostic withHealthDiagnosticCode(String healthDiagnosticCode) {
- this.healthDiagnosticCode = healthDiagnosticCode;
- return this;
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
- }
-
- public RequestHealthDiagnostic withAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- return this;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
deleted file mode 100644
index 8b84cf6659..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"client-name", "code", "processing-host", "request-id", "status"})
-public class ResultInfo {
-
- @JsonProperty("client-name")
- private String clientName;
- @JsonProperty("code")
- private String code;
- @JsonProperty("processing-host")
- private String processingHost;
- @JsonProperty("request-id")
- private String requestId;
- @JsonProperty("status")
- private String status;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
-
- @JsonProperty("client-name")
- public String getClientName() {
- return clientName;
- }
-
- @JsonProperty("client-name")
- public void setClientName(String clientName) {
- this.clientName = clientName;
- }
-
- @JsonProperty("code")
- public String getCode() {
- return code;
- }
-
- @JsonProperty("code")
- public void setCode(String code) {
- this.code = code;
- }
-
- @JsonProperty("processing-host")
- public String getProcessingHost() {
- return processingHost;
- }
-
- @JsonProperty("processing-host")
- public void setProcessingHost(String processingHost) {
- this.processingHost = processingHost;
- }
-
- @JsonProperty("request-id")
- public String getRequestId() {
- return requestId;
- }
-
- @JsonProperty("request-id")
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- @JsonProperty("status")
- public String getStatus() {
- return status;
- }
-
- @JsonProperty("status")
- public void setStatus(String status) {
- this.status = status;
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
deleted file mode 100644
index 46e2c1d1fc..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno.beans;
-
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.Map;
-import com.fasterxml.jackson.annotation.JsonAnyGetter;
-import com.fasterxml.jackson.annotation.JsonAnySetter;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-
-@JsonInclude(JsonInclude.Include.NON_NULL)
-@JsonPropertyOrder({"operation", "nodeLoc", "nodeType", "body"})
-public class SDNO implements Serializable {
-
- @JsonProperty("operation")
- private String operation;
- @JsonProperty("nodeLoc")
- private String nodeLoc;
- @JsonProperty("nodeType")
- private String nodeType;
- @JsonProperty("body")
- private Body body;
- @JsonIgnore
- private Map<String, Object> additionalProperties = new HashMap<>();
- private static final long serialVersionUID = -5303297382564282650L;
-
- @JsonProperty("operation")
- public String getOperation() {
- return operation;
- }
-
- @JsonProperty("operation")
- public void setOperation(String operation) {
- this.operation = operation;
- }
-
- @JsonProperty("nodeLoc")
- public String getNodeLoc() {
- return nodeLoc;
- }
-
- @JsonProperty("nodeLoc")
- public void setNodeLoc(String nodeLoc) {
- this.nodeLoc = nodeLoc;
- }
-
- public SDNO withNodeLoc(String nodeLoc) {
- this.nodeLoc = nodeLoc;
- return this;
- }
-
- public SDNO withOperation(String operation) {
- this.operation = operation;
- return this;
- }
-
- @JsonProperty("nodeType")
- public String getNodeType() {
- return nodeType;
- }
-
- @JsonProperty("nodeType")
- public void setNodeType(String nodeType) {
- this.nodeType = nodeType;
- }
-
- public SDNO withNodeType(String nodeType) {
- this.nodeType = nodeType;
- return this;
- }
-
- @JsonProperty("body")
- public Body getBody() {
- return body;
- }
-
- @JsonProperty("body")
- public void setBody(Body body) {
- this.body = body;
- }
-
- public SDNO withBody(Body body) {
- this.body = body;
- return this;
- }
-
- @JsonAnyGetter
- public Map<String, Object> getAdditionalProperties() {
- return this.additionalProperties;
- }
-
- @JsonAnySetter
- public void setAdditionalProperty(String name, Object value) {
- this.additionalProperties.put(name, value);
- }
-
- public void setAdditionalProperties(Map<String, Object> map) {
- this.additionalProperties = map;
- }
-
- public SDNO SDNO(String name, Object value) {
- this.additionalProperties.put(name, value);
- return this;
- }
-
-}
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
deleted file mode 100644
index c63cbc0b68..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ /dev/null
@@ -1,118 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro;
-
-import java.util.LinkedHashMap;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.client.BaseClient;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.sniro.beans.ManagerProperties;
-import org.onap.so.client.sniro.beans.SniroConductorRequest;
-import org.onap.so.client.sniro.beans.SniroManagerRequest;
-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;
-import org.springframework.http.MediaType;
-import org.springframework.stereotype.Component;
-
-
-@Component
-public class SniroClient {
-
- private static final Logger logger = LoggerFactory.getLogger(SniroClient.class);
-
- @Autowired
- private ManagerProperties managerProperties;
-
- @Autowired
- private SniroValidator validator;
-
-
- /**
- * Makes a rest call to sniro manager to perform homing and licensing for a list of demands
- *
- * @param homingRequest
- * @return
- * @throws BadResponseException
- * @throws BpmnError
- */
- public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException {
- logger.trace("Started Sniro Client Post Demands");
- String url = managerProperties.getHost() + managerProperties.getUri().get("v2");
- logger.debug("Post demands url: {}", url);
- logger.debug("Post demands payload: {}", homingRequest.toJsonString());
-
- HttpHeaders header = new HttpHeaders();
- header.setContentType(MediaType.APPLICATION_JSON);
- header.set("Authorization", managerProperties.getHeaders().get("auth"));
- header.set("X-patchVersion", managerProperties.getHeaders().get("patchVersion"));
- header.set("X-minorVersion", managerProperties.getHeaders().get("minorVersion"));
- header.set("X-latestVersion", managerProperties.getHeaders().get("latestVersion"));
- BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<String, Object> response = baseClient.post(homingRequest.toJsonString(),
- new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- validator.validateDemandsResponse(response);
- logger.trace("Completed Sniro Client Post Demands");
- }
-
- /**
- * Makes a rest call to sniro conductor to notify them of successful or unsuccessful vnf creation for previously
- * homed resources
- *
- * TODO Temporarily being used in groovy therefore can not utilize autowire. Once java "release" subflow is
- * developed it will be refactored to use autowire.
- *
- * @param releaseRequest
- * @return
- * @throws BadResponseException
- */
- public void postRelease(SniroConductorRequest releaseRequest) throws BadResponseException {
- logger.trace("Started Sniro Client Post Release");
- String url = UrnPropertiesReader.getVariable("sniro.conductor.host")
- + UrnPropertiesReader.getVariable("sniro.conductor.uri");
- logger.debug("Post release url: {}", url);
- logger.debug("Post release payload: {}", releaseRequest.toJsonString());
-
- HttpHeaders header = new HttpHeaders();
- header.setContentType(MediaType.APPLICATION_JSON);
- header.set("Authorization", UrnPropertiesReader.getVariable("sniro.conductor.headers.auth"));
- BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
-
- baseClient.setTargetUrl(url);
- baseClient.setHttpHeader(header);
-
- LinkedHashMap<String, Object> response = baseClient.post(releaseRequest.toJsonString(),
- new ParameterizedTypeReference<LinkedHashMap<String, Object>>() {});
- SniroValidator v = new SniroValidator();
- v.validateReleaseResponse(response);
- logger.trace("Completed Sniro Client Post Release");
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
deleted file mode 100644
index eb73001f42..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro;
-
-
-import static org.apache.commons.lang.StringUtils.*;
-import java.util.LinkedHashMap;
-import org.json.JSONObject;
-import org.onap.so.client.exception.BadResponseException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-
-
-
-@Component
-public class SniroValidator {
-
- private static final Logger logger = LoggerFactory.getLogger(SniroValidator.class);
-
- /**
- * Validates the synchronous homing response from sniro manager
- *
- * @throws BadResponseException
- */
- public void validateDemandsResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
- logger.debug("Validating Sniro Managers synchronous response");
- if (!response.isEmpty()) {
- JSONObject jsonResponse = new JSONObject(response);
- if (jsonResponse.has("requestStatus")) {
- String status = jsonResponse.getString("requestStatus");
- if ("accepted".equals(status)) {
- logger.debug("Sniro Managers synchronous response indicates accepted");
- } else {
- String message = jsonResponse.getString("statusMessage");
- if (isNotBlank(message)) {
- logger.debug("Sniro Managers response indicates failed: " + message);
- } else {
- logger.debug("Sniro Managers response indicates failed: no status message provided");
- message = "error message not provided";
- }
- throw new BadResponseException("Sniro Managers synchronous response indicates failed: " + message);
- }
- } else {
- logger.debug("Sniro Managers synchronous response does not contain: request status");
- throw new BadResponseException("Sniro Managers synchronous response does not contain: request status");
- }
- } else {
- logger.debug("Sniro Managers synchronous response is empty");
- throw new BadResponseException("Sniro Managers synchronous response i is empty");
- }
- }
-
- /**
- * Validates the asynchronous/callback response from sniro manager which contains the homing and licensing solutions
- *
- * @throws BadResponseException
- */
- public static void validateSolution(String response) throws BadResponseException {
- logger.debug("Validating Sniro Managers asynchronous callback response");
- if (isNotBlank(response)) {
- JSONObject jsonResponse = new JSONObject(response);
- if (!jsonResponse.has("serviceException")) {
- logger.debug("Sniro Managers asynchronous response is valid");
- } else {
- String message = jsonResponse.getJSONObject("serviceException").getString("text");
- if (isNotBlank(message)) {
- logger.debug("Sniro Managers response contains a service exception: " + message);
- } else {
- logger.debug(
- "Sniro Managers response contains a service exception: no service exception text provided");
- message = "error message not provided";
- }
- throw new BadResponseException(
- "Sniro Managers asynchronous response contains a service exception: " + message);
- }
- } else {
- logger.debug("Sniro Managers asynchronous response is empty");
- throw new BadResponseException("Sniro Managers asynchronous response is empty");
- }
- }
-
-
- /**
- * Validates the release response from sniro conductor
- *
- * @throws BadResponseException
- */
- public void validateReleaseResponse(LinkedHashMap<String, Object> response) throws BadResponseException {
- logger.debug("Validating Sniro Conductors response");
- if (!response.isEmpty()) {
- String status = (String) response.get("status");
- if (isNotBlank(status)) {
- if ("success".equals(status)) {
- logger.debug("Sniro Conductors synchronous response indicates success");
- } else {
- String message = (String) response.get("message");
- if (isNotBlank(message)) {
- logger.debug("Sniro Conductors response indicates failed: " + message);
- } else {
- logger.debug("Sniro Conductors response indicates failed: error message not provided");
- message = "error message not provided";
- }
- throw new BadResponseException(
- "Sniro Conductors synchronous response indicates failed: " + message);
- }
- } else {
- logger.debug("Sniro Managers Conductors response does not contain: status");
- throw new BadResponseException("Sniro Conductors synchronous response does not contain: status");
- }
- } else {
- logger.debug("Sniro Conductors response is empty");
- throw new BadResponseException("Sniro Conductors response is empty");
- }
-
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
deleted file mode 100644
index 3127275b24..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import java.util.List;
-import org.onap.so.bpmn.servicedecomposition.homingobjects.CandidateType;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class Candidate implements Serializable {
-
- private static final long serialVersionUID = -5474502255533410907L;
-
- @JsonProperty("identifierType")
- private CandidateType identifierType;
- @JsonProperty("identifiers")
- private List<String> identifiers;
- @JsonProperty("cloudOwner")
- private String cloudOwner;
-
- public Candidate() {}
-
- public Candidate(CandidateType identifierType, List<String> identifiers, String cloudOwner) {
- this.identifierType = identifierType;
- this.identifiers = identifiers;
- this.cloudOwner = cloudOwner;
- }
-
- public CandidateType getIdentifierType() {
- return identifierType;
- }
-
- public void setIdentifierType(CandidateType identifierType) {
- this.identifierType = identifierType;
- }
-
- public List<String> getIdentifiers() {
- return identifiers;
- }
-
- public void setIdentifiers(List<String> identifiers) {
- this.identifiers = identifiers;
- }
-
- public String getCloudOwner() {
- return cloudOwner;
- }
-
- public void setCloudOwner(String cloudOwner) {
- this.cloudOwner = cloudOwner;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
deleted file mode 100644
index 9ac8727a0f..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.util.Map;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConfigurationProperties(prefix = "sniro.conductor")
-public class ConductorProperties {
-
- private String host;
- private String uri;
-
- private Map<String, String> headers;
-
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public String getUri() {
- return uri;
- }
-
- public void setUri(String uri) {
- this.uri = uri;
- }
-
- public Map<String, String> getHeaders() {
- return headers;
- }
-
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
deleted file mode 100644
index 0cc993560d..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class Demand implements Serializable {
-
- private static final long serialVersionUID = 5676094538091859816L;
-
- @JsonProperty("serviceResourceId")
- private String serviceResourceId;
- @JsonProperty("resourceModuleName")
- private String resourceModuleName;
- @JsonProperty("resourceModelInfo")
- private ModelInfo modelInfo;
- @JsonProperty("requiredCandidates")
- private List<Candidate> requiredCandidates;
- @JsonProperty("excludedCandidates")
- private List<Candidate> excludedCandidates;
- @JsonProperty("existingCandidates")
- private List<Candidate> existingCandidates;
- @JsonProperty("filteringAttributes")
- private List<Candidate> filteringAttributes;
-
-
- public List<Candidate> getRequiredCandidates() {
- return requiredCandidates;
- }
-
- public void setRequiredCandidates(List<Candidate> requiredCandidates) {
- this.requiredCandidates = requiredCandidates;
- }
-
- public List<Candidate> getExcludedCandidates() {
- return excludedCandidates;
- }
-
- public void setExcludedCandidates(List<Candidate> excludedCandidates) {
- this.excludedCandidates = excludedCandidates;
- }
-
- public String getServiceResourceId() {
- return serviceResourceId;
- }
-
- public void setServiceResourceId(String serviceResourceId) {
- this.serviceResourceId = serviceResourceId;
- }
-
- public String getResourceModuleName() {
- return resourceModuleName;
- }
-
- public void setResourceModuleName(String resourceModuleName) {
- this.resourceModuleName = resourceModuleName;
- }
-
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
- public List<Candidate> getExistingCandidates() {
- return existingCandidates;
- }
-
- public void setExistingCandidates(List<Candidate> existingCandidates) {
- this.existingCandidates = existingCandidates;
- }
-
- public List<Candidate> getFilteringAttributes() {
- return filteringAttributes;
- }
-
- public void setFilteringAttributes(List<Candidate> filteringAttributes) {
- this.filteringAttributes = filteringAttributes;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
deleted file mode 100644
index 9ab3ae673a..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class LicenseInfo implements Serializable {
-
- private static final long serialVersionUID = 6878164369491185856L;
-
- @JsonProperty("licenseDemands")
- private List<Demand> demands = new ArrayList<>();
-
-
- public List<Demand> getDemands() {
- return demands;
- }
-
- public void setDemands(List<Demand> demands) {
- this.demands = demands;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
deleted file mode 100644
index 70b1a37b5e..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.util.Map;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.context.annotation.Configuration;
-
-@Configuration
-@ConfigurationProperties(prefix = "sniro.manager")
-public class ManagerProperties {
-
- private String host;
- private Map<String, String> uri;
- private Map<String, String> headers;
-
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
- }
-
- public Map<String, String> getUri() {
- return uri;
- }
-
- public void setUri(Map<String, String> uri) {
- this.uri = uri;
- }
-
- public Map<String, String> getHeaders() {
- return headers;
- }
-
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
deleted file mode 100644
index 6c1932e344..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-@JsonPropertyOrder({"modelName", "modelVersionId", "modelVersion", "modelInvariantId"})
-@JsonRootName("modelInfo")
-public class ModelInfo implements Serializable {
-
- private static final long serialVersionUID = 1488642558601651075L;
-
- @JsonProperty("modelInvariantId")
- private String modelInvariantId;
- @JsonProperty("modelVersionId")
- private String modelVersionId;
- @JsonProperty("modelName")
- private String modelName;
- @JsonProperty("modelVersion")
- private String modelVersion;
-
-
- public String getModelInvariantId() {
- return modelInvariantId;
- }
-
- public void setModelInvariantId(String modelInvariantId) {
- this.modelInvariantId = modelInvariantId;
- }
-
- public String getModelVersionId() {
- return modelVersionId;
- }
-
- public void setModelVersionId(String modelVersionId) {
- this.modelVersionId = modelVersionId;
- }
-
- public String getModelName() {
- return modelName;
- }
-
- public void setModelName(String modelName) {
- this.modelName = modelName;
- }
-
- public String getModelVersion() {
- return modelVersion;
- }
-
- public void setModelVersion(String modelVersion) {
- this.modelVersion = modelVersion;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
deleted file mode 100644
index bbbbf9cfd6..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRawValue;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-@JsonPropertyOrder({"subscriberInfo", "placementDemands", "requestParameters"})
-@JsonRootName("placementInfo")
-public class PlacementInfo implements Serializable {
-
- private static final long serialVersionUID = -964488472247386556L;
-
- @JsonProperty("subscriberInfo")
- private SubscriberInfo subscriberInfo;
- @JsonProperty("placementDemands")
- private List<Demand> demands = new ArrayList<>();
- @JsonRawValue
- @JsonProperty("requestParameters")
- private String requestParameters;
-
-
- public SubscriberInfo getSubscriberInfo() {
- return subscriberInfo;
- }
-
- public void setSubscriberInfo(SubscriberInfo subscriberInfo) {
- this.subscriberInfo = subscriberInfo;
- }
-
- public List<Demand> getDemands() {
- return demands;
- }
-
- public void setDemands(List<Demand> demands) {
- this.demands = demands;
- }
-
- public String getRequestParameters() {
- return requestParameters;
- }
-
- public void setRequestParameters(String requestParameters) {
- this.requestParameters = requestParameters;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
deleted file mode 100644
index fc6aec7d14..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-
-@JsonRootName("requestInfo")
-public class RequestInfo implements Serializable {
-
- private static final long serialVersionUID = -759180997599143791L;
-
- @JsonProperty("transactionId")
- String transactionId;
- @JsonProperty("requestId")
- String requestId;
- @JsonProperty("callbackUrl")
- String callbackUrl;
- @JsonProperty("sourceId")
- String sourceId = "mso";
- @JsonProperty("requestType")
- String requestType;
- @JsonProperty("timeout")
- long timeout;
-
- public String getTransactionId() {
- return transactionId;
- }
-
- public void setTransactionId(String transactionId) {
- this.transactionId = transactionId;
- }
-
- public String getRequestId() {
- return requestId;
- }
-
- public void setRequestId(String requestId) {
- this.requestId = requestId;
- }
-
- public String getCallbackUrl() {
- return callbackUrl;
- }
-
- public void setCallbackUrl(String callbackUrl) {
- this.callbackUrl = callbackUrl;
- }
-
- public String getSourceId() {
- return sourceId;
- }
-
- public void setSourceId(String sourceId) {
- this.sourceId = sourceId;
- }
-
- public String getRequestType() {
- return requestType;
- }
-
- public void setRequestType(String requestType) {
- this.requestType = requestType;
- }
-
- public long getTimeout() {
- return timeout;
- }
-
- public void setTimeout(long timeout) {
- this.timeout = timeout;
- }
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java
deleted file mode 100644
index b5d40a8e80..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class Resource implements Serializable {
-
- private static final long serialVersionUID = 5949861520571440421L;
-
- @JsonProperty("service-resource-id")
- private String serviceResourceId;
- @JsonProperty("status")
- private String status;
-
-
- public String getServiceResourceId() {
- return serviceResourceId;
- }
-
- public void setServiceResourceId(String serviceResourceId) {
- this.serviceResourceId = serviceResourceId;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
deleted file mode 100644
index 8b6f234c1e..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonPropertyOrder;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-@JsonPropertyOrder({"modelInfo", "serviceRole", "serviceInstanceId", "serviceName"})
-@JsonRootName("serviceInfo")
-public class ServiceInfo implements Serializable {
-
- private static final long serialVersionUID = -6866022419398548585L;
-
- @JsonProperty("serviceInstanceId")
- private String serviceInstanceId;
- @JsonProperty("serviceName")
- private String serviceName;
- @JsonProperty("serviceRole")
- private String serviceRole;
- @JsonProperty("modelInfo")
- private ModelInfo modelInfo;
-
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public String getServiceName() {
- return serviceName;
- }
-
- public void setServiceName(String serviceName) {
- this.serviceName = serviceName;
- }
-
- public String getServiceRole() {
- return serviceRole;
- }
-
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
-
- public ModelInfo getModelInfo() {
- return modelInfo;
- }
-
- public void setModelInfo(ModelInfo modelInfo) {
- this.modelInfo = modelInfo;
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
deleted file mode 100644
index b8896a2bab..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class SniroConductorRequest implements Serializable {
-
- private static final long serialVersionUID = 1906052095861777655L;
- private static final Logger logger = LoggerFactory.getLogger(SniroConductorRequest.class);
-
- @JsonProperty("release-locks")
- private List<Resource> resources = new ArrayList<>();
-
-
- public List<Resource> getResources() {
- return resources;
- }
-
- @JsonInclude(Include.NON_NULL)
- public String toJsonString() {
- String json = "";
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
- try {
- json = ow.writeValueAsString(this);
- } catch (Exception e) {
- logger.error("Unable to convert SniroConductorRequest to string", e);
- }
- return json;
- }
-
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
deleted file mode 100644
index 4babbe5c39..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Modifications Copyright (c) 2019 Samsung
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonInclude;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class SniroManagerRequest implements Serializable {
-
- private static final long serialVersionUID = -1541132882892163132L;
- private static final Logger logger = LoggerFactory.getLogger(SniroManagerRequest.class);
-
- @JsonProperty("requestInfo")
- private RequestInfo requestInformation;
- @JsonProperty("serviceInfo")
- private ServiceInfo serviceInformation;
- @JsonProperty("placementInfo")
- private PlacementInfo placementInformation;
- @JsonProperty("licenseInfo")
- private LicenseInfo licenseInformation;
-
-
- public RequestInfo getRequestInformation() {
- return requestInformation;
- }
-
- public void setRequestInformation(RequestInfo requestInformation) {
- this.requestInformation = requestInformation;
- }
-
- public ServiceInfo getServiceInformation() {
- return serviceInformation;
- }
-
- public void setServiceInformation(ServiceInfo serviceInformation) {
- this.serviceInformation = serviceInformation;
- }
-
- public PlacementInfo getPlacementInformation() {
- return placementInformation;
- }
-
- public void setPlacementInformation(PlacementInfo placementInformation) {
- this.placementInformation = placementInformation;
- }
-
- public LicenseInfo getLicenseInformation() {
- return licenseInformation;
- }
-
- public void setLicenseInformation(LicenseInfo licenseInformation) {
- this.licenseInformation = licenseInformation;
- }
-
-
- @JsonInclude(Include.NON_NULL)
- public String toJsonString() {
- String json = "";
- ObjectMapper mapper = new ObjectMapper();
- mapper.setSerializationInclusion(Include.NON_NULL);
- ObjectWriter ow = mapper.writer().withDefaultPrettyPrinter();
- try {
- json = ow.writeValueAsString(this);
- } catch (Exception e) {
- logger.error("Unable to convert SniroManagerRequest to string", e);
- }
- return json.replaceAll("\\\\", "");
- }
-
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
deleted file mode 100644
index 35a4cac459..0000000000
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro.beans;
-
-import java.io.Serializable;
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonRootName;
-
-@JsonRootName("subscriberInfo")
-public class SubscriberInfo implements Serializable {
-
- private static final long serialVersionUID = -6350949051379748872L;
-
- @JsonProperty("globalSubscriberId")
- private String globalSubscriberId;
- @JsonProperty("subscriberName")
- private String subscriberName;
- @JsonProperty("subscriberCommonSiteId")
- private String subscriberCommonSiteId;
-
-
- public String getGlobalSubscriberId() {
- return globalSubscriberId;
- }
-
- public void setGlobalSubscriberId(String globalSubscriberId) {
- this.globalSubscriberId = globalSubscriberId;
- }
-
- public String getSubscriberName() {
- return subscriberName;
- }
-
- public void setSubscriberName(String subscriberName) {
- this.subscriberName = subscriberName;
- }
-
- public String getSubscriberCommonSiteId() {
- return subscriberCommonSiteId;
- }
-
- public void setSubscriberCommonSiteId(String subscriberCommonSiteId) {
- this.subscriberCommonSiteId = subscriberCommonSiteId;
- }
-
-}
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 a7dfe7f7a4..28d2abc792 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
@@ -161,6 +161,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
+ public void updateOrchestrationStatusInventoriedPnfTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.INVENTORIED);
+
+ aaiUpdateTasks.updateOrchestrationStatusInventoriedPnf(execution);
+
+ verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.INVENTORIED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusInventoriedPnfExceptionTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doThrow(RuntimeException.class).when(aaiPnfResources).updateOrchestrationStatusPnf(pnf,
+ OrchestrationStatus.INVENTORIED);
+
+ expectedException.expect(BpmnError.class);
+ aaiUpdateTasks.updateOrchestrationStatusInventoriedPnf(execution);
+ }
+
+ @Test
public void updateOrchestrationStatusActivePnfTest() throws Exception {
Pnf pnf = preparePnfAndExtractForPnf();
doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ACTIVE);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index 38c74eecc7..d7d6da209e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -149,6 +149,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
private void fillRequiredAppcExecutionFields() {
RequestContext context = new RequestContext();
context.setMsoRequestId("TEST-MSO-ID");
+ context.setRequestorId("testRequestorId");
execution.setVariable("aicIdentity", "AIC-TEST");
execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
@@ -192,6 +193,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
"{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
context.setRequestParameters(requestParameters);
context.setMsoRequestId("TEST-MSO-ID");
+ context.setRequestorId("testRequestorId");
execution.setVariable("aicIdentity", "AIC-TEST");
execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
index 0eb0304cdf..d4f1660986 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.net.URISyntaxException;
@@ -33,6 +33,8 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -78,81 +80,4 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
Assert.assertEquals("MsoRequestId", genericInfo.getRequestInformation().getRequestId());
}
-
-
- private VpnBondingLink getVpnBondingLink() {
- VpnBondingLink vpnBondingLink = new VpnBondingLink();
- Configuration vrfConfiguration = getVRFConfiguration();
- vpnBondingLink.setVrfConfiguration(vrfConfiguration);
- Configuration vnrConfiguration = getVNRConfiguration();
- vpnBondingLink.setVnrConfiguration(vnrConfiguration);
- vpnBondingLink.setTransportServiceProxy(buildServiceProxy(buildServiceInstance(buildGenericVnf())));
- return vpnBondingLink;
- }
-
- private RequestContext getRequestContext() {
- RequestContext requestContext = new RequestContext();
- requestContext.setMsoRequestId("MsoRequestId");
- Map<String, Object> userParams = getUserParams();
- requestContext.setUserParams(userParams);
- return requestContext;
- }
-
- private Map<String, Object> getUserParams() {
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("lppCustomerId", "lppCustomerId");
- return userParams;
- }
-
- private ServiceProxy buildServiceProxy(ServiceInstance serviceInstance) {
- ServiceProxy serviceProxy = new ServiceProxy();
- serviceProxy.setServiceInstance(serviceInstance);
- return serviceProxy;
- }
-
- private Configuration getVRFConfiguration() {
- Configuration vrfConfiguration = new Configuration();
- vrfConfiguration.setConfigurationId("ConfigurationId");
- vrfConfiguration.setConfigurationName("ConfigurationName");
- vrfConfiguration.setConfigurationSubType("ConfigurationSubType");
- vrfConfiguration.setConfigurationType("VRF-ENTRY");
- return vrfConfiguration;
- }
-
- public Configuration getVNRConfiguration() {
- Configuration vnrConfiguration = new Configuration();
- vnrConfiguration.setConfigurationId("ConfigurationId");
- vnrConfiguration.setConfigurationName("ConfigurationName");
- vnrConfiguration.setConfigurationSubType("ConfigurationSubType");
- vnrConfiguration.setConfigurationType("VNRConfiguration");
- L3Network l3Network = getL3Network();
- vnrConfiguration.setNetwork(l3Network);
- return vnrConfiguration;
- }
-
- public L3Network getL3Network() {
- L3Network l3Network = new L3Network();
- l3Network.setNetworkId("l3NetworkId");
- Subnet ipv4subnet = getSubnet("ipv4CidrMask", "ipv4NetworkStartAddress", "IPV4");
- Subnet ipv6subnet = getSubnet("ipv6CidrMask", "ipv6NetworkStartAddress", "IPV6");
- l3Network.getSubnets().add(ipv4subnet);
- l3Network.getSubnets().add(ipv6subnet);
- return l3Network;
- }
-
- private Subnet getSubnet(String ipv4CidrMask, String ipv4NetworkStartAddress, String ipv4) {
- Subnet ipv4subnet = new Subnet();
- ipv4subnet.setCidrMask(ipv4CidrMask);
- ipv4subnet.setNetworkStartAddress(ipv4NetworkStartAddress);
- ipv4subnet.setIpVersion(ipv4);
- return ipv4subnet;
- }
-
- private ServiceInstance buildServiceInstance(GenericVnf vnf) {
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("ServiceInstanceId");
- List<GenericVnf> vnfs = serviceInstance.getVnfs();
- vnfs.add(vnf);
- return serviceInstance;
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapperTest.java
index 88a291e68b..92fc13b633 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
@@ -47,6 +47,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumerat
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
index 76e915781f..0952a35ab0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -38,6 +38,8 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapperTest.java
index f4006ab5d5..bd5c234e50 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -33,6 +33,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.ServiceTopologyOperationMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
index 2fd684e0f0..e064300ab7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -40,6 +40,8 @@ import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
index 00836176f0..a042289281 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -35,6 +35,8 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
new file mode 100644
index 0000000000..a99ee7d2df
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/service/level/ServiceLevelPreparationTest.java
@@ -0,0 +1,130 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.service.level;
+
+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.junit.runner.RunWith;
+import org.onap.so.bpmn.infrastructure.service.level.impl.ServiceLevelPreparation;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable.RESOURCE_TYPE;
+import static org.onap.so.bpmn.infrastructure.service.level.AbstractServiceLevelPreparable.WORKFLOW_TO_INVOKE;
+
+
+
+@RunWith(SpringJUnit4ClassRunner.class)
+@ContextConfiguration(classes = {ServiceLevelPreparation.class, ExceptionBuilder.class})
+public class ServiceLevelPreparationTest {
+
+ private static final String TEST_PNF_SCOPE = "pnf";
+ private static final String TEST_PROCESS_KEY = "testProcessKey";
+ private static final String PROCESS_KEY_VALUE = "testProcessKeyValue";
+ private static final List<String> PNF_HEALTH_CHECK_PARAMS = Arrays.asList("SERVICE_MODEL_INFO",
+ "SERVICE_INSTANCE_NAME", "PNF_CORRELATION_ID", "MODEL_UUID", "PNF_UUID", "PRC_BLUEPRINT_NAME",
+ "PRC_BLUEPRINT_VERSION", "PRC_CUSTOMIZATION_UUID", "RESOURCE_CUSTOMIZATION_UUID_PARAM", "PRC_INSTANCE_NAME",
+ "PRC_CONTROLLER_ACTOR", "REQUEST_PAYLOAD");
+ private Map<String, String> pnfHealthCheckTestParams = new HashMap<>();
+
+ @Autowired
+ private ServiceLevelPreparation serviceLevelPrepare;
+
+ @Autowired
+ private ExceptionBuilder exceptionBuilder;
+
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
+ private DelegateExecution execution = new DelegateExecutionFake();
+ private DelegateExecution invalidExecution = new DelegateExecutionFake();
+
+
+ @Before
+ public void setUpPnfUpgradeTest() {
+ pnfHealthCheckTestParams.put("TEST_SERVICE_MODEL_INFO", "d4c6855e-3be2-5dtu-9390-c999a38829bc");
+ pnfHealthCheckTestParams.put("TEST_SERVICE_INSTANCE_NAME", "test_service_id");
+ pnfHealthCheckTestParams.put("TEST_PNF_CORRELATION_ID", "pnfCorrelationId");
+ pnfHealthCheckTestParams.put("TEST_MODEL_UUID", "6bc0b04d-1873-4721-b53d-6615225b2a28");
+ pnfHealthCheckTestParams.put("TEST_PNF_UUID", "c93g70d9-8de3-57f1-7de1-f5690ac2b005");
+ pnfHealthCheckTestParams.put("TEST_PRC_BLUEPRINT_NAME", "serviceUpgrade");
+ pnfHealthCheckTestParams.put("TEST_PRC_BLUEPRINT_VERSION", "1.0.2");
+ pnfHealthCheckTestParams.put("TEST_PRC_CUSTOMIZATION_UUID", "PRC_customizationUuid");
+ pnfHealthCheckTestParams.put("TEST_RESOURCE_CUSTOMIZATION_UUID_PARAM", "9acb3a83-8a52-412c-9a45-901764938144");
+ pnfHealthCheckTestParams.put("TEST_PRC_INSTANCE_NAME", "Demo_pnf");
+ pnfHealthCheckTestParams.put("TEST_PRC_CONTROLLER_ACTOR", "cds");
+ pnfHealthCheckTestParams.put("TEST_REQUEST_PAYLOAD", "test_payload");
+
+ for (String param : PNF_HEALTH_CHECK_PARAMS) {
+ execution.setVariable(param, pnfHealthCheckTestParams.get("TEST_" + param));
+ }
+ execution.setVariable(RESOURCE_TYPE, TEST_PNF_SCOPE);
+ execution.setVariable(TEST_PROCESS_KEY, PROCESS_KEY_VALUE);
+
+ invalidExecution.setVariables(execution.getVariables());
+ }
+
+ @Test
+ public void executePnfUpgradeSuccessTest() throws Exception {
+ serviceLevelPrepare.execute(execution);
+ // Expect the pnf health check workflow to be set in to execution if validation is successful
+ assertThat(String.valueOf(execution.getVariable(WORKFLOW_TO_INVOKE))).isEqualTo("GenericPnfHealthCheck");
+ }
+
+ @Test
+ public void validateFailureParamsForPnfTest() throws Exception {
+ invalidExecution.removeVariable("PNF_UUID");
+ invalidExecution.setVariable("PRC_BLUEPRINT_NAME", null);
+ // BPMN exception is thrown in case of validation failure or invalid execution
+ thrown.expect(BpmnError.class);
+ serviceLevelPrepare.validateParamsWithScope(invalidExecution, TEST_PNF_SCOPE, PNF_HEALTH_CHECK_PARAMS);
+ }
+
+ @Test
+ public void invalidScopeExecuteTest() throws Exception {
+ invalidExecution.setVariable(RESOURCE_TYPE, "InvalidResource");
+ // BPMN workflow exception is expected incase of invalid resource type other than pnf/vnf
+ thrown.expect(BpmnError.class);
+ serviceLevelPrepare.execute(invalidExecution);
+ }
+
+ @Test
+ public void invokeServiceLevelPrepareWithoutScope() throws Exception {
+ invalidExecution.removeVariable(RESOURCE_TYPE);
+ thrown.expect(BpmnError.class);
+ serviceLevelPrepare.execute(invalidExecution);
+
+ }
+
+}
+
+
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 b9feeedc14..98f84414db 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
@@ -4,12 +4,14 @@
* ================================================================================
* Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2020 Nokia Intellectual Property. All rights reserved.
+ * ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,31 +22,20 @@
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;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.when;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.ArgumentCaptor;
import org.mockito.ArgumentMatchers;
import org.mockito.InjectMocks;
+import org.mockito.Mock;
import org.mockito.Mockito;
import org.onap.so.bpmn.BaseTaskTest;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.exception.OrchestrationStatusValidationException;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.OrchestrationAction;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -52,7 +43,16 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusStateTransitionDirective;
import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.springframework.beans.factory.annotation.Autowired;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+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;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@@ -62,6 +62,9 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
private static final String vfModuleNotExistExpectedMessage =
"The VfModule was not found, thus no VfModule was deleted in the cloud via this request";
+ @Mock
+ private ExceptionBuilder exceptionBuilder;
+
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,11 +75,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.setVariable("aLaCarte", true);
execution.setVariable("flowToBeCalled", flowToBeCalled);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -88,12 +88,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.thenReturn(serviceInstance);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE,
+ OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED,
@@ -107,6 +103,19 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
Mockito.verifyZeroInteractions(requestsDbClient);
}
+ private OrchestrationStatusStateTransitionDirective getOrchestrationStatusStateTransitionDirective(
+ OrchestrationStatusValidationDirective aContinue, OrchestrationStatus precreated, ResourceType service,
+ OrchestrationAction assign) {
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(aContinue);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(precreated);
+ orchestrationStatusStateTransitionDirective.setResourceType(service);
+ orchestrationStatusStateTransitionDirective.setTargetAction(assign);
+ return orchestrationStatusStateTransitionDirective;
+ }
+
@Test
public void test_validateOrchestrationStatusConfiguration() throws Exception {
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
@@ -124,11 +133,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.setVariable("flowToBeCalled", flowToBeCalled);
execution.setVariable("aLaCarte", true);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("UnassignFabricConfigurationBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.CONFIGURATION);
- buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
+ BuildingBlockDetail buildingBlockDetail = getBuildingBlockDetail("UnassignFabricConfigurationBB",
+ ResourceType.CONFIGURATION, OrchestrationAction.UNASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -140,13 +146,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
.thenReturn(configuration);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.CONFIGURATION);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.UNASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PRECREATED, ResourceType.CONFIGURATION, OrchestrationAction.UNASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.CONFIGURATION,
@@ -160,44 +161,30 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
Mockito.verifyZeroInteractions(requestsDbClient);
}
- @Ignore
@Test
- public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
- expectedException.expect(BpmnError.class);
-
+ public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() {
String flowToBeCalled = "AssignServiceInstanceBB";
-
execution.setVariable("flowToBeCalled", flowToBeCalled);
-
doReturn(null).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000),
+ any(OrchestrationStatusValidationException.class));
}
- @Ignore
@Test
- public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
- expectedException.expect(BpmnError.class);
-
+ public void test_validateOrchestrationStatus_orchestrationValidationFail() {
String flowToBeCalled = "AssignServiceInstanceBB";
-
execution.setVariable("flowToBeCalled", flowToBeCalled);
-
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.FAIL,
+ OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.SERVICE, OrchestrationStatus.PRECREATED,
@@ -206,32 +193,23 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
Mockito.verifyZeroInteractions(requestsDbClient);
+ verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000),
+ any(NullPointerException.class));
}
- @Ignore
@Test
- public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
- expectedException.expect(BpmnError.class);
-
+ public void test_validateOrchestrationStatus_orchestrationValidationNotFound() {
String flowToBeCalled = "AssignServiceInstanceBB";
-
execution.setVariable("flowToBeCalled", flowToBeCalled);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("AssignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("AssignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.SERVICE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ASSIGN);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.FAIL,
+ OrchestrationStatus.PRECREATED, ResourceType.SERVICE, OrchestrationAction.ASSIGN);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.NETWORK, OrchestrationStatus.PRECREATED,
@@ -240,24 +218,33 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
Mockito.verifyZeroInteractions(requestsDbClient);
+ verify(exceptionBuilder).buildAndThrowWorkflowException(eq(execution), eq(7000),
+ any(NullPointerException.class));
+ }
+
+ private BuildingBlockDetail getBuildingBlockDetail(String assignServiceInstanceBB, ResourceType service,
+ OrchestrationAction assign) {
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(assignServiceInstanceBB);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(service);
+ buildingBlockDetail.setTargetAction(assign);
+ return buildingBlockDetail;
}
@Test
- public void test_validateOrchestrationStatus_unassignNotFound() throws Exception {
+ public void test_validateOrchestrationStatus_unassignNotFound() {
String flowToBeCalled = "UnassignServiceInstanceBB";
execution.setVariable("flowToBeCalled", flowToBeCalled);
execution.setVariable("aLaCarte", true);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("UnassignServiceInstanceBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.SERVICE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.UNASSIGN);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("UnassignServiceInstanceBB", ResourceType.SERVICE, OrchestrationAction.UNASSIGN);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
- lookupKeyMap = new HashMap<ResourceKey, String>();
+ lookupKeyMap = new HashMap<>();
orchestrationStatusValidator.validateOrchestrationStatus(execution);
@@ -285,21 +272,14 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
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);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -334,22 +314,14 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
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);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -387,11 +359,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -402,13 +371,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -446,11 +410,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -461,13 +422,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ASSIGNED,
@@ -505,11 +461,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.ACTIVATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.ACTIVATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -520,13 +473,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.ACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -564,11 +512,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("CreateVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
@@ -579,13 +524,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.ACTIVATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.ACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
@@ -611,11 +551,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@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);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail(flowToBeCalled, ResourceType.VF_MODULE, OrchestrationAction.DEACTIVATE);
when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
@@ -625,12 +562,8 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
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);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.CONTINUE,
+ OrchestrationStatus.ACTIVATED, ResourceType.VF_MODULE, OrchestrationAction.DEACTIVATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
OrchestrationAction.DEACTIVATE);
@@ -666,22 +599,14 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
- BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
- buildingBlockDetail.setBuildingBlockName("DeleteVfModuleBB");
- buildingBlockDetail.setId(1);
- buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
- buildingBlockDetail.setTargetAction(OrchestrationAction.CREATE);
+ BuildingBlockDetail buildingBlockDetail =
+ getBuildingBlockDetail("DeleteVfModuleBB", ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
- new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS);
- orchestrationStatusStateTransitionDirective.setId(1);
- orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
- orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
- orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.CREATE);
+ getOrchestrationStatusStateTransitionDirective(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
+ OrchestrationStatus.PENDING_ACTIVATION, ResourceType.VF_MODULE, OrchestrationAction.CREATE);
doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
.getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE,
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index 2e4f2e54f0..a7ee89f073 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -44,7 +44,9 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -53,7 +55,9 @@ import org.springframework.core.env.Environment;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
@@ -67,6 +71,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
private static final String SAMPLE_MSO_REQUEST_ID = "00f704ca-c5e5-4f95-a72c-6889db7b0688";
private static final String SAMPLE_REQUEST_ACTION = "Delete-Network-Collection";
private static final int SAMPLE_SEQUENCE = 0;
+ private static final String EMPTY_STRING = "";
@Mock
protected WorkflowAction workflowAction;
@@ -172,7 +177,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.selectBB(execution);
boolean success = (boolean) execution.getVariable("completed");
int currentSequence = (int) execution.getVariable("gCurrentSequence");
- assertEquals(false, success);
+ assertFalse(success);
assertEquals(1, currentSequence);
}
@@ -195,6 +200,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
public void rollbackExecutionPathTest() {
execution.setVariable("handlingCode", "Rollback");
execution.setVariable("isRollback", false);
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
@@ -224,6 +231,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
public void rollbackExecutionPathUnfinishedFlowTest() {
execution.setVariable("handlingCode", "Rollback");
execution.setVariable("isRollback", false);
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
@@ -253,6 +262,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
public void rollbackExecutionTest() {
execution.setVariable("handlingCode", "Rollback");
execution.setVariable("isRollback", false);
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
@@ -286,6 +297,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
public void rollbackExecutionRollbackToAssignedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToAssigned");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
@@ -311,9 +324,50 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionPathChangeBBForReplaceVFModuleTest() {
+ execution.setVariable("handlingCode", "Rollback");
+ execution.setVariable("isRollback", false);
+ execution.setVariable("requestAction", "replaceInstance");
+ execution.setVariable("resourceName", "VfModule");
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+ BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+ flowsToExecute.add(ebb1);
+
+ BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+ flowsToExecute.add(ebb2);
+
+ BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+ flowsToExecute.add(ebb3);
+
+
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("ChangeModelVnfBB");
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+ flowsToExecute.add(ebb4);
+
+ BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ChangeModelServiceInstanceBB");
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
+ flowsToExecute.add(ebb5);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 5);
+ doNothing().when(workflowActionBBFailure).updateRequestErrorStatusMessage(isA(DelegateExecution.class));
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(ebbs.get(0).getBuildingBlock().getBpmnFlowName(), "ChangeModelVnfBB");
+ assertEquals(ebbs.get(1).getBuildingBlock().getBpmnFlowName(), "ChangeModelServiceInstanceBB");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ }
+
+ @Test
public void rollbackExecutionRollbackToAssignedWithFabricTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToAssigned");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
@@ -346,9 +400,47 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToCreatedWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+
+ BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+ flowsToExecute.add(ebb1);
+
+ BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+ flowsToExecute.add(ebb2);
+
+ BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+ flowsToExecute.add(ebb3);
+
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+ flowsToExecute.add(ebb4);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 4);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(2, ebbs.size());
+ assertEquals("DeleteFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
@@ -376,6 +468,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
public void rollbackExecutionRollbackInPlaceSoftwareUpdateTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "Rollback");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
@@ -435,6 +529,8 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
public void rollbackExecutionRollbackConfigModifyTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "Rollback");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity");
ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
@@ -471,6 +567,55 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
assertEquals(2, ebbs.size());
}
+ @Test
+ public void postProcessingExecuteBBActivateVfModuleTest() throws CloneNotSupportedException {
+ BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule);
+
+ WorkflowResourceIds resourceIdsActivateVfModule = new WorkflowResourceIds();
+ resourceIdsActivateVfModule.setServiceInstanceId("test-service-inbstance-id");
+ resourceIdsActivateVfModule.setVnfId("test-vnf-id");
+ resourceIdsActivateVfModule.setVfModuleId("test-vf-module-id");
+ resourceIdsActivateVfModule.setConfigurationId("");
+
+ RequestDetails requestDetails = new RequestDetails();
+
+ ebbActivateVfModule.setApiVersion("7");
+ ebbActivateVfModule.setaLaCarte(true);
+ ebbActivateVfModule.setRequestAction("createInstance");
+ ebbActivateVfModule.setVnfType("test-vnf-type");
+ ebbActivateVfModule.setRequestId("f6c00ae2-a205-4cbd-b055-02e553efde12");
+ ebbActivateVfModule.setRequestDetails(requestDetails);
+ ebbActivateVfModule.setWorkflowResourceIds(resourceIdsActivateVfModule);
+
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID("07d64cd2-4427-4156-b11d-d14b96b3e4cb");
+ configurationResourceKeys.setVfModuleCustomizationUUID("50b61075-6ebb-4aab-a9fc-bedad9a2aa76");
+ configurationResourceKeys.setVnfResourceCustomizationUUID("a1d0e36e-34a9-431b-b5ba-4bbb72f63c7c");
+ configurationResourceKeys.setVnfcName("rdm54bvbgw5001vm018pim001");
+
+ ExecuteBuildingBlock ebbAddFabricConfig =
+ workflowActionBBTasks.getExecuteBBForConfig("AddFabricConfigurationBB", ebbActivateVfModule,
+ "cc7e12f9-967c-4362-8d14-e5b2bf0608a4", configurationResourceKeys);
+
+ assertEquals("7", ebbAddFabricConfig.getApiVersion());
+ assertTrue(ebbAddFabricConfig.isaLaCarte());
+ assertEquals("createInstance", ebbAddFabricConfig.getRequestAction());
+ assertEquals("test-vnf-type", ebbAddFabricConfig.getVnfType());
+ assertEquals("f6c00ae2-a205-4cbd-b055-02e553efde12", ebbAddFabricConfig.getRequestId());
+ assertEquals(requestDetails, ebbAddFabricConfig.getRequestDetails());
+ assertEquals("cc7e12f9-967c-4362-8d14-e5b2bf0608a4",
+ ebbAddFabricConfig.getWorkflowResourceIds().getConfigurationId());
+ assertEquals("test-service-inbstance-id", ebbAddFabricConfig.getWorkflowResourceIds().getServiceInstanceId());
+ assertEquals("test-vnf-id", ebbAddFabricConfig.getWorkflowResourceIds().getVnfId());
+ assertEquals("test-vf-module-id", ebbAddFabricConfig.getWorkflowResourceIds().getVfModuleId());
+
+ assertThat(ebbAddFabricConfig.getConfigurationResourceKeys()).isEqualTo(configurationResourceKeys);
+ assertThat(ebbAddFabricConfig.getWorkflowResourceIds())
+ .isNotEqualTo(ebbActivateVfModule.getWorkflowResourceIds());
+ assertThat(ebbAddFabricConfig.getWorkflowResourceIds().getConfigurationId())
+ .isNotEqualTo(ebbActivateVfModule.getWorkflowResourceIds().getConfigurationId());
+ }
@Test
public void checkRetryStatusTest() {
@@ -533,7 +678,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
- public void getConfigurationId() {
+ public void getConfigurationId() throws Exception {
org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
vnfc.setModelInvariantId("modelInvariantId");
vnfc.setVnfcName("testVnfcName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index e24eaf0581..407a844c4e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -43,6 +43,7 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -116,6 +117,15 @@ import org.springframework.core.env.Environment;
public class WorkflowActionTest extends BaseTaskTest {
+ private static final String MACRO_ACTIVATE_DELETE_UNASSIGN_JSON = "Macro/ServiceMacroActivateDeleteUnassign.json";
+ private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json";
+ private static final String MACRO_ASSIGN_NO_CLOUD_JSON = "Macro/ServiceMacroAssignNoCloud.json";
+ private static final String VF_MODULE_CREATE_WITH_FABRIC_JSON = "VfModuleCreateWithFabric.json";
+ private static final String VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON =
+ "VfModuleReplaceRebuildVolumeGroups.json";
+ private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
+ private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
+
@Mock
protected Environment environment;
@InjectMocks
@@ -140,6 +150,11 @@ public class WorkflowActionTest extends BaseTaskTest {
"DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "UnassignVolumeGroupBB",
"AssignVolumeGroupBB", "ChangeModelVfModuleBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
"CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
+ private List<OrchestrationFlow> replaceVfModuleWithFabricOrchFlows = createFlowList("DeleteFabricConfigurationBB",
+ "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB",
+ "UnassignVFModuleBB", "UnassignVolumeGroupBB", "AssignVolumeGroupBB", "AssignVfModuleBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "AddFabricConfigurationBB", "CreateVolumeGroupBB",
+ "ActivateVolumeGroupBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
@Before
public void before() throws Exception {
@@ -158,13 +173,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteNetworkCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "Network";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/networks/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -183,13 +193,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Network";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/networks/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -208,13 +213,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteServiceCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/serviceInstances/123");
@@ -230,87 +230,11 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
- public void selectExecutionListExceptionAlreadyBuiltTest() throws Exception {
- DelegateExecution delegateExecution = new DelegateExecutionFake();
- String gAction = "deleteInstance";
- String resource = "VfModule";
- delegateExecution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- delegateExecution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- delegateExecution.setVariable("bpmnRequest", bpmnRequest);
- delegateExecution.setVariable("aLaCarte", true);
- delegateExecution.setVariable("apiVersion", "7");
- delegateExecution.setVariable("requestUri",
- "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
- true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
-
- doAnswer(invocation -> {
- DelegateExecutionFake execution = invocation.getArgument(0);
- execution.setVariable("WorkflowException", "exception");
- execution.setVariable("WorkflowExceptionErrorMessage", "errorMessage");
- throw new BpmnError("WorkflowException");
- }).when(exceptionUtil).buildAndThrowWorkflowException(delegateExecution, 7000,
- "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations");
-
-
- org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
- vnf.setVnfId("vnf0");
- vnf.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
-
- org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
- vfModule.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
-
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
- vnfcs.add(vnfc);
- doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
-
- List<org.onap.aai.domain.yang.Configuration> configurations =
- new ArrayList<org.onap.aai.domain.yang.Configuration>();
- org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
- configuration.setConfigurationId("configurationId");
- configuration.setModelCustomizationId("modelCustimizationId");
- configuration.setConfigurationName("testConfigurationName");
- configurations.add(configuration);
- org.onap.aai.domain.yang.Configuration configuration1 = new org.onap.aai.domain.yang.Configuration();
- configuration1.setConfigurationId("configurationId");
- configuration1.setModelCustomizationId("modelCustimizationId");
- configuration1.setConfigurationName("testConfigurationName");
- configurations.add(configuration1);
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
-
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(any());
-
- thrown.expect(BpmnError.class);
- SPY_workflowAction.selectExecutionList(delegateExecution);
- assertEquals(
- "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations",
- delegateExecution.getVariable("WorkflowException"));
- }
-
- @Test
public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
String gAction = "createInstance";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/serviceInstances");
- execution.setVariable("requestAction", gAction);
doThrow(new DuplicateNameException(
"serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique."))
@@ -329,16 +253,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroAssignTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
"AssignVolumeGroupBB", "AssignVfModuleBB");
@@ -383,16 +301,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroAssignNoCloudTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_NO_CLOUD_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
"AssignVolumeGroupBB", "AssignVfModuleBB");
@@ -438,16 +350,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroActivateTest() throws Exception {
String gAction = "activateInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/si0");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows =
createFlowList("CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
@@ -462,7 +368,6 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnf0");
-
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
@@ -492,23 +397,16 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
-
}
@Test
public void selectExecutionListServiceMacroDeactivateTest() throws Exception {
String gAction = "deactivateInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
@@ -524,16 +422,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroEmptyServiceTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -556,16 +448,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateJustNetworkTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -592,16 +478,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -687,16 +567,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
"AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
@@ -769,21 +643,16 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
- "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB",
- "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB",
+ "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB",
+ "UnassignServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
@@ -792,7 +661,10 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf =
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
vnf.setVnfId("vnfId123");
+ pnf.setPnfId("pnfId123");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
@@ -805,6 +677,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnf.getVolumeGroups().add(volumeGroup);
serviceInstanceMSO.getVnfs().add(vnf);
+ serviceInstanceMSO.getPnfs().add(pnf);
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
@@ -814,24 +687,53 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
"DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB",
- "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB",
- "UnassignVnfBB", "UnassignServiceInstanceBB");
+ "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB",
+ "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroDeleteWithPnfTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "Service";
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB",
+ "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB",
+ "UnassignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("aaisi123");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
+ pnf.setPnfId("pnfId123");
+
+ serviceInstanceMSO.getPnfs().add(pnf);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignServiceInstanceBB");
}
@Test
public void selectExecutionListServiceMacroUnassignTest() throws Exception {
String gAction = "unassignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("UnassignVfModuleBB", "UnassignVolumeGroupBB",
"UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
@@ -871,16 +773,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
"DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
@@ -920,13 +816,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListVnfMacroRecreateTest() throws Exception {
String gAction = "recreateInstance";
String resource = "Vnf";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/recreate");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
@@ -974,13 +865,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListVnfMacroReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "Vnf";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/replace");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
@@ -1047,16 +933,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListNetworkCollectionMacroCreate() throws Exception {
String gAction = "createInstance";
String resource = "NetworkCollection";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB", "AssignNetworkBB",
"CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
@@ -1084,13 +964,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListNetworkCollectionMacroDelete() throws Exception {
String gAction = "deleteInstance";
String resource = "NetworkCollection";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -1119,17 +994,11 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
"AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
@@ -1146,13 +1015,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1205,13 +1069,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
@@ -1231,13 +1090,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
@@ -1256,13 +1110,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1289,13 +1138,8 @@ public class WorkflowActionTest extends BaseTaskTest {
throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1322,13 +1166,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1360,16 +1199,69 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListALaCarteVfModuleWithFabricKeepVolumeGroupReplaceTest() throws Exception {
+ String gAction = "replaceInstance";
+ String resource = "VfModule";
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
+ execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
+ execution.setVariable("vfModuleId", "1234");
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModuleFromAAI = new org.onap.aai.domain.yang.VfModule();
+ vfModuleFromAAI.setModelCustomizationId("modelCustomizationId");
+ vfModuleFromAAI.setVfModuleId("1234");
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModuleFromAAI);
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ doReturn(Optional.of(volumeGroup)).when(bbSetupUtils)
+ .getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModuleCustomization.setVfModule(vfModule);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("9a6d01fd-19a7-490a-9800-460830a12e0b"))
+ .thenReturn(vfModuleCustomization);
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
+
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ doReturn(configuration).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setOrchestrationFlowList(replaceVfModuleWithFabricOrchFlows);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ SPY_workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+
+ assertEqualsBulkFlowName(ebbs, "DeleteFabricConfigurationBB", "DeactivateVfModuleBB", "DeleteVfModuleATTBB",
+ "UnassignVFModuleBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AddFabricConfigurationBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
+ }
+
+ @Test
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1403,13 +1295,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupToVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1440,13 +1327,8 @@ public class WorkflowActionTest extends BaseTaskTest {
throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1476,13 +1358,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleReplaceRebuildVolumeGroups.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1518,13 +1395,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleReplaceRebuildVolumeGroups.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1561,13 +1433,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1596,18 +1463,13 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurations =
- new ArrayList<org.onap.aai.domain.yang.Configuration>();
org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
configuration.setConfigurationId("configurationId");
configuration.setModelCustomizationId("modelCustimizationId");
configuration.setConfigurationName("testConfigurationName");
- configurations.add(configuration);
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
+ doReturn(configuration).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
anyObject());
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
-
SPY_workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB",
@@ -1619,10 +1481,9 @@ public class WorkflowActionTest extends BaseTaskTest {
String gAction = "deleteInstance";
ObjectMapper mapper = new ObjectMapper();
WorkflowType resourceType = WorkflowType.VFMODULE;
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
execution.setVariable("bpmnRequest", bpmnRequest);
execution.setVariable("vnfId", "1234");
execution.setVariable("vfModuleId", "vfModuleId1234");
@@ -1665,22 +1526,92 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
- public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
+ public void getConfigBuildingBlocksTest() throws Exception {
String gAction = "deleteInstance";
- String resource = "VfModule";
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
+
+ WorkflowType resourceType = WorkflowType.VFMODULE;
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
execution.setVariable("requestAction", gAction);
String bpmnRequest =
new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ execution.setVariable("vnfId", "1234");
+ execution.setVariable("vfModuleId", "vfModuleId1234");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ String requestAction = "deleteInstance";
+ String requestId = "9c944122-d161-4280-8594-48c06a9d96d5";
+ boolean aLaCarte = true;
+ String apiVersion = "7";
+ String vnfType = "vnfType";
+ String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
+ String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
+
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeleteFabricConfigurationBB");
+
+ ConfigBuildingBlocksDataObject dataObj = new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest)
+ .setOrchFlows(orchFlows).setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails).setExecution(execution);
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+
+ org.onap.aai.domain.yang.Configuration config1 = new org.onap.aai.domain.yang.Configuration();
+ config1.setConfigurationId("config1");
+ org.onap.aai.domain.yang.Configuration config2 = new org.onap.aai.domain.yang.Configuration();
+ config2.setConfigurationId("config2");
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc1 = new org.onap.aai.domain.yang.Vnfc();
+ vnfc1.setVnfcName("zauk53avetd02svm001");
+ org.onap.aai.domain.yang.Vnfc vnfc2 = new org.onap.aai.domain.yang.Vnfc();
+ vnfc2.setVnfcName("zauk53avetd02tvm001");
+ vnfcs.add(vnfc1);
+ vnfcs.add(vnfc2);
+
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
+ eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+ doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+
+ List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
+
+ assertFalse(results.isEmpty());
+ assertEquals(2, results.size());
+ assertEquals("config1", results.get(0).getWorkflowResourceIds().getConfigurationId());
+ assertEquals("config2", results.get(1).getWorkflowResourceIds().getConfigurationId());
+ assertEquals("zauk53avetd02svm001", results.get(0).getConfigurationResourceKeys().getVnfcName());
+ assertEquals("zauk53avetd02tvm001", results.get(1).getConfigurationResourceKeys().getVnfcName());
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ "UnassignVfModuleBB", "DeleteFabricConfigurationBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
@@ -1696,21 +1627,10 @@ public class WorkflowActionTest extends BaseTaskTest {
when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
- vnfcs.add(vnfc);
- doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
- anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurations =
- new ArrayList<org.onap.aai.domain.yang.Configuration>();
- org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
anyObject());
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
-
SPY_workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB");
@@ -1720,13 +1640,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListMacroResumeTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -1780,10 +1695,9 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),
anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurationsList = SPY_workflowAction.getRelatedResourcesInVnfc(
- vnfc, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- assertEquals(1, configurationsList.size());
- assertEquals("testConfigurationId", configurationsList.get(0).getConfigurationId());
+ org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc,
+ org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ assertEquals("testConfigurationId", configuration.getConfigurationId());
}
/**
@@ -2961,8 +2875,7 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
doReturn(collectionResourceCustomization).when(catalogDbClient)
.getNetworkCollectionResourceCustomizationByID("123");
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
List<Resource> resourceCounter = new ArrayList<>();
@@ -3049,7 +2962,7 @@ public class WorkflowActionTest extends BaseTaskTest {
ExecuteBuildingBlock result = null;
try {
result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null,
- false, null, null, null, false, null, null, true);
+ false, null, null, null, false, null, null, true, null);
} catch (NullPointerException e) {
fail("NullPointerException should not be thrown when 'resource' is null");
}
@@ -3138,4 +3051,16 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(), flowNames[i]);
}
}
+
+ private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) {
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", isAlaCarte);
+ execution.setVariable("apiVersion", "7");
+ }
+
+ private String readBpmnRequestFromFile(String fileName) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName)));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListenerTest.java
new file mode 100644
index 0000000000..d2383185d0
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/HomingListenerTest.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+
+public class HomingListenerTest {
+
+ private static final String CALLED_HOMING = "calledHoming";
+
+ @Test
+ public void shouldRunForAssignVnfBB() {
+ assertThat(new HomingListener().shouldRunFor("AssignVnfBB", false, null)).isTrue();
+ }
+
+ @Test
+ public void shouldNotRunForDifferentThanAssignVnfBB() {
+ assertThat(new HomingListener().shouldRunFor("someDifferentBB", false, null)).isFalse();
+ }
+
+ @Test
+ public void runWithHoming() {
+ // given
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable("homing", true);
+ execution.setVariable(CALLED_HOMING, false);
+ BuildingBlockExecution buildingBlockExecution = new DelegateExecutionImpl(execution);
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ // when
+ new HomingListener().run(null, executeBuildingBlock, buildingBlockExecution);
+ // then
+ assertThat(executeBuildingBlock.isHoming()).isTrue();
+ assertThat((boolean) buildingBlockExecution.getVariable(CALLED_HOMING)).isTrue();
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListenerTest.java
new file mode 100644
index 0000000000..64c42fa577
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListenerTest.java
@@ -0,0 +1,122 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.workflow.tasks.listeners;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+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.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+
+@RunWith(MockitoJUnitRunner.class)
+public class SkipConfigVnfListenerTest {
+
+ private static final String MODEL_UUID = "modelUuidTest";
+ private static final String VNF_CUSTOMIZATION_UUID = "vnfCustomizationUUIDTest";
+ private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
+
+ private DelegateExecution execution;
+ @Mock
+ private CatalogDbClient catalogDbClientMock;
+ @InjectMocks
+ private SkipConfigVnfListener testedObject;
+ private BuildingBlockExecution buildingBlockExecution;
+
+ @Before
+ public void setup() {
+ execution = new DelegateExecutionFake();
+ buildingBlockExecution = new DelegateExecutionImpl(execution);
+ }
+
+ @Test
+ public void shouldRunFor_ConfigAssignVnfBB() {
+ assertThat(testedObject.shouldRunFor("ConfigAssignVnfBB", true, null)).isTrue();
+ }
+
+ @Test
+ public void shouldRunFor_ConfigDeployVnfBB() {
+ assertThat(testedObject.shouldRunFor("ConfigDeployVnfBB", true, null)).isTrue();
+ }
+
+ @Test
+ public void shouldNotRunFor_notConfigBB() {
+ assertThat(testedObject.shouldRunFor("BBtest", true, null)).isFalse();
+ }
+
+ @Test
+ public void skipVnfSuccessful_sequenceIncremented() {
+ // given
+ execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ List<VnfResourceCustomization> vnfResourceCustomizations = createVnfResourceCustomizationList();
+ when(catalogDbClientMock.getVnfResourceCustomizationByModelUuid(MODEL_UUID))
+ .thenReturn(vnfResourceCustomizations);
+ when(catalogDbClientMock.findVnfResourceCustomizationInList(VNF_CUSTOMIZATION_UUID, vnfResourceCustomizations))
+ .thenReturn(createVnfResourceCustomization());
+ // when
+ testedObject.run(null, createExecuteBuildingBlock(), buildingBlockExecution);
+ // then
+ assertThat((int) execution.getVariable(G_CURRENT_SEQUENCE)).isEqualTo(1);
+ }
+
+ private ExecuteBuildingBlock createExecuteBuildingBlock() {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelUuid(MODEL_UUID);
+ RequestDetails requestDetails = new RequestDetails();
+ requestDetails.setModelInfo(modelInfo);
+
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
+ BuildingBlock buildingBlock = new BuildingBlock();
+ buildingBlock.setKey(VNF_CUSTOMIZATION_UUID);
+ executeBuildingBlock.setBuildingBlock(buildingBlock);
+ executeBuildingBlock.setRequestDetails(requestDetails);
+ return executeBuildingBlock;
+ }
+
+ private List<VnfResourceCustomization> createVnfResourceCustomizationList() {
+ VnfResourceCustomization vnfResourceCustomization2 = new VnfResourceCustomization();
+ vnfResourceCustomization2.setSkipPostInstConf(false);
+ return new ArrayList<>(Arrays.asList(createVnfResourceCustomization(), vnfResourceCustomization2));
+ }
+
+ private VnfResourceCustomization createVnfResourceCustomization() {
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setSkipPostInstConf(true);
+ return vnfResourceCustomization;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
deleted file mode 100644
index 3ae0db627a..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 Intel Corp. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.oof;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static org.junit.Assert.assertEquals;
-import org.junit.Test;
-import org.onap.so.BaseIntegrationTest;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.oof.beans.LicenseInfo;
-import org.onap.so.client.oof.beans.ModelInfo;
-import org.onap.so.client.oof.beans.OofRequest;
-import org.onap.so.client.oof.beans.OofRequestParameters;
-import org.onap.so.client.oof.beans.PlacementDemand;
-import org.onap.so.client.oof.beans.PlacementInfo;
-import org.onap.so.client.oof.beans.RequestInfo;
-import org.onap.so.client.oof.beans.ResourceModelInfo;
-import org.onap.so.client.oof.beans.ServiceInfo;
-import org.onap.so.client.oof.beans.SubscriberInfo;
-import org.skyscreamer.jsonassert.JSONAssert;
-import org.springframework.beans.factory.annotation.Autowired;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import java.util.ArrayList;
-import java.util.List;
-
-
-public class OofClientTestIT extends BaseIntegrationTest {
-
- @Autowired
- private OofClient client;
-
- @Test
- public void testPostDemands_success() throws BadResponseException, JsonProcessingException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
-
- ModelInfo modelInfo = new ModelInfo();
- modelInfo.setModelCustomizationName("modelCustomizationName-Service");
- modelInfo.setModelInvariantId("modelInvariantId-Service");
- modelInfo.setModelName("modelName-Service");
- modelInfo.setModelType("modelType-Service");
- modelInfo.setModelVersion("modelVersion-Service");
- modelInfo.setModelVersionId("modelVersionId-Service");
-
- ServiceInfo serviceInfo = new ServiceInfo();
- serviceInfo.setModelInfo(modelInfo);
- serviceInfo.setServiceInstanceId("serviceInstanceId");
- serviceInfo.setServiceName("serviceName");
-
- SubscriberInfo subscriberInfo = new SubscriberInfo();
- subscriberInfo.setGlobalSubscriberId("globalSubscriberId");
- subscriberInfo.setSubscriberCommonSiteId("subscriberCommonSiteId");
- subscriberInfo.setSubscriberName("subscriberName");
-
- ResourceModelInfo resourceModelInfo = new ResourceModelInfo();
- resourceModelInfo.setModelType("modelType");
- resourceModelInfo.setModelCustomizationName("modelCustomizationName");
- resourceModelInfo.setModelInvariantId("invarianteId");
- resourceModelInfo.setModelName("modelName");
- resourceModelInfo.setModelVersion("version");
- resourceModelInfo.setModelVersionId("versionId");
-
- PlacementDemand placementDemand = new PlacementDemand();
- placementDemand.setResourceModelInfo(resourceModelInfo);
- placementDemand.setResourceModuleName("resourceModuleName");
- placementDemand.setServiceResourceId("serviceResourceId");
- placementDemand.setTenantId("tenantId");
-
- OofRequestParameters oofRequestParameters = new OofRequestParameters();
- oofRequestParameters.setCustomerLatitude("customerLatitude");
- oofRequestParameters.setCustomerLongitude("customerLongitude");
- oofRequestParameters.setCustomerName("customerName");
-
- ArrayList<PlacementDemand> placementDemands = new ArrayList<>();
- placementDemands.add(placementDemand);
-
- PlacementInfo placementInfo = new PlacementInfo();
- placementInfo.setPlacementDemands(placementDemands);
- placementInfo.setRequestParameters(oofRequestParameters);
- placementInfo.setSubscriberInfo(subscriberInfo);
-
- RequestInfo requestInfo = new RequestInfo();
- requestInfo.setTransactionId("transactionId");
- List<String> optimizer = new ArrayList<>();
- optimizer.add("optimizer1");
- optimizer.add("optimizer2");
- requestInfo.setOptimizers(optimizer);
- requestInfo.setCallbackUrl("callBackUrl");
- requestInfo.setNumSolutions(1);
- requestInfo.setRequestId("requestId");
- requestInfo.setSourceId("sourceId");
- requestInfo.setTimeout(30L);
- requestInfo.setRequestType("requestType");
-
- OofRequest oofRequest = new OofRequest();
- oofRequest.setRequestInformation(requestInfo);
- oofRequest.setPlacementInformation(placementInfo);
- oofRequest.setServiceInformation(serviceInfo);
- oofRequest.setLicenseInformation(new LicenseInfo());
-
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postDemands(oofRequest);
-
- String oofRequestOutput = oofRequest.toJsonString();
- JSONAssert.assertEquals("{\n" + " \"requestInfo\" : {\n" + " \"transactionId\" : \"transactionId\",\n"
- + " \"requestId\" : \"requestId\",\n" + " \"callbackUrl\" : \"callBackUrl\",\n"
- + " \"sourceId\" : \"sourceId\",\n" + " \"requestType\" : \"requestType\",\n"
- + " \"numSolutions\" : 1,\n" + " \"optimizers\" : [ \"optimizer1\", \"optimizer2\" ],\n"
- + " \"timeout\" : 30\n" + " },\n" + " \"serviceInfo\" : {\n"
- + " \"serviceInstanceId\" : \"serviceInstanceId\",\n" + " \"serviceName\" : \"serviceName\",\n"
- + " \"modelInfo\" : {\n" + " \"modelType\" : \"modelType-Service\",\n"
- + " \"modelInvariantId\" : \"modelInvariantId-Service\",\n"
- + " \"modelVersionId\" : \"modelVersionId-Service\",\n"
- + " \"modelName\" : \"modelName-Service\",\n"
- + " \"modelVersion\" : \"modelVersion-Service\",\n"
- + " \"modelCustomizationName\" : \"modelCustomizationName-Service\"\n" + " }\n" + " },\n"
- + " \"placementInfo\" : {\n" + " \"requestParameters\" : {\n"
- + " \"customerLatitude\" : \"customerLatitude\",\n"
- + " \"customerLongitude\" : \"customerLongitude\",\n"
- + " \"customerName\" : \"customerName\"\n" + " },\n" + " \"subscriberInfo\" : {\n"
- + " \"globalSubscriberId\" : \"globalSubscriberId\",\n"
- + " \"subscriberName\" : \"subscriberName\",\n"
- + " \"subscriberCommonSiteId\" : \"subscriberCommonSiteId\"\n" + " },\n"
- + " \"placementDemands\" : [ {\n" + " \"resourceModuleName\" : \"resourceModuleName\",\n"
- + " \"serviceResourceId\" : \"serviceResourceId\",\n" + " \"tenantId\" : \"tenantId\",\n"
- + " \"resourceModelInfo\" : {\n" + " \"modelType\" : \"modelType\",\n"
- + " \"modelInvariantId\" : \"invarianteId\",\n" + " \"modelVersionId\" : \"versionId\",\n"
- + " \"modelName\" : \"modelName\",\n" + " \"modelVersion\" : \"version\",\n"
- + " \"modelCustomizationName\" : \"modelCustomizationName\"\n" + " }\n" + " } ]\n"
- + " },\n" + " \"licenseInfo\" : { \n" + " \"licenseDemands\" : [ ]\n" + "}\n" + "}",
- oofRequestOutput, false);
- }
-
- @Test
- public void testAsyncResponse_success() throws BadResponseException, JsonProcessingException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"status\", \"requestStatus\": \"accepted\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postDemands(new OofRequest());
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new OofRequest());
-
- // TODO assertEquals("missing data", );
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new OofRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
-
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new OofRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException {
- String mockResponse = "{ }";
-
- wireMockServer.stubFor(post(urlEqualTo("/api/oof/v1/placement")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new OofRequest());
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
index 59cd53edd5..b8be045f97 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
@@ -48,13 +48,18 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIPnfResourcesTest extends TestDataSetup {
+ public static final String TEST_VERSION = "testVersion";
private static final String PNF_NAME = "pnfTest";
+ public static final String TEST_CUSTOMIZATION_UUID = "testCustomizationUuid";
+ public static final String TEST_INVARIANT_UUID = "testInvariantUuid";
+ public static final String TEST_ROLE = "testRole";
private Pnf pnf;
private ServiceInstance serviceInstance;
@@ -110,42 +115,87 @@ public class AAIPnfResourcesTest extends TestDataSetup {
@Test
public void existingPnfInAaiWithInventoriedStatusCanBeUsed() throws Exception {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+ verify(aaiResourcesClientMock, times(1)).update(any(), any());
}
@Test
public void existingPnfInAaiWithNullStatusCanBeUsed() throws Exception {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
+ pnfTest.setRole("test");
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+ verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
+ }
+
+ @Test
+ public void existingPnfInAaiIsUpdated() throws Exception {
+ // given
+ org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
+ Pnf pnfTest = getPnfWithTestValues();
+ when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ // when
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+ verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
+ verifyPnfFromAai(pnfFromAai);
+ }
+
+ private void verifyPnfFromAai(org.onap.aai.domain.yang.Pnf pnf) {
+ assertEquals(OrchestrationStatus.INVENTORIED.toString(), pnf.getOrchestrationStatus());
+ assertEquals(TEST_ROLE, pnf.getNfRole());
+ assertEquals(TEST_CUSTOMIZATION_UUID, pnf.getModelCustomizationId());
+ assertEquals(TEST_INVARIANT_UUID, pnf.getModelInvariantId());
+ assertEquals(TEST_VERSION, pnf.getModelVersionId());
+ }
+
+ private Pnf getPnfWithTestValues() {
+ Pnf pnfTest = createPnfWithDefaultName();
+ ModelInfoPnf modelInfoPnf = getModelInfoPnf();
+ pnfTest.setModelInfoPnf(modelInfoPnf);
+ pnfTest.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ pnfTest.setRole(TEST_ROLE);
+ return pnfTest;
+ }
+
+ private ModelInfoPnf getModelInfoPnf() {
+ ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+ modelInfoPnf.setModelCustomizationUuid(TEST_CUSTOMIZATION_UUID);
+ modelInfoPnf.setModelInvariantUuid(TEST_INVARIANT_UUID);
+ modelInfoPnf.setModelUuid(TEST_VERSION);
+ return modelInfoPnf;
}
@Test
public void existingPnfInAaiWithEmptyStatusCanBeUsed() throws Exception {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
}
@Test
public void existingPnfInAaiCanNotBeUsed() {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
try {
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
} catch (Exception e) {
// then
assertThat(e.getMessage()).isEqualTo(String.format(
@@ -153,6 +203,7 @@ public class AAIPnfResourcesTest extends TestDataSetup {
+ "if status is not set or set as Inventoried",
PNF_NAME));
}
+ verify(aaiResourcesClientMock, times(0)).update(any(), any());
}
@Test
@@ -161,19 +212,21 @@ public class AAIPnfResourcesTest extends TestDataSetup {
final String relatedTo = "service-instance";
final String serviceInstanceId = "service-instance-id";
final String path = "src/test/resources/__files/BuildingBlocks/aaiPnf.json";
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai =
new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
try {
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
} catch (Exception e) {
// then
assertThat(e.getMessage()).isEqualTo(String.format(
"Pnf with name %s exist with orchestration status %s and is related to %s service with certain service-instance-id: %s",
PNF_NAME, OrchestrationStatus.ACTIVE, relatedTo, serviceInstanceId));
}
+ verify(aaiResourcesClientMock, times(0)).update(any(), any());
}
private org.onap.aai.domain.yang.Pnf createPnf(String orchestrationStatus) {
@@ -182,4 +235,10 @@ public class AAIPnfResourcesTest extends TestDataSetup {
pnfFromAai.setOrchestrationStatus(orchestrationStatus);
return pnfFromAai;
}
+
+ private Pnf createPnfWithDefaultName() {
+ Pnf pnfTest = new Pnf();
+ pnfTest.setPnfName(PNF_NAME);
+ return pnfTest;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
index 9049fe1965..3429a16f0b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
@@ -35,6 +35,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,7 +46,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCConfigurationResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
index 327bae5749..f86a712e33 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
@@ -32,6 +32,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -42,7 +43,6 @@ import org.onap.so.client.exception.MapperException;
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.NetworkTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCNetworkResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
index ad05ac0072..4282b0d158 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
@@ -35,6 +35,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.ServiceTopologyOperationMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -42,7 +43,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCServiceInstanceResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
index 14e993281a..813c2f7cd4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
@@ -33,6 +33,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -43,8 +44,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
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.onap.so.client.sdnc.beans.SDNCSvcOperation;;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCVfModuleResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
index 0ccf056ddc..f9c380bc84 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
@@ -39,6 +39,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -49,7 +50,6 @@ import org.onap.so.client.exception.MapperException;
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;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCVnfResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
deleted file mode 100644
index a8816e1b04..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdn.common;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import java.util.LinkedHashMap;
-import org.junit.Assert;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.SdnCommonTasks;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.MediaType;
-
-
-public class SdnCommonTasksTest {
-
-
- SdnCommonTasks sdnCommonTasks = new SdnCommonTasks();
-
- @Rule
- public ExpectedException expectedException = ExpectedException.none();
-
- @Test
- public void buildJsonRequestTest() throws MapperException {
- String jsonStr = sdnCommonTasks.buildJsonRequest("");
- Assert.assertNotNull(jsonStr);
- }
-
- @Test
- public void buildJsonRequestTestException() throws MapperException {
- expectedException.expect(MapperException.class);
- sdnCommonTasks.buildJsonRequest(new Object());
- }
-
- @Test
- public void getHttpHeadersTest() {
- HttpHeaders result = sdnCommonTasks.getHttpHeaders("auth", true);
-
- assertEquals("auth", result.getFirst("Authorization"));
- assertEquals(MediaType.APPLICATION_JSON.toString(), result.getFirst("Content-Type"));
- assertEquals(MediaType.APPLICATION_JSON.toString(), result.getFirst("Accept"));
- }
-
- @Test
- public void getHttpHeadersGetRequestTest() {
- HttpHeaders result = sdnCommonTasks.getHttpHeaders("auth", false);
-
- assertEquals("auth", result.getFirst("Authorization"));
- assertEquals(MediaType.APPLICATION_JSON.toString(), result.getFirst("Accept"));
- assertFalse(result.containsKey("Content-Type"));
- }
-
- @Test
- public void validateSDNResponseTest() throws BadResponseException {
- String jsonResponse = "{\"output\":{\"response-code\":\"0\",\"response-message\":\"success\"}}";
- LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>();
- LinkedHashMap<String, Object> output = new LinkedHashMap<>();
- output.put("response-code", "0");
- output.put("response-message", "success");
- responseMap.put("output", output);
- assertEquals(jsonResponse, sdnCommonTasks.validateSDNResponse(responseMap));
- }
-
- @Test
- public void validateSDNResponseTestException() throws BadResponseException {
- expectedException.expect(BadResponseException.class);
- LinkedHashMap responseMap = new LinkedHashMap();
- Assert.assertNotNull(sdnCommonTasks.validateSDNResponse(responseMap));
- }
-
- @Test
- public void validateSDNResponseTestRespCodeNot200() throws BadResponseException {
- expectedException.expect(BadResponseException.class);
- LinkedHashMap<String, Object> responseMap = new LinkedHashMap<>();
- LinkedHashMap<String, Object> output = new LinkedHashMap<>();
- output.put("response-code", "300");
- output.put("response-message", "Failed");
- responseMap.put("output", output);
- sdnCommonTasks.validateSDNResponse(responseMap);
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
deleted file mode 100644
index 0b338bde1d..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdnc;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import org.junit.Test;
-import org.onap.so.BaseIntegrationTest;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.exception.MapperException;
-import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.skyscreamer.jsonassert.JSONAssert;
-
-public class SDNCClientIT extends BaseIntegrationTest {
- private final static String JSON_FILE_LOCATION = "src/test/resources/__files/";
-
- @Test
- public void getTest() throws BadResponseException, MapperException, IOException {
- String responseJson =
- new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientGetResponse.json")));
- String queryLink = "/topologyQuery";
-
- wireMockServer.stubFor(get(urlEqualTo(queryLink)).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
- String response = SPY_sdncClient.get(queryLink);
- JSONAssert.assertEquals(responseJson, response, false);
- }
-
- @Test(expected = BadResponseException.class)
- public void post404Test() throws BadResponseException, MapperException, IOException {
- String responseJson =
- new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut404Response.json")));
-
- String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
-
- wireMockServer.stubFor(post(urlMatching(queryLink)).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
-
- SPY_sdncClient.post("", SDNCTopology.NETWORK);
- }
-
- @Test
- public void post200Test() throws BadResponseException, MapperException, IOException {
- String responseJson =
- new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "SDNCClientPut200Response.json")));
-
- String queryLink = "/restconf/operations/GENERIC-RESOURCE-API:network-topology-operation/";
-
- wireMockServer.stubFor(post(urlMatching(queryLink)).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(responseJson)));
-
- String response = SPY_sdncClient.post("", SDNCTopology.NETWORK);
- JSONAssert.assertEquals(responseJson, response, true);
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
deleted file mode 100644
index 750e578558..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno;
-
-import static org.junit.Assert.assertEquals;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Optional;
-import org.junit.Test;
-import org.onap.so.client.sdno.beans.SDNO;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class SDNOHealthCheckClientTest {
-
-
-
- private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/health-check/";
- private static final String userId = "test-user";
- private static final Optional<String> clliCode = Optional.of("test-clli");
- private static final String requestId = "test-request-id";
- private static final String configurationId = "test-configuration-id";
- private static final String interfaceId = "test-interface-id";
-
- @Test
- public void verfyLPortMirrorPreCheckRequest() throws IOException {
- String content = this.getJson("custom-lport-mirror-pre-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual =
- client.buildLPortMirrorCheckPreRequest(userId, requestId, clliCode, configurationId, interfaceId);
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
- }
-
- @Test
- public void verfyLPortMirrorPostCheckRequest() throws IOException {
- String content = this.getJson("custom-lport-mirror-post-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual =
- client.buildLPortMirrorCheckPostRequest(userId, requestId, clliCode, configurationId, interfaceId);
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
- }
-
-
- @Test
- public void verifyPortMirrorPostCheckRequest() throws IOException {
- String content = this.getJson("custom-port-mirror-post-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual = client.buildPortMirrorPostCheckRequest(userId, requestId, clliCode, configurationId);
-
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
-
- }
-
- @Test
- public void verifyPortMirrorPreCheckRequest() throws IOException {
- String content = this.getJson("custom-port-mirror-pre-check-request.json");
- ObjectMapper mapper = new ObjectMapper();
- SDNO expected = mapper.readValue(content, SDNO.class);
- SDNOHealthCheckClient client = new SDNOHealthCheckClient();
- String actual = client.buildPortMirrorPreCheckRequest(userId, requestId, clliCode, configurationId);
-
- assertEquals("payloads are equal", mapper.writeValueAsString(expected), actual);
-
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java
deleted file mode 100644
index b91f83c1b7..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno;
-
-import static org.hamcrest.CoreMatchers.containsString;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.spy;
-import static org.mockito.Mockito.when;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.Arrays;
-import java.util.UUID;
-import org.junit.Before;
-import org.junit.Ignore;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.ExpectedException;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.BaseIntegrationTest;
-import org.onap.so.client.dmaap.Consumer;
-import org.onap.so.client.dmaap.exceptions.DMaaPConsumerFailure;
-import org.onap.so.client.exceptions.SDNOException;
-import org.onap.so.client.sdno.beans.SDNO;
-import org.onap.so.client.sdno.dmaap.SDNOHealthCheckDmaapConsumer;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-
-public class SDNOValidatorIT extends BaseIntegrationTest {
-
-
- @Mock
- private Consumer mrConsumer;
- private SDNOHealthCheckDmaapConsumer dmaapConsumer;
- private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/";
- private final String uuid = "xyz123";
- @Rule
- public ExpectedException thrown = ExpectedException.none();
-
- @Before
- public void setUpTests() {
- MockitoAnnotations.initMocks(this);
-
- }
-
- @Test
- public void success() throws IOException, Exception {
- dmaapConsumer = spy(new SDNOHealthCheckDmaapConsumer());
- when(dmaapConsumer.getConsumer()).thenReturn(mrConsumer);
- when(mrConsumer.fetch())
- .thenReturn(Arrays.asList(new String[] {getJson("response.json"), getJson("output-success.json")}));
-
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- SDNOValidatorImpl spy = spy(validator);
- when(dmaapConsumer.getRequestId()).thenReturn("xyz123");
- doReturn(dmaapConsumer).when(spy).getConsumer(any(String.class));
- boolean result = spy.pollForResponse("xyz123");
- assertEquals("result is true", result, true);
- }
-
- @Test
- public void failure() throws IOException, Exception {
- dmaapConsumer = spy(new SDNOHealthCheckDmaapConsumer());
-
- when(dmaapConsumer.getConsumer()).thenReturn(mrConsumer);
- when(mrConsumer.fetch())
- .thenReturn(Arrays.asList(new String[] {getJson("response.json"), getJson("output-failure.json")}));
-
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- SDNOValidatorImpl spy = spy(validator);
- when(dmaapConsumer.getRequestId()).thenReturn("xyz123");
- doReturn(dmaapConsumer).when(spy).getConsumer(any(String.class));
- thrown.expect(SDNOException.class);
- thrown.expectMessage(containsString("my error message"));
- boolean result = spy.pollForResponse("xyz123");
-
- }
-
- @Ignore
- @Test
- public void run() throws Exception {
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- UUID uuid = UUID.randomUUID();
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfId("test");
- vnf.setIpv4OamAddress("1.2.3.4");
- vnf.setNfRole("VPE");
- SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(request);
- validator.submitRequest(json);
- thrown.expect(DMaaPConsumerFailure.class);
- boolean result = validator.pollForResponse(uuid.toString());
- System.out.println(json);
-
- }
-
- private String getJson(String filename) throws IOException {
- return new String(Files.readAllBytes(Paths.get(fileLocation + filename)));
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
deleted file mode 100644
index c2278c26f9..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sdno;
-
-import static org.junit.Assert.assertEquals;
-import java.util.UUID;
-import org.junit.Test;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.so.client.sdno.beans.RequestHealthDiagnostic;
-import org.onap.so.client.sdno.beans.SDNO;
-
-public class SDNOValidatorImplTest {
-
- @Test
- public void buildRequestDiagnosticTest() throws Exception {
- SDNOValidatorImpl validator = new SDNOValidatorImpl();
- UUID uuid = UUID.randomUUID();
- GenericVnf vnf = new GenericVnf();
- vnf.setVnfName("VNFNAME");
- vnf.setVnfId("test");
- vnf.setIpv4OamAddress("1.2.3.4");
- vnf.setNfRole("VPE");
- SDNO request = validator.buildRequestDiagnostic(vnf, uuid, "mechid");
- assertEquals(request.getNodeType(), "VPE");
- assertEquals(request.getOperation(), "health-diagnostic");
-
- RequestHealthDiagnostic innerRequest = request.getBody().getInput().getRequestHealthDiagnostic();
- assertEquals(innerRequest.getRequestClientName(), "MSO");
- assertEquals(innerRequest.getRequestNodeName(), "VNFNAME");
- assertEquals(innerRequest.getRequestNodeUuid(), "test");
- assertEquals(innerRequest.getRequestNodeType(), "VPE");
- assertEquals(innerRequest.getRequestNodeIp(), "1.2.3.4");
- assertEquals(innerRequest.getRequestUserId(), "mechid");
- assertEquals(innerRequest.getRequestId(), uuid.toString());
- assertEquals(innerRequest.getHealthDiagnosticCode(), "default");
-
- }
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
deleted file mode 100644
index 56c52388f8..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.sniro;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
-import org.junit.Test;
-import org.onap.so.BaseIntegrationTest;
-import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.sniro.beans.SniroConductorRequest;
-import org.onap.so.client.sniro.beans.SniroManagerRequest;
-import org.springframework.beans.factory.annotation.Autowired;
-import com.fasterxml.jackson.core.JsonProcessingException;
-
-
-public class SniroClientTestIT extends BaseIntegrationTest {
-
- @Autowired
- private SniroClient client;
-
-
- @Test(expected = Test.None.class)
- public void testPostDemands_success() throws BadResponseException, JsonProcessingException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"corys cool\", \"requestStatus\": \"accepted\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postDemands(new SniroManagerRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_failed() throws JsonProcessingException, BadResponseException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": \"failed\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new SniroManagerRequest());
-
- // TODO assertEquals("missing data", );
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_noMessage() throws JsonProcessingException, BadResponseException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"\", \"requestStatus\": \"failed\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new SniroManagerRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_noStatus() throws JsonProcessingException, BadResponseException {
- String mockResponse =
- "{\"transactionId\": \"123456789\", \"requestId\": \"1234\", \"statusMessage\": \"missing data\", \"requestStatus\": null}";
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new SniroManagerRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostDemands_error_empty() throws JsonProcessingException, BadResponseException {
- String mockResponse = "{ }";
-
- wireMockServer.stubFor(post(urlEqualTo("/sniro/api/placement/v2")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
-
- client.postDemands(new SniroManagerRequest());
- }
-
- @Test(expected = Test.None.class)
- public void testPostRelease_success() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"status\": \"success\", \"message\": \"corys cool\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postRelease(new SniroConductorRequest());
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostRelease_error_failed() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"status\": \"failure\", \"message\": \"corys cool\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postRelease(new SniroConductorRequest());
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostRelease_error_noStatus() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"status\": \"\", \"message\": \"corys cool\"}";
-
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postRelease(new SniroConductorRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostRelease_error_noMessage() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{\"status\": \"failure\", \"message\": null}";
-
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postRelease(new SniroConductorRequest());
-
- }
-
- @Test(expected = BadResponseException.class)
- public void testPostRelease_error_empty() throws BadResponseException, JsonProcessingException {
- String mockResponse = "{ }";
-
- wireMockServer.stubFor(post(urlEqualTo("/v1/release-orders")).willReturn(
- aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody(mockResponse)));
-
- client.postRelease(new SniroConductorRequest());
-
- }
-
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
index 957c603dc9..191e0ac40e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
@@ -2,6 +2,7 @@
"ApplicationControllerTaskRequest": {
"controllerType": "TEST-CONTROLLER-NAME",
"action": "Lock",
+ "requestorId": "testRequestorId",
"identityUrl": "IDENTITY-URL-TEST",
"applicationControllerVnf": {
"vnfId": "TEST-VNF-ID",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
index 040c680d1c..724f096a4e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -2,6 +2,7 @@
"ApplicationControllerTaskRequest": {
"controllerType": "APPC",
"action": "ConfigModify",
+ "requestorId": "testRequestorId",
"identityUrl": "IDENTITY-URL-TEST",
"applicationControllerVnf": {
"vnfId": "TEST-VNF-ID",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json
new file mode 100644
index 0000000000..ac047a9638
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json
@@ -0,0 +1,40 @@
+{
+ "automated-assignment": false,
+ "heat-stack-id": "zauk53avetd02_base/5c7a8a55-edb8-458e-a7dc-2dbbc696682e",
+ "is-base-vf-module": true,
+ "model-customization-id": "521d5f9b-0b76-49d3-879e-fce8767f34eb",
+ "model-invariant-id": "f0ac6f78-543f-41ac-81c3-672a4d47001c",
+ "model-version-id": "215ea5bd-f0e0-4560-9f64-9a9716ff6178",
+ "module-index": 0,
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v20/network/vnfcs/vnfc/zauk53avetd02svm001",
+ "related-to": "vnfc",
+ "relationship-data": [
+ {
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "zauk53avetd02svm001"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ },
+ {
+ "related-link": "/aai/v20/network/vnfcs/vnfc/zauk53avetd02tvm001",
+ "related-to": "vnfc",
+ "relationship-data": [
+ {
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "zauk53avetd02tvm001"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ }
+ ]
+ },
+ "resource-version": "1595304004908",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/16b9c65d-70c7-47f0-aa03-7cdb8dfb76be/service-data/vnfs/vnf/9cf22c37-4f39-4fa5-a942-b72efc8f6450/vnf-data/vf-modules/vf-module/2cf0ecd4-737c-4a46-9097-adc2f0088483/vf-module-data/vf-module-topology/",
+ "vf-module-id": "2cf0ecd4-737c-4a46-9097-adc2f0088483",
+ "vf-module-name": "zauk53avetd02_base"
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
deleted file mode 100644
index 2c46b5a8cb..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000004",
- "operation-type": "lport_mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- },
- {
- "key": "interface-id",
- "value": "test-interface-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
deleted file mode 100644
index bf168b0028..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000003",
- "operation-type": "lport_mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- },
- {
- "key": "interface-id",
- "value": "test-interface-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
deleted file mode 100644
index 89e505e7d0..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000004",
- "operation-type": "mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
deleted file mode 100644
index 86897c8a1f..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
+++ /dev/null
@@ -1,23 +0,0 @@
-{
- "body": {
- "input": {
- "request-hd-custom": {
- "request-client-name": "MSO",
- "request-user-id": "test-user",
- "request-id": "test-request-id",
- "health-diagnostic-code": "VROUTER000003",
- "operation-type": "mirroring_check",
- "send-detailed-cmd-response": "false",
- "aai-param-list": [
- {
- "key": "configuration-id",
- "value": "test-configuration-id"
- }
- ]
- }
- }
- },
- "operation": "health-diagnostic-custom",
- "nodeLoc": "test-clli",
- "nodeType": "VROUTER"
-}
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json
deleted file mode 100644
index 8cf0a820cd..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "body": {
- "output": {
- "response-hd-custom": {
- "response-status": "Failure",
- "cached-data": "false",
- "response-interface-type": "ansible",
- "response-id": "191bf423-8473-4f7c-9fbb-e5dcbb40a12b",
- "remote_end_time": "2017-10-13T14:51:53.490+0000",
- "response-client-name": "MSO",
- "user_id": "xxxxxx",
- "remote_start_time": "2017-10-13T14:51:53.173+0000",
- "error-message": "my error message",
- "connection-failure-msg": "SDNO was unable to connect to an Ansible REST API server; Please ensure Ansible REST server is running"
- }
- }
- },
- "result-info": {
- "code": "200",
- "status": "SUCCESS",
- "request-id": "xyz123",
- "client-name": "MSO",
- "processing-host": "sdno-sdno-mtsnjv9sdno01"
- }
-} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json
deleted file mode 100644
index a6794327d8..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "body": {
- "output": {
- "response-healthdiagnostic": {
- "response-node-ip": "192.20.127.76",
- "response-id": "xyz123",
- "response-node-name": "mtvnjv9aads11",
- "response-status": "Success",
- "response-interface-type": "ssh",
- "response-details-json": "result",
- "cached-data": "false"
- }
- }
- },
- "result-info": {
- "client-name": "MSO",
- "code": "200",
- "processing-host": "sdno1-host01",
- "request-id": "xyz123",
- "status": "SUCCESS"
- }
-} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json b/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json
deleted file mode 100644
index 2355e86938..0000000000
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json
+++ /dev/null
@@ -1,17 +0,0 @@
-{
-
- "result-info": {
-
- "client-name": "MSO",
-
- "code": "202",
-
- "processing-host": "sdno1-host01",
-
- "request-id": "xyz123",
-
- "status": "ACCEPTED"
-
- }
-
-} \ No newline at end of file