aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java2
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml16
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java6
-rw-r--r--adapters/mso-openstack-adapters/pom.xml2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java10
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java11
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java23
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java32
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java13
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java134
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java15
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java9
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java74
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java110
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java123
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml7
-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/activity/ExecuteActivity.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java23
-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/WorkflowAction.java435
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java106
-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/WorkflowActionBBFailureTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java186
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java126
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java6
-rw-r--r--common/src/main/java/org/onap/so/client/exception/BadResponseException.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java)0
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java2
-rw-r--r--pom.xml5
-rw-r--r--so-optimization-clients/pom.xml89
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/OofClient.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java)1
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/OofValidator.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java)2
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofProperties.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofRequest.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/Resource.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroClient.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java)9
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroValidator.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java)2
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Candidate.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java)1
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java41
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java)42
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Demand.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Resource.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java)0
-rw-r--r--so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java)0
-rw-r--r--so-optimization-clients/src/test/java/org/onap/so/BaseIntegrationTest.java63
-rw-r--r--so-optimization-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java60
-rw-r--r--so-optimization-clients/src/test/java/org/onap/so/IntegrationTestSuite.java31
-rw-r--r--so-optimization-clients/src/test/java/org/onap/so/TestApplication.java43
-rw-r--r--so-optimization-clients/src/test/java/org/onap/so/client/oof/OofClientTestIT.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java)7
-rw-r--r--so-optimization-clients/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java)0
-rw-r--r--so-optimization-clients/src/test/resources/application-test.yaml231
-rw-r--r--so-optimization-clients/src/test/resources/schema.sql1195
-rw-r--r--so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java26
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json87
-rw-r--r--so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json2
82 files changed, 2787 insertions, 1120 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java
index 2f7d19ff1d..cc79e615f1 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/NovaCacheConfig.java
@@ -24,12 +24,14 @@ import org.springframework.cache.CacheManager;
import org.springframework.cache.caffeine.CaffeineCacheManager;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Primary;
import com.github.benmanes.caffeine.cache.Caffeine;
@Configuration
public class NovaCacheConfig {
@Bean
+ @Primary
public CacheManager cacheManager() {
CaffeineCacheManager cacheManager = new CaffeineCacheManager("novaClient");
cacheManager.setCaffeine(caffeineCacheBuilder());
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 0201dd6776..bfb600f3ba 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -73,14 +73,14 @@
</plugin>
</plugins>
<pluginManagement>
- <plugins>
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
+ <plugins>
+ <plugin>
+ <groupId>org.eclipse.m2e</groupId>
+ <artifactId>lifecycle-mapping</artifactId>
+ <version>1.0.0</version>
+ <configuration>
+ <lifecycleMappingMetadata>
+ <pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java
index fdec7cf5d6..4d8f55e220 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDbRepositoryConfiguration.java
@@ -20,8 +20,8 @@
package org.onap.so.adapters.catalogdb;
-import java.util.stream.Collectors;
import javax.persistence.EntityManager;
+import javax.persistence.metamodel.Type;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
@@ -35,8 +35,8 @@ public class CatalogDbRepositoryConfiguration extends RepositoryRestConfigurerAd
@Override
public void configureRepositoryRestConfiguration(RepositoryRestConfiguration config) {
- config.exposeIdsFor(entityManager.getMetamodel().getEntities().stream().map(e -> e.getJavaType())
- .collect(Collectors.toList()).toArray(new Class[0]));
+ config.exposeIdsFor(
+ entityManager.getMetamodel().getEntities().stream().map(Type::getJavaType).toArray(Class[]::new));
}
}
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 9cee2882be..893f50c458 100644
--- a/adapters/mso-openstack-adapters/pom.xml
+++ b/adapters/mso-openstack-adapters/pom.xml
@@ -263,7 +263,7 @@
<artifactId>openstack4j-jersey2</artifactId>
<version>3.2.0</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.22.1</version>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java
index b104c3310c..4d8c74dbfe 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryService.java
@@ -21,7 +21,6 @@
package org.onap.so.adapters.inventory.delete;
import javax.annotation.PostConstruct;
-import org.camunda.bpm.client.ExternalTaskClient;
import org.onap.so.utils.ExternalTaskServiceUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
@@ -43,10 +42,11 @@ public class DeleteInventoryService {
@PostConstruct
public void auditAAIInventory() throws Exception {
- ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryDelete")
- .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
- .handler(deleteInventory::executeExternalTask).open();
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ externalTaskServiceUtils.createExternalTaskClient().subscribe("InventoryDelete")
+ .lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
+ .handler(deleteInventory::executeExternalTask).open();
+ }
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
index 4e8443bf45..200f6375ea 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/audit/AuditDataService.java
@@ -17,6 +17,8 @@ import com.fasterxml.jackson.databind.JsonMappingException;
@Component
public class AuditDataService {
+ private static final String AUDIT_STACK_DATA = "AuditStackData";
+
@Autowired
private RequestsDbClient requestsDbClient;
@@ -30,7 +32,7 @@ public class AuditDataService {
throws JsonProcessingException {
List<RequestProcessingData> requestProcessingDataList =
requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
- auditInventory.getHeatStackName(), "AuditStackData");
+ auditInventory.getHeatStackName(), AUDIT_STACK_DATA);
if (requestProcessingDataList.isEmpty()) {
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
@@ -39,7 +41,7 @@ public class AuditDataService {
requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
requestProcessingData.setGroupingId(auditInventory.getVfModuleId());
requestProcessingData.setName(auditInventory.getHeatStackName());
- requestProcessingData.setTag("AuditStackData");
+ requestProcessingData.setTag(AUDIT_STACK_DATA);
requestProcessingData.setValue(auditListString);
requestsDbClient.saveRequestProcessingData(requestProcessingData);
@@ -53,12 +55,11 @@ public class AuditDataService {
* @throws JsonMappingException
* @throws JsonParseException
*/
- public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory)
- throws JsonParseException, JsonMappingException, IOException {
+ public Optional<AAIObjectAuditList> getStackDataFromRequestDb(AuditInventory auditInventory) throws IOException {
List<RequestProcessingData> requestProcessingDataList =
requestsDbClient.getRequestProcessingDataByGroupingIdAndNameAndTag(auditInventory.getVfModuleId(),
- auditInventory.getHeatStackName(), "AuditStackData");
+ auditInventory.getHeatStackName(), AUDIT_STACK_DATA);
if (!requestProcessingDataList.isEmpty()) {
RequestProcessingData requestProcessingData = requestProcessingDataList.get(0);
String auditListString = requestProcessingData.getValue();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
index 8829c702cf..e2fa89bf39 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/factory/OpenstackClientFactoryImpl.java
@@ -60,6 +60,7 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory {
OSClientV3 client;
try {
+ OSFactory.enableHttpLoggingFilter(true);
client = OSFactory.builderV3().endpoint(osAccess.getUrl())
.credentials(osAccess.getUser(), osAccess.getPassword(), osAccess.getDomainNameIdentifier())
.scopeToProject(Identifier.byId(osAccess.getTenantId()), osAccess.getProjectNameIdentifier())
@@ -81,6 +82,7 @@ public class OpenstackClientFactoryImpl implements OpenstackClientFactory {
OSClientV2 client;
try {
+ OSFactory.enableHttpLoggingFilter(true);
client = OSFactory.builderV2().endpoint(osAccess.getUrl())
.credentials(osAccess.getUser(), osAccess.getPassword()).tenantId(osAccess.getTenantId())
.authenticate().useRegion(osAccess.getRegion());
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
index fd36995f3d..76e5bbc47f 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tasks/audit/AuditDataServiceTest.java
@@ -1,10 +1,9 @@
package org.onap.so.adapters.tasks.audit;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.when;
+import static org.assertj.core.api.Assertions.assertThat;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -13,7 +12,6 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.Vserver;
-import org.onap.so.adapters.tasks.audit.AuditDataService;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.so.db.request.beans.RequestProcessingData;
@@ -22,6 +20,7 @@ import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
+
@RunWith(MockitoJUnitRunner.Silent.class)
public class AuditDataServiceTest {
@@ -56,9 +55,8 @@ public class AuditDataServiceTest {
vserver.setVserverId("testVserverId");
audit.setAaiObject(vserver);
auditList.getAuditList().add(audit);
-
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
- String auditListString = objectMapper.getMapper().writeValueAsString(auditList);;
+ String auditListString = objectMapper.getMapper().writeValueAsString(auditList);
RequestProcessingData requestProcessingData = new RequestProcessingData();
requestProcessingData.setSoRequestId(auditInventory.getMsoRequestId());
@@ -99,4 +97,17 @@ public class AuditDataServiceTest {
"testVnfModuleId", "testVfModuleName1", "AuditStackData");
}
+ @Test
+ public void testGetStackDataToRequestDbWhenRequestProcessingDataListIsEmpty() throws Exception {
+
+ Mockito.doReturn(new ArrayList<RequestProcessingData>()).when(requestsDbClient)
+ .getRequestProcessingDataByGroupingIdAndNameAndTag(Mockito.any(), Mockito.any(), Mockito.any());
+ Optional<AAIObjectAuditList> result = auditDataService.getStackDataFromRequestDb(auditInventory);
+ Mockito.verify(requestsDbClient, Mockito.times(1)).getRequestProcessingDataByGroupingIdAndNameAndTag(
+ "testVnfModuleId", "testVfModuleName1", "AuditStackData");
+ assertThat(result).isEmpty();
+
+ }
+
+
}
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index ba179b6717..55e59d134e 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -280,7 +280,7 @@
</ignore>
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
diff --git a/adapters/mso-sdnc-adapter/pom.xml b/adapters/mso-sdnc-adapter/pom.xml
index 0c320faf8a..8bc9501fbd 100644
--- a/adapters/mso-sdnc-adapter/pom.xml
+++ b/adapters/mso-sdnc-adapter/pom.xml
@@ -16,7 +16,7 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
- <pluginManagement>
+ <pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
index 9e320700bd..5be06f9be2 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlockBase.java
@@ -1,8 +1,11 @@
package org.onap.so.bpmn.servicedecomposition.entities;
+import java.io.Serializable;
import org.onap.so.serviceinstancebeans.RequestDetails;
-public class BuildingBlockBase {
+public abstract class BuildingBlockBase<T extends BuildingBlockBase<T>> implements Serializable {
+
+ private static final long serialVersionUID = 4671883098039479717L;
private Boolean aLaCarte;
private String apiVersion;
@@ -14,40 +17,49 @@ public class BuildingBlockBase {
private WorkflowResourceIds workflowResourceIds;
private String vnfType;
- public void setaLaCarte(Boolean aLaCarte) {
+ public T setaLaCarte(Boolean aLaCarte) {
this.aLaCarte = aLaCarte;
+ return (T) this;
}
- public void setApiVersion(String apiVersion) {
+ public T setApiVersion(String apiVersion) {
this.apiVersion = apiVersion;
+ return (T) this;
}
- public void setResume(Boolean resume) {
+ public T setResume(Boolean resume) {
isResume = resume;
+ return (T) this;
}
- public void setResourceId(String resourceId) {
+ public T setResourceId(String resourceId) {
this.resourceId = resourceId;
+ return (T) this;
}
- public void setRequestId(String requestId) {
+ public T setRequestId(String requestId) {
this.requestId = requestId;
+ return (T) this;
}
- public void setRequestAction(String requestAction) {
+ public T setRequestAction(String requestAction) {
this.requestAction = requestAction;
+ return (T) this;
}
- public void setRequestDetails(RequestDetails requestDetails) {
+ public T setRequestDetails(RequestDetails requestDetails) {
this.requestDetails = requestDetails;
+ return (T) this;
}
- public void setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ public T setWorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
this.workflowResourceIds = workflowResourceIds;
+ return (T) this;
}
- public void setVnfType(String vnfType) {
+ public T setVnfType(String vnfType) {
this.vnfType = vnfType;
+ return (T) this;
}
public Boolean isResume() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
index 9274e0659e..e867b670b7 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
@@ -21,8 +21,9 @@
package org.onap.so.bpmn.servicedecomposition.entities;
import java.io.Serializable;
+import org.onap.so.serviceinstancebeans.RequestDetails;
-public class ExecuteBuildingBlock extends BuildingBlockBase implements Serializable {
+public class ExecuteBuildingBlock extends BuildingBlockBase<ExecuteBuildingBlock> implements Serializable {
private BuildingBlock buildingBlock;
private ConfigurationResourceKeys configurationResourceKeys;
@@ -33,24 +34,26 @@ public class ExecuteBuildingBlock extends BuildingBlockBase implements Serializa
return buildingBlock;
}
- public void setBuildingBlock(BuildingBlock buildingBlock) {
+ public ExecuteBuildingBlock setBuildingBlock(BuildingBlock buildingBlock) {
this.buildingBlock = buildingBlock;
+ return this;
}
public Boolean isHoming() {
return homing;
}
- public void setHoming(Boolean homing) {
+ public ExecuteBuildingBlock setHoming(Boolean homing) {
this.homing = homing;
+ return this;
}
public ConfigurationResourceKeys getConfigurationResourceKeys() {
return configurationResourceKeys;
}
- public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ public ExecuteBuildingBlock setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
this.configurationResourceKeys = configurationResourceKeys;
+ return this;
}
-
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
index e8be2734cc..508709e12c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/WorkflowResourceIds.java
@@ -41,14 +41,33 @@ public class WorkflowResourceIds implements Serializable {
private String configurationId;
private String instanceGroupId;
+
+ public WorkflowResourceIds() {
+ super();
+ }
+
+ public WorkflowResourceIds(WorkflowResourceIds workflowResourceIds) {
+ this.serviceInstanceId = workflowResourceIds.serviceInstanceId;
+ this.pnfId = workflowResourceIds.pnfId;
+ this.vnfId = workflowResourceIds.vnfId;
+ this.networkId = workflowResourceIds.networkId;
+ this.volumeGroupId = workflowResourceIds.volumeGroupId;
+ this.vfModuleId = workflowResourceIds.vfModuleId;
+ this.networkCollectionId = workflowResourceIds.networkCollectionId;
+ this.configurationId = workflowResourceIds.configurationId;
+ this.instanceGroupId = workflowResourceIds.instanceGroupId;
+ }
+
+
@Override
public String toString() {
return new ToStringBuilder(this).append("serviceInstanceId", serviceInstanceId).append("pnfId", pnfId)
.append("vnfId", vnfId).append("networkId", networkId).append("volumeGroupId", volumeGroupId)
.append("vfModuleId", vfModuleId).append("networkCollectionId", networkCollectionId)
- .append("configurationId", configurationId).toString();
+ .append("configurationId", configurationId).append("instanceGroupId", instanceGroupId).toString();
}
+
public String getServiceInstanceId() {
return serviceInstanceId;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index bfa77212c4..fcc8484385 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -1699,20 +1699,8 @@ public class BBInputSetup implements JavaDelegate {
&& bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) {
throw new Exception("Request invalid missing: RequestInfo:InstanceName");
} else {
- org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null;
- if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) {
- serviceInstanceAAI = bbInputSetupUtils
- .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer);
- }
- if (serviceInstanceId != null && serviceInstanceAAI == null) {
- if (customer != null && customer.getServiceSubscription() != null) {
- serviceInstanceAAI =
- bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
- customer.getServiceSubscription().getServiceType(), serviceInstanceId);
- } else {
- serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
- }
- }
+ org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI;
+ serviceInstanceAAI = getServiceInstanceAAI(requestDetails, customer, serviceInstanceId, aLaCarte, bbName);
if (serviceInstanceAAI != null) {
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, serviceInstanceId);
return this.getExistingServiceInstance(serviceInstanceAAI);
@@ -1722,6 +1710,25 @@ public class BBInputSetup implements JavaDelegate {
}
}
+ private org.onap.aai.domain.yang.ServiceInstance getServiceInstanceAAI(RequestDetails requestDetails,
+ Customer customer, String serviceInstanceId, boolean aLaCarte, String bbName) throws Exception {
+ org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = null;
+ if (aLaCarte && bbName.equalsIgnoreCase(AssignFlows.SERVICE_INSTANCE.toString())) {
+ serviceInstanceAAI = bbInputSetupUtils
+ .getAAIServiceInstanceByName(requestDetails.getRequestInfo().getInstanceName(), customer);
+ }
+ if (serviceInstanceId != null && serviceInstanceAAI == null) {
+ if (customer != null && customer.getServiceSubscription() != null) {
+ serviceInstanceAAI =
+ bbInputSetupUtils.getAAIServiceInstanceByIdAndCustomer(customer.getGlobalCustomerId(),
+ customer.getServiceSubscription().getServiceType(), serviceInstanceId);
+ } else {
+ serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+ }
+ }
+ return serviceInstanceAAI;
+ }
+
protected ServiceInstance createServiceInstance(RequestDetails requestDetails, Project project,
OwningEntity owningEntity, Map<ResourceKey, String> lookupKeyMap, String serviceInstanceId) {
ServiceInstance serviceInstance = new ServiceInstance();
@@ -1833,13 +1840,12 @@ public class BBInputSetup implements JavaDelegate {
AAIResultWrapper serviceInstanceWrapper = new AAIResultWrapper(
new AAICommonObjectMapperProvider().getMapper().writeValueAsString(serviceInstanceAAI));
Optional<Relationships> relationshipsOp = serviceInstanceWrapper.getRelationships();
- Relationships relationships = null;
if (relationshipsOp.isPresent()) {
- relationships = relationshipsOp.get();
- } else {
- return;
+ mapRelationship(serviceInstance, relationshipsOp.get());
}
+ }
+ private void mapRelationship(ServiceInstance serviceInstance, Relationships relationships) {
this.mapProject(relationships.getByType(AAIObjectType.PROJECT), serviceInstance);
this.mapOwningEntity(relationships.getByType(AAIObjectType.OWNING_ENTITY), serviceInstance);
this.mapL3Networks(relationships.getRelatedAAIUris(AAIObjectType.L3_NETWORK), serviceInstance.getNetworks());
@@ -1945,14 +1951,10 @@ public class BBInputSetup implements JavaDelegate {
AAIResultWrapper lineOfBusinessWrapper = lineOfBusinesses.get(0);
Optional<org.onap.aai.domain.yang.LineOfBusiness> aaiLineOfBusinessOp =
lineOfBusinessWrapper.asBean(org.onap.aai.domain.yang.LineOfBusiness.class);
- org.onap.aai.domain.yang.LineOfBusiness aaiLineOfBusiness = null;
- if (!aaiLineOfBusinessOp.isPresent()) {
- return;
+ if (aaiLineOfBusinessOp.isPresent()) {
+ LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusinessOp.get());
+ genericVnf.setLineOfBusiness(lineOfBusiness);
}
- aaiLineOfBusiness = aaiLineOfBusinessOp.get();
-
- LineOfBusiness lineOfBusiness = this.mapperLayer.mapAAILineOfBusiness(aaiLineOfBusiness);
- genericVnf.setLineOfBusiness(lineOfBusiness);
}
}
@@ -1961,14 +1963,10 @@ public class BBInputSetup implements JavaDelegate {
AAIResultWrapper platformWrapper = platforms.get(0);
Optional<org.onap.aai.domain.yang.Platform> aaiPlatformOp =
platformWrapper.asBean(org.onap.aai.domain.yang.Platform.class);
- org.onap.aai.domain.yang.Platform aaiPlatform = null;
- if (!aaiPlatformOp.isPresent()) {
- return;
+ if (aaiPlatformOp.isPresent()) {
+ Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatformOp.get());
+ genericVnf.setPlatform(platform);
}
- aaiPlatform = aaiPlatformOp.get();
-
- Platform platform = this.mapperLayer.mapAAIPlatform(aaiPlatform);
- genericVnf.setPlatform(platform);
}
}
@@ -1977,34 +1975,36 @@ public class BBInputSetup implements JavaDelegate {
AAIResultWrapper collectionWrapper = collections.get(0);
Optional<org.onap.aai.domain.yang.Collection> aaiCollectionOp =
collectionWrapper.asBean(org.onap.aai.domain.yang.Collection.class);
- org.onap.aai.domain.yang.Collection aaiCollection = null;
- if (!aaiCollectionOp.isPresent()) {
- return;
- }
- aaiCollection = aaiCollectionOp.get();
-
- Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection);
- NetworkCollectionResourceCustomization collectionResourceCust = bbInputSetupUtils
- .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
- collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust,
- collectionResourceCust.getCollectionResource()));
- Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships();
- Relationships relationships = null;
- if (relationshipsOp.isPresent()) {
- relationships = relationshipsOp.get();
- } else {
- serviceInstance.setCollection(collection);
- return;
- }
- List<InstanceGroup> instanceGroupsList =
- mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP));
- if (!instanceGroupsList.isEmpty()) {
- collection.setInstanceGroup(instanceGroupsList.get(0));
- }
- serviceInstance.setCollection(collection);
+ aaiCollectionOp.ifPresent(
+ collection -> serviceInstanceSetCollection(serviceInstance, collectionWrapper, collection));
}
}
+ private void serviceInstanceSetCollection(ServiceInstance serviceInstance, AAIResultWrapper collectionWrapper,
+ org.onap.aai.domain.yang.Collection aaiCollection) {
+ Collection collection = getCollection(aaiCollection);
+ Optional<Relationships> relationshipsOp = collectionWrapper.getRelationships();
+ relationshipsOp.ifPresent(relationships -> setInstanceGroupForCollection(collection, relationships));
+ serviceInstance.setCollection(collection);
+ }
+
+ private void setInstanceGroupForCollection(Collection collection, Relationships relationships) {
+ List<InstanceGroup> instanceGroupsList =
+ mapInstanceGroups(relationships.getByType(AAIObjectType.INSTANCE_GROUP));
+ if (!instanceGroupsList.isEmpty()) {
+ collection.setInstanceGroup(instanceGroupsList.get(0));
+ }
+ }
+
+ private Collection getCollection(org.onap.aai.domain.yang.Collection aaiCollection) {
+ Collection collection = this.mapperLayer.mapAAICollectionIntoCollection(aaiCollection);
+ NetworkCollectionResourceCustomization collectionResourceCust = bbInputSetupUtils
+ .getCatalogNetworkCollectionResourceCustByID(aaiCollection.getCollectionCustomizationId());
+ collection.setModelInfoCollection(mapperLayer.mapCatalogCollectionToCollection(collectionResourceCust,
+ collectionResourceCust.getCollectionResource()));
+ return collection;
+ }
+
protected void mapL3Networks(List<AAIResourceUri> list, List<L3Network> l3Networks) {
for (AAIResourceUri aaiResourceUri : list) {
l3Networks.add(this.mapL3Network(aaiResourceUri));
@@ -2080,14 +2080,10 @@ public class BBInputSetup implements JavaDelegate {
AAIResultWrapper owningEntityWrapper = owningEntities.get(0);
Optional<org.onap.aai.domain.yang.OwningEntity> aaiOwningEntityOp =
owningEntityWrapper.asBean(org.onap.aai.domain.yang.OwningEntity.class);
- org.onap.aai.domain.yang.OwningEntity aaiOwningEntity = null;
- if (!aaiOwningEntityOp.isPresent()) {
- return;
+ if (aaiOwningEntityOp.isPresent()) {
+ OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntityOp.get());
+ serviceInstance.setOwningEntity(owningEntity);
}
- aaiOwningEntity = aaiOwningEntityOp.get();
-
- OwningEntity owningEntity = this.mapperLayer.mapAAIOwningEntity(aaiOwningEntity);
- serviceInstance.setOwningEntity(owningEntity);
}
}
@@ -2096,14 +2092,10 @@ public class BBInputSetup implements JavaDelegate {
AAIResultWrapper projectWrapper = projects.get(0);
Optional<org.onap.aai.domain.yang.Project> aaiProjectOp =
projectWrapper.asBean(org.onap.aai.domain.yang.Project.class);
- org.onap.aai.domain.yang.Project aaiProject = null;
- if (!aaiProjectOp.isPresent()) {
- return;
+ if (aaiProjectOp.isPresent()) {
+ Project project = this.mapperLayer.mapAAIProject(aaiProjectOp.get());
+ serviceInstance.setProject(project);
}
- aaiProject = aaiProjectOp.get();
-
- Project project = this.mapperLayer.mapAAIProject(aaiProject);
- serviceInstance.setProject(project);
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
index 4379864bfe..68161a8dd5 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.serviceinstancebeans.Pnfs;
@@ -36,6 +37,10 @@ final class BBInputSetupPnf {
Pnf pnf = new Pnf();
pnf.setPnfId(pnfId);
pnf.setPnfName(pnfs.getInstanceName());
+ pnf.setModelInfoPnf(new ModelInfoPnf());
+ pnf.getModelInfoPnf().setModelCustomizationUuid(pnfs.getModelInfo().getModelCustomizationId());
+ pnf.getModelInfoPnf().setModelInvariantUuid(pnfs.getModelInfo().getModelInvariantId());
+ pnf.getModelInfoPnf().setModelUuid(pnfs.getModelInfo().getModelVersionId());
pnf.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
serviceInstance.getPnfs().add(pnf);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
index 0eef9cccd8..aa9943b9b1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnfTest.java
@@ -29,6 +29,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
+import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.Pnfs;
import static org.mockito.Mockito.doReturn;
@@ -38,11 +39,22 @@ public class BBInputSetupPnfTest {
@Mock
private Pnfs pnfs;
+ @Mock
+ private ModelInfo modelInfo;
+
@Test
public void populatePnfShouldSetRequiredFields() {
final String pnfId = "PNF_id1";
final String pnfName = "PNF_name1";
+ final String modelCustomizationId = "8421fe03-fd1b-4bf7-845a-c3fe91edb031";
+ final String modelInvariantId = "3360a2a5-22ff-44c7-8935-08c8e5ecbd06";
+ final String modelVersionId = "b80c3a52-abd4-436c-a22e-9c5da768781a";
+
+ doReturn(modelCustomizationId).when(modelInfo).getModelCustomizationId();
+ doReturn(modelInvariantId).when(modelInfo).getModelInvariantId();
+ doReturn(modelVersionId).when(modelInfo).getModelVersionId();
doReturn(pnfName).when(pnfs).getInstanceName();
+ doReturn(modelInfo).when(pnfs).getModelInfo();
ServiceInstance serviceInstance = new ServiceInstance();
BBInputSetupPnf.populatePnfToServiceInstance(pnfs, pnfId, serviceInstance);
@@ -53,6 +65,9 @@ public class BBInputSetupPnfTest {
assertEquals(pnfId, pnf.getPnfId());
assertEquals(pnfName, pnf.getPnfName());
+ assertEquals(modelCustomizationId, pnf.getModelInfoPnf().getModelCustomizationUuid());
+ assertEquals(modelInvariantId, pnf.getModelInfoPnf().getModelInvariantUuid());
+ assertEquals(modelVersionId, pnf.getModelInfoPnf().getModelUuid());
assertEquals(OrchestrationStatus.PRECREATED, pnf.getOrchestrationStatus());
}
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
index a74d78e04b..d7cfaf94f7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
@@ -115,8 +115,7 @@ public class BBInputSetupPopulateMethodsTest {
.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -182,8 +181,7 @@ public class BBInputSetupPopulateMethodsTest {
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.VF_MODULE.toString()).setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
@@ -245,8 +243,7 @@ public class BBInputSetupPopulateMethodsTest {
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("AssignFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index ffdc275dee..9e9c6f365f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -308,9 +308,8 @@ public class BBInputSetupTest {
@Test
public void testGetExecuteBBFromExecution() throws IOException {
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
- ExecuteBuildingBlock expected = new ExecuteBuildingBlock();
- expected.setBuildingBlock(bb);
- expected.setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017");
+ ExecuteBuildingBlock expected =
+ new ExecuteBuildingBlock().setBuildingBlock(bb).setRequestId("00032ab7-3fb3-42e5-965d-8ea592502017");
DelegateExecution execution = Mockito.mock(DelegateExecution.class);
doReturn(expected).when(execution).getVariable(any(String.class));
ExecuteBuildingBlock actual = SPY_bbInputSetup.getExecuteBBFromExecution(execution);
@@ -322,8 +321,7 @@ public class BBInputSetupTest {
GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
GeneralBuildingBlock.class);
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId");
RequestDetails requestDetails = new RequestDetails();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelType(ModelType.service);
@@ -351,8 +349,7 @@ public class BBInputSetupTest {
GeneralBuildingBlock expected = mapper
.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockCMExpected.json"), GeneralBuildingBlock.class);
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId");
RequestDetails requestDetails = new RequestDetails();
requestDetails.setModelInfo(null);
RequestParameters requestParams = new RequestParameters();
@@ -818,6 +815,26 @@ public class BBInputSetupTest {
assertThat(actual, sameBeanAs(expected));
}
+ @Test
+ public void testGetServiceInstanceHelperCreateScenarioExistingWithName() throws Exception {
+ RequestDetails requestDetails = new RequestDetails();
+ RequestInfo requestInfo = new RequestInfo();
+ requestDetails.setRequestInfo(requestInfo);
+ ServiceSubscription serviceSub = new ServiceSubscription();
+ Customer customer = new Customer();
+ customer.setServiceSubscription(serviceSub);
+ ServiceInstance expected = new ServiceInstance();
+ expected.setServiceInstanceId("serviceInstanceId");
+ org.onap.aai.domain.yang.ServiceInstance serviceInstanceAAI = new org.onap.aai.domain.yang.ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("serviceInstanceId");
+
+ doReturn(serviceInstanceAAI).when(SPY_bbInputSetupUtils).getAAIServiceInstanceByIdAndCustomer(Mockito.any(),
+ Mockito.any(), Mockito.any());
+ ServiceInstance actual = SPY_bbInputSetup.getServiceInstanceHelper(requestDetails, customer, null, null,
+ new HashMap<>(), "SharansInstanceId", false, new Service(), "ActivateServiceInstanceBB");
+ assertThat(actual, sameBeanAs(expected));
+ }
+
@Test(expected = Exception.class)
public void testGetServiceInstanceHelperCreateScenarioExistingNoNameButWithIdExceptionThrown() throws Exception {
RequestDetails requestDetails = new RequestDetails();
@@ -1006,9 +1023,7 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName(AssignFlows.SERVICE_INSTANCE.toString());
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setaLaCarte(true);
- executeBB.setBuildingBlock(buildingBlock);
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setaLaCarte(true).setBuildingBlock(buildingBlock);
RequestDetails requestDetails = new RequestDetails();
RequestInfo reqInfo = new RequestInfo();
reqInfo.setInstanceName("serviceInstanceName");
@@ -2055,8 +2070,7 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = prepareLookupKeyMap();
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("AssignVrfConfigurationBB");
buildingBlock.setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
@@ -2236,8 +2250,7 @@ public class BBInputSetupTest {
.readValue(new File(RESOURCE_PATH + "RequestDetailsInput_serviceMacro.json"), RequestDetails.class);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2306,8 +2319,7 @@ public class BBInputSetupTest {
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(false);
@@ -2352,8 +2364,7 @@ public class BBInputSetupTest {
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString())
.setKey("ab153b6e-c364-44c0-bef6-1f2982117f04").setIsVirtualLink(true);
@@ -2399,8 +2410,7 @@ public class BBInputSetupTest {
requestDetails.getRequestParameters().setUserParams(null);
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName(otherFlowName).setKey("ab153b6e-c364-44c0-bef6-1f2982117f04")
.setIsVirtualLink(true);
@@ -2472,8 +2482,7 @@ public class BBInputSetupTest {
aaiNetwork.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("DeleteNetworkBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2524,8 +2533,7 @@ public class BBInputSetupTest {
aaiVnf.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
buildingBlock.setBpmnScope("VNF");
@@ -2577,8 +2585,7 @@ public class BBInputSetupTest {
aaiVnf.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ActivateVnfBB").setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2634,8 +2641,7 @@ public class BBInputSetupTest {
aaiVfModule.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ControllerExecutionBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
buildingBlock.setBpmnScope("VfModule");
@@ -2695,8 +2701,7 @@ public class BBInputSetupTest {
aaiVfModule.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("UnassignVfModuleBB").setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
@@ -2757,8 +2762,7 @@ public class BBInputSetupTest {
aaiVolumeGroup.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("UnassignVolumeGroupBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
@@ -2824,8 +2828,7 @@ public class BBInputSetupTest {
aaiConfiguration.setModelCustomizationId("modelCustId");
ConfigurationResourceKeys configResourceKeys = prepareConfigurationResourceKeys();
- executeBB.setConfigurationResourceKeys(configResourceKeys);
- executeBB.setRequestDetails(requestDetails);
+ executeBB.setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails);
BuildingBlock buildingBlock = executeBB.getBuildingBlock();
buildingBlock.setBpmnFlowName("ActivateFabricConfigurationBB").setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
@@ -2893,8 +2896,7 @@ public class BBInputSetupTest {
@Test
public void testGetVnfId() {
String expected = "vnfId";
- ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock();
- executeBB.setRequestId("requestId");
+ ExecuteBuildingBlock executeBB = new ExecuteBuildingBlock().setRequestId("requestId");
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
InfraActiveRequests request = new InfraActiveRequests();
request.setVnfId(expected);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
index bac29150c1..ee47b514d1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java
@@ -58,8 +58,7 @@ public class ExecuteBuildingBlockRainyDayTest extends BaseTest {
vnf = setGenericVnf();
BuildingBlock buildingBlock = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- executeBuildingBlock.setBuildingBlock(buildingBlock);
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock);
delegateExecution.setVariable("gBBInput", gBBInput);
delegateExecution.setVariable("WorkflowException", new WorkflowException("", 7000, ""));
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java
deleted file mode 100644
index fd7498f468..0000000000
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package org.onap.so.bpmn.common.workflow.service;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.RuntimeService;
-import org.camunda.bpm.engine.migration.MigrationInstruction;
-import org.camunda.bpm.engine.migration.MigrationPlan;
-import org.camunda.bpm.engine.migration.MigrationPlanExecutionBuilder;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.runtime.ProcessInstanceQuery;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.context.event.ApplicationReadyEvent;
-import org.springframework.context.event.EventListener;
-import org.springframework.core.env.Environment;
-import org.springframework.stereotype.Service;
-
-@Service
-public class AutoProcessInstanceMigrationService {
-
- private static Logger logger = LoggerFactory.getLogger(AutoProcessInstanceMigrationService.class);
-
- @Autowired
- private Environment env;
- @Autowired
- protected ProcessEngine processEngine;
-
- @Value("${migration.autoMigrationEnabled:false}")
- private boolean autoMigrationEnabled;
-
- private RuntimeService runtimeService;
- private RepositoryService repositoryService;
- private List<String> processDefinitionKeys;
-
- @EventListener(ApplicationReadyEvent.class)
- protected void executeAutoProcessInstanceMigrations() {
- if (autoMigrationEnabled) {
- runtimeService = processEngine.getRuntimeService();
- repositoryService = processEngine.getRepositoryService();
- for (ProcessDefinition definition : getProcessDefinitions()) {
- for (ProcessDefinition procDefOld : getOldProcessDefinitions(definition.getKey(),
- definition.getVersion())) {
- migrate(procDefOld.getId(), definition.getId());
- }
- }
- }
- }
-
- protected List<ProcessDefinition> getProcessDefinitions() {
- List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
- processDefinitionKeys = env.getProperty("migration.processDefinitionKeys", List.class, new ArrayList<String>());
- for (String key : processDefinitionKeys) {
- processDefinitions.add(repositoryService.createProcessDefinitionQuery().processDefinitionKey(key)
- .latestVersion().singleResult());
- }
- return processDefinitions;
- }
-
- private void migrate(String sourceProcessDefinitionId, String targetProcessDefinitionId) {
- MigrationPlan migrationPlan =
- runtimeService.createMigrationPlan(sourceProcessDefinitionId, targetProcessDefinitionId)
- .mapEqualActivities().updateEventTriggers().build();
- List<String> activityIds = new ArrayList<>();
-
- for (MigrationInstruction instruction : migrationPlan.getInstructions()) {
- activityIds.add(instruction.getSourceActivityId());
- }
- for (String activityId : activityIds) {
- ProcessInstanceQuery activeProcessInstancesQuery = runtimeService.createProcessInstanceQuery()
- .processDefinitionId(sourceProcessDefinitionId).activityIdIn(activityId).active();
- if (!activeProcessInstancesQuery.list().isEmpty()) {
- logger.info("Migrating {} process instance(s) from {} to {}",
- Long.valueOf(activeProcessInstancesQuery.count()), sourceProcessDefinitionId,
- targetProcessDefinitionId);
- MigrationPlanExecutionBuilder migration =
- runtimeService.newMigration(migrationPlan).processInstanceQuery(activeProcessInstancesQuery);
- migration.executeAsync();
- }
- }
- suspendEmptyProcessDefinition(sourceProcessDefinitionId);
- }
-
- private void suspendEmptyProcessDefinition(String sourceProcessDefinitionId) {
- List<ProcessInstance> activeProcessInstances = runtimeService.createProcessInstanceQuery()
- .processDefinitionId(sourceProcessDefinitionId).active().list();
- if (activeProcessInstances.isEmpty()) {
- repositoryService.suspendProcessDefinitionById(sourceProcessDefinitionId);
- } else {
- logger.info("Unable to migrate {} process instance(s) from {}",
- Integer.valueOf(activeProcessInstances.size()), sourceProcessDefinitionId);
- }
- }
-
- protected List<ProcessDefinition> getOldProcessDefinitions(String key, int version) {
- List<ProcessDefinition> processDefinitions =
- repositoryService.createProcessDefinitionQuery().processDefinitionKey(key).list();
- List<ProcessDefinition> oldProcessDefinitions = new ArrayList<>();
- for (ProcessDefinition processDef : processDefinitions) {
- if (!processDef.isSuspended() && (processDef.getVersion() != version)) {
- oldProcessDefinitions.add(processDef);
- }
- }
- return oldProcessDefinitions;
- }
-}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java
deleted file mode 100644
index 77b3535ce1..0000000000
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2020 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.bpmn.common.workflow.service;
-
-import static org.junit.Assert.assertEquals;
-import static org.mockito.Mockito.doReturn;
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.ProcessEngine;
-import org.camunda.bpm.engine.RepositoryService;
-import org.camunda.bpm.engine.repository.ProcessDefinition;
-import org.camunda.bpm.engine.repository.ProcessDefinitionQuery;
-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.springframework.core.env.Environment;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AutoProcessInstanceMigrationServiceTest {
-
- @Mock
- private ProcessEngine processEngine;
-
- @Mock
- private ProcessDefinition outdated;
-
- @Mock
- private ProcessDefinition newDef;
-
- @Mock
- private ProcessDefinition key;
-
- @Mock
- private ProcessDefinition testKey;
-
- @Mock
- private ProcessDefinition suspendedDef;
-
- @Mock
- private RepositoryService repositoryService;
-
- @Mock
- private ProcessDefinitionQuery query;
-
- @Mock
- private ProcessDefinitionQuery keyQuery;
-
- @Mock
- private Environment env;
-
- @Spy
- @InjectMocks
- private AutoProcessInstanceMigrationService migrationService;
-
-
- @Test
- public void getOldProcessDefinitionsTest() {
- List<ProcessDefinition> expectedList = new ArrayList<>();
- expectedList.add(outdated);
-
- List<ProcessDefinition> defList = new ArrayList<>();
- defList.add(outdated);
- defList.add(newDef);
- defList.add(suspendedDef);
-
- doReturn(query).when(repositoryService).createProcessDefinitionQuery();
- doReturn(query).when(query).processDefinitionKey("test");
- doReturn(defList).when(query).list();
- doReturn(3).when(outdated).getVersion();
- doReturn(4).when(newDef).getVersion();
- doReturn(true).when(suspendedDef).isSuspended();
- List<ProcessDefinition> outdatedList = migrationService.getOldProcessDefinitions("test", 4);
-
- assertEquals(expectedList, outdatedList);
- }
-
- @Test
- public void getProcessDefinitionsTest() {
- List<ProcessDefinition> expected = new ArrayList<ProcessDefinition>();
- expected.add(testKey);
- expected.add(key);
-
- List<String> processDefinitionKeys = new ArrayList<String>();
- processDefinitionKeys.add("testKey");
- processDefinitionKeys.add("key");
-
- doReturn(processDefinitionKeys).when(env).getProperty("migration.processDefinitionKeys", List.class,
- new ArrayList<String>());
-
- doReturn(query).when(repositoryService).createProcessDefinitionQuery();
- doReturn(query).when(query).processDefinitionKey("testKey");
- doReturn(query).when(query).latestVersion();
- doReturn(testKey).when(query).singleResult();
-
- doReturn(keyQuery).when(query).processDefinitionKey("key");
- doReturn(keyQuery).when(keyQuery).latestVersion();
- doReturn(key).when(keyQuery).singleResult();
-
- List<ProcessDefinition> actualProcessDefinitions = migrationService.getProcessDefinitions();
-
- assertEquals(expected, actualProcessDefinitions);
- }
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/pom.xml b/bpmn/so-bpmn-infrastructure-common/pom.xml
index 92bf43f982..075f6f8fdd 100644
--- a/bpmn/so-bpmn-infrastructure-common/pom.xml
+++ b/bpmn/so-bpmn-infrastructure-common/pom.xml
@@ -55,7 +55,7 @@
</plugins>
<pluginManagement>
<plugins>
- <plugin>
+ <plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index dec9560574..e89bbec9e1 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -210,7 +210,7 @@
<groupId>javax.ws.rs</groupId>
<artifactId>jsr311-api</artifactId>
</exclusion>
- <exclusion>
+ <exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
@@ -252,5 +252,10 @@
<version>${grpc.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-optimization-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/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index a4ffb45370..415d4614da 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -166,16 +166,10 @@ public class ExecuteActivity implements JavaDelegate {
String bpmnRequest = (String) execution.getVariable(G_BPMN_REQUEST);
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
RequestDetails requestDetails = sIRequest.getRequestDetails();
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- executeBuildingBlock.setaLaCarte(true);
- executeBuildingBlock.setRequestAction((String) execution.getVariable(G_ACTION));
- executeBuildingBlock.setResourceId((String) execution.getVariable(VNF_ID));
- executeBuildingBlock.setVnfType((String) execution.getVariable(VNF_TYPE));
- executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
- executeBuildingBlock.setRequestId(requestId);
- executeBuildingBlock.setBuildingBlock(buildingBlock);
- executeBuildingBlock.setRequestDetails(requestDetails);
- return executeBuildingBlock;
+ return new ExecuteBuildingBlock().setaLaCarte(true).setRequestAction((String) execution.getVariable(G_ACTION))
+ .setResourceId((String) execution.getVariable(VNF_ID))
+ .setVnfType((String) execution.getVariable(VNF_TYPE)).setWorkflowResourceIds(workflowResourceIds)
+ .setRequestId(requestId).setBuildingBlock(buildingBlock).setRequestDetails(requestDetails);
}
protected void buildAndThrowException(DelegateExecution execution, String msg, Exception ex) {
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 d22435c495..e154375d3d 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,14 +20,20 @@
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 extends BuildingBlockBase {
+public class ConfigBuildingBlocksDataObject extends BuildingBlockBase<ConfigBuildingBlocksDataObject>
+ implements Serializable {
+ private static final long serialVersionUID = 3L;
private DelegateExecution execution;
private List<OrchestrationFlow> orchFlows;
private Resource resourceKey;
@@ -37,31 +43,38 @@ public class ConfigBuildingBlocksDataObject extends BuildingBlockBase {
return sIRequest;
}
- public void setsIRequest(ServiceInstancesRequest sIRequest) {
+ public ConfigBuildingBlocksDataObject setsIRequest(ServiceInstancesRequest sIRequest) {
this.sIRequest = sIRequest;
+ return this;
}
public List<OrchestrationFlow> getOrchFlows() {
return orchFlows;
}
- public void setOrchFlows(List<OrchestrationFlow> orchFlows) {
+ public ConfigBuildingBlocksDataObject setOrchFlows(List<OrchestrationFlow> orchFlows) {
this.orchFlows = orchFlows;
+ return this;
}
public Resource getResourceKey() {
return resourceKey;
}
- public void setResourceKey(Resource resourceKey) {
+ public ConfigBuildingBlocksDataObject setResourceKey(Resource resourceKey) {
this.resourceKey = resourceKey;
+ return this;
}
public DelegateExecution getExecution() {
return execution;
}
- public void setExecution(DelegateExecution execution) {
+ public ConfigBuildingBlocksDataObject setExecution(DelegateExecution execution) {
this.execution = execution;
+ 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/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 71e1abd564..2921cada18 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
@@ -75,6 +75,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 +144,7 @@ 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";
@Autowired
protected BBInputSetup bbInputSetup;
@@ -158,10 +160,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;
@@ -221,57 +221,59 @@ public class WorkflowAction {
cloudOwner, serviceType);
}
Resource resourceKey = getResourceKey(sIRequest, resourceType);
- if (isConfiguration(orchFlows) && !requestAction.equalsIgnoreCase(CREATEINSTANCE)) {
- ConfigBuildingBlocksDataObject configBuildingBlocksDataObject =
- new ConfigBuildingBlocksDataObject();
- configBuildingBlocksDataObject.setsIRequest(sIRequest);
- configBuildingBlocksDataObject.setOrchFlows(orchFlows);
- configBuildingBlocksDataObject.setRequestId(requestId);
- configBuildingBlocksDataObject.setResourceKey(resourceKey);
- configBuildingBlocksDataObject.setApiVersion(apiVersion);
- configBuildingBlocksDataObject.setResourceId(resourceId);
- configBuildingBlocksDataObject.setRequestAction(requestAction);
- configBuildingBlocksDataObject.setaLaCarte(true);
- configBuildingBlocksDataObject.setVnfType(vnfType);
- configBuildingBlocksDataObject.setWorkflowResourceIds(workflowResourceIds);
- configBuildingBlocksDataObject.setRequestDetails(requestDetails);
- configBuildingBlocksDataObject.setExecution(execution);
-
- List<ExecuteBuildingBlock> configBuildingBlocks =
- getConfigBuildingBlocks(configBuildingBlocksDataObject);
-
- flowsToExecute.addAll(configBuildingBlocks);
- }
- orchFlows = orchFlows.stream().filter(item -> !item.getFlowName().contains(FABRIC_CONFIGURATION))
- .collect(Collectors.toList());
if ((requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS))
&& resourceType.equals(WorkflowType.VFMODULE)) {
logger.debug("Build a BB list for replacing BB modules");
-
- ConfigBuildingBlocksDataObject configBuildingBlocksDataObject =
- new ConfigBuildingBlocksDataObject();
- configBuildingBlocksDataObject.setsIRequest(sIRequest);
- configBuildingBlocksDataObject.setOrchFlows(orchFlows);
- configBuildingBlocksDataObject.setRequestId(requestId);
- configBuildingBlocksDataObject.setResourceKey(resourceKey);
- configBuildingBlocksDataObject.setApiVersion(apiVersion);
- configBuildingBlocksDataObject.setResourceId(resourceId);
- configBuildingBlocksDataObject.setRequestAction(requestAction);
- configBuildingBlocksDataObject.setaLaCarte(true);
- configBuildingBlocksDataObject.setVnfType(vnfType);
- configBuildingBlocksDataObject.setWorkflowResourceIds(workflowResourceIds);
- configBuildingBlocksDataObject.setRequestDetails(requestDetails);
- configBuildingBlocksDataObject.setExecution(execution);
-
- orchFlows = getVfModuleReplaceBuildingBlocks(configBuildingBlocksDataObject);
- }
- for (OrchestrationFlow orchFlow : orchFlows) {
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
- apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
- requestDetails, false, null, null, false);
- flowsToExecute.add(ebb);
+ 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) {
+ if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ List<OrchestrationFlow> configOrchFlows = new ArrayList<>();
+ configOrchFlows.add(orchFlow);
+ List<ExecuteBuildingBlock> configBuildingBlocks =
+ getConfigBuildingBlocks(new ConfigBuildingBlocksDataObject()
+ .setsIRequest(sIRequest).setOrchFlows(configOrchFlows)
+ .setRequestId(requestId).setResourceKey(resourceKey)
+ .setApiVersion(apiVersion).setResourceId(resourceId)
+ .setRequestAction(requestAction).setaLaCarte(true).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds)
+ .setRequestDetails(requestDetails).setExecution(execution));
+ flowsToExecute.addAll(configBuildingBlocks);
+ } else {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
+ requestDetails, false, null, null, false);
+ flowsToExecute.add(ebb);
+ }
+ }
+ } else {
+ if (isConfiguration(orchFlows) && !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());
+
+ for (OrchestrationFlow orchFlow : orchFlows) {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
+ requestDetails, false, null, null, false);
+ flowsToExecute.add(ebb);
+ }
}
} else {
boolean foundRelated = false;
@@ -284,11 +286,8 @@ public class WorkflowAction {
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 =
+ userParams.stream().anyMatch(param -> param.containsKey(USERPARAMSERVICE));
if (containsService) {
traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
}
@@ -306,11 +305,8 @@ public class WorkflowAction {
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 =
+ userParams.stream().anyMatch(param -> param.containsKey(USERPARAMSERVICE));
}
if (containsService) {
foundRelated = traverseUserParamsService(execution, resourceList, sIRequest, requestAction);
@@ -338,13 +334,13 @@ public class WorkflowAction {
} 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);
+ logger.info("Found {}", foundObjects.toString());
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, isALaCarte,
@@ -364,8 +360,7 @@ public class WorkflowAction {
// 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()) {
+ && resourceList.stream().anyMatch(x -> WorkflowType.VNF.equals(x.getResourceType()))) {
execution.setVariable("homing", true);
execution.setVariable("calledHoming", false);
}
@@ -386,11 +381,7 @@ public class WorkflowAction {
sIRequest.getRequestDetails().getRequestParameters().getUserParams();
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)));
}
}
}
@@ -445,7 +436,7 @@ public class WorkflowAction {
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,
@@ -511,7 +502,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) {
@@ -572,8 +563,7 @@ 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();
}
Optional<VolumeGroup> volumeGroupFromVfModule =
@@ -626,7 +616,7 @@ public class WorkflowAction {
}
Relationships relationships = relationshipsOp.get();
List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
+ if (vnfcResultWrappers.size() != 1) {
logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
}
Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
@@ -664,11 +654,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) {
@@ -685,11 +674,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,
@@ -830,82 +818,102 @@ public class WorkflowAction {
protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
org.onap.so.db.catalog.beans.Service service) {
- if (isVnfCustomizationsEmpty(service)) {
- 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);
- } else {
+ 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 (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.");
+ 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;
}
- } else {
- logger.debug("No Network Collection found. collectionResource is null");
}
- } else {
+ if (interfaceNetworkQuantityIsAvailableInCollection(collectionInstCust)) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust =
+ getCollectionNetworkResourceCustomization(collectionResourceCustomization, instanceGroup);
+ 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);
+ }
+ }
+ }
+
+ 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,
@@ -924,12 +932,11 @@ public class WorkflowAction {
}
private boolean isNetworkCollectionInTheResourceList(List<Resource> resourceList) {
- return !(resourceList.stream().filter(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType())
- .collect(Collectors.toList()).isEmpty());
+ return resourceList.stream().anyMatch(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType());
}
- private boolean isVnfCustomizationsEmpty(org.onap.so.db.catalog.beans.Service service) {
- return service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty();
+ 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,
@@ -939,28 +946,7 @@ 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);
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
.getNetworks()) {
@@ -999,6 +985,38 @@ 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 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 {
@@ -1111,12 +1129,9 @@ public class WorkflowAction {
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) {
@@ -1406,7 +1421,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()
@@ -1415,10 +1430,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));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
if (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
@@ -1454,8 +1469,8 @@ public class WorkflowAction {
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);
if (resource != null
&& (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
@@ -1464,28 +1479,27 @@ public class WorkflowAction {
resourceId = workflowResourceIds.getVolumeGroupId();
}
- ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock();
- executeBuildingBlock.setApiVersion(apiVersion);
- executeBuildingBlock.setaLaCarte(aLaCarte);
- executeBuildingBlock.setRequestAction(requestAction);
- executeBuildingBlock.setResourceId(resourceId);
- executeBuildingBlock.setVnfType(vnfType);
- executeBuildingBlock.setWorkflowResourceIds(workflowResourceIds);
- executeBuildingBlock.setRequestId(requestId);
- executeBuildingBlock.setBuildingBlock(buildingBlock);
- executeBuildingBlock.setRequestDetails(requestDetails);
+ ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion)
+ .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock)
+ .setRequestDetails(requestDetails);
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, "");
@@ -1494,7 +1508,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 =
@@ -1575,7 +1589,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) {
@@ -1639,8 +1653,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()) {
@@ -1684,8 +1697,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()) {
@@ -1703,8 +1715,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);
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 31df5bbdc3..343b25eb97 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 {
@@ -108,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);
}
@@ -152,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) {
@@ -222,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.";
@@ -237,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));
@@ -294,14 +285,11 @@ public class WorkflowActionBBTasks {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = new ArrayList();
- for (int i = 0; i < flowsToExecute.size(); i++) {
- if (flowsToExecute.get(i).getBuildingBlock().getBpmnFlowName().startsWith("Change")) {
- flowsToExecuteChangeBBs.add(flowsToExecute.get(i));
- }
- }
+ List<ExecuteBuildingBlock> flowsToExecuteChangeBBs = flowsToExecute.stream()
+ .filter(buildingBlock -> buildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change"))
+ .collect(Collectors.toList());
- List<ExecuteBuildingBlock> rollbackFlows = new ArrayList();
+ List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>();
int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
int listSize = flowsToExecute.size();
@@ -339,25 +327,24 @@ 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")
&& ROLLBACKTOCREATED.equals(handlingCode)) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ rollbackFlowsFiltered.remove(rollbackFlow);
}
}
}
- List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList();
+ List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList<>();
if (action.equals(REPLACEINSTANCE) && resourceName.equals(VFMODULE)) {
- for (int i = 0; i < rollbackFlowsFiltered.size(); i++) {
- if (!rollbackFlowsFiltered.get(i).getBuildingBlock().getBpmnFlowName().startsWith("Change")) {
- rollbackFlowsFilteredNonChangeBBs.add(rollbackFlowsFiltered.get(i));
+ for (ExecuteBuildingBlock executeBuildingBlock : rollbackFlowsFiltered) {
+ if (!executeBuildingBlock.getBuildingBlock().getBpmnFlowName().startsWith("Change")) {
+ rollbackFlowsFilteredNonChangeBBs.add(executeBuildingBlock);
}
}
rollbackFlowsFiltered.clear();
@@ -366,10 +353,7 @@ public class WorkflowActionBBTasks {
}
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);
@@ -456,9 +440,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 {
@@ -491,19 +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();
- configBB.setaLaCarte(ebb.isaLaCarte());
- configBB.setApiVersion(ebb.getApiVersion());
- configBB.setRequestAction(ebb.getRequestAction());
- configBB.setVnfType(ebb.getVnfType());
- configBB.setRequestId(ebb.getRequestId());
- configBB.setRequestDetails(ebb.getRequestDetails());
- configBB.setBuildingBlock(buildingBlock);
- configBB.setWorkflowResourceIds(workflowResourceIds);
- configBB.setConfigurationResourceKeys(configurationResourceKeys);
- return configBB;
+ 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);
}
protected void setInstanceName(String resourceId, WorkflowType resourceType, InfraActiveRequests request) {
@@ -527,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/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/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 23ffbac645..7f44c97f59 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -144,8 +144,7 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
@Test
public void updateRequestStatusToFailedRollbackFabric() {
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("UnassignFabricConfigurationBB");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(bb);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
execution.setVariable("buildingBlock", ebb);
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", false);
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 9b41d0fada..1aa7640492 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;
@@ -115,9 +119,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ModelInfo mi = new ModelInfo();
mi.setModelUuid(modelUuid);
rd.setModelInfo(mi);
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(buildingBlock);
- ebb.setRequestDetails(rd);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd);
flowsToExecute.add(ebb);
List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList<>();
@@ -152,9 +154,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
ModelInfo mi = new ModelInfo();
mi.setModelUuid(modelUuid);
rd.setModelInfo(mi);
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(buildingBlock);
- ebb.setRequestDetails(rd);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock).setRequestDetails(rd);
ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
flowsToExecute.add(ebb);
@@ -177,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);
}
@@ -204,18 +204,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -238,18 +235,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -272,23 +266,19 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignServiceInstanceBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateNetworkCollectionBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -312,18 +302,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -344,29 +331,24 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", "VfModule");
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("ChangeModelVnfBB");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("ChangeModelServiceInstanceBB");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(buildingBlock5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
flowsToExecute.add(ebb5);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -389,23 +371,19 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -429,18 +407,15 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -461,53 +436,43 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("VNFCheckInMaintFlagActivity");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("VNFSetInMaintFlagActivity");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("VNFCheckClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("VNFSetClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(buildingBlock5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
flowsToExecute.add(ebb5);
BuildingBlock buildingBlock6 = new BuildingBlock().setBpmnFlowName("VNFLockActivity");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(buildingBlock6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock6);
flowsToExecute.add(ebb6);
BuildingBlock buildingBlock7 = new BuildingBlock().setBpmnFlowName("VNFUpgradePreCheckActivity");
- ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock();
- ebb7.setBuildingBlock(buildingBlock7);
+ ExecuteBuildingBlock ebb7 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock7);
flowsToExecute.add(ebb7);
BuildingBlock buildingBlock8 = new BuildingBlock().setBpmnFlowName("VNFQuiesceTrafficActivity");
- ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock();
- ebb8.setBuildingBlock(buildingBlock8);
+ ExecuteBuildingBlock ebb8 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock8);
flowsToExecute.add(ebb8);
BuildingBlock buildingBlock9 = new BuildingBlock().setBpmnFlowName("VNFStopActivity");
- ExecuteBuildingBlock ebb9 = new ExecuteBuildingBlock();
- ebb9.setBuildingBlock(buildingBlock9);
+ ExecuteBuildingBlock ebb9 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock9);
flowsToExecute.add(ebb9);
BuildingBlock buildingBlock10 = new BuildingBlock().setBpmnFlowName("VNFSnapShotActivity");
- ExecuteBuildingBlock ebb10 = new ExecuteBuildingBlock();
- ebb10.setBuildingBlock(buildingBlock10);
+ ExecuteBuildingBlock ebb10 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock10);
flowsToExecute.add(ebb10);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -532,33 +497,27 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
execution.setVariable("resourceName", EMPTY_STRING);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("VNFCheckPserversLockedFlagActivity");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(buildingBlock1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
flowsToExecute.add(ebb1);
BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("VNFCheckInMaintFlagActivity");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(buildingBlock2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
flowsToExecute.add(ebb2);
BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("VNFSetInMaintFlagActivity");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(buildingBlock3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
flowsToExecute.add(ebb3);
BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("VNFCheckClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(buildingBlock4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
flowsToExecute.add(ebb4);
BuildingBlock buildingBlock5 = new BuildingBlock().setBpmnFlowName("VNFSetClosedLoopDisabledFlagActivity");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(buildingBlock5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock5);
flowsToExecute.add(ebb5);
BuildingBlock buildingBlock6 = new BuildingBlock().setBpmnFlowName("VNFHealthCheckActivity");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(buildingBlock6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock6);
flowsToExecute.add(ebb6);
execution.setVariable("flowsToExecute", flowsToExecute);
@@ -572,6 +531,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() {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
index e064fb0b64..73aace7592 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksUpdateReqDbTest.java
@@ -68,12 +68,10 @@ public class WorkflowActionBBTasksUpdateReqDbTest extends BaseTaskTest {
public void getUpdatedRequestTest() throws Exception {
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
BuildingBlock bb1 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB");
- ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
- ebb1.setBuildingBlock(bb1);
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(bb1);
flowsToExecute.add(ebb1);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
flowsToExecute.add(ebb2);
String requestId = "requestId";
execution.setVariable("mso-request-id", requestId);
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 c762c16d92..cf8d98e86e 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
@@ -140,6 +140,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 {
@@ -1360,6 +1365,74 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListALaCarteVfModuleWithFabricKeepVolumeGroupReplaceTest() 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");
+ 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());
+
+ 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(any(), any(), any());
+
+ doReturn("testVnfcName").when(SPY_workflowAction).getVnfcNameForConfiguration(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";
@@ -1647,19 +1720,10 @@ public class WorkflowActionTest extends BaseTaskTest {
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
"UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
- ConfigBuildingBlocksDataObject dataObj = new ConfigBuildingBlocksDataObject();
- dataObj.setsIRequest(sIRequest);
- dataObj.setOrchFlows(orchFlows);
- dataObj.setRequestId(requestId);
- dataObj.setResourceKey(resourceKey);
- dataObj.setApiVersion(apiVersion);
- dataObj.setResourceId(resourceId);
- dataObj.setRequestAction(requestAction);
- dataObj.setaLaCarte(aLaCarte);
- dataObj.setVnfType(vnfType);
- dataObj.setWorkflowResourceIds(workflowResourceIds);
- dataObj.setRequestDetails(requestDetails);
- dataObj.setExecution(execution);
+ 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");
@@ -1816,33 +1880,27 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(bb);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
executeFlows.add(ebb);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("AssignNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
executeFlows.add(ebb2);
BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(bb3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3);
executeFlows.add(ebb3);
BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("CreateNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(bb4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4);
executeFlows.add(ebb4);
BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(bb5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5);
executeFlows.add(ebb5);
BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("ActivateNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(bb6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6);
executeFlows.add(ebb6);
List<ExecuteBuildingBlock> sorted =
@@ -1856,33 +1914,27 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> executeFlows = new ArrayList<>();
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("DeactivateNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setBuildingBlock(bb);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setBuildingBlock(bb);
executeFlows.add(ebb);
BuildingBlock bb2 = new BuildingBlock().setBpmnFlowName("DeactivateNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
- ebb2.setBuildingBlock(bb2);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(bb2);
executeFlows.add(ebb2);
BuildingBlock bb3 = new BuildingBlock().setBpmnFlowName("DeleteNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
- ebb3.setBuildingBlock(bb3);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(bb3);
executeFlows.add(ebb3);
BuildingBlock bb4 = new BuildingBlock().setBpmnFlowName("DeleteNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
- ebb4.setBuildingBlock(bb4);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(bb4);
executeFlows.add(ebb4);
BuildingBlock bb5 = new BuildingBlock().setBpmnFlowName("UnassignNetworkBB").setKey("0");
- ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
- ebb5.setBuildingBlock(bb5);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock().setBuildingBlock(bb5);
executeFlows.add(ebb5);
BuildingBlock bb6 = new BuildingBlock().setBpmnFlowName("UnassignNetworkBB").setKey("1");
- ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock();
- ebb6.setBuildingBlock(bb6);
+ ExecuteBuildingBlock ebb6 = new ExecuteBuildingBlock().setBuildingBlock(bb6);
executeFlows.add(ebb6);
List<ExecuteBuildingBlock> sorted =
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
index 1b4ddf71c2..9d208f41e8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java
@@ -91,10 +91,8 @@ public class MultiStageSkipListenerTest {
workflowResourceIds.setServiceInstanceId("serviceInstanceId");
workflowResourceIds.setVnfId(vnfId);
BuildingBlock bb = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
- ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
- ebb.setResourceId(vfModuleId);
- ebb.setBuildingBlock(bb);
- ebb.setWorkflowResourceIds(workflowResourceIds);
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock().setResourceId(vfModuleId).setBuildingBlock(bb)
+ .setWorkflowResourceIds(workflowResourceIds);
flowsToExecute.add(ebb);
flowsToExecute.add(new ExecuteBuildingBlock());
flowsToExecute.add(new ExecuteBuildingBlock());
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java b/common/src/main/java/org/onap/so/client/exception/BadResponseException.java
index 7b1066d48c..7b1066d48c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/BadResponseException.java
+++ b/common/src/main/java/org/onap/so/client/exception/BadResponseException.java
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 2f25d409d2..afb734d46e 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -265,7 +265,7 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
- <pluginManagement>
+ <pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.m2e</groupId>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
index fc0048bacf..70de94a3ef 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java
@@ -148,7 +148,7 @@ public class AAIDataRetrieval {
}
public List<LInterface> getLinterfacesOfVnf(String vnfId) {
- DSLStartNode startNode = new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("generic-vnf-id", vnfId));
+ DSLStartNode startNode = new DSLStartNode(AAIObjectType.GENERIC_VNF, __.key("vnf-id", vnfId));
DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(startNode)
.to(__.node(AAIObjectType.VSERVER).to(__.node(AAIObjectType.L_INTERFACE).output()));
List<LInterface> linterfaces =
diff --git a/pom.xml b/pom.xml
index b2fd0d5898..2556f32c56 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,6 +29,7 @@
<module>mso-api-handlers</module>
<module>adapters</module>
<module>asdc-controller</module>
+ <module>so-optimization-clients</module>
<module>bpmn</module>
<module>cloudify-client</module>
<module>cxf-logging</module>
@@ -535,7 +536,7 @@
</plugins>
<pluginManagement>
<plugins>
- <plugin>
+ <plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
@@ -555,7 +556,7 @@
<execute />
</action>
</pluginExecution>
- <pluginExecution>
+ <pluginExecution>
<pluginExecutionFilter>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>groovy-maven-plugin</artifactId>
diff --git a/so-optimization-clients/pom.xml b/so-optimization-clients/pom.xml
new file mode 100644
index 0000000000..a15314d4b5
--- /dev/null
+++ b/so-optimization-clients/pom.xml
@@ -0,0 +1,89 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so</artifactId>
+ <version>1.6.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+ <artifactId>so-optimization-clients</artifactId>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>integration-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/IntegrationTestSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <parallel>suites</parallel>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <!-- Import dependency management from Spring Boot -->
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-dependencies</artifactId>
+ <version>${springboot.version}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.camunda.bpm.springboot</groupId>
+ <artifactId>camunda-bpm-spring-boot-starter</artifactId>
+ <version>${camunda.springboot.version}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.cloud</groupId>
+ <artifactId>spring-cloud-contract-wiremock</artifactId>
+ <version>1.2.4.RELEASE</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-test</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.commons</groupId>
+ <artifactId>commons-lang3</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-configuration-processor</artifactId>
+ <optional>true</optional>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>common</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/OofClient.java
index 8b0cf69f6c..71ecc5c478 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofClient.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/OofClient.java
@@ -21,7 +21,6 @@
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;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/OofValidator.java
index abbf52e38c..2c22d9d09e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/OofValidator.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/OofValidator.java
@@ -27,7 +27,7 @@ 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;
+import static org.apache.commons.lang3.StringUtils.isNotBlank;
@Component
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java
index e64a5450b5..e64a5450b5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/LicenseDemand.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java
index 74ff9339d3..74ff9339d3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/LicenseInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
index 433de22aba..433de22aba 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ModelInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
index 84e29b6f2d..84e29b6f2d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofProperties.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
index f8896240ba..f8896240ba 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofRequest.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
index 6c9e45c787..6c9e45c787 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/OofRequestParameters.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
index 631b3707d4..631b3707d4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/PlacementDemand.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
index 7519e8c87e..7519e8c87e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/PlacementInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
index 0132ed56e9..0132ed56e9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/RequestInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/Resource.java
index 8d44c63571..8d44c63571 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/Resource.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/Resource.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
index 9d0352525d..9d0352525d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ResourceModelInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
index db0e2acd60..db0e2acd60 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/ServiceInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
index 8fef4c45e7..8fef4c45e7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/oof/beans/SubscriberInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroClient.java
index c63cbc0b68..6930b6e0af 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -23,10 +23,9 @@
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.ConductorProperties;
import org.onap.so.client.sniro.beans.ManagerProperties;
import org.onap.so.client.sniro.beans.SniroConductorRequest;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
@@ -57,7 +56,6 @@ public class SniroClient {
* @param homingRequest
* @return
* @throws BadResponseException
- * @throws BpmnError
*/
public void postDemands(SniroManagerRequest homingRequest) throws BadResponseException {
logger.trace("Started Sniro Client Post Demands");
@@ -95,14 +93,13 @@ public class SniroClient {
*/
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");
+ String url = ConductorProperties.getHost() + ConductorProperties.getUri();
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"));
+ header.set("Authorization", ConductorProperties.getAuth());
BaseClient<String, LinkedHashMap<String, Object>> baseClient = new BaseClient<>();
baseClient.setTargetUrl(url);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroValidator.java
index eb73001f42..fc16125433 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroValidator.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/SniroValidator.java
@@ -23,7 +23,7 @@
package org.onap.so.client.sniro;
-import static org.apache.commons.lang.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*;
import java.util.LinkedHashMap;
import org.json.JSONObject;
import org.onap.so.client.exception.BadResponseException;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
index 3127275b24..87e81ccaad 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Candidate.java
@@ -22,7 +22,6 @@ 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 {
diff --git a/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
new file mode 100644
index 0000000000..3ef89184e2
--- /dev/null
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/CandidateType.java
@@ -0,0 +1,41 @@
+/*-
+ * ============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 com.fasterxml.jackson.annotation.JsonValue;
+
+public enum CandidateType {
+
+
+ SERVICE_INSTANCE_ID("serviceInstanceId"), CLOUD_REGION_ID("cloudRegionId"), VNF_ID("vnfId"), VNF_NAME("vnfName");
+
+ private final String name;
+
+ private CandidateType(String name) {
+ this.name = name;
+ }
+
+ @Override
+ @JsonValue
+ public String toString() {
+ return name;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
index 9ac8727a0f..0250ea06b4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ConductorProperties.java
@@ -20,42 +20,40 @@
package org.onap.so.client.sniro.beans;
-import java.util.Map;
-import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+@Component
@Configuration
-@ConfigurationProperties(prefix = "sniro.conductor")
public class ConductorProperties {
- private String host;
- private String uri;
+ private static Environment environment;
- private Map<String, String> headers;
-
-
- public String getHost() {
- return host;
- }
-
- public void setHost(String host) {
- this.host = host;
+ @Autowired
+ public void setEnvironment(Environment environment) {
+ this.environment = environment;
}
- public String getUri() {
- return uri;
+ public static String getHost() {
+ return getProperty("sniro.conductor.host");
}
- public void setUri(String uri) {
- this.uri = uri;
+ public static String getUri() {
+ return getProperty("sniro.conductor.uri");
}
- public Map<String, String> getHeaders() {
- return headers;
+ public static String getAuth() {
+ return getProperty("sniro.conductor.headers.auth");
}
- public void setHeaders(Map<String, String> headers) {
- this.headers = headers;
+ private static String getProperty(String variableName) {
+ if (environment != null) {
+ return environment.getProperty(variableName);
+ } else {
+ return null;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Demand.java
index 0cc993560d..0cc993560d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Demand.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Demand.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
index 9ab3ae673a..9ab3ae673a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/LicenseInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
index 70b1a37b5e..70b1a37b5e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ManagerProperties.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
index 6c1932e344..6c1932e344 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ModelInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
index bbbbf9cfd6..bbbbf9cfd6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/PlacementInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
index fc6aec7d14..fc6aec7d14 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/RequestInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Resource.java
index b5d40a8e80..b5d40a8e80 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/Resource.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/Resource.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
index 8b6f234c1e..8b6f234c1e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/ServiceInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
index b8896a2bab..b8896a2bab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SniroConductorRequest.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
index 4babbe5c39..4babbe5c39 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SniroManagerRequest.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
index 35a4cac459..35a4cac459 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
+++ b/so-optimization-clients/src/main/java/org/onap/so/client/sniro/beans/SubscriberInfo.java
diff --git a/so-optimization-clients/src/test/java/org/onap/so/BaseIntegrationTest.java b/so-optimization-clients/src/test/java/org/onap/so/BaseIntegrationTest.java
new file mode 100644
index 0000000000..7dccfd3208
--- /dev/null
+++ b/so-optimization-clients/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -0,0 +1,63 @@
+/*-
+ * ============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;
+
+import java.io.IOException;
+import java.io.InputStream;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.onap.so.client.oof.OofClient;
+import org.onap.so.client.sniro.SniroClient;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.boot.test.mock.mockito.SpyBean;
+import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringRunner;
+import com.github.tomakehurst.wiremock.WireMockServer;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+@ContextConfiguration
+@AutoConfigureWireMock(port = 0)
+public abstract class BaseIntegrationTest {
+
+ @Value("${wiremock.server.port}")
+ protected String wireMockPort;
+
+ @SpyBean
+ protected SniroClient sniroClient;
+
+ @SpyBean
+ protected OofClient oofClient;
+
+ @Autowired
+ protected WireMockServer wireMockServer;
+
+ @Before
+ public void baseTestBefore() {
+ wireMockServer.resetAll();
+ }
+}
+
+
diff --git a/so-optimization-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/so-optimization-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..62d9ecee44
--- /dev/null
+++ b/so-optimization-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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;
+
+import ch.vorburger.exec.ManagedProcessException;
+import ch.vorburger.mariadb4j.DBConfigurationBuilder;
+import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.jdbc.DataSourceBuilder;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.Profile;
+import javax.sql.DataSource;
+
+@Configuration
+@Profile({"test"})
+public class EmbeddedMariaDbConfig {
+
+ @Bean
+ MariaDB4jSpringService mariaDB4jSpringService() {
+ MariaDB4jSpringService service = new MariaDB4jSpringService();
+
+
+ service.getConfiguration().addArg("--lower_case_table_names=1");
+ return service;
+ }
+
+ @Bean
+ DataSource dataSource(MariaDB4jSpringService mariaDB4jSpringService,
+ @Value("${mariaDB4j.databaseName}") String databaseName,
+ @Value("${spring.datasource.username}") String datasourceUsername,
+ @Value("${spring.datasource.password}") String datasourcePassword,
+ @Value("${spring.datasource.driver-class-name}") String datasourceDriver) throws ManagedProcessException {
+ // Create our database with default root user and no password
+ mariaDB4jSpringService.getDB().createDB(databaseName);
+
+ DBConfigurationBuilder config = mariaDB4jSpringService.getConfiguration();
+
+ return DataSourceBuilder.create().username(datasourceUsername).password(datasourcePassword)
+ .url(config.getURL(databaseName)).driverClassName(datasourceDriver).build();
+ }
+}
diff --git a/so-optimization-clients/src/test/java/org/onap/so/IntegrationTestSuite.java b/so-optimization-clients/src/test/java/org/onap/so/IntegrationTestSuite.java
new file mode 100644
index 0000000000..50bbc1845f
--- /dev/null
+++ b/so-optimization-clients/src/test/java/org/onap/so/IntegrationTestSuite.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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;
+
+import org.junit.runner.RunWith;
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@SuiteClasses({"**/*IT.class"})
+public class IntegrationTestSuite {
+
+}
diff --git a/so-optimization-clients/src/test/java/org/onap/so/TestApplication.java b/so-optimization-clients/src/test/java/org/onap/so/TestApplication.java
new file mode 100644
index 0000000000..fe965b4444
--- /dev/null
+++ b/so-optimization-clients/src/test/java/org/onap/so/TestApplication.java
@@ -0,0 +1,43 @@
+package org.onap.so;
+/*-
+ * ============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=========================================================
+ */
+
+
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.context.annotation.ComponentScan;
+import org.springframework.context.annotation.ComponentScan.Filter;
+import org.springframework.context.annotation.FilterType;
+import org.springframework.context.annotation.Profile;
+
+@SpringBootApplication
+@Profile("test")
+@ComponentScan(basePackages = {"org.onap.so"},
+ excludeFilters = {@Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
+public class TestApplication {
+ public static void main(String... args) {
+ SpringApplication.run(TestApplication.class, args);
+ System.getProperties().setProperty("mso.db", "MARIADB");
+ System.getProperties().setProperty("server.name", "Springboot");
+
+
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java b/so-optimization-clients/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
index 3ae0db627a..a54d34a944 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
+++ b/so-optimization-clients/src/test/java/org/onap/so/client/oof/OofClientTestIT.java
@@ -23,7 +23,8 @@ 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 java.util.ArrayList;
+import java.util.List;
import org.junit.Test;
import org.onap.so.BaseIntegrationTest;
import org.onap.so.client.exception.BadResponseException;
@@ -40,8 +41,6 @@ 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 {
@@ -150,7 +149,7 @@ public class OofClientTestIT extends BaseIntegrationTest {
+ " \"modelName\" : \"modelName\",\n" + " \"modelVersion\" : \"version\",\n"
+ " \"modelCustomizationName\" : \"modelCustomizationName\"\n" + " }\n" + " } ]\n"
+ " },\n" + " \"licenseInfo\" : { \n" + " \"licenseDemands\" : [ ]\n" + "}\n" + "}",
- oofRequestOutput, false);
+ oofRequestOutput.replace("\r\n", "\n"), false);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java b/so-optimization-clients/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
index 56c52388f8..56c52388f8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
+++ b/so-optimization-clients/src/test/java/org/onap/so/client/sniro/SniroClientTestIT.java
diff --git a/so-optimization-clients/src/test/resources/application-test.yaml b/so-optimization-clients/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..75bd982d9b
--- /dev/null
+++ b/so-optimization-clients/src/test/resources/application-test.yaml
@@ -0,0 +1,231 @@
+aai:
+ auth: 5A1272FE739BECA4D4374A86B25C021DFE6745E3BB7BE6836BF64A6059B8220E586C21FD7567AF41DB42571EB7
+ endpoint: http://localhost:${wiremock.server.port}
+ pnfEntryNotificationTimeout: P14D
+appc:
+ client:
+ key: iaEMAfjsVsZnraBP
+ response:
+ timeout: '120000'
+ secret: wcivUjsjXzmGFBfxMmyJu9dz
+ poolMembers: localhost:3904
+ service: ueb
+ topic:
+ read:
+ name: APPC-TEST-AMDOCS2
+ timeout: '120000'
+ write: APPC-TEST-AMDOCS1-DEV3
+ sdnc:
+ read: SDNC-LCM-READ
+ write: SDNC-LCM-WRITE
+log:
+ debug:
+ CompleteMsoProcess: 'true'
+ CreateNetworkInstanceInfra: 'true'
+ CreateServiceInstanceInfra: 'true'
+ DeleteNetworkInstanceInfra: 'true'
+ FalloutHandler: 'true'
+ UpdateNetworkInstanceInfra: 'true'
+ VnfAdapterRestV1: 'true'
+ sdncAdapter: 'true'
+ vnfAdapterCreateV1: 'true'
+ vnfAdapterRestV1: 'true'
+pnf:
+ dmaap:
+ host: hostTest
+ port: 1234
+ protocol: http
+ uriPathPrefix: events
+ topicName: pnfReady
+ consumerGroup: consumerGroup
+ consumerId: consumerId
+ topicListenerDelayInSeconds: 5
+mso:
+ naming:
+ endpoint: http://localhost:${wiremock.server.port}/web/service/v1/genNetworkElementName
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
+ completemsoprocess:
+ endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess
+ db:
+ auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
+ endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ network:
+ endpoint: http://localhost:${wiremock.server.port}/networks/NetworkAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/networks/rest/v1/networks
+ openecomp:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/dbadapters/RequestsDbAdapter
+ po:
+ auth: 5E12ACACBD552A415E081E29F2C4772F9835792A51C766CCFDD7433DB5220B59969CB2798C
+ password: 3141634BF7E070AA289CF2892C986C0B
+ sdnc:
+ endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/SDNCAdapter/v1/sdnc
+ timeout: PT60S
+ tenant:
+ endpoint: http://localhost:${wiremock.server.port}/tenantAdapterMock
+ vnf:
+ endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapter
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/vnfs
+ volume-groups:
+ rest:
+ endpoint: http://localhost:${wiremock.server.port}/services/rest/v1/volume-groups
+ vnf-async:
+ endpoint: http://localhost:${wiremock.server.port}/vnfs/VnfAdapterAsync
+ workflow:
+ message:
+ endpoint: http://localhost:${wiremock.server.port}/workflows/messages/message
+
+ async:
+ core-pool-size: 50
+ max-pool-size: 50
+ queue-capacity: 500
+
+ bpmn:
+ optimisticlockingexception:
+ retrycount: '3'
+ cloudRegionIdsToSkipAddingVnfEdgesTo: test25Region1,test25Region2,test25Region99
+ callbackRetryAttempts: '5'
+ catalog:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ spring:
+ endpoint: http://localhost:${wiremock.server.port}
+ correlation:
+ timeout: 60
+ db:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ default:
+ adapter:
+ namespace: http://org.onap.so
+ healthcheck:
+ log:
+ debug: 'false'
+ infra:
+ customer:
+ id: testCustIdInfra
+ logPath: logs
+ msoKey: 07a7159d3bf51a0e53be7a8f89699be7
+ po:
+ timeout: PT60S
+ request:
+ db:
+ endpoint: http://localhost:${wiremock.server.port}/
+ rollback: 'true'
+ site-name: localDevEnv
+ workflow:
+ default:
+ aai:
+ cloud-region:
+ version: '9'
+ generic-vnf:
+ version: '9'
+ global:
+ default:
+ aai:
+ namespace: http://org.openecomp.aai.inventory/
+ version: '8'
+ message:
+ endpoint: http://localhost:${wiremock.server.port}/mso/WorkflowMesssage
+ notification:
+ name: GenericNotificationService
+ sdncadapter:
+ callback: http://localhost:${wiremock.server.port}/mso/SDNCAdapterCallbackService
+ vnfadapter:
+ create:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ delete:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ query:
+ callback: http://localhost:${wiremock.server.port}/mso/services/VNFAdapterQuerCallbackV1
+ rollback:
+ callback: http://localhost:${wiremock.server.port}/mso/vnfAdapterNotify
+ global:
+ dmaap:
+ username: dmaapUsername
+ password: dmaapPassword
+ host: http://localhost:28090
+ publisher:
+ topic: com.att.mso.asyncStatusUpdate
+policy:
+ auth: Basic dGVzdHBkcDphbHBoYTEyMw==
+ client:
+ auth: Basic bTAzNzQzOnBvbGljeVIwY2sk
+ endpoint: https://localhost:8081/pdp/api/
+ environment: TEST
+sdnc:
+ auth: Basic YWRtaW46YWRtaW4=
+ host: http://localhost:${wiremock.server.port}
+ path: /restconf/operations/GENERIC-RESOURCE-API
+sniro:
+ conductor:
+ enabled: true
+ host: http://localhost:${wiremock.server.port}
+ uri: /v1/release-orders
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ manager:
+ timeout: PT30M
+ host: http://localhost:${wiremock.server.port}
+ uri.v1: /sniro/api/v2/placement
+ uri.v2: /sniro/api/placement/v2
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+ headers.patchVersion: 1
+ headers.minorVersion: 1
+ headers.latestVersion: 2
+oof:
+ timeout: PT30M
+ host: http://localhost:${wiremock.server.port}
+ uri: /api/oof/v1/placement
+ headers.auth: Basic dGVzdDp0ZXN0cHdk
+org:
+ onap:
+ so:
+ cloud-owner: CloudOwner
+spring:
+ datasource:
+ jdbc-url: jdbc:mariadb://localhost:3307/camundabpmn
+ username: root
+ password: password
+ driver-class-name: org.mariadb.jdbc.Driver
+ initialization-mode: always
+ jpa:
+ generate-ddl: false
+ show-sql: false
+ hibernate:
+ ddl-auto: none
+ naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy
+ enable-lazy-load-no-trans: true
+ database-platform: org.hibernate.dialect.MySQL5InnoDBDialect
+sdno:
+ health-check:
+ dmaap:
+ password: password
+ publisher:
+ topic: sdno.test-health-diagnostic-v02
+ subscriber:
+ topic: sdno.test-health-diagnostic-v02
+ username: username
+mariaDB4j:
+ dataDir:
+ port: 3307
+ databaseName: camundabpmn
+camunda:
+ bpm:
+ metrics:
+ enabled: false
+ db-reporter-activate: false
+# CDSProcessingClient
+cds:
+ endpoint: localhost
+ port: 11012
+ auth: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw==
+ timeout: 60
diff --git a/so-optimization-clients/src/test/resources/schema.sql b/so-optimization-clients/src/test/resources/schema.sql
new file mode 100644
index 0000000000..5ae6a2d972
--- /dev/null
+++ b/so-optimization-clients/src/test/resources/schema.sql
@@ -0,0 +1,1195 @@
+
+USE `camundabpmn`;
+
+
+create table ACT_GE_PROPERTY (
+ NAME_ varchar(64),
+ VALUE_ varchar(300),
+ REV_ integer,
+ primary key (NAME_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+
+create table ACT_GE_BYTEARRAY (
+ ID_ varchar(64),
+ REV_ integer,
+ NAME_ varchar(255),
+ DEPLOYMENT_ID_ varchar(64),
+ BYTES_ LONGBLOB,
+ GENERATED_ TINYINT,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RE_DEPLOYMENT (
+ ID_ varchar(64),
+ NAME_ varchar(255),
+ DEPLOY_TIME_ timestamp(3),
+ SOURCE_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_EXECUTION (
+ ID_ varchar(64),
+ REV_ integer,
+ PROC_INST_ID_ varchar(64),
+ BUSINESS_KEY_ varchar(255),
+ PARENT_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ SUPER_EXEC_ varchar(64),
+ SUPER_CASE_EXEC_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ ACT_INST_ID_ varchar(64),
+ IS_ACTIVE_ TINYINT,
+ IS_CONCURRENT_ TINYINT,
+ IS_SCOPE_ TINYINT,
+ IS_EVENT_SCOPE_ TINYINT,
+ SUSPENSION_STATE_ integer,
+ CACHED_ENT_STATE_ integer,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_JOB (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ TYPE_ varchar(255) NOT NULL,
+ LOCK_EXP_TIME_ timestamp(3) NULL,
+ LOCK_OWNER_ varchar(255),
+ EXCLUSIVE_ boolean,
+ EXECUTION_ID_ varchar(64),
+ PROCESS_INSTANCE_ID_ varchar(64),
+ PROCESS_DEF_ID_ varchar(64),
+ PROCESS_DEF_KEY_ varchar(255),
+ RETRIES_ integer,
+ EXCEPTION_STACK_ID_ varchar(64),
+ EXCEPTION_MSG_ varchar(4000),
+ DUEDATE_ timestamp(3) NULL,
+ REPEAT_ varchar(255),
+ HANDLER_TYPE_ varchar(255),
+ HANDLER_CFG_ varchar(4000),
+ DEPLOYMENT_ID_ varchar(64),
+ SUSPENSION_STATE_ integer NOT NULL DEFAULT 1,
+ JOB_DEF_ID_ varchar(64),
+ PRIORITY_ bigint NOT NULL DEFAULT 0,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_JOBDEF (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ ACT_ID_ varchar(255),
+ JOB_TYPE_ varchar(255) NOT NULL,
+ JOB_CONFIGURATION_ varchar(255),
+ SUSPENSION_STATE_ integer,
+ JOB_PRIORITY_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RE_PROCDEF (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ HAS_START_FORM_KEY_ TINYINT,
+ SUSPENSION_STATE_ integer,
+ TENANT_ID_ varchar(64),
+ VERSION_TAG_ varchar(64),
+ HISTORY_TTL_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_TASK (
+ ID_ varchar(64),
+ REV_ integer,
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64),
+ NAME_ varchar(255),
+ PARENT_TASK_ID_ varchar(64),
+ DESCRIPTION_ varchar(4000),
+ TASK_DEF_KEY_ varchar(255),
+ OWNER_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ DELEGATION_ varchar(64),
+ PRIORITY_ integer,
+ CREATE_TIME_ timestamp(3),
+ DUE_DATE_ datetime(3),
+ FOLLOW_UP_DATE_ datetime(3),
+ SUSPENSION_STATE_ integer,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_IDENTITYLINK (
+ ID_ varchar(64),
+ REV_ integer,
+ GROUP_ID_ varchar(255),
+ TYPE_ varchar(255),
+ USER_ID_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_VARIABLE (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ TYPE_ varchar(255) not null,
+ NAME_ varchar(255) not null,
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ VAR_SCOPE_ varchar(64) not null,
+ SEQUENCE_COUNTER_ bigint,
+ IS_CONCURRENT_LOCAL_ TINYINT,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_EVENT_SUBSCR (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ EVENT_TYPE_ varchar(255) not null,
+ EVENT_NAME_ varchar(255),
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ ACTIVITY_ID_ varchar(255),
+ CONFIGURATION_ varchar(255),
+ CREATED_ timestamp(3) not null,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_INCIDENT (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ INCIDENT_TIMESTAMP_ timestamp(3) not null,
+ INCIDENT_MSG_ varchar(4000),
+ INCIDENT_TYPE_ varchar(255) not null,
+ EXECUTION_ID_ varchar(64),
+ ACTIVITY_ID_ varchar(255),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ CAUSE_INCIDENT_ID_ varchar(64),
+ ROOT_CAUSE_INCIDENT_ID_ varchar(64),
+ CONFIGURATION_ varchar(255),
+ TENANT_ID_ varchar(64),
+ JOB_DEF_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_AUTHORIZATION (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ TYPE_ integer not null,
+ GROUP_ID_ varchar(255),
+ USER_ID_ varchar(255),
+ RESOURCE_TYPE_ integer not null,
+ RESOURCE_ID_ varchar(255),
+ PERMS_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_FILTER (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ RESOURCE_TYPE_ varchar(255) not null,
+ NAME_ varchar(255) not null,
+ OWNER_ varchar(255),
+ QUERY_ LONGTEXT not null,
+ PROPERTIES_ LONGTEXT,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_METER_LOG (
+ ID_ varchar(64) not null,
+ NAME_ varchar(64) not null,
+ REPORTER_ varchar(255),
+ VALUE_ bigint,
+ TIMESTAMP_ timestamp(3),
+ MILLISECONDS_ bigint DEFAULT 0,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_EXT_TASK (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ WORKER_ID_ varchar(255),
+ TOPIC_NAME_ varchar(255),
+ RETRIES_ integer,
+ ERROR_MSG_ varchar(4000),
+ ERROR_DETAILS_ID_ varchar(64),
+ LOCK_EXP_TIME_ timestamp(3) NULL,
+ SUSPENSION_STATE_ integer,
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ ACT_ID_ varchar(255),
+ ACT_INST_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ PRIORITY_ bigint NOT NULL DEFAULT 0,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_RU_BATCH (
+ ID_ varchar(64) not null,
+ REV_ integer not null,
+ TYPE_ varchar(255),
+ TOTAL_JOBS_ integer,
+ JOBS_CREATED_ integer,
+ JOBS_PER_SEED_ integer,
+ INVOCATIONS_PER_JOB_ integer,
+ SEED_JOB_DEF_ID_ varchar(64),
+ BATCH_JOB_DEF_ID_ varchar(64),
+ MONITOR_JOB_DEF_ID_ varchar(64),
+ SUSPENSION_STATE_ integer,
+ CONFIGURATION_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create index ACT_IDX_EXEC_BUSKEY on ACT_RU_EXECUTION(BUSINESS_KEY_);
+create index ACT_IDX_EXEC_TENANT_ID on ACT_RU_EXECUTION(TENANT_ID_);
+create index ACT_IDX_TASK_CREATE on ACT_RU_TASK(CREATE_TIME_);
+create index ACT_IDX_TASK_ASSIGNEE on ACT_RU_TASK(ASSIGNEE_);
+create index ACT_IDX_TASK_TENANT_ID on ACT_RU_TASK(TENANT_ID_);
+create index ACT_IDX_IDENT_LNK_USER on ACT_RU_IDENTITYLINK(USER_ID_);
+create index ACT_IDX_IDENT_LNK_GROUP on ACT_RU_IDENTITYLINK(GROUP_ID_);
+create index ACT_IDX_EVENT_SUBSCR_CONFIG_ on ACT_RU_EVENT_SUBSCR(CONFIGURATION_);
+create index ACT_IDX_EVENT_SUBSCR_TENANT_ID on ACT_RU_EVENT_SUBSCR(TENANT_ID_);
+create index ACT_IDX_VARIABLE_TASK_ID on ACT_RU_VARIABLE(TASK_ID_);
+create index ACT_IDX_VARIABLE_TENANT_ID on ACT_RU_VARIABLE(TENANT_ID_);
+create index ACT_IDX_ATHRZ_PROCEDEF on ACT_RU_IDENTITYLINK(PROC_DEF_ID_);
+create index ACT_IDX_INC_CONFIGURATION on ACT_RU_INCIDENT(CONFIGURATION_);
+create index ACT_IDX_INC_TENANT_ID on ACT_RU_INCIDENT(TENANT_ID_);
+-- CAM-5914
+create index ACT_IDX_JOB_EXECUTION_ID on ACT_RU_JOB(EXECUTION_ID_);
+-- this index needs to be limited in mariadb see CAM-6938
+create index ACT_IDX_JOB_HANDLER on ACT_RU_JOB(HANDLER_TYPE_(100),HANDLER_CFG_(155));
+create index ACT_IDX_JOB_PROCINST on ACT_RU_JOB(PROCESS_INSTANCE_ID_);
+create index ACT_IDX_JOB_TENANT_ID on ACT_RU_JOB(TENANT_ID_);
+create index ACT_IDX_JOBDEF_TENANT_ID on ACT_RU_JOBDEF(TENANT_ID_);
+
+-- new metric milliseconds column
+CREATE INDEX ACT_IDX_METER_LOG_MS ON ACT_RU_METER_LOG(MILLISECONDS_);
+CREATE INDEX ACT_IDX_METER_LOG_NAME_MS ON ACT_RU_METER_LOG(NAME_, MILLISECONDS_);
+CREATE INDEX ACT_IDX_METER_LOG_REPORT ON ACT_RU_METER_LOG(NAME_, REPORTER_, MILLISECONDS_);
+
+-- old metric timestamp column
+CREATE INDEX ACT_IDX_METER_LOG_TIME ON ACT_RU_METER_LOG(TIMESTAMP_);
+CREATE INDEX ACT_IDX_METER_LOG ON ACT_RU_METER_LOG(NAME_, TIMESTAMP_);
+
+create index ACT_IDX_EXT_TASK_TOPIC on ACT_RU_EXT_TASK(TOPIC_NAME_);
+create index ACT_IDX_EXT_TASK_TENANT_ID on ACT_RU_EXT_TASK(TENANT_ID_);
+create index ACT_IDX_EXT_TASK_PRIORITY ON ACT_RU_EXT_TASK(PRIORITY_);
+create index ACT_IDX_EXT_TASK_ERR_DETAILS ON ACT_RU_EXT_TASK(ERROR_DETAILS_ID_);
+create index ACT_IDX_AUTH_GROUP_ID ON ACT_RU_AUTHORIZATION(GROUP_ID_);
+create index ACT_IDX_JOB_JOB_DEF_ID on ACT_RU_JOB(JOB_DEF_ID_);
+
+alter table ACT_GE_BYTEARRAY
+ add constraint ACT_FK_BYTEARR_DEPL
+ foreign key (DEPLOYMENT_ID_)
+ references ACT_RE_DEPLOYMENT (ID_);
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION (ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_PARENT
+ foreign key (PARENT_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_SUPER
+ foreign key (SUPER_EXEC_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_EXECUTION
+ add constraint ACT_FK_EXE_PROCDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF (ID_);
+
+alter table ACT_RU_IDENTITYLINK
+ add constraint ACT_FK_TSKASS_TASK
+ foreign key (TASK_ID_)
+ references ACT_RU_TASK (ID_);
+
+alter table ACT_RU_IDENTITYLINK
+ add constraint ACT_FK_ATHRZ_PROCEDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF(ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_PROCDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF (ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION(ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_BYTEARRAY
+ foreign key (BYTEARRAY_ID_)
+ references ACT_GE_BYTEARRAY (ID_);
+
+alter table ACT_RU_JOB
+ add constraint ACT_FK_JOB_EXCEPTION
+ foreign key (EXCEPTION_STACK_ID_)
+ references ACT_GE_BYTEARRAY (ID_);
+
+alter table ACT_RU_EVENT_SUBSCR
+ add constraint ACT_FK_EVENT_EXEC
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION(ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_PROCINST
+ foreign key (PROC_INST_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_PROCDEF
+ foreign key (PROC_DEF_ID_)
+ references ACT_RE_PROCDEF (ID_);
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_CAUSE
+ foreign key (CAUSE_INCIDENT_ID_)
+ references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_RCAUSE
+ foreign key (ROOT_CAUSE_INCIDENT_ID_)
+ references ACT_RU_INCIDENT (ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_EXT_TASK
+ add constraint ACT_FK_EXT_TASK_ERROR_DETAILS
+ foreign key (ERROR_DETAILS_ID_)
+ references ACT_GE_BYTEARRAY (ID_);
+
+create index ACT_IDX_INC_JOB_DEF on ACT_RU_INCIDENT(JOB_DEF_ID_);
+alter table ACT_RU_INCIDENT
+ add constraint ACT_FK_INC_JOB_DEF
+ foreign key (JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+alter table ACT_RU_AUTHORIZATION
+ add constraint ACT_UNIQ_AUTH_USER
+ unique (USER_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_);
+
+alter table ACT_RU_AUTHORIZATION
+ add constraint ACT_UNIQ_AUTH_GROUP
+ unique (GROUP_ID_,TYPE_,RESOURCE_TYPE_,RESOURCE_ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_UNIQ_VARIABLE
+ unique (VAR_SCOPE_, NAME_);
+
+alter table ACT_RU_EXT_TASK
+ add constraint ACT_FK_EXT_TASK_EXE
+ foreign key (EXECUTION_ID_)
+ references ACT_RU_EXECUTION (ID_);
+
+create index ACT_IDX_BATCH_SEED_JOB_DEF ON ACT_RU_BATCH(SEED_JOB_DEF_ID_);
+alter table ACT_RU_BATCH
+ add constraint ACT_FK_BATCH_SEED_JOB_DEF
+ foreign key (SEED_JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+create index ACT_IDX_BATCH_MONITOR_JOB_DEF ON ACT_RU_BATCH(MONITOR_JOB_DEF_ID_);
+alter table ACT_RU_BATCH
+ add constraint ACT_FK_BATCH_MONITOR_JOB_DEF
+ foreign key (MONITOR_JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+create index ACT_IDX_BATCH_JOB_DEF ON ACT_RU_BATCH(BATCH_JOB_DEF_ID_);
+alter table ACT_RU_BATCH
+ add constraint ACT_FK_BATCH_JOB_DEF
+ foreign key (BATCH_JOB_DEF_ID_)
+ references ACT_RU_JOBDEF (ID_);
+
+-- indexes for deadlock problems - https://app.camunda.com/jira/browse/CAM-2567 --
+create index ACT_IDX_INC_CAUSEINCID on ACT_RU_INCIDENT(CAUSE_INCIDENT_ID_);
+create index ACT_IDX_INC_EXID on ACT_RU_INCIDENT(EXECUTION_ID_);
+create index ACT_IDX_INC_PROCDEFID on ACT_RU_INCIDENT(PROC_DEF_ID_);
+create index ACT_IDX_INC_PROCINSTID on ACT_RU_INCIDENT(PROC_INST_ID_);
+create index ACT_IDX_INC_ROOTCAUSEINCID on ACT_RU_INCIDENT(ROOT_CAUSE_INCIDENT_ID_);
+-- index for deadlock problem - https://app.camunda.com/jira/browse/CAM-4440 --
+create index ACT_IDX_AUTH_RESOURCE_ID on ACT_RU_AUTHORIZATION(RESOURCE_ID_);
+-- index to prevent deadlock on fk constraint - https://app.camunda.com/jira/browse/CAM-5440 --
+create index ACT_IDX_EXT_TASK_EXEC on ACT_RU_EXT_TASK(EXECUTION_ID_);
+
+-- indexes to improve deployment
+create index ACT_IDX_BYTEARRAY_NAME on ACT_GE_BYTEARRAY(NAME_);
+create index ACT_IDX_DEPLOYMENT_NAME on ACT_RE_DEPLOYMENT(NAME_);
+create index ACT_IDX_DEPLOYMENT_TENANT_ID on ACT_RE_DEPLOYMENT(TENANT_ID_);
+create index ACT_IDX_JOBDEF_PROC_DEF_ID ON ACT_RU_JOBDEF(PROC_DEF_ID_);
+create index ACT_IDX_JOB_HANDLER_TYPE ON ACT_RU_JOB(HANDLER_TYPE_);
+create index ACT_IDX_EVENT_SUBSCR_EVT_NAME ON ACT_RU_EVENT_SUBSCR(EVENT_NAME_);
+create index ACT_IDX_PROCDEF_DEPLOYMENT_ID ON ACT_RE_PROCDEF(DEPLOYMENT_ID_);
+create index ACT_IDX_PROCDEF_TENANT_ID ON ACT_RE_PROCDEF(TENANT_ID_);
+create index ACT_IDX_PROCDEF_VER_TAG ON ACT_RE_PROCDEF(VERSION_TAG_);
+-- create case definition table --
+create table ACT_RE_CASE_DEF (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ HISTORY_TTL_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create case execution table --
+create table ACT_RU_CASE_EXECUTION (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ CASE_INST_ID_ varchar(64),
+ SUPER_CASE_EXEC_ varchar(64),
+ SUPER_EXEC_ varchar(64),
+ BUSINESS_KEY_ varchar(255),
+ PARENT_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ PREV_STATE_ integer,
+ CURRENT_STATE_ integer,
+ REQUIRED_ boolean,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create case sentry part table --
+
+create table ACT_RU_CASE_SENTRY_PART (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ CASE_INST_ID_ varchar(64),
+ CASE_EXEC_ID_ varchar(64),
+ SENTRY_ID_ varchar(255),
+ TYPE_ varchar(255),
+ SOURCE_CASE_EXEC_ID_ varchar(64),
+ STANDARD_EVENT_ varchar(255),
+ SOURCE_ varchar(255),
+ VARIABLE_EVENT_ varchar(255),
+ VARIABLE_NAME_ varchar(255),
+ SATISFIED_ boolean,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create index on business key --
+create index ACT_IDX_CASE_EXEC_BUSKEY on ACT_RU_CASE_EXECUTION(BUSINESS_KEY_);
+
+-- create foreign key constraints on ACT_RU_CASE_EXECUTION --
+alter table ACT_RU_CASE_EXECUTION
+ add constraint ACT_FK_CASE_EXE_CASE_INST
+ foreign key (CASE_INST_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_) on delete cascade on update cascade;
+
+alter table ACT_RU_CASE_EXECUTION
+ add constraint ACT_FK_CASE_EXE_PARENT
+ foreign key (PARENT_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_CASE_EXECUTION
+ add constraint ACT_FK_CASE_EXE_CASE_DEF
+ foreign key (CASE_DEF_ID_)
+ references ACT_RE_CASE_DEF(ID_);
+
+-- create foreign key constraints on ACT_RU_VARIABLE --
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_CASE_EXE
+ foreign key (CASE_EXECUTION_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_VARIABLE
+ add constraint ACT_FK_VAR_CASE_INST
+ foreign key (CASE_INST_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+-- create foreign key constraints on ACT_RU_TASK --
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_CASE_EXE
+ foreign key (CASE_EXECUTION_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_TASK
+ add constraint ACT_FK_TASK_CASE_DEF
+ foreign key (CASE_DEF_ID_)
+ references ACT_RE_CASE_DEF(ID_);
+
+-- create foreign key constraints on ACT_RU_CASE_SENTRY_PART --
+alter table ACT_RU_CASE_SENTRY_PART
+ add constraint ACT_FK_CASE_SENTRY_CASE_INST
+ foreign key (CASE_INST_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+alter table ACT_RU_CASE_SENTRY_PART
+ add constraint ACT_FK_CASE_SENTRY_CASE_EXEC
+ foreign key (CASE_EXEC_ID_)
+ references ACT_RU_CASE_EXECUTION(ID_);
+
+create index ACT_IDX_CASE_DEF_TENANT_ID on ACT_RE_CASE_DEF(TENANT_ID_);
+create index ACT_IDX_CASE_EXEC_TENANT_ID on ACT_RU_CASE_EXECUTION(TENANT_ID_);
+-- create decision definition table --
+create table ACT_RE_DECISION_DEF (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) not null,
+ VERSION_ integer not null,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ DEC_REQ_ID_ varchar(64),
+ DEC_REQ_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ HISTORY_TTL_ integer,
+ VERSION_TAG_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create decision requirements definition table --
+create table ACT_RE_DECISION_REQ_DEF (
+ ID_ varchar(64) NOT NULL,
+ REV_ integer,
+ CATEGORY_ varchar(255),
+ NAME_ varchar(255),
+ KEY_ varchar(255) NOT NULL,
+ VERSION_ integer NOT NULL,
+ DEPLOYMENT_ID_ varchar(64),
+ RESOURCE_NAME_ varchar(4000),
+ DGRM_RESOURCE_NAME_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+alter table ACT_RE_DECISION_DEF
+ add constraint ACT_FK_DEC_REQ
+ foreign key (DEC_REQ_ID_)
+ references ACT_RE_DECISION_REQ_DEF(ID_);
+
+create index ACT_IDX_DEC_DEF_TENANT_ID on ACT_RE_DECISION_DEF(TENANT_ID_);
+create index ACT_IDX_DEC_DEF_REQ_ID on ACT_RE_DECISION_DEF(DEC_REQ_ID_);
+create index ACT_IDX_DEC_REQ_DEF_TENANT_ID on ACT_RE_DECISION_REQ_DEF(TENANT_ID_);
+create table ACT_HI_PROCINST (
+ ID_ varchar(64) not null,
+ PROC_INST_ID_ varchar(64) not null,
+ BUSINESS_KEY_ varchar(255),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64) not null,
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ START_USER_ID_ varchar(255),
+ START_ACT_ID_ varchar(255),
+ END_ACT_ID_ varchar(255),
+ SUPER_PROCESS_INSTANCE_ID_ varchar(64),
+ SUPER_CASE_INSTANCE_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ DELETE_REASON_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ STATE_ varchar(255),
+ primary key (ID_),
+ unique (PROC_INST_ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_ACTINST (
+ ID_ varchar(64) not null,
+ PARENT_ACT_INST_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64) not null,
+ PROC_INST_ID_ varchar(64) not null,
+ EXECUTION_ID_ varchar(64) not null,
+ ACT_ID_ varchar(255) not null,
+ TASK_ID_ varchar(64),
+ CALL_PROC_INST_ID_ varchar(64),
+ CALL_CASE_INST_ID_ varchar(64),
+ ACT_NAME_ varchar(255),
+ ACT_TYPE_ varchar(255) not null,
+ ASSIGNEE_ varchar(64),
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ ACT_INST_STATE_ integer,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_TASKINST (
+ ID_ varchar(64) not null,
+ TASK_DEF_KEY_ varchar(255),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ NAME_ varchar(255),
+ PARENT_TASK_ID_ varchar(64),
+ DESCRIPTION_ varchar(4000),
+ OWNER_ varchar(255),
+ ASSIGNEE_ varchar(255),
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ DELETE_REASON_ varchar(4000),
+ PRIORITY_ integer,
+ DUE_DATE_ datetime(3),
+ FOLLOW_UP_DATE_ datetime(3),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_VARINST (
+ ID_ varchar(64) not null,
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ NAME_ varchar(255) not null,
+ VAR_TYPE_ varchar(100),
+ REV_ integer,
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ STATE_ varchar(20),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_DETAIL (
+ ID_ varchar(64) not null,
+ TYPE_ varchar(255) not null,
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ VAR_INST_ID_ varchar(64),
+ NAME_ varchar(255) not null,
+ VAR_TYPE_ varchar(255),
+ REV_ integer,
+ TIME_ datetime(3) not null,
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ OPERATION_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_IDENTITYLINK (
+ ID_ varchar(64) not null,
+ TIMESTAMP_ timestamp(3) not null,
+ TYPE_ varchar(255),
+ USER_ID_ varchar(255),
+ GROUP_ID_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ OPERATION_TYPE_ varchar(64),
+ ASSIGNER_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_COMMENT (
+ ID_ varchar(64) not null,
+ TYPE_ varchar(255),
+ TIME_ datetime(3) not null,
+ USER_ID_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ ACTION_ varchar(255),
+ MESSAGE_ varchar(4000),
+ FULL_MSG_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_ATTACHMENT (
+ ID_ varchar(64) not null,
+ REV_ integer,
+ USER_ID_ varchar(255),
+ NAME_ varchar(255),
+ DESCRIPTION_ varchar(4000),
+ TYPE_ varchar(255),
+ TASK_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ URL_ varchar(4000),
+ CONTENT_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_OP_LOG (
+ ID_ varchar(64) not null,
+ DEPLOYMENT_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ CASE_EXECUTION_ID_ varchar(64),
+ TASK_ID_ varchar(64),
+ JOB_ID_ varchar(64),
+ JOB_DEF_ID_ varchar(64),
+ BATCH_ID_ varchar(64),
+ USER_ID_ varchar(255),
+ TIMESTAMP_ timestamp(3) not null,
+ OPERATION_TYPE_ varchar(64),
+ OPERATION_ID_ varchar(64),
+ ENTITY_TYPE_ varchar(30),
+ PROPERTY_ varchar(64),
+ ORG_VALUE_ varchar(4000),
+ NEW_VALUE_ varchar(4000),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_INCIDENT (
+ ID_ varchar(64) not null,
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ CREATE_TIME_ timestamp(3) not null,
+ END_TIME_ timestamp(3) null,
+ INCIDENT_MSG_ varchar(4000),
+ INCIDENT_TYPE_ varchar(255) not null,
+ ACTIVITY_ID_ varchar(255),
+ CAUSE_INCIDENT_ID_ varchar(64),
+ ROOT_CAUSE_INCIDENT_ID_ varchar(64),
+ CONFIGURATION_ varchar(255),
+ INCIDENT_STATE_ integer,
+ TENANT_ID_ varchar(64),
+ JOB_DEF_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_JOB_LOG (
+ ID_ varchar(64) not null,
+ TIMESTAMP_ timestamp(3) not null,
+ JOB_ID_ varchar(64) not null,
+ JOB_DUEDATE_ timestamp(3) NULL,
+ JOB_RETRIES_ integer,
+ JOB_PRIORITY_ bigint NOT NULL DEFAULT 0,
+ JOB_EXCEPTION_MSG_ varchar(4000),
+ JOB_EXCEPTION_STACK_ID_ varchar(64),
+ JOB_STATE_ integer,
+ JOB_DEF_ID_ varchar(64),
+ JOB_DEF_TYPE_ varchar(255),
+ JOB_DEF_CONFIGURATION_ varchar(255),
+ ACT_ID_ varchar(255),
+ EXECUTION_ID_ varchar(64),
+ PROCESS_INSTANCE_ID_ varchar(64),
+ PROCESS_DEF_ID_ varchar(64),
+ PROCESS_DEF_KEY_ varchar(255),
+ DEPLOYMENT_ID_ varchar(64),
+ SEQUENCE_COUNTER_ bigint,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_BATCH (
+ ID_ varchar(64) not null,
+ TYPE_ varchar(255),
+ TOTAL_JOBS_ integer,
+ JOBS_PER_SEED_ integer,
+ INVOCATIONS_PER_JOB_ integer,
+ SEED_JOB_DEF_ID_ varchar(64),
+ MONITOR_JOB_DEF_ID_ varchar(64),
+ BATCH_JOB_DEF_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ START_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_EXT_TASK_LOG (
+ ID_ varchar(64) not null,
+ TIMESTAMP_ timestamp(3) not null,
+ EXT_TASK_ID_ varchar(64) not null,
+ RETRIES_ integer,
+ TOPIC_NAME_ varchar(255),
+ WORKER_ID_ varchar(255),
+ PRIORITY_ bigint NOT NULL DEFAULT 0,
+ ERROR_MSG_ varchar(4000),
+ ERROR_DETAILS_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ ACT_INST_ID_ varchar(64),
+ EXECUTION_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ PROC_DEF_ID_ varchar(64),
+ PROC_DEF_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ STATE_ integer,
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create index ACT_IDX_HI_PRO_INST_END on ACT_HI_PROCINST(END_TIME_);
+create index ACT_IDX_HI_PRO_I_BUSKEY on ACT_HI_PROCINST(BUSINESS_KEY_);
+create index ACT_IDX_HI_PRO_INST_TENANT_ID on ACT_HI_PROCINST(TENANT_ID_);
+create index ACT_IDX_HI_PRO_INST_PROC_DEF_KEY on ACT_HI_PROCINST(PROC_DEF_KEY_);
+
+create index ACT_IDX_HI_ACT_INST_START on ACT_HI_ACTINST(START_TIME_);
+create index ACT_IDX_HI_ACT_INST_END on ACT_HI_ACTINST(END_TIME_);
+create index ACT_IDX_HI_ACT_INST_PROCINST on ACT_HI_ACTINST(PROC_INST_ID_, ACT_ID_);
+create index ACT_IDX_HI_ACT_INST_COMP on ACT_HI_ACTINST(EXECUTION_ID_, ACT_ID_, END_TIME_, ID_);
+create index ACT_IDX_HI_ACT_INST_STATS on ACT_HI_ACTINST(PROC_DEF_ID_, ACT_ID_, END_TIME_, ACT_INST_STATE_);
+create index ACT_IDX_HI_ACT_INST_TENANT_ID on ACT_HI_ACTINST(TENANT_ID_);
+create index ACT_IDX_HI_ACT_INST_PROC_DEF_KEY on ACT_HI_ACTINST(PROC_DEF_KEY_);
+
+create index ACT_IDX_HI_TASK_INST_TENANT_ID on ACT_HI_TASKINST(TENANT_ID_);
+create index ACT_IDX_HI_TASK_INST_PROC_DEF_KEY on ACT_HI_TASKINST(PROC_DEF_KEY_);
+create index ACT_IDX_HI_TASKINST_PROCINST on ACT_HI_TASKINST(PROC_INST_ID_);
+create index ACT_IDX_HI_TASKINSTID_PROCINST on ACT_HI_TASKINST(ID_,PROC_INST_ID_);
+
+create index ACT_IDX_HI_DETAIL_PROC_INST on ACT_HI_DETAIL(PROC_INST_ID_);
+create index ACT_IDX_HI_DETAIL_ACT_INST on ACT_HI_DETAIL(ACT_INST_ID_);
+create index ACT_IDX_HI_DETAIL_CASE_INST on ACT_HI_DETAIL(CASE_INST_ID_);
+create index ACT_IDX_HI_DETAIL_CASE_EXEC on ACT_HI_DETAIL(CASE_EXECUTION_ID_);
+create index ACT_IDX_HI_DETAIL_TIME on ACT_HI_DETAIL(TIME_);
+create index ACT_IDX_HI_DETAIL_NAME on ACT_HI_DETAIL(NAME_);
+create index ACT_IDX_HI_DETAIL_TASK_ID on ACT_HI_DETAIL(TASK_ID_);
+create index ACT_IDX_HI_DETAIL_TENANT_ID on ACT_HI_DETAIL(TENANT_ID_);
+create index ACT_IDX_HI_DETAIL_PROC_DEF_KEY on ACT_HI_DETAIL(PROC_DEF_KEY_);
+create index ACT_IDX_HI_DETAIL_BYTEAR on ACT_HI_DETAIL(BYTEARRAY_ID_);
+
+create index ACT_IDX_HI_IDENT_LNK_USER on ACT_HI_IDENTITYLINK(USER_ID_);
+create index ACT_IDX_HI_IDENT_LNK_GROUP on ACT_HI_IDENTITYLINK(GROUP_ID_);
+create index ACT_IDX_HI_IDENT_LNK_TENANT_ID on ACT_HI_IDENTITYLINK(TENANT_ID_);
+create index ACT_IDX_HI_IDENT_LNK_PROC_DEF_KEY on ACT_HI_IDENTITYLINK(PROC_DEF_KEY_);
+create index ACT_IDX_HI_IDENT_LINK_TASK on ACT_HI_IDENTITYLINK(TASK_ID_);
+
+create index ACT_IDX_HI_PROCVAR_PROC_INST on ACT_HI_VARINST(PROC_INST_ID_);
+create index ACT_IDX_HI_PROCVAR_NAME_TYPE on ACT_HI_VARINST(NAME_, VAR_TYPE_);
+create index ACT_IDX_HI_CASEVAR_CASE_INST on ACT_HI_VARINST(CASE_INST_ID_);
+create index ACT_IDX_HI_VAR_INST_TENANT_ID on ACT_HI_VARINST(TENANT_ID_);
+create index ACT_IDX_HI_VAR_INST_PROC_DEF_KEY on ACT_HI_VARINST(PROC_DEF_KEY_);
+create index ACT_IDX_HI_VARINST_BYTEAR on ACT_HI_VARINST(BYTEARRAY_ID_);
+
+create index ACT_IDX_HI_INCIDENT_TENANT_ID on ACT_HI_INCIDENT(TENANT_ID_);
+create index ACT_IDX_HI_INCIDENT_PROC_DEF_KEY on ACT_HI_INCIDENT(PROC_DEF_KEY_);
+create index ACT_IDX_HI_INCIDENT_PROCINST on ACT_HI_INCIDENT(PROC_INST_ID_);
+
+create index ACT_IDX_HI_JOB_LOG_PROCINST on ACT_HI_JOB_LOG(PROCESS_INSTANCE_ID_);
+create index ACT_IDX_HI_JOB_LOG_PROCDEF on ACT_HI_JOB_LOG(PROCESS_DEF_ID_);
+create index ACT_IDX_HI_JOB_LOG_TENANT_ID on ACT_HI_JOB_LOG(TENANT_ID_);
+create index ACT_IDX_HI_JOB_LOG_JOB_DEF_ID on ACT_HI_JOB_LOG(JOB_DEF_ID_);
+create index ACT_IDX_HI_JOB_LOG_PROC_DEF_KEY on ACT_HI_JOB_LOG(PROCESS_DEF_KEY_);
+create index ACT_IDX_HI_JOB_LOG_EX_STACK on ACT_HI_JOB_LOG(JOB_EXCEPTION_STACK_ID_);
+
+create index ACT_HI_EXT_TASK_LOG_PROCINST on ACT_HI_EXT_TASK_LOG(PROC_INST_ID_);
+create index ACT_HI_EXT_TASK_LOG_PROCDEF on ACT_HI_EXT_TASK_LOG(PROC_DEF_ID_);
+create index ACT_HI_EXT_TASK_LOG_PROC_DEF_KEY on ACT_HI_EXT_TASK_LOG(PROC_DEF_KEY_);
+create index ACT_HI_EXT_TASK_LOG_TENANT_ID on ACT_HI_EXT_TASK_LOG(TENANT_ID_);
+create index ACT_IDX_HI_EXTTASKLOG_ERRORDET on ACT_HI_EXT_TASK_LOG(ERROR_DETAILS_ID_);
+
+create index ACT_IDX_HI_OP_LOG_PROCINST on ACT_HI_OP_LOG(PROC_INST_ID_);
+create index ACT_IDX_HI_OP_LOG_PROCDEF on ACT_HI_OP_LOG(PROC_DEF_ID_);
+
+create index ACT_IDX_HI_COMMENT_TASK on ACT_HI_COMMENT(TASK_ID_);
+create index ACT_IDX_HI_COMMENT_PROCINST on ACT_HI_COMMENT(PROC_INST_ID_);
+
+create index ACT_IDX_HI_ATTACHMENT_CONTENT on ACT_HI_ATTACHMENT(CONTENT_ID_);
+create index ACT_IDX_HI_ATTACHMENT_PROCINST on ACT_HI_ATTACHMENT(PROC_INST_ID_);
+create index ACT_IDX_HI_ATTACHMENT_TASK on ACT_HI_ATTACHMENT(TASK_ID_);
+create table ACT_HI_CASEINST (
+ ID_ varchar(64) not null,
+ CASE_INST_ID_ varchar(64) not null,
+ BUSINESS_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64) not null,
+ CREATE_TIME_ datetime(3) not null,
+ CLOSE_TIME_ datetime(3),
+ DURATION_ bigint,
+ STATE_ integer,
+ CREATE_USER_ID_ varchar(255),
+ SUPER_CASE_INSTANCE_ID_ varchar(64),
+ SUPER_PROCESS_INSTANCE_ID_ varchar(64),
+ TENANT_ID_ varchar(64),
+ primary key (ID_),
+ unique (CASE_INST_ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_HI_CASEACTINST (
+ ID_ varchar(64) not null,
+ PARENT_ACT_INST_ID_ varchar(64),
+ CASE_DEF_ID_ varchar(64) not null,
+ CASE_INST_ID_ varchar(64) not null,
+ CASE_ACT_ID_ varchar(255) not null,
+ TASK_ID_ varchar(64),
+ CALL_PROC_INST_ID_ varchar(64),
+ CALL_CASE_INST_ID_ varchar(64),
+ CASE_ACT_NAME_ varchar(255),
+ CASE_ACT_TYPE_ varchar(255),
+ CREATE_TIME_ datetime(3) not null,
+ END_TIME_ datetime(3),
+ DURATION_ bigint,
+ STATE_ integer,
+ REQUIRED_ boolean,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create index ACT_IDX_HI_CAS_I_CLOSE on ACT_HI_CASEINST(CLOSE_TIME_);
+create index ACT_IDX_HI_CAS_I_BUSKEY on ACT_HI_CASEINST(BUSINESS_KEY_);
+create index ACT_IDX_HI_CAS_I_TENANT_ID on ACT_HI_CASEINST(TENANT_ID_);
+create index ACT_IDX_HI_CAS_A_I_CREATE on ACT_HI_CASEACTINST(CREATE_TIME_);
+create index ACT_IDX_HI_CAS_A_I_END on ACT_HI_CASEACTINST(END_TIME_);
+create index ACT_IDX_HI_CAS_A_I_COMP on ACT_HI_CASEACTINST(CASE_ACT_ID_, END_TIME_, ID_);
+create index ACT_IDX_HI_CAS_A_I_CASEINST on ACT_HI_CASEACTINST(CASE_INST_ID_, CASE_ACT_ID_);
+create index ACT_IDX_HI_CAS_A_I_TENANT_ID on ACT_HI_CASEACTINST(TENANT_ID_);
+-- create history decision instance table --
+create table ACT_HI_DECINST (
+ ID_ varchar(64) NOT NULL,
+ DEC_DEF_ID_ varchar(64) NOT NULL,
+ DEC_DEF_KEY_ varchar(255) NOT NULL,
+ DEC_DEF_NAME_ varchar(255),
+ PROC_DEF_KEY_ varchar(255),
+ PROC_DEF_ID_ varchar(64),
+ PROC_INST_ID_ varchar(64),
+ CASE_DEF_KEY_ varchar(255),
+ CASE_DEF_ID_ varchar(64),
+ CASE_INST_ID_ varchar(64),
+ ACT_INST_ID_ varchar(64),
+ ACT_ID_ varchar(255),
+ EVAL_TIME_ datetime(3) not null,
+ COLLECT_VALUE_ double,
+ USER_ID_ varchar(255),
+ ROOT_DEC_INST_ID_ varchar(64),
+ DEC_REQ_ID_ varchar(64),
+ DEC_REQ_KEY_ varchar(255),
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create history decision input table --
+create table ACT_HI_DEC_IN (
+ ID_ varchar(64) NOT NULL,
+ DEC_INST_ID_ varchar(64) NOT NULL,
+ CLAUSE_ID_ varchar(64),
+ CLAUSE_NAME_ varchar(255),
+ VAR_TYPE_ varchar(100),
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+-- create history decision output table --
+create table ACT_HI_DEC_OUT (
+ ID_ varchar(64) NOT NULL,
+ DEC_INST_ID_ varchar(64) NOT NULL,
+ CLAUSE_ID_ varchar(64),
+ CLAUSE_NAME_ varchar(255),
+ RULE_ID_ varchar(64),
+ RULE_ORDER_ integer,
+ VAR_NAME_ varchar(255),
+ VAR_TYPE_ varchar(100),
+ BYTEARRAY_ID_ varchar(64),
+ DOUBLE_ double,
+ LONG_ bigint,
+ TEXT_ LONGBLOB,
+ TEXT2_ LONGBLOB,
+ TENANT_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+
+create index ACT_IDX_HI_DEC_INST_ID on ACT_HI_DECINST(DEC_DEF_ID_);
+create index ACT_IDX_HI_DEC_INST_KEY on ACT_HI_DECINST(DEC_DEF_KEY_);
+create index ACT_IDX_HI_DEC_INST_PI on ACT_HI_DECINST(PROC_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_CI on ACT_HI_DECINST(CASE_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_ACT on ACT_HI_DECINST(ACT_ID_);
+create index ACT_IDX_HI_DEC_INST_ACT_INST on ACT_HI_DECINST(ACT_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_TIME on ACT_HI_DECINST(EVAL_TIME_);
+create index ACT_IDX_HI_DEC_INST_TENANT_ID on ACT_HI_DECINST(TENANT_ID_);
+create index ACT_IDX_HI_DEC_INST_ROOT_ID on ACT_HI_DECINST(ROOT_DEC_INST_ID_);
+create index ACT_IDX_HI_DEC_INST_REQ_ID on ACT_HI_DECINST(DEC_REQ_ID_);
+create index ACT_IDX_HI_DEC_INST_REQ_KEY on ACT_HI_DECINST(DEC_REQ_KEY_);
+
+
+create index ACT_IDX_HI_DEC_IN_INST on ACT_HI_DEC_IN(DEC_INST_ID_);
+create index ACT_IDX_HI_DEC_IN_CLAUSE on ACT_HI_DEC_IN(DEC_INST_ID_, CLAUSE_ID_);
+
+create index ACT_IDX_HI_DEC_OUT_INST on ACT_HI_DEC_OUT(DEC_INST_ID_);
+create index ACT_IDX_HI_DEC_OUT_RULE on ACT_HI_DEC_OUT(RULE_ORDER_, CLAUSE_ID_);
+
+-- mariadb_identity_7.8.0-ee
+
+create table ACT_ID_GROUP (
+ ID_ varchar(64),
+ REV_ integer,
+ NAME_ varchar(255),
+ TYPE_ varchar(255),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_MEMBERSHIP (
+ USER_ID_ varchar(64),
+ GROUP_ID_ varchar(64),
+ primary key (USER_ID_, GROUP_ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_USER (
+ ID_ varchar(64),
+ REV_ integer,
+ FIRST_ varchar(255),
+ LAST_ varchar(255),
+ EMAIL_ varchar(255),
+ PWD_ varchar(255),
+ SALT_ varchar(255),
+ PICTURE_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_INFO (
+ ID_ varchar(64),
+ REV_ integer,
+ USER_ID_ varchar(64),
+ TYPE_ varchar(64),
+ KEY_ varchar(255),
+ VALUE_ varchar(255),
+ PASSWORD_ LONGBLOB,
+ PARENT_ID_ varchar(255),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_TENANT (
+ ID_ varchar(64),
+ REV_ integer,
+ NAME_ varchar(255),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+create table ACT_ID_TENANT_MEMBER (
+ ID_ varchar(64) not null,
+ TENANT_ID_ varchar(64) not null,
+ USER_ID_ varchar(64),
+ GROUP_ID_ varchar(64),
+ primary key (ID_)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE utf8_bin;
+
+alter table ACT_ID_MEMBERSHIP
+ add constraint ACT_FK_MEMB_GROUP
+ foreign key (GROUP_ID_)
+ references ACT_ID_GROUP (ID_);
+
+alter table ACT_ID_MEMBERSHIP
+ add constraint ACT_FK_MEMB_USER
+ foreign key (USER_ID_)
+ references ACT_ID_USER (ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_UNIQ_TENANT_MEMB_USER
+ unique (TENANT_ID_, USER_ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_UNIQ_TENANT_MEMB_GROUP
+ unique (TENANT_ID_, GROUP_ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_FK_TENANT_MEMB
+ foreign key (TENANT_ID_)
+ references ACT_ID_TENANT (ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_FK_TENANT_MEMB_USER
+ foreign key (USER_ID_)
+ references ACT_ID_USER (ID_);
+
+alter table ACT_ID_TENANT_MEMBER
+ add constraint ACT_FK_TENANT_MEMB_GROUP
+ foreign key (GROUP_ID_)
+ references ACT_ID_GROUP (ID_);
+
+ALTER TABLE ACT_GE_BYTEARRAY
+ ADD TYPE_ integer;
+
+ALTER TABLE ACT_GE_BYTEARRAY
+ ADD CREATE_TIME_ datetime(3);
+
+ALTER TABLE ACT_RE_PROCDEF
+ ADD STARTABLE_ BOOLEAN NOT NULL DEFAULT TRUE; \ No newline at end of file
diff --git a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
index f790d804ca..954ebdd013 100644
--- a/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
+++ b/so-simulator/src/main/java/org/onap/so/simulator/actions/aai/ProcessVnfc.java
@@ -1,12 +1,18 @@
package org.onap.so.simulator.actions.aai;
+import java.io.InputStream;
+import java.util.List;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.Vserver;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
+import org.onap.aaiclient.client.aai.entities.Relationships;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.io.ClassPathResource;
import com.consol.citrus.actions.AbstractTestAction;
import com.consol.citrus.context.TestContext;
@@ -56,6 +62,26 @@ public class ProcessVnfc extends AbstractTestAction {
aaiResourceClient.connect(vnfcURI, vserverURI);
aaiResourceClient.connect(vserverURI, pserverURI);
aaiResourceClient.connect(vfModuleURI, vnfcURI);
+ } else if (context.getVariable("requestAction").equals("CreateVfModuleInstance")
+ && context.getVariable("serviceAction").equals("activate")) {
+ // For recreate after soft delete
+ AAIResourceUri vnfcURI = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, "zauk51bfrwl09oam001");
+ AAIResourceUri vserverURI = AAIUriFactory.createResourceUri(AAIObjectType.VSERVER,
+ context.getVariable("cloudOwner"), context.getVariable("cloudRegion"),
+ context.getVariable("tenant"), "d29f3151-592d-4011-9356-ad047794e236");
+
+ Relationships relationships = aaiResourceClient.get(vnfcURI).getRelationships().get();
+ List<AAIResourceUri> uris = relationships.getRelatedUris(AAIObjectType.VSERVER);
+ if (uris.isEmpty() || uris.size() == 0) {
+ if (!aaiResourceClient.exists(vserverURI)) {
+ AAICommonObjectMapperProvider aaiMapper = new AAICommonObjectMapperProvider();
+ InputStream vserverFile =
+ new ClassPathResource("openstack/gr_api/CreateVserver.json").getInputStream();
+ Vserver vserver = aaiMapper.getMapper().readValue(vserverFile, Vserver.class);
+ aaiResourceClient.create(vserverURI, vserver);
+ }
+ aaiResourceClient.connect(vnfcURI, vserverURI);
+ }
}
} catch (Exception e) {
logger.debug("Exception in ProcessVnfc.doExecute", e);
diff --git a/so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json b/so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json
new file mode 100644
index 0000000000..17bc9233d4
--- /dev/null
+++ b/so-simulator/src/main/resources/openstack/gr_api/CreateVserver.json
@@ -0,0 +1,87 @@
+{
+ "vserver-id": "d29f3151-592d-4011-9356-ad047794e236",
+ "vserver-name": "ssc_server_1",
+ "vserver-name2": "ssc_server_1",
+ "vserver-selflink": "https://test.com:8774/v2/0422ffb57ba042c0800a29dc85ca70f8/servers/92272b67-d23f-42ca-87fa-7b06a9ec81f3",
+ "in-maint": false,
+ "is-closed-loop-disabled": false,
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "ssc_1_mgmt_port_0",
+ "selflink": "https://test.com:9696/v2.0/ports/07f5b14c-147a-4d14-8c94-a9e94dbc097b",
+ "interface-id": "e80bec21-4b4b-42b0-ae17-20e736b8a82b",
+ "macaddr": "02:07:f5:b1:4c:14",
+ "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_OAMP_NSD_TSBC0_net_1",
+ "is-port-mirrored": false,
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "192.61.12.203",
+ "l3-interface-ipv4-prefix-length": 28,
+ "is-floating": false,
+ "neutron-network-id": "cae2ade2-9f44-40fa-b124-18b101ff9aa0",
+ "neutron-subnet-id": "1f954922-6e9c-4a64-9d78-62e869ba8c77"
+ }
+ ],
+ "vlans" : {
+ "vlan": [
+ {
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "is-private": false,
+ "vlan-id-inner": 0,
+ "vlan-id-outer": 123,
+ "vlan-interface": "oamfw_oam_direct1_0_port141"
+ }
+ ]
+ }
+ },
+ {
+ "interface-name": "ssc_1_int_ha_port_0",
+ "selflink": "https://test.com:9696/v2.0/ports/0594a2f2-7ea4-42eb-abc2-48ea49677fca",
+ "interface-id": "e80bec21-4b4b-42b0-ae17-20e736b8a82a",
+ "macaddr": "02:05:94:a2:f2:7e",
+ "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR-UNTR-ROLE1-PARNT_net_1",
+ "is-port-mirrored": false,
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "l-interfaces": {
+ "l-interface": [
+ {
+ "interface-name": "tsbc0005v_tsbc0005vm002_subint_untrusted_role1_81",
+ "interface-id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc",
+ "macaddr": "02:05:94:a2:f2:7e",
+ "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_UNTR_VSE_ROLE10_net_1",
+ "is-port-mirrored": false,
+ "in-maint": false,
+ "is-ip-unnumbered": false
+ }
+ ]
+ },
+ "l3-interface-ipv4-address-list": [
+ {
+ "l3-interface-ipv4-address": "172.26.0.36",
+ "l3-interface-ipv4-prefix-length": 27,
+ "is-floating": false,
+ "neutron-network-id": "49bd2c8c-808d-4783-a1c5-5d9ae0c6a9fa",
+ "neutron-subnet-id": "8d073a94-b1b9-493a-8fc1-cf92abcba466"
+ }
+ ],
+ "vlans" : {
+ "vlan": [
+ {
+ "in-maint": false,
+ "is-ip-unnumbered": false,
+ "is-private": false,
+ "vlan-id-inner": 0,
+ "vlan-id-outer": 965,
+ "vlan-interface": "oamfw_oam_direct1_0_port141"
+ }
+ ]
+ }
+ }
+ ]
+ }
+}
diff --git a/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json b/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
index 622bf8e3ef..afc7b8e6db 100644
--- a/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
+++ b/so-simulator/src/main/resources/openstack/gr_api/GetNovaServer.json
@@ -66,7 +66,7 @@
"OS-SRV-USG:terminated_at": null,
"key_name": null,
"OS-EXT-SRV-ATTR:hypervisor_hostname": "test.com",
- "name": "zauk51bfrwl09oam001",
+ "name": "ssc_server_1",
"created": "2019-02-11T19:11:58Z",
"tenant_id": "872f331350c54e59991a8de2cbffb40c",
"os-extended-volumes:volumes_attached": [],