aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--INFO.yaml34
-rw-r--r--adapters/etsi-sol002-adapter/pom.xml12
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java56
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java29
-rw-r--r--adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java2
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/application.yaml14
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jksbin0 -> 1413 bytes
-rw-r--r--adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12bin0 -> 4079 bytes
-rw-r--r--adapters/etsi-sol003-adapter/pom.xml2
-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-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java32
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql32
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java31
-rw-r--r--adapters/mso-openstack-adapters/pom.xml7
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java23
-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/inventory/delete/DeleteInventoryTask.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java4
-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/adapters/tasks/inventory/CreateAAIInventory.java3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java4
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java232
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java6
-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-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java73
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml2
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml2
-rw-r--r--adapters/mso-sdnc-adapter/pom.xml2
-rw-r--r--adapters/pom.xml1
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java20
-rw-r--r--adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java2
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java1
-rw-r--r--adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java37
-rw-r--r--bpmn/MSOCommonBPMN/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.java21
-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.java153
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPnf.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java13
-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.java98
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json8
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json38
-rw-r--r--bpmn/mso-infrastructure-bpmn/pom.xml4
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationService.java1
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java21
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/AutoProcessInstanceMigrationServiceTest.java1
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn56
-rw-r--r--bpmn/so-bpmn-infrastructure-common/pom.xml2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/GenericPnfTaskProcessor.groovy127
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn203
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java1
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java234
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PnfHealthCheckTest.json50
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest.json26
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest_catalogdb.json39
-rw-r--r--bpmn/so-bpmn-tasks/pom.xml29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java174
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapper.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java)2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java32
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java548
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java114
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java)81
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java)3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/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.java224
-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.java686
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/MultiStageSkipListenerTest.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java69
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json40
-rw-r--r--common/pom.xml4
-rw-r--r--common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java9
-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--common/src/main/java/org/onap/so/client/exception/MapperException.java (renamed from bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java)0
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java22
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java19
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java6
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java3
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java7
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java15
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java4
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java22
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java17
-rw-r--r--graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java12
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java17
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java29
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java20
-rw-r--r--graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java26
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java7
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java2
-rw-r--r--graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java228
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java29
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/AAIDataRetrieval.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecuteServiceLevelCustomWorkflow.json39
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_ServiceLevel_Response.json6
-rw-r--r--packages/docker/pom.xml24
-rw-r--r--pom.xml12
-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-sdn-clients/pom.xml173
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SDNCClient.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidator.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java)15
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java)12
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/Body.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/Input.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java)0
-rw-r--r--so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/SDNO.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java)0
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/BaseIntegrationTest.java60
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java60
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/IntegrationTestSuite.java31
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/TestApplication.java43
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/UnitTestSuite.java32
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java)0
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java)0
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java)2
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java)2
-rw-r--r--so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json7
-rw-r--r--so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json54
-rw-r--r--so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json53
-rw-r--r--so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json54
-rw-r--r--so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json74
-rw-r--r--so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json31
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientGetResponse.json27
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponse.json127
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json47
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json39
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json34
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPut200Response.json15
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPut200ResponseNotFinal.json15
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientPut404Response.json8
-rw-r--r--so-sdn-clients/src/test/resources/__files/SDNCClientResponseIncorrectPath.json29
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/client/output-failure.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/client/output-success.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/client/response.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-lport-mirror-post-check-request.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-lport-mirror-pre-check-request.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-port-mirror-post-check-request.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json)0
-rw-r--r--so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-port-mirror-pre-check-request.json (renamed from bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json)0
-rw-r--r--so-sdn-clients/src/test/resources/application-test.yaml231
-rw-r--r--so-sdn-clients/src/test/resources/dmaap.properties10
-rw-r--r--so-sdn-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
255 files changed, 7872 insertions, 1928 deletions
diff --git a/INFO.yaml b/INFO.yaml
index 7e1f91f30c..470e0d2ade 100644
--- a/INFO.yaml
+++ b/INFO.yaml
@@ -26,7 +26,7 @@ meetings:
server: 'n/a'
channel: 'n/a'
repeats: 'weekly'
- time: '14:00 UTC'
+ time: '13:30 UTC'
repositories:
- so
- so-chef-repo
@@ -45,41 +45,16 @@ committers:
company: 'Ericsson'
id: 'byungwoojun'
timezone: 'America/New_York'
- - name: 'DeWayne Filppi'
- email: 'dewayne@cloudify.co'
- company: 'Cloudify'
- id: 'dfilppi'
- timezone: 'America/Los_Angeles'
- name: 'Max Benjamin'
email: 'max.benjamin@att.com'
company: 'ATT'
id: 'mfour'
timezone: 'America/New_York'
- - name: 'Yan Yang'
- email: 'yangyanyj@chinamobile.com'
- company: 'China Mobile'
- id: 'yangyan'
- timezone: 'Asia/Shanghai'
- - name: 'Marcus Williams'
- email: 'marcus.williams@intel.com'
- company: 'Intel'
- id: 'mgkwill'
- timezone: 'America/Los_Angeles'
- - name: 'Sanchita Pathak'
- email: 'sanchita@techmahindra.com'
- company: 'Tech Mahindra'
- id: 'sanchitap'
- timezone: 'Asia/Kolkata'
- name: 'Steve Smokowski'
email: 'ss835w@att.com'
company: 'ATT'
id: 'stevesmokowski'
timezone: 'America/New_York'
- - name: 'Subhash Kumar Singh'
- email: 'Subhash.Kumar.Singh@huawei.com'
- company: 'Huawei'
- id: 'subhash_singh'
- timezone: 'Asia/Kolkata'
- name: 'Lukasz Muszkieta'
email: 'lukasz.muszkieta@nokia.com'
company: 'Nokia'
@@ -115,4 +90,9 @@ tsc:
- type: 'addition'
name: 'Max Benjamin'
link: 'https://lists.onap.org/g/onap-tsc/message/4981?p=,,,20,0,0,0::Created,,committer,20,2,0,31638681'
-
+ - type: 'removal'
+ name: 'DeWayne Filppi'
+ name: 'Yan Yang'
+ name: 'Marcus Williams'
+ name: 'Sanchita Pathak'
+ name: 'Subhash Kumar Singh'
diff --git a/adapters/etsi-sol002-adapter/pom.xml b/adapters/etsi-sol002-adapter/pom.xml
index 81e35d896d..5dee8fe8e6 100644
--- a/adapters/etsi-sol002-adapter/pom.xml
+++ b/adapters/etsi-sol002-adapter/pom.xml
@@ -82,6 +82,18 @@
</executions>
</plugin>
</plugins>
+ <resources>
+ <resource>
+ <directory>${basedir}/src/main/resources</directory>
+ <excludes>
+ <exclude>certs/*</exclude>
+ </excludes>
+ </resource>
+ <resource>
+ <directory>${basedir}/src/main/resources/certs</directory>
+ <filtering>false</filtering>
+ </resource>
+ </resources>
</build>
</project>
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
index 411572ff5b..38f7a0cd3f 100644
--- a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ApplicationConfiguration.java
@@ -20,17 +20,44 @@
package org.onap.so.adapters.vevnfm.configuration;
+import java.io.IOException;
+import java.security.*;
+import java.security.cert.CertificateException;
+import javax.net.ssl.SSLContext;
+import org.apache.http.client.HttpClient;
+import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
+import org.apache.http.impl.client.HttpClients;
+import org.apache.http.ssl.SSLContextBuilder;
import org.onap.so.adapters.vevnfm.provider.AuthorizationHeadersProvider;
import org.onap.so.configuration.rest.HttpHeadersProvider;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
+import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.web.client.RestTemplate;
@Configuration
public class ApplicationConfiguration {
+ private static final Logger logger = LoggerFactory.getLogger(ApplicationConfiguration.class);
+
+ private final Resource clientKeyStore;
+ private final String clientKeyStorePassword;
+ private final Resource clientTrustStore;
+ private final String clientTrustStorePassword;
+
+ public ApplicationConfiguration(final ConfigProperties configProperties) {
+ clientKeyStore = configProperties.getClientKeyStore();
+ clientKeyStorePassword = configProperties.getClientKeyStorePassword();
+ clientTrustStore = configProperties.getClientTrustStore();
+ clientTrustStorePassword = configProperties.getClientTrustStorePassword();
+ }
+
@Bean
public AuthorizationHeadersProvider headersProvider() {
return new AuthorizationHeadersProvider();
@@ -39,6 +66,35 @@ public class ApplicationConfiguration {
@Bean
public HttpRestServiceProvider restProvider(final RestTemplate restTemplate,
final HttpHeadersProvider headersProvider) {
+ modify(restTemplate);
return new HttpRestServiceProviderImpl(restTemplate, headersProvider);
}
+
+ private void modify(final RestTemplate restTemplate) {
+
+ if (clientKeyStore == null || clientTrustStore == null) {
+ return;
+ }
+
+ try {
+ final KeyStore keystore = KeyStore.getInstance("PKCS12");
+ keystore.load(clientKeyStore.getInputStream(), clientKeyStorePassword.toCharArray());
+
+ final SSLContext sslContext = new SSLContextBuilder()
+ .loadTrustMaterial(clientTrustStore.getURL(), clientTrustStorePassword.toCharArray())
+ .loadKeyMaterial(keystore, clientKeyStorePassword.toCharArray()).build();
+
+ logger.info("Setting truststore: {}", clientTrustStore.getURL());
+
+ final SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(sslContext);
+ final HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(socketFactory).build();
+ final HttpComponentsClientHttpRequestFactory factory =
+ new HttpComponentsClientHttpRequestFactory(httpClient);
+
+ restTemplate.setRequestFactory(new BufferingClientHttpRequestFactory(factory));
+ } catch (KeyManagementException | NoSuchAlgorithmException | KeyStoreException | CertificateException
+ | IOException | UnrecoverableKeyException e) {
+ logger.error("Error reading truststore, TLS connection to VNFM will fail.", e);
+ }
+ }
}
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
index d4ca5af0f2..a8a436ddc6 100644
--- a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/configuration/ConfigProperties.java
@@ -23,6 +23,7 @@ package org.onap.so.adapters.vevnfm.configuration;
import org.onap.so.adapters.vevnfm.constant.NotificationVnfFilterType;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
+import org.springframework.core.io.Resource;
@Configuration
public class ConfigProperties {
@@ -72,6 +73,18 @@ public class ConfigProperties {
@Value("${spring.security.usercredentials[0].openpass}")
private String springSecurityOpenpass;
+ @Value("${client.key-store:#{null}}")
+ private Resource clientKeyStore;
+
+ @Value("${client.key-store-password:#{null}}")
+ private String clientKeyStorePassword;
+
+ @Value("${client.trust-store:#{null}}")
+ private Resource clientTrustStore;
+
+ @Value("${client.trust-store-password:#{null}}")
+ private String clientTrustStorePassword;
+
public String getVevnfmadapterVnfFilterJson() {
return vevnfmadapterVnfFilterJson;
}
@@ -131,4 +144,20 @@ public class ConfigProperties {
public String getSpringSecurityOpenpass() {
return springSecurityOpenpass;
}
+
+ public Resource getClientKeyStore() {
+ return clientKeyStore;
+ }
+
+ public String getClientKeyStorePassword() {
+ return clientKeyStorePassword;
+ }
+
+ public Resource getClientTrustStore() {
+ return clientTrustStore;
+ }
+
+ public String getClientTrustStorePassword() {
+ return clientTrustStorePassword;
+ }
}
diff --git a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
index c128275e43..eba1d087c6 100644
--- a/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
+++ b/adapters/etsi-sol002-adapter/src/main/java/org/onap/so/adapters/vevnfm/service/StartupService.java
@@ -28,7 +28,6 @@ import org.onap.so.adapters.vevnfm.configuration.ConfigProperties;
import org.onap.so.adapters.vevnfm.exception.VeVnfmException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.retry.annotation.Recover;
@@ -44,7 +43,6 @@ public class StartupService {
private final String vnfmDefaultEndpoint;
private final AaiConnection aaiConnection;
- @Autowired
public StartupService(final ConfigProperties configProperties, final AaiConnection aaiConnection) {
this.vnfmDefaultEndpoint = configProperties.getVnfmDefaultEndpoint();
this.aaiConnection = aaiConnection;
diff --git a/adapters/etsi-sol002-adapter/src/main/resources/application.yaml b/adapters/etsi-sol002-adapter/src/main/resources/application.yaml
index c69c95187a..f5b6bc3158 100644
--- a/adapters/etsi-sol002-adapter/src/main/resources/application.yaml
+++ b/adapters/etsi-sol002-adapter/src/main/resources/application.yaml
@@ -19,17 +19,23 @@ server:
vevnfmadapter:
vnf-filter-json: '{notificationTypes:[VnfLcmOperationOccurrenceNotification],operationStates:[COMPLETED]}'
- endpoint: http://so-ve-vnfm-adapter.onap:9098
+ endpoint: http://so-ve-vnfm-adapter:9098
+
+client:
+ key-store: classpath:ve-vnfm-adapter.p12
+ key-store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L'
+ trust-store: classpath:org.onap.so.trust.jks
+ trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H'
mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
aai:
- endpoint: https://aai.onap:30233
+ endpoint: https://aai:30233
auth: 75C4483F9C05E2C33A8602635FA532397EC44AB667A2B64DED4FEE08DD932F2E3C1FEE
vnfm:
- default-endpoint: https://so-vnfm-simulator.onap:9093
+ default-endpoint: https://so-vnfm-simulator:9093
subscription: /vnflcm/v1/subscriptions
notification: /lcm/v1/vnf/instances/notifications
@@ -37,7 +43,7 @@ notification:
vnf-filter-type: NONE
dmaap:
- endpoint: http://message-router.onap:30227
+ endpoint: http://message-router:30227
topic: /events/unauthenticated.DCAE_CL_OUTPUT
closed-loop:
control:
diff --git a/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks b/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks
new file mode 100644
index 0000000000..1f0d8a550a
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/main/resources/certs/org.onap.so.trust.jks
Binary files differ
diff --git a/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12 b/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12
new file mode 100644
index 0000000000..ae4fddc684
--- /dev/null
+++ b/adapters/etsi-sol002-adapter/src/main/resources/certs/ve-vnfm-adapter.p12
Binary files differ
diff --git a/adapters/etsi-sol003-adapter/pom.xml b/adapters/etsi-sol003-adapter/pom.xml
index fe34ff47c3..9ea25a5eb7 100644
--- a/adapters/etsi-sol003-adapter/pom.xml
+++ b/adapters/etsi-sol003-adapter/pom.xml
@@ -16,7 +16,7 @@
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<version-swagger-codegen>2.3.1</version-swagger-codegen>
<gson-fire-version>1.8.2</gson-fire-version>
- <retrofit-version>2.3.0</retrofit-version>
+ <retrofit-version>2.7.2</retrofit-version>
<threetenbp-version>1.3.5</threetenbp-version>
<oltu-version>1.0.1</oltu-version>
<swagger-core-version>1.5.21</swagger-core-version>
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-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
index f283af1ba6..aa039c6ac4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java
@@ -655,4 +655,36 @@ public class CatalogDbAdapterRest {
return Response.status(HttpStatus.SC_NOT_FOUND).header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.build();
}
+
+ @GET
+ @Path("processingFlags")
+ @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON})
+ @Transactional(readOnly = true)
+ public Response getAllProcessingFlags() {
+ return getAllProcessingFlagsImpl();
+ }
+
+ public Response getAllProcessingFlagsImpl() {
+ List<ProcessingFlags> processingFlags = null;
+
+ int respStatus = HttpStatus.SC_OK;
+ try {
+ processingFlags = processingFlagsRepo.findAll();
+ if (processingFlags == null) {
+ logger.debug("ProcessingFlags not found");
+ respStatus = HttpStatus.SC_NOT_FOUND;
+ } else {
+
+ logger.debug("ProcessingFlags processingFlags = {}", processingFlags.toString());
+ }
+ return Response.status(respStatus).entity(processingFlags)
+ .header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON).build();
+ } catch (Exception e) {
+ logger.error("Exception - queryProcesssingFlags", e);
+ CatalogQueryException excResp = new CatalogQueryException(e.getMessage(),
+ CatalogQueryExceptionCategory.INTERNAL, Boolean.FALSE, null);
+ return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
+ .entity(new GenericEntity<CatalogQueryException>(excResp) {}).build();
+ }
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
index a5e546e093..91a0dbd1f0 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/R__MacroData.sql
@@ -84,16 +84,17 @@ INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FL
('Service-Macro-Delete', '3', 'DeactivateVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Service-Macro-Delete', '4', 'DeleteVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Service-Macro-Delete', '5', 'DeactivateVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '6', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '7', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '8', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '9', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '10', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '11', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '12', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '13', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '14', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
-('Service-Macro-Delete', '15', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '6', 'DeactivatePnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '7', 'DeactivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '8', 'DeleteNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '9', 'DeactivateNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '10', 'DeleteNetworkCollectionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '11', 'DeactivateServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '12', 'UnassignVfModuleBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '13', 'UnassignVolumeGroupBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '14', 'UnassignVnfBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '15', 'UnassignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
+('Service-Macro-Delete', '16', 'UnassignServiceInstanceBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Service-Macro-Delete' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '1', 'AssignNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '2', 'CreateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
('Network-Create', '3', 'ActivateNetworkBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'Network-Create' and CLOUD_OWNER = 'DEFAULT')),
@@ -280,6 +281,7 @@ VALUES
('DeactivateVolumeGroupBB', 'VOLUME_GROUP', 'DEACTIVATE'),
('DeactivateVfModuleBB', 'VF_MODULE', 'DEACTIVATE'),
('DeactivateNetworkBB', 'NETWORK', 'DEACTIVATE'),
+('DeactivatePnfBB', 'NO_VALIDATE', 'DEACTIVATE'),
('ChangeModelServiceInstanceBB', 'SERVICE', 'CHANGEMODEL'),
@@ -929,3 +931,13 @@ VALUES
('VNFConfigModifyActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetInMaintFlagActivity','*','*','*','*','Manual','Abort','*', '*'),
('VNFUnsetClosedLoopDisabledActivity','*','*','*','*','Manual','Abort','*', '*');
+
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-assign' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigAssignVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='config-deploy' WHERE COMPOSITE_ACTION = 'Service-Macro-Create' and FLOW_NAME = 'ConfigDeployVnfBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vnf', ACTION='HealthCheck' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
+UPDATE orchestration_flow_reference set FLOW_NAME='ControllerExecutionBB', SCOPE='vfmodule', ACTION='ScaleOutReconfiguration' WHERE COMPOSITE_ACTION = 'VFModule-ScaleOut' and FLOW_NAME = 'GenericVnfHealthCheckBB';
+
+INSERT INTO orchestration_flow_reference(COMPOSITE_ACTION, SEQ_NO, FLOW_NAME, FLOW_VERSION, NB_REQ_REF_LOOKUP_ID, SCOPE, ACTION) VALUES
+('VFModule-Delete', '1', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'DEFAULT'), "vnf", "HealthCheck"),
+('VFModule-Delete', '2', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'DEFAULT'), "vfmodule", "ScaleInReconfiguration"),
+('VFModule-Delete', '6', 'ControllerExecutionBB', 1.0,(SELECT id from northbound_request_ref_lookup WHERE MACRO_ACTION = 'VFModule-Delete' and CLOUD_OWNER = 'DEFAULT'), "vnf", "HealthCheck"); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 04161e9df9..3906229c2c 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -21,7 +21,9 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
import java.io.IOException;
+import java.util.List;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.json.JSONException;
@@ -37,6 +39,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
+import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -831,6 +834,34 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
}
@Test
+ public void testGetAllProcessingFlags() throws Exception {
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(ECOMP_MSO_CATALOG_PROCESSING_FLAGS));
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ ObjectMapper mapper = new ObjectMapper();
+
+ List<ProcessingFlags> processingFlagsResponse =
+ mapper.readValue(response.getBody(), new TypeReference<List<ProcessingFlags>>() {});
+
+ boolean testFlagFound = false;
+ for (int i = 0; i < processingFlagsResponse.size(); i++) {
+ if (processingFlagsResponse.get(i).getFlag().equals("TESTFLAG")) {
+ assertEquals(processingFlagsResponse.get(i).getEndpoint(), "TESTENDPOINT");
+ assertEquals(processingFlagsResponse.get(i).getDescription(), "TEST FLAG");
+ testFlagFound = true;
+ }
+ }
+ assertTrue(testFlagFound);
+ }
+
+ @Test
public void testSetProcessingFlagsFlagValue() throws JSONException {
ProcessingFlags updatedProcessingFlag = new ProcessingFlags();
updatedProcessingFlag.setFlag("TESTFLAG");
diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml
index 9cee2882be..d78178f5ba 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>
@@ -353,5 +353,10 @@
<artifactId>camunda-external-task-client</artifactId>
<version>1.1.1</version>
</dependency>
+ <dependency>
+ <groupId>com.github.seancfoley</groupId>
+ <artifactId>ipaddress</artifactId>
+ <version>2.0.0</version>
+ </dependency>
</dependencies>
</project>
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
index 15c5eda054..1f0422b0b2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteAAIInventory.java
@@ -47,20 +47,19 @@ public class DeleteAAIInventory {
@Autowired
protected Environment env;
- public void heatbridge(CloudInformation cloudInformation, boolean dryrun) {
+ public void heatbridge(CloudInformation cloudInformation) {
try {
- if (!dryrun) {
- logger.debug("Heatbridge delete executing");
+ logger.debug("Heatbridge delete executing");
+
+ CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
+ .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
+ HeatBridgeApi heatBridgeClient =
+ new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity, cloudInformation.getOwner(),
+ cloudInformation.getRegionId(), cloudSite.getRegionId(), cloudInformation.getTenantId());
+ heatBridgeClient.authenticate();
+ heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
- CloudSite cloudSite = cloudConfig.getCloudSite(cloudInformation.getRegionId())
- .orElseThrow(() -> new MsoCloudSiteNotFound(cloudInformation.getRegionId()));
- CloudIdentity cloudIdentity = cloudSite.getIdentityService();
- HeatBridgeApi heatBridgeClient = new HeatBridgeImpl(new AAIResourcesClient(), cloudIdentity,
- cloudInformation.getOwner(), cloudInformation.getRegionId(), cloudSite.getRegionId(),
- cloudInformation.getTenantId());
- heatBridgeClient.authenticate();
- heatBridgeClient.deleteVfModuleData(cloudInformation.getVnfId(), cloudInformation.getVfModuleId());
- }
} catch (Exception ex) {
logger.debug("Heatbrige failed for stackId: " + cloudInformation.getTemplateInstanceId(), ex);
}
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..4e5e880f80 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(externalTaskServiceUtils.getLockDurationMedium())
+ .handler(deleteInventory::executeExternalTask).open();
+ }
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java
index c5feee2089..10faa2b08f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/delete/DeleteInventoryTask.java
@@ -60,14 +60,13 @@ public class DeleteInventoryTask extends ExternalTaskUtils {
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
mdcSetup.setupMDC(externalTask);
- boolean inventoryException = false;
String externalTaskId = externalTask.getId();
CloudInformation cloudInformation = externalTask.getVariable("cloudInformation");
boolean success = true;
if (cloudInformation != null) {
Integer retryCount = externalTask.getRetries();
try {
- deleteInventory.heatbridge(cloudInformation, env.getProperty("heatBridgeDryrun", Boolean.class, true));
+ deleteInventory.heatbridge(cloudInformation);
} catch (Exception e) {
logger.error("Error during inventory of stack", e);
success = false;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
index db9a7cefae..d4a4bb792f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/TaskServices.java
@@ -70,7 +70,7 @@ public class TaskServices {
public void auditAddAAIInventory() throws Exception {
for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryAddAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ client.subscribe("InventoryAddAudit").lockDuration(externalTaskServiceUtils.getLockDurationLong())
.handler(auditCreateStack::executeExternalTask).open();
}
}
@@ -79,7 +79,7 @@ public class TaskServices {
public void auditDeleteAAIInventory() throws Exception {
for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
- client.subscribe("InventoryDeleteAudit").lockDuration(externalTaskServiceUtils.getLockDuration())
+ client.subscribe("InventoryDeleteAudit").lockDuration(externalTaskServiceUtils.getLockDurationLong())
.handler(auditDeleteStack::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/adapters/tasks/inventory/CreateAAIInventory.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
index eab0451aa6..df4229c985 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/tasks/inventory/CreateAAIInventory.java
@@ -108,7 +108,8 @@ public class CreateAAIInventory {
if (!CollectionUtils.isEmpty(oobMgtNetNames)) {
oobMgtNetIds = heatBridgeClient.extractNetworkIds(oobMgtNetNames);
}
- heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds);
+ heatBridgeClient.buildAddVserverLInterfacesToAaiAction(stackResources, oobMgtNetIds,
+ cloudInformation.getOwner());
logger.debug(
"Successfully queried neutron resources and built AAI actions to add l-interfaces to vservers.");
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
index d0ca87df95..9c098863f2 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeApi.java
@@ -134,8 +134,10 @@ public interface HeatBridgeApi {
*
* @param stackResources Openstack Heat stack resource list
* @param oobMgtNetIds List of OOB network IDs list
+ * @param cloudOwner
*/
- void buildAddVserverLInterfacesToAaiAction(List<Resource> stackResources, List<String> oobMgtNetIds);
+ void buildAddVserverLInterfacesToAaiAction(List<Resource> stackResources, List<String> oobMgtNetIds,
+ String cloudOwner);
/**
* Query and build AAI actions for Openstack Compute resources to AAI's pserver and pinterface objects
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
index 53736e912f..e537b241c0 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/HeatBridgeImpl.java
@@ -42,6 +42,7 @@ import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
+import javax.ws.rs.NotFoundException;
import javax.ws.rs.WebApplicationException;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.validator.routines.InetAddressValidator;
@@ -66,6 +67,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
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.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.graphinventory.entities.uri.Depth;
import org.onap.aaiclient.client.graphinventory.exceptions.BulkProcessFailed;
import org.onap.logging.filter.base.ErrorCode;
@@ -79,17 +81,21 @@ import org.onap.so.heatbridge.openstack.factory.OpenstackClientFactoryImpl;
import org.onap.so.heatbridge.utils.HeatBridgeUtils;
import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.spring.SpringContextHelper;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.IP;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import org.springframework.core.env.Environment;
import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
import com.google.common.collect.ImmutableMap;
+import inet.ipaddr.IPAddressString;
/**
* This class provides an implementation of {@link HeatBridgeApi}
@@ -109,6 +115,8 @@ public class HeatBridgeImpl implements HeatBridgeApi {
private String tenantId;
private AaiHelper aaiHelper = new AaiHelper();
private CloudIdentity cloudIdentity;
+ private Environment env;
+
public HeatBridgeImpl(AAIResourcesClient resourcesClient, final CloudIdentity cloudIdentity,
@Nonnull final String cloudOwner, @Nonnull final String cloudRegionId, @Nonnull final String regionId,
@@ -124,7 +132,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
this.regionId = regionId;
this.tenantId = tenantId;
this.resourcesClient = resourcesClient;
- this.transaction = resourcesClient.beginSingleTransaction();
+ if (resourcesClient != null)
+ this.transaction = resourcesClient.beginSingleTransaction();
+ if (SpringContextHelper.getAppContext() != null)
+ this.env = SpringContextHelper.getAppContext().getEnvironment();
}
public HeatBridgeImpl() {
@@ -246,26 +257,25 @@ public class HeatBridgeImpl implements HeatBridgeApi {
// Build vserver relationships to: image, flavor, pserver, vf-module
vserver.setRelationshipList(
aaiHelper.getVserverRelationshipList(cloudOwner, cloudRegionId, genericVnfId, vfModuleId, server));
- transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegionId,
- tenantId, vserver.getVserverId()), vserver);
+ transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
+ cloudRegionId, tenantId, vserver.getVserverId()), Optional.of(vserver));
});
}
@Override
public void buildAddVserverLInterfacesToAaiAction(final List<Resource> stackResources,
- final List<String> oobMgtNetIds) {
+ final List<String> oobMgtNetIds, String cloudOwner) {
Objects.requireNonNull(osClient, ERR_MSG_NULL_OS_CLIENT);
List<String> portIds =
extractStackResourceIdsByResourceType(stackResources, HeatBridgeConstants.OS_PORT_RESOURCE_TYPE);
for (String portId : portIds) {
Port port = osClient.getPortById(portId);
+ Network network = osClient.getNetworkById(port.getNetworkId());
LInterface lIf = new LInterface();
lIf.setInterfaceId(port.getId());
lIf.setInterfaceName(port.getName());
lIf.setMacaddr(port.getMacAddress());
- if (port.getProfile() != null && port.getProfile().get("physical_network") != null) {
- lIf.setNetworkName((String) port.getProfile().get("physical_network"));
- }
+ lIf.setNetworkName(network.getName());
lIf.setIsPortMirrored(false);
lIf.setIsIpUnnumbered(false);
lIf.setInMaint(false);
@@ -282,12 +292,16 @@ public class HeatBridgeImpl implements HeatBridgeApi {
}
}
lIf.setL2Multicasting(isL2Multicast);
+
+ transaction.createIfNotExists(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner,
+ cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName()), Optional.of(lIf));
+
updateLInterfaceIps(port, lIf);
- updateLInterfaceVlan(port, lIf);
+ if (cloudOwner.equals(env.getProperty("mso.cloudOwner.included", ""))) {
+ updateLInterfaceVlan(port, lIf);
+ }
- // Update l-interface to the vserver
- transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.L_INTERFACE, cloudOwner, cloudRegionId,
- tenantId, port.getDeviceId(), lIf.getInterfaceName()), lIf);
+ updateSriovPfToPserver(port, lIf);
}
}
@@ -341,38 +355,35 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Vlan vlan = new Vlan();
Network network = osClient.getNetworkById(port.getNetworkId());
if (network.getNetworkType() != null && network.getNetworkType().equals(NetworkType.VLAN)) {
- vlan.setVlanInterface(network.getName() + network.getProviderSegID());
-
+ vlan.setVlanInterface(port.getName() + network.getProviderSegID());
vlan.setVlanIdOuter(Long.parseLong(network.getProviderSegID()));
vlan.setVlanIdInner(0L);
vlan.setInMaint(false);
vlan.setIsIpUnnumbered(false);
vlan.setIsPrivate(false);
- Vlans vlans = new Vlans();
- List<Vlan> vlanList = vlans.getVlan();
- vlanList.add(vlan);
- lIf.setVlans(vlans);
+
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).vlan(vlan.getVlanInterface())),
+ Optional.of(vlan));
}
- // Build sriov-vf to the l-interface
+
if (port.getvNicType() != null && port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
- SriovVfs sriovVfs = new SriovVfs();
- // JAXB does not generate setters for list, however getter ensures its creation.
- // Thus, all list manipulations must be made on live list.
- List<SriovVf> sriovVfList = sriovVfs.getSriovVf();
SriovVf sriovVf = new SriovVf();
sriovVf.setPciId(port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
sriovVf.setNeutronNetworkId(port.getNetworkId());
- if (port.getVifDetails() != null) {
- sriovVf.setVfVlanFilter((String) port.getVifDetails().get(HeatBridgeConstants.OS_VLAN_NETWORK_KEY));
- }
+ sriovVf.setVfVlanFilter("0");
sriovVf.setVfVlanAntiSpoofCheck(false);
sriovVf.setVfMacAntiSpoofCheck(false);
- sriovVfList.add(sriovVf);
-
- lIf.setSriovVfs(sriovVfs);
- // For the given port create sriov-pf for host pserver/p-interface if absent
- updateSriovPfToPserver(port, lIf);
+ transaction
+ .createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).sriovVf(sriovVf.getPciId())),
+ Optional.of(sriovVf));
}
}
@@ -386,63 +397,82 @@ public class HeatBridgeImpl implements HeatBridgeApi {
* @param lIf AAI l-interface object
*/
private void updateSriovPfToPserver(final Port port, final LInterface lIf) {
- if (port.getProfile() == null || Strings
- .isNullOrEmpty(port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString())) {
- logger.debug("The SRIOV port:" + port.getName() + " is missing physical-network-id, cannot update "
- + "sriov-pf object for host pserver: " + port.getHostId());
- return;
- }
- Optional<String> matchingPifName = HeatBridgeUtils.getMatchingPserverPifName(
- port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString());
- if (matchingPifName.isPresent()) {
- // Update l-interface description
- String pserverHostName = port.getHostId();
- lIf.setInterfaceDescription("Attached to SR-IOV port: " + pserverHostName + "::" + matchingPifName.get());
- try {
- Optional<PInterface> matchingPIf = resourcesClient.get(PInterface.class,
- AAIUriFactory
- .createResourceUri(AAIObjectType.P_INTERFACE, pserverHostName, matchingPifName.get())
- .depth(Depth.ONE));
- if (matchingPIf.isPresent()) {
- SriovPfs pIfSriovPfs = matchingPIf.get().getSriovPfs();
- if (pIfSriovPfs == null) {
- pIfSriovPfs = new SriovPfs();
- }
- // Extract PCI-ID from OS port object
- String pfPciId = port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString();
-
- List<SriovPf> existingSriovPfs = pIfSriovPfs.getSriovPf();
- if (CollectionUtils.isEmpty(existingSriovPfs) || existingSriovPfs.stream()
- .noneMatch(existingSriovPf -> existingSriovPf.getPfPciId().equals(pfPciId))) {
- // Add sriov-pf object with PCI-ID to AAI
- SriovPf sriovPf = new SriovPf();
- sriovPf.setPfPciId(pfPciId);
- logger.debug("Queuing AAI command to update sriov-pf object to pserver: " + pserverHostName
- + "/" + matchingPifName.get());
- transaction.create(AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF, pserverHostName,
- matchingPifName.get(), sriovPf.getPfPciId()), sriovPf);
+ if (port.getvNicType().equalsIgnoreCase(HeatBridgeConstants.OS_SRIOV_PORT_TYPE)) {
+ if (port.getProfile() == null || Strings
+ .isNullOrEmpty(port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString())) {
+ logger.debug("The SRIOV port:" + port.getName() + " is missing physical-network-id, cannot update "
+ + "sriov-pf object for host pserver: " + port.getHostId());
+ return;
+ }
+ Optional<String> matchingPifName = HeatBridgeUtils.getMatchingPserverPifName(
+ port.getProfile().get(HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY).toString());
+ if (matchingPifName.isPresent()) {
+ // Update l-interface description
+ String pserverHostName = port.getHostId();
+ lIf.setInterfaceDescription(
+ "Attached to SR-IOV port: " + pserverHostName + "::" + matchingPifName.get());
+ try {
+ Optional<PInterface> matchingPIf = resourcesClient.get(PInterface.class, AAIUriFactory
+ .createResourceUri(AAIObjectType.P_INTERFACE, pserverHostName, matchingPifName.get())
+ .depth(Depth.ONE));
+ if (matchingPIf.isPresent()) {
+ SriovPfs pIfSriovPfs = matchingPIf.get().getSriovPfs();
+ if (pIfSriovPfs == null) {
+ pIfSriovPfs = new SriovPfs();
+ }
+ // Extract PCI-ID from OS port object
+ String pfPciId = port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString();
+
+ List<SriovPf> existingSriovPfs = pIfSriovPfs.getSriovPf();
+ if (CollectionUtils.isEmpty(existingSriovPfs) || existingSriovPfs.stream()
+ .noneMatch(existingSriovPf -> existingSriovPf.getPfPciId().equals(pfPciId))) {
+ // Add sriov-pf object with PCI-ID to AAI
+ SriovPf sriovPf = new SriovPf();
+ sriovPf.setPfPciId(pfPciId);
+ logger.debug("Queuing AAI command to update sriov-pf object to pserver: " + pserverHostName
+ + "/" + matchingPifName.get());
+
+ AAIResourceUri sriovPfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
+ pserverHostName, matchingPifName.get(), sriovPf.getPfPciId());
+
+ if (!resourcesClient.exists(sriovPfUri)) {
+ transaction.create(sriovPfUri, sriovPf);
+
+ AAIResourceUri sriovVfUri = AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_VF,
+ cloudOwner, cloudRegionId, tenantId, port.getDeviceId(), lIf.getInterfaceName(),
+ port.getProfile().get(HeatBridgeConstants.OS_PCI_SLOT_KEY).toString());
+
+ transaction.connect(sriovPfUri, sriovVfUri);
+ }
+ }
}
+ } catch (WebApplicationException e) {
+ // Silently log that we failed to update the Pserver p-interface with PCI-ID
+ logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName,
+ matchingPifName.get(), cloudOwner, tenantId, "OpenStack", "Heatbridge",
+ ErrorCode.DataError.getValue(), "Exception - Failed to add sriov-pf object to pserver", e);
}
- } catch (WebApplicationException e) {
- // Silently log that we failed to update the Pserver p-interface with PCI-ID
- logger.error(LoggingAnchor.NINE, MessageEnum.GENERAL_EXCEPTION, pserverHostName, matchingPifName.get(),
- cloudOwner, tenantId, "OpenStack", "Heatbridge", ErrorCode.DataError.getValue(),
- "Exception - Failed to add sriov-pf object to pserver", e);
}
}
}
private void updateLInterfaceIps(final Port port, final LInterface lIf) {
- List<L3InterfaceIpv4AddressList> lInterfaceIps = lIf.getL3InterfaceIpv4AddressList();
for (IP ip : port.getFixedIps()) {
String ipAddress = ip.getIpAddress();
if (InetAddressValidator.getInstance().isValidInet4Address(ipAddress)) {
+ Subnet subnet = osClient.getSubnetById(ip.getSubnetId());
+ IPAddressString cidr = new IPAddressString(subnet.getCidr());
L3InterfaceIpv4AddressList lInterfaceIp = new L3InterfaceIpv4AddressList();
lInterfaceIp.setL3InterfaceIpv4Address(ipAddress);
lInterfaceIp.setNeutronNetworkId(port.getNetworkId());
lInterfaceIp.setNeutronSubnetId(ip.getSubnetId());
- lInterfaceIp.setL3InterfaceIpv4PrefixLength(32L);
- lInterfaceIps.add(lInterfaceIp);
+ lInterfaceIp.setL3InterfaceIpv4PrefixLength(Long.parseLong(cidr.getNetworkPrefixLength().toString()));
+
+ transaction.createIfNotExists(
+ AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.cloudInfrastructure()
+ .cloudRegion(cloudOwner, cloudRegionId).tenant(tenantId).vserver(port.getDeviceId())
+ .lInterface(lIf.getInterfaceName()).l3InterfaceIpv4AddressList(ipAddress)),
+ Optional.of(lInterfaceIp));
}
}
}
@@ -464,27 +494,34 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Objects.requireNonNull(vnfId, "Null vnf-id!");
Objects.requireNonNull(vfModuleId, "Null vf-module-id!");
try {
- Optional<VfModule> vfModule = resourcesClient.get(VfModule.class,
- AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE));
- logger.debug("vfModule is present: {}", vfModule.isPresent());
- if (vfModule.isPresent()) {
-
- AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule.get());
- Optional<Relationships> relationships = resultWrapper.getRelationships();
- logger.debug("relationships is present: {}", relationships.isPresent());
- if (relationships.isPresent()) {
- List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(AAIObjectType.VSERVER);
- logger.debug("vserverList isEmpty: {}", vserverUris.isEmpty());
- createTransactionToDeleteSriovPfFromPserver(vserverUris);
-
- if (!vserverUris.isEmpty()) {
- for (AAIResourceUri vserverUri : vserverUris) {
- logger.debug("Deleting Vservers: {}", vserverUri.toString());
+ Optional<VfModule> vfModule = resourcesClient
+ .get(AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId).depth(Depth.ONE),
+ NotFoundException.class)
+ .asBean(VfModule.class);
+
+ AAIResultWrapper resultWrapper = new AAIResultWrapper(vfModule.get());
+ Optional<Relationships> relationships = resultWrapper.getRelationships();
+ logger.debug("VfModule contains relationships in AAI: {}", relationships.isPresent());
+ if (relationships.isPresent()) {
+ List<AAIResourceUri> vserverUris = relationships.get().getRelatedUris(AAIObjectType.VSERVER);
+ logger.debug("VServer contains {} relationships in AAI", vserverUris.size());
+ createTransactionToDeleteSriovPfFromPserver(vserverUris);
+
+ if (!vserverUris.isEmpty()) {
+ for (AAIResourceUri vserverUri : vserverUris) {
+ if (env.getProperty("heatBridgeDryrun", Boolean.class, true)) {
+ logger.debug("Would delete Vserver: {}", vserverUri.build().toString());
+ } else {
resourcesClient.delete(vserverUri);
}
}
}
}
+
+ } catch (NotFoundException e) {
+ String msg = "Failed to commit delete heatbridge data transaction";
+ logger.debug(msg + " with error: " + e);
+ throw new HeatBridgeException(msg, e);
} catch (Exception e) {
String msg = "Failed to commit delete heatbridge data transaction";
logger.debug(msg + " with error: " + e);
@@ -507,8 +544,16 @@ public class HeatBridgeImpl implements HeatBridgeApi {
if (pciIds.contains(sriovPf.getPfPciId())) {
logger.debug("creating transaction to delete SR-IOV PF: " + pIf.getInterfaceName()
+ " from PServer: " + pserverName);
- resourcesClient.delete(AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
- pserverName, pIf.getInterfaceName(), sriovPf.getPfPciId()));
+ if (env.getProperty("heatBridgeDryrun", Boolean.class, true)) {
+ logger.debug("Would delete Sriov Pf: {}",
+ AAIUriFactory
+ .createResourceUri(AAIObjectType.SRIOV_PF, pserverName,
+ pIf.getInterfaceName(), sriovPf.getPfPciId())
+ .build().toString());
+ } else {
+ resourcesClient.delete(AAIUriFactory.createResourceUri(AAIObjectType.SRIOV_PF,
+ pserverName, pIf.getInterfaceName(), sriovPf.getPfPciId()));
+ }
}
}));
}
@@ -525,9 +570,10 @@ public class HeatBridgeImpl implements HeatBridgeApi {
Vserver vserver = vserverWrapper.asBean(Vserver.class).get();
List<String> pciIds = HeatBridgeUtils.extractPciIdsFromVServer(vserver);
if (CollectionUtils.isNotEmpty(pciIds)) {
- List<String> matchingPservers = vserverRelationships.get().getRelatedLinks(AAIObjectType.PSERVER);
+ List<AAIResourceUri> matchingPservers =
+ vserverRelationships.get().getRelatedUris(AAIObjectType.PSERVER);
if (matchingPservers != null && matchingPservers.size() == 1) {
- pserverToPciIdMap.put(matchingPservers.get(0), pciIds);
+ pserverToPciIdMap.put(matchingPservers.get(0).getURIKeys().get("hostname"), pciIds);
}
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 6817be8c49..c4d9cbe871 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -145,7 +145,6 @@ public class AaiHelper {
vserver.setVserverId(serverId);
vserver.setVserverName(server.getName());
vserver.setVserverName2(server.getName());
- vserver.setProvStatus(server.getStatus().value());
server.getLinks().stream().filter(link -> link.getRel().equals(HeatBridgeConstants.OS_RESOURCES_SELF_LINK_KEY))
.findFirst().ifPresent(link -> vserver.setVserverSelflink(link.getHref()));
return vserver;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
index 7184ec1e93..8d47ff4ceb 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClient.java
@@ -42,6 +42,7 @@ import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
public interface OpenstackClient {
@@ -92,4 +93,12 @@ public interface OpenstackClient {
* @return List of filtered Network objects
*/
List<Network> listNetworksByFilter(Map<String, String> filterParams);
+
+ /**
+ * Get a subnet object by subnet ID
+ *
+ * @param subnetId Unique UUID of the subnet.
+ * @return Subnet object.
+ */
+ Subnet getSubnetById(String subnetId);
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
index 5a2b0732dc..1505203d7c 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/openstack/api/OpenstackClientImpl.java
@@ -45,6 +45,7 @@ import org.openstack4j.model.compute.Server;
import org.openstack4j.model.heat.Resource;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.Port;
+import org.openstack4j.model.network.Subnet;
abstract class OpenstackClientImpl implements OpenstackClient {
@Override
@@ -78,6 +79,11 @@ abstract class OpenstackClientImpl implements OpenstackClient {
return (List<Network>) getClient().networking().network().list(filterParams);
}
+ @Override
+ public Subnet getSubnetById(String subnetId) {
+ return getClient().networking().subnet().get(subnetId);
+ }
+
/**
* Retrieves the specific client to utilize.
*
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-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
index 464a17d2a5..643dd4cd9a 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/heatbridge/HeatBridgeImplTest.java
@@ -42,15 +42,18 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
+import static org.mockito.Mockito.doReturn;
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
+import java.util.Set;
import org.apache.commons.io.FileUtils;
import org.junit.Assert;
import org.junit.Before;
@@ -58,12 +61,13 @@ import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentCaptor;
+import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.PInterface;
import org.onap.aai.domain.yang.SriovPf;
-import org.onap.aai.domain.yang.Vserver;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.AAISingleTransactionClient;
@@ -80,11 +84,13 @@ import org.openstack4j.model.compute.Image;
import org.openstack4j.model.compute.Server;
import org.openstack4j.model.compute.Server.Status;
import org.openstack4j.model.heat.Resource;
+import org.openstack4j.model.network.IP;
import org.openstack4j.model.network.Network;
import org.openstack4j.model.network.NetworkType;
import org.openstack4j.model.network.Port;
import org.openstack4j.openstack.heat.domain.HeatResource;
import org.openstack4j.openstack.heat.domain.HeatResource.Resources;
+import org.springframework.core.env.Environment;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableMap;
@@ -104,16 +110,20 @@ public class HeatBridgeImplTest {
@Mock
private AAIResourcesClient resourcesClient;
+
@Mock
private AAISingleTransactionClient transaction;
- private HeatBridgeImpl heatbridge;
+ @Mock
+ private Environment env;
+
+ @InjectMocks
+ private HeatBridgeImpl heatbridge =
+ new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID);
@Before
public void setUp() throws HeatBridgeException, OpenstackClientException, BulkProcessFailed {
-
when(resourcesClient.beginSingleTransaction()).thenReturn(transaction);
- heatbridge = new HeatBridgeImpl(resourcesClient, cloudIdentity, CLOUD_OWNER, REGION_ID, REGION_ID, TENANT_ID);
}
@Ignore
@@ -252,7 +262,7 @@ public class HeatBridgeImplTest {
// Assert
ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
- verify(transaction, times(2)).create(captor.capture(), any(Vserver.class));
+ verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
List<AAIResourceUri> uris = captor.getAllValues();
assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
@@ -296,7 +306,7 @@ public class HeatBridgeImplTest {
// Assert
ArgumentCaptor<AAIResourceUri> captor = ArgumentCaptor.forClass(AAIResourceUri.class);
- verify(transaction, times(2)).create(captor.capture(), any(Vserver.class));
+ verify(transaction, times(2)).createIfNotExists(captor.capture(), any(Optional.class));
List<AAIResourceUri> uris = captor.getAllValues();
assertEquals(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, CLOUD_OWNER, REGION_ID, TENANT_ID,
@@ -396,7 +406,6 @@ public class HeatBridgeImplTest {
verify(transaction, times(2)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
}
- @Ignore
@Test
public void testUpdateVserverLInterfacesToAai() throws HeatBridgeException {
// Arrange
@@ -408,7 +417,6 @@ public class HeatBridgeImplTest {
when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a");
when(port.getDeviceId()).thenReturn("test-device-id");
- when(port.getVifDetails()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_VLAN_NETWORK_KEY, "2345"));
String pfPciId = "0000:08:00.0";
when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
@@ -430,12 +438,55 @@ public class HeatBridgeImplTest {
PInterface pIf = mock(PInterface.class);
when(pIf.getInterfaceName()).thenReturn("test-port-id");
when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+ when(env.getProperty("mso.cloudOwner.included", "")).thenReturn("CloudOwner");
// Act
- heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"));
+ heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
// Assert
- verify(transaction, times(5)).create(any(AAIResourceUri.class), any(LInterface.class));
+ verify(transaction, times(15)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
+ verify(osClient, times(5)).getPortById(anyString());
+ verify(osClient, times(10)).getNetworkById(anyString());
+ }
+
+ @Test
+ public void testUpdateVserverLInterfacesToAai_skipVlans() throws HeatBridgeException {
+ // Arrange
+ List<Resource> stackResources = (List<Resource>) extractTestStackResources();
+ Port port = mock(Port.class);
+ when(port.getId()).thenReturn("test-port-id");
+ when(port.getName()).thenReturn("test-port-name");
+ when(port.getvNicType()).thenReturn(HeatBridgeConstants.OS_SRIOV_PORT_TYPE);
+ when(port.getMacAddress()).thenReturn("78:4f:43:68:e2:78");
+ when(port.getNetworkId()).thenReturn("890a203a-23gg-56jh-df67-731656a8f13a");
+ when(port.getDeviceId()).thenReturn("test-device-id");
+ String pfPciId = "0000:08:00.0";
+ when(port.getProfile()).thenReturn(ImmutableMap.of(HeatBridgeConstants.OS_PCI_SLOT_KEY, pfPciId,
+ HeatBridgeConstants.OS_PHYSICAL_NETWORK_KEY, "physical_network_id"));
+
+ Network network = mock(Network.class);
+ when(network.getId()).thenReturn("test-network-id");
+ when(network.getNetworkType()).thenReturn(NetworkType.VLAN);
+ when(network.getProviderSegID()).thenReturn("2345");
+
+ when(osClient.getPortById("212a203a-9764-4f42-84ea-731536a8f13a")).thenReturn(port);
+ when(osClient.getPortById("387e3904-8948-43d1-8635-b6c2042b54da")).thenReturn(port);
+ when(osClient.getPortById("70a09dfd-f1c5-4bc8-bd8f-dc539b8d662a")).thenReturn(port);
+ when(osClient.getPortById("12f88b4d-c8a4-4fbd-bcb4-7e36af02430b")).thenReturn(port);
+ when(osClient.getPortById("c54b9f45-b413-4937-bbe4-3c8a5689cfc9")).thenReturn(port);
+ when(osClient.getNetworkById(anyString())).thenReturn(network);
+
+ SriovPf sriovPf = new SriovPf();
+ sriovPf.setPfPciId(pfPciId);
+ PInterface pIf = mock(PInterface.class);
+ when(pIf.getInterfaceName()).thenReturn("test-port-id");
+ when(resourcesClient.get(eq(PInterface.class), any(AAIResourceUri.class))).thenReturn(Optional.of(pIf));
+
+ // Act
+ heatbridge.buildAddVserverLInterfacesToAaiAction(stackResources, Arrays.asList("1", "2"), "CloudOwner");
+
+ // Assert
+ verify(transaction, times(5)).createIfNotExists(any(AAIResourceUri.class), any(Optional.class));
verify(osClient, times(5)).getPortById(anyString());
verify(osClient, times(5)).getNetworkById(anyString());
}
@@ -463,4 +514,6 @@ public class HeatBridgeImplTest {
}
return content;
}
+
+
}
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 42955c35c9..ac45f85711 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -64,8 +64,6 @@ mso:
adapters:
requestDb:
endpoint: http://localhost:${wiremock.server.port}
- audit:
- lock-time: 240000
logPath: logs
msb-ip: localhost
msb-port: ${wiremock.server.port}
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/adapters/pom.xml b/adapters/pom.xml
index 9e703b9dab..56d4328577 100644
--- a/adapters/pom.xml
+++ b/adapters/pom.xml
@@ -22,7 +22,6 @@
<module>mso-vfc-adapter</module>
<module>mso-openstack-adapters</module>
<module>etsi-sol003-adapter</module>
- <module>etsi-sol002-adapter</module>
<module>mso-nssmf-adapter</module>
<module>so-appc-orchestrator</module>
</modules>
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
index 20093be6a4..1da6fc096f 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/client/ApplicationControllerClient.java
@@ -52,7 +52,6 @@ import org.onap.appc.client.lcm.model.ZULU;
@Component
public class ApplicationControllerClient {
-
@Autowired
public Environment env;
@@ -117,6 +116,7 @@ public class ApplicationControllerClient {
controllerType = DEFAULT_CONTROLLER_TYPE;
}
controllerType = controllerType.toUpperCase();
+
return AppcClientServiceFactoryProvider.getFactory(AppcLifeCycleManagerServiceFactory.class)
.createLifeCycleManagerStateful(new ApplicationContext(), getLCMProperties(controllerType));
} catch (AppcClientException e) {
@@ -128,7 +128,7 @@ public class ApplicationControllerClient {
}
public Status vnfCommand(Action action, String requestId, String vnfId, Optional<String> vserverId,
- Optional<String> request, String controllerType, ApplicationControllerCallback listener)
+ Optional<String> request, String controllerType, ApplicationControllerCallback listener, String requestorId)
throws ApplicationControllerOrchestratorException {
this.setControllerType(controllerType);
Status status;
@@ -142,7 +142,7 @@ public class ApplicationControllerClient {
payload = new Payload(request.get());
}
- status = runCommand(action, actionIdentifiers, payload, requestId, listener);
+ status = runCommand(action, actionIdentifiers, payload, requestId, listener, requestorId);
if (appCSupport.getCategoryOf(status).equals(StatusCategory.ERROR)) {
throw new ApplicationControllerOrchestratorException(status.getMessage(), status.getCode());
} else {
@@ -152,11 +152,11 @@ public class ApplicationControllerClient {
public Status runCommand(Action action, org.onap.appc.client.lcm.model.ActionIdentifiers actionIdentifiers,
- org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener)
- throws ApplicationControllerOrchestratorException {
+ org.onap.appc.client.lcm.model.Payload payload, String requestID, ApplicationControllerCallback listener,
+ String requestorId) throws ApplicationControllerOrchestratorException {
Status status;
Object requestObject;
- requestObject = createRequest(action, actionIdentifiers, payload, requestID);
+ requestObject = createRequest(action, actionIdentifiers, payload, requestID, requestorId);
appCSupport.logLCMMessage(requestObject);
LifeCycleManagerStateful client = getAppCClient();
Method lcmMethod = appCSupport.getAPIMethod(action.name(), client, true);
@@ -194,12 +194,13 @@ public class ApplicationControllerClient {
return properties;
}
- public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId) {
+ public Object createRequest(Action action, ActionIdentifiers identifier, Payload payload, String requestId,
+ String requestorId) {
Object requestObject = appCSupport.getInput(action.name());
try {
- CommonHeader commonHeader = buildCommonHeader(requestId);
+ CommonHeader commonHeader = buildCommonHeader(requestId, requestorId);
requestObject.getClass().getDeclaredMethod("setCommonHeader", CommonHeader.class).invoke(requestObject,
commonHeader);
requestObject.getClass().getDeclaredMethod("setAction", Action.class).invoke(requestObject, action);
@@ -215,12 +216,13 @@ public class ApplicationControllerClient {
return requestObject;
}
- private CommonHeader buildCommonHeader(String requestId) {
+ private CommonHeader buildCommonHeader(String requestId, String requestorId) {
CommonHeader commonHeader = new CommonHeader();
commonHeader.setApiVer(API_VER);
commonHeader.setOriginatorId(ORIGINATOR_ID);
commonHeader.setRequestId(requestId == null ? UUID.randomUUID().toString() : requestId);
commonHeader.setSubRequestId(UUID.randomUUID().toString());
+ commonHeader.setXOnapRequestorid(requestorId);
Flags flags = new Flags();
String flagsMode = "NORMAL";
Mode mode = Mode.valueOf(flagsMode);
diff --git a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
index 8e38935441..e61053d043 100644
--- a/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
+++ b/adapters/so-appc-orchestrator/src/main/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImpl.java
@@ -111,7 +111,7 @@ public class ApplicationControllerTaskImpl {
status = appcClient.vnfCommand(request.getAction(), msoRequestId,
request.getApplicationControllerVnf().getVnfId(), vserverId, payload, request.getControllerType(),
- listener);
+ listener, request.getRequestorId());
return status;
}
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
index 82b0695ed9..cac8e9e16a 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplITTest.java
@@ -63,6 +63,7 @@ public class ApplicationControllerTaskImplITTest {
@Before
public void setup() {
request = new ApplicationControllerTaskRequest();
+ request.setRequestorId("testRequestorId");
request.setBookName("testBookName");
request.setControllerType("testControllerType");
request.setFileParameters("testFileParams");
diff --git a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
index ff979acf7b..fe2b4f84b5 100644
--- a/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
+++ b/adapters/so-appc-orchestrator/src/test/java/org/onap/so/adapters/appc/orchestrator/service/ApplicationControllerTaskImplTest.java
@@ -52,6 +52,7 @@ public class ApplicationControllerTaskImplTest {
request.setNewSoftwareVersion("2.0");
request.setExistingSoftwareVersion("1.0");
request.setOperationsTimeout("30");
+ request.setRequestorId("testRequestorId");
Map<String, String> reqConfigParams = new HashMap<>();
reqConfigParams.put("name1", "value1");
reqConfigParams.put("name2", "value2");
@@ -77,13 +78,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(Action.HealthCheck, "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@@ -99,13 +100,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -118,13 +119,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -133,13 +134,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener)).thenReturn(new Status());
+ "testControllerType", listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), Optional.empty(),
- "testControllerType", listener);
+ "testControllerType", listener, "testRequestorId");
}
@Test
@@ -154,13 +155,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -179,13 +180,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -204,13 +205,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -224,13 +225,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
@@ -251,13 +252,13 @@ public class ApplicationControllerTaskImplTest {
Mockito.when(applicationControllerClient.vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener)).thenReturn(new Status());
+ listener, "testRequestorId")).thenReturn(new Status());
Status status = applicationControllerTaskImpl.execute("testRequestId", request, listener);
Mockito.verify(applicationControllerClient).vnfCommand(request.getAction(), "testRequestId",
request.getApplicationControllerVnf().getVnfId(), Optional.empty(), payload, "testControllerType",
- listener);
+ listener, "testRequestorId");
}
@Test
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index c395b01221..0c61cc3012 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -182,7 +182,7 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.9.3</version>
+ <version>1.9.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</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..e45811117c 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,36 +21,49 @@
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;
private Boolean homing = false;
+ private String oldVolumeGroupName;
private static final long serialVersionUID = 3L;
public BuildingBlock getBuildingBlock() {
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;
}
+ public String getOldVolumeGroupName() {
+ return oldVolumeGroupName;
+ }
+
+ public ExecuteBuildingBlock setOldVolumeGroupName(String oldVolumeGroupName) {
+ this.oldVolumeGroupName = oldVolumeGroupName;
+ 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..e65e1a8471 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
@@ -62,6 +62,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
@@ -750,6 +751,10 @@ public class BBInputSetup implements JavaDelegate {
parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
vnf.getVolumeGroups().add(volumeGroup);
if (parameter.getIsReplace()) {
+ if (parameter.getExecuteBB().getOldVolumeGroupName() != null
+ && !parameter.getExecuteBB().getOldVolumeGroupName().isEmpty()) {
+ volumeGroup.setVolumeGroupName(parameter.getExecuteBB().getOldVolumeGroupName());
+ }
mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(),
parameter.getServiceModel().getNewService(), replaceVnfModelCustomizationUUID);
} else {
@@ -1699,20 +1704,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 +1715,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,17 +1845,17 @@ 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());
this.mapGenericVnfs(relationships.getRelatedAAIUris(AAIObjectType.GENERIC_VNF), serviceInstance.getVnfs());
+ this.mapPnfs(relationships.getRelatedAAIUris(AAIObjectType.PNF), serviceInstance.getPnfs());
this.mapCollection(relationships.getByType(AAIObjectType.COLLECTION), serviceInstance);
this.mapConfigurations(relationships.getRelatedAAIUris(AAIObjectType.CONFIGURATION),
serviceInstance.getConfigurations());
@@ -1895,6 +1907,19 @@ public class BBInputSetup implements JavaDelegate {
return genericVnf;
}
+ protected void mapPnfs(List<AAIResourceUri> list, List<Pnf> pnfs) {
+ for (AAIResourceUri aaiResourceUri : list) {
+ pnfs.add(this.mapPnf(aaiResourceUri));
+ }
+ }
+
+ protected Pnf mapPnf(AAIResourceUri aaiResourceUri) {
+ AAIResultWrapper aaiPnfWrapper = this.bbInputSetupUtils.getAAIResourceDepthOne(aaiResourceUri);
+ Optional<org.onap.aai.domain.yang.Pnf> aaiPnfWrapperOp =
+ aaiPnfWrapper.asBean(org.onap.aai.domain.yang.Pnf.class);
+ return aaiPnfWrapperOp.map(pnf -> this.mapperLayer.mapAAIPnfIntoPnf(pnf)).orElse(null);
+ }
+
protected List<InstanceGroup> mapInstanceGroups(List<AAIResultWrapper> instanceGroups) {
List<InstanceGroup> instanceGroupsList = new ArrayList<>();
for (AAIResultWrapper volumeGroupWrapper : instanceGroups) {
@@ -1945,14 +1970,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 +1982,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 +1994,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 +2099,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 +2111,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/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index 67d073d7b6..2bb383e4ec 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -52,6 +52,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Tenant;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Vnfc;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -323,6 +324,10 @@ public class BBInputSetupMapperLayer {
return genericVnf;
}
+ protected Pnf mapAAIPnfIntoPnf(org.onap.aai.domain.yang.Pnf aaiPnf) {
+ return modelMapper.map(aaiPnf, Pnf.class);
+ }
+
protected void mapAllLicensesIntoGenericVnf(org.onap.aai.domain.yang.GenericVnf aaiGenericVnf,
GenericVnf genericVnf) {
if (aaiGenericVnf.getLicenses() != null) {
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/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index 5a52e3a49d..4206596c94 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
handlingCode = "Abort";
} else {
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
serviceType = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceType();
}
@@ -119,7 +119,7 @@ public class ExecuteBuildingBlockRainyDay {
String vnfType = ASTERISK;
String vnfName = ASTERISK;
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
for (GenericVnf vnf : gBBInput.getCustomer().getServiceSubscription().getServiceInstances()
.get(0).getVnfs()) {
if (vnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
@@ -173,7 +173,7 @@ public class ExecuteBuildingBlockRainyDay {
String serviceRole = ASTERISK;
try {
- if (gBBInput.getCustomer().getServiceSubscription() != null) {
+ if (gBBInput.getCustomer() != null && gBBInput.getCustomer().getServiceSubscription() != null) {
serviceRole = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0)
.getModelInfoServiceInstance().getServiceRole();
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
index 13d2b7d3d3..4755e58582 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
@@ -39,6 +39,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
@@ -75,7 +76,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
-import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -422,6 +422,17 @@ public class BBInputSetupMapperLayerTest {
}
@Test
+ public void testMapAAIPnfIntoPnf() throws IOException {
+ Pnf expected = mapper.readValue(new File(RESOURCE_PATH + "PnfExpected.json"), Pnf.class);
+ org.onap.aai.domain.yang.Pnf aaiPnf =
+ mapper.readValue(new File(RESOURCE_PATH + "aaiPnfInput.json"), org.onap.aai.domain.yang.Pnf.class);
+
+ Pnf actual = bbInputSetupMapperLayer.mapAAIPnfIntoPnf(aaiPnf);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
public void testMapAAICollectionIntoCollection() throws JsonParseException, JsonMappingException, IOException {
org.onap.aai.domain.yang.Collection aaiCollection = mapper
.readValue(new File(RESOURCE_PATH + "CollectionInput.json"), org.onap.aai.domain.yang.Collection.class);
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..dd79d2772f 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
@@ -69,6 +69,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.LineOfBusiness;
@@ -308,9 +309,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 +322,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 +350,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 +816,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 +1024,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");
@@ -1800,6 +1816,29 @@ public class BBInputSetupTest {
}
@Test
+ public void testMapPnfs() throws JsonProcessingException {
+ org.onap.aai.domain.yang.Pnf expectedAAI = new org.onap.aai.domain.yang.Pnf();
+ org.onap.aai.domain.yang.RelationshipList relationshipList = new org.onap.aai.domain.yang.RelationshipList();
+ org.onap.aai.domain.yang.Relationship relationship = new org.onap.aai.domain.yang.Relationship();
+ relationshipList.getRelationship().add(relationship);
+ expectedAAI.setRelationshipList(relationshipList);
+
+ Pnf expected = new Pnf();
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.PNF, "pnfId");
+ AAIResultWrapper pnfWrapper =
+ new AAIResultWrapper(new AAICommonObjectMapperProvider().getMapper().writeValueAsString(expectedAAI));
+
+ doReturn(pnfWrapper).when(SPY_bbInputSetupUtils).getAAIResourceDepthOne(aaiResourceUri);
+ doReturn(expected).when(bbInputSetupMapperLayer).mapAAIPnfIntoPnf(isA(org.onap.aai.domain.yang.Pnf.class));
+
+ List<Pnf> pnfs = new ArrayList<>();
+
+ SPY_bbInputSetup.mapPnfs(Arrays.asList(aaiResourceUri), pnfs);
+
+ assertEquals(expected, pnfs.get(0));
+ }
+
+ @Test
public void testMapVolumeGroups() throws JsonProcessingException {
org.onap.aai.domain.yang.VolumeGroup expectedAAI = new org.onap.aai.domain.yang.VolumeGroup();
@@ -2055,8 +2094,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 +2274,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 +2343,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 +2388,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 +2434,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 +2506,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 +2557,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 +2609,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 +2665,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 +2725,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 +2786,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 +2852,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 +2920,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/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json
new file mode 100644
index 0000000000..460f72aa31
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/PnfExpected.json
@@ -0,0 +1,8 @@
+{
+ "pnf-id":"pnfId",
+ "pnf-name":"pnfName",
+ "nf-role":"gNB",
+ "orchestration-status":"INVENTORIED",
+ "cloud-region":null,
+ "model-info-pnf":null
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json
new file mode 100644
index 0000000000..da0039c923
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/aaiPnfInput.json
@@ -0,0 +1,38 @@
+{
+ "pnfName":"pnfName",
+ "pnfName2":null,
+ "selflink":null,
+ "pnfName2Source":null,
+ "pnfId":"pnfId",
+ "nfNamingCode":null,
+ "equipType":null,
+ "equipVendor":null,
+ "equipModel":null,
+ "managementOption":null,
+ "orchestrationStatus":"INVENTORIED",
+ "ipaddressV4Oam":null,
+ "swVersion":null,
+ "inMaint":null,
+ "frameId":null,
+ "serialNumber":null,
+ "ipaddressV4Loopback0":null,
+ "ipaddressV6Loopback0":null,
+ "ipaddressV4Aim":null,
+ "ipaddressV6Aim":null,
+ "ipaddressV6Oam":null,
+ "invStatus":null,
+ "resourceVersion":null,
+ "provStatus":null,
+ "nfRole":"gNB",
+ "adminStatus":null,
+ "operationalStatus":null,
+ "modelCustomizationId":null,
+ "modelInvariantId":null,
+ "modelVersionId":null,
+ "pnfIpv4Address":null,
+ "pnfIpv6Address":null,
+ "softwareVersions":null,
+ "relationshipList":null,
+ "lagInterfaces":null,
+ "vrfs":null
+} \ No newline at end of file
diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml
index 0df49c103a..9c9a7f9257 100644
--- a/bpmn/mso-infrastructure-bpmn/pom.xml
+++ b/bpmn/mso-infrastructure-bpmn/pom.xml
@@ -342,6 +342,10 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
</dependencies>
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
index fd7498f468..58d0c6d374 100644
--- 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
@@ -52,6 +52,7 @@ public class AutoProcessInstanceMigrationService {
}
protected List<ProcessDefinition> getProcessDefinitions() {
+
List<ProcessDefinition> processDefinitions = new ArrayList<ProcessDefinition>();
processDefinitionKeys = env.getProperty("migration.processDefinitionKeys", List.class, new ArrayList<String>());
for (String key : processDefinitionKeys) {
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
index 4fb63651eb..2d41eb4e26 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
@@ -45,6 +45,7 @@ import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.springframework.core.env.Environment;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -68,6 +69,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
private static final WorkflowContextHolder contextHolder = WorkflowContextHolder.getInstance();
long workflowPollInterval = 1000;
+ private static final String ASYNC_WAIT_TIME = "mso.workflow.async.waitTime";
@Autowired
private WorkflowProcessor processor;
@@ -75,6 +77,9 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
@Autowired
private WorkflowContextHolder workflowContext;
+ @Autowired
+ private Environment env;
+
public void setProcessor(WorkflowProcessor processor) {
this.processor = processor;
}
@@ -119,7 +124,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
protected WorkflowResponse waitForResponse(Map<String, Object> inputVariables) throws Exception {
String requestId = getRequestId(inputVariables);
long currentWaitTime = 0;
- long waitTime = getWaitTime(inputVariables);
+ long waitTime = getWaitTime();
logger.debug("WorkflowAsyncResource.waitForResponse using timeout: " + waitTime);
while (waitTime > currentWaitTime) {
Thread.sleep(workflowPollInterval);
@@ -185,18 +190,8 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
* @param inputVariables
* @return
*/
- private long getWaitTime(Map<String, Object> inputVariables) {
- String timeout = inputVariables.get("mso-service-request-timeout") == null ? null
- : inputVariables.get("mso-service-request-timeout").toString();
-
- if (timeout != null) {
- try {
- return Long.parseLong(timeout) * 1000;
- } catch (NumberFormatException nex) {
- logger.debug("Invalid input for mso-service-request-timeout");
- }
- }
- return DEFAULT_WAIT_TIME;
+ private long getWaitTime() {
+ return env.getProperty(ASYNC_WAIT_TIME, Long.class, new Long(DEFAULT_WAIT_TIME));
}
}
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
index 77b3535ce1..36e828448d 100644
--- 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
@@ -83,6 +83,7 @@ public class AutoProcessInstanceMigrationServiceTest {
defList.add(newDef);
defList.add(suspendedDef);
+
doReturn(query).when(repositoryService).createProcessDefinitionQuery();
doReturn(query).when(query).processDefinitionKey("test");
doReturn(defList).when(query).list();
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn
new file mode 100644
index 0000000000..f01f81073b
--- /dev/null
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeactivatePnfBB.bpmn
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_1a52v2f" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+ <bpmn:collaboration id="Collaboration_0go8wi3">
+ <bpmn:participant id="Participant_1dwc5st" name="SO&#10;Deactivate PNF" processRef="DeactivatePnfBB" />
+ <bpmn:participant id="Participant_0gycee4" name="AAI" />
+ <bpmn:messageFlow id="MessageFlow_0xh6bkn" sourceRef="UpdatePnfOrchestrationStatusToInventoried" targetRef="Participant_0gycee4" />
+ </bpmn:collaboration>
+ <bpmn:process id="DeactivatePnfBB" name="DeactivatePnfBB" isExecutable="true">
+ <bpmn:sequenceFlow id="SequenceFlow_0l6rtzy" sourceRef="UpdatePnfOrchestrationStatusToInventoried" targetRef="PnfInventoried" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fu9o4x" sourceRef="DeactivatePnf_StartEvent" targetRef="UpdatePnfOrchestrationStatusToInventoried" />
+ <bpmn:endEvent id="PnfInventoried" name="Pnf Inventoried">
+ <bpmn:incoming>SequenceFlow_0l6rtzy</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:serviceTask id="UpdatePnfOrchestrationStatusToInventoried" name="Update Pnf Orchestration Status to Inventoried" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusInventoriedPnf(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1fu9o4x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0l6rtzy</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:startEvent id="DeactivatePnf_StartEvent">
+ <bpmn:outgoing>SequenceFlow_1fu9o4x</bpmn:outgoing>
+ </bpmn:startEvent>
+ </bpmn:process>
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0go8wi3">
+ <bpmndi:BPMNShape id="Participant_1dwc5st_di" bpmnElement="Participant_1dwc5st" isHorizontal="true">
+ <dc:Bounds x="160" y="80" width="646" height="391" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1fu9o4x_di" bpmnElement="SequenceFlow_1fu9o4x">
+ <di:waypoint x="255" y="287" />
+ <di:waypoint x="461" y="287" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0l6rtzy_di" bpmnElement="SequenceFlow_0l6rtzy">
+ <di:waypoint x="561" y="287" />
+ <di:waypoint x="722" y="287" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_1wfgsdz_di" bpmnElement="PnfInventoried">
+ <dc:Bounds x="722" y="269" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="705" y="312" width="74" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_1ix8822_di" bpmnElement="UpdatePnfOrchestrationStatusToInventoried">
+ <dc:Bounds x="461" y="247" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="StartEvent_1g3euow_di" bpmnElement="DeactivatePnf_StartEvent">
+ <dc:Bounds x="219" y="269" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="Participant_0gycee4_di" bpmnElement="Participant_0gycee4" isHorizontal="true">
+ <dc:Bounds x="260" y="567" width="502" height="60" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="MessageFlow_0xh6bkn_di" bpmnElement="MessageFlow_0xh6bkn">
+ <di:waypoint x="511" y="327" />
+ <di:waypoint x="511" y="567" />
+ </bpmndi:BPMNEdge>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
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-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/GenericPnfTaskProcessor.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/GenericPnfTaskProcessor.groovy
new file mode 100644
index 0000000000..727a7508c4
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/GenericPnfTaskProcessor.groovy
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+
+package org.onap.so.bpmn.infrastructure.scripts
+
+import org.camunda.bpm.engine.delegate.DelegateExecution
+import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
+import org.onap.so.bpmn.common.scripts.ExceptionUtil
+import org.onap.so.bpmn.common.scripts.MsoUtils
+import org.onap.so.bpmn.common.workflow.context.WorkflowContext
+import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder
+import org.onap.so.bpmn.core.WorkflowException
+import org.slf4j.Logger
+import org.slf4j.LoggerFactory
+
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.REQUEST_ID
+
+class GenericPnfTaskProcessor extends AbstractServiceTaskProcessor {
+ private static final Logger logger = LoggerFactory.getLogger(GenericPnfTaskProcessor.class)
+
+ ExceptionUtil exceptionUtil = new ExceptionUtil()
+ String prefix = "Generic_"
+
+ @Override
+ void preProcessRequest(DelegateExecution execution) {
+ }
+
+ void sendResponse(DelegateExecution execution) {
+ def requestId = execution.getVariable(REQUEST_ID)
+ def instanceId = execution.getVariable(PNF_CORRELATION_ID)
+ logger.debug("Send response for requestId: {}, instanceId: {}", requestId, instanceId)
+
+ String response = """{"requestReferences":{"requestId":"${requestId}", "instanceId":"${instanceId}"}}""".trim()
+ sendWorkflowResponse(execution, 200, response)
+ }
+
+ static WorkflowContext getWorkflowContext(DelegateExecution execution) {
+ String requestId = execution.getVariable(REQUEST_ID)
+ return WorkflowContextHolder.getInstance().getWorkflowContext(requestId)
+ }
+
+ void prepareCompletion(DelegateExecution execution) {
+ try {
+ String requestId = execution.getVariable(REQUEST_ID)
+ logger.debug("Prepare Completion of PNF for requestId: {}", requestId)
+
+ String msoCompletionRequest =
+ """<aetgt:MsoCompletionRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>UPDATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:status-message>Activity is successful.</aetgt:status-message>
+ <aetgt:mso-bpel-name>${execution.getProcessDefinitionId()}</aetgt:mso-bpel-name>
+ </aetgt:MsoCompletionRequest>"""
+ String xmlMsoCompletionRequest = utils.formatXml(msoCompletionRequest)
+
+ execution.setVariable(prefix + "CompleteMsoProcessRequest", xmlMsoCompletionRequest)
+
+ logger.debug("CompleteMsoProcessRequest of PNF - " + "\n" + xmlMsoCompletionRequest)
+ } catch (Exception e) {
+ String msg = "Prepare Completion error for PNF - " + e.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+
+ void prepareFalloutHandler(DelegateExecution execution) {
+ WorkflowContext workflowContext = getWorkflowContext(execution)
+ if (workflowContext == null) {
+ logger.debug("Error occurred before sending response to API handler, and send it now")
+ sendResponse(execution)
+ }
+
+ try {
+ String requestId = execution.getVariable(REQUEST_ID)
+ logger.debug("Prepare FalloutHandler of PNF for requestId: {}", requestId)
+
+ WorkflowException workflowException = execution.getVariable("WorkflowException")
+ String errorCode = String.valueOf(workflowException.getErrorCode())
+ String errorMessage = workflowException.getErrorMessage()
+ String falloutHandlerRequest =
+ """<aetgt:FalloutHandlerRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
+ xmlns:ns="http://org.onap/so/request/types/v1">
+ <request-info xmlns="http://org.onap/so/infra/vnf-request/v1">
+ <request-id>${MsoUtils.xmlEscape(requestId)}</request-id>
+ <action>UPDATE</action>
+ <source>VID</source>
+ </request-info>
+ <aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
+ <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage>
+ <aetgt:ErrorCode>${MsoUtils.xmlEscape(errorCode)}</aetgt:ErrorCode>
+ </aetgt:WorkflowException>
+ </aetgt:FalloutHandlerRequest>"""
+ String xmlFalloutHandlerRequest = utils.formatXml(falloutHandlerRequest)
+
+ execution.setVariable(prefix + "FalloutHandlerRequest", xmlFalloutHandlerRequest)
+
+ logger.debug("FalloutHandlerRequest of PNF - " + "\n" + xmlFalloutHandlerRequest)
+ } catch (Exception e) {
+ String msg = "Prepare FalloutHandler error for PNF - " + e.getMessage()
+ logger.error(msg)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg)
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn
new file mode 100644
index 0000000000..1722137056
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/GenericPnfHealthCheck.bpmn
@@ -0,0 +1,203 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1yd8m0g" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="4.0.0">
+ <bpmn:process id="GenericPnfHealthCheck" name="GenericPnfHealthCheck" isExecutable="true">
+ <bpmn:startEvent id="pnfHealthCheck_startEvent" name="Start Flow">
+ <bpmn:outgoing>SequenceFlow_1ng4b6l</bpmn:outgoing>
+ </bpmn:startEvent>
+ <bpmn:serviceTask id="ServiceTask_042uz7m" name="PNF Request Dispatcher" camunda:delegateExpression="${GenericPnfDispatcher}">
+ <bpmn:incoming>SequenceFlow_1ng4b6l</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_12ejx4m</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_12ejx4m" sourceRef="ServiceTask_042uz7m" targetRef="ScriptTask_10klpg9" />
+ <bpmn:endEvent id="pnfHealthCheck_endEvent" name="End">
+ <bpmn:incoming>SequenceFlow_0tle5zb</bpmn:incoming>
+ <bpmn:terminateEventDefinition />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_1ng4b6l" sourceRef="pnfHealthCheck_startEvent" targetRef="ServiceTask_042uz7m" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_0x6h0yi" default="SequenceFlow_0piri91">
+ <bpmn:incoming>SequenceFlow_0j26xlx</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0piri91</bpmn:outgoing>
+ <bpmn:outgoing>Flow_015z1h4</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:endEvent id="EndEvent_180lm4y">
+ <bpmn:incoming>SequenceFlow_0piri91</bpmn:incoming>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_0fm5he7" errorRef="Error_12cpov5" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0piri91" name="Failure" sourceRef="ExclusiveGateway_0x6h0yi" targetRef="EndEvent_180lm4y" />
+ <bpmn:scriptTask id="ScriptTask_10klpg9" name="Send Response" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_12ejx4m</bpmn:incoming>
+ <bpmn:outgoing>Flow_12uv2m0</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def taskProcessor = new GenericPnfTaskProcessor()
+taskProcessor.sendResponse(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:scriptTask id="ScriptTask_1igtc83" name="Prepare Completion" scriptFormat="groovy">
+ <bpmn:incoming>Flow_015z1h4</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0ipc3nt</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def taskProcessor = new GenericPnfTaskProcessor()
+taskProcessor.prepareCompletion(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0ipc3nt" sourceRef="ScriptTask_1igtc83" targetRef="CallActivity_0o1mi8u" />
+ <bpmn:callActivity id="CallActivity_0o1mi8u" name="Complete Process" calledElement="CompleteMsoProcess">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_CompleteMsoProcessRequest" target="CompleteMsoProcessRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_0ipc3nt</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0tle5zb</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:sequenceFlow id="SequenceFlow_0tle5zb" sourceRef="CallActivity_0o1mi8u" targetRef="pnfHealthCheck_endEvent" />
+ <bpmn:subProcess id="SubProcess_02p6q4s" name="Subprocess for FalloutHandler" triggeredByEvent="true">
+ <bpmn:startEvent id="StartEvent_149ecdm" name="Catch All Errors">
+ <bpmn:outgoing>SequenceFlow_05haut5</bpmn:outgoing>
+ <bpmn:errorEventDefinition id="ErrorEventDefinition_1" />
+ </bpmn:startEvent>
+ <bpmn:scriptTask id="ScriptTask_0gov132" name="Prepare FalloutHandler" scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_05haut5</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_09y0mpc</bpmn:outgoing>
+ <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.*
+def pnfSwUpgrade = new PNFSoftwareUpgrade()
+pnfSwUpgrade.prepareFalloutHandler(execution)</bpmn:script>
+ </bpmn:scriptTask>
+ <bpmn:callActivity id="CallActivity_00psvtk" name="Call FalloutHandler" calledElement="FalloutHandler">
+ <bpmn:extensionElements>
+ <camunda:in source="PnfSwUpgrade_FalloutHandlerRequest" target="FalloutHandlerRequest" />
+ </bpmn:extensionElements>
+ <bpmn:incoming>SequenceFlow_09y0mpc</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1tcjlty</bpmn:outgoing>
+ </bpmn:callActivity>
+ <bpmn:endEvent id="EndEvent_1vq2glg" name="End">
+ <bpmn:incoming>SequenceFlow_1tcjlty</bpmn:incoming>
+ <bpmn:terminateEventDefinition id="TerminateEventDefinition_0994ojb" />
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_05haut5" sourceRef="StartEvent_149ecdm" targetRef="ScriptTask_0gov132" />
+ <bpmn:sequenceFlow id="SequenceFlow_09y0mpc" sourceRef="ScriptTask_0gov132" targetRef="CallActivity_00psvtk" />
+ <bpmn:sequenceFlow id="SequenceFlow_1tcjlty" sourceRef="CallActivity_00psvtk" targetRef="EndEvent_1vq2glg" />
+ </bpmn:subProcess>
+ <bpmn:serviceTask id="ServiceTask_0slpaht" name="HealthCheck" camunda:delegateExpression="${ControllerExecutionDE}">
+ <bpmn:extensionElements>
+ <camunda:inputOutput>
+ <camunda:inputParameter name="action">healthCheck</camunda:inputParameter>
+ <camunda:inputParameter name="scope">pnf</camunda:inputParameter>
+ <camunda:inputParameter name="mode">async</camunda:inputParameter>
+ </camunda:inputOutput>
+ </bpmn:extensionElements>
+ <bpmn:incoming>Flow_12uv2m0</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0j26xlx</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0j26xlx" sourceRef="ServiceTask_0slpaht" targetRef="ExclusiveGateway_0x6h0yi" />
+ <bpmn:sequenceFlow id="Flow_015z1h4" name="Success" sourceRef="ExclusiveGateway_0x6h0yi" targetRef="ScriptTask_1igtc83">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("ControllerStatus").equals("Success")}</bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="Flow_12uv2m0" sourceRef="ScriptTask_10klpg9" targetRef="ServiceTask_0slpaht" />
+ </bpmn:process>
+ <bpmn:error id="Error_12cpov5" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
+ <bpmndi:BPMNDiagram id="BPMNDiagram_1">
+ <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="GenericPnfHealthCheck">
+ <bpmndi:BPMNEdge id="Flow_12uv2m0_di" bpmnElement="Flow_12uv2m0">
+ <di:waypoint x="530" y="120" />
+ <di:waypoint x="590" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="Flow_015z1h4_di" bpmnElement="Flow_015z1h4">
+ <di:waypoint x="825" y="120" />
+ <di:waypoint x="900" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="842" y="102" width="43" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0j26xlx_di" bpmnElement="SequenceFlow_0j26xlx">
+ <di:waypoint x="690" y="120" />
+ <di:waypoint x="775" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0tle5zb_di" bpmnElement="SequenceFlow_0tle5zb">
+ <di:waypoint x="1180" y="120" />
+ <di:waypoint x="1262" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ipc3nt_di" bpmnElement="SequenceFlow_0ipc3nt">
+ <di:waypoint x="1000" y="120" />
+ <di:waypoint x="1080" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0piri91_di" bpmnElement="SequenceFlow_0piri91">
+ <di:waypoint x="800" y="145" />
+ <di:waypoint x="800" y="202" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="793" y="145" width="35" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1ng4b6l_di" bpmnElement="SequenceFlow_1ng4b6l">
+ <di:waypoint x="178" y="120" />
+ <di:waypoint x="270" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_12ejx4m_di" bpmnElement="SequenceFlow_12ejx4m">
+ <di:waypoint x="370" y="120" />
+ <di:waypoint x="430" y="120" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="pnfHealthCheck_startEvent">
+ <dc:Bounds x="142" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="137" y="145" width="51" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_042uz7n_di" bpmnElement="ServiceTask_042uz7m">
+ <dc:Bounds x="270" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1w3jv30_di" bpmnElement="pnfHealthCheck_endEvent">
+ <dc:Bounds x="1262" y="102" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="1271" y="145" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ExclusiveGateway_0x6h0ni_di" bpmnElement="ExclusiveGateway_0x6h0yi" isMarkerVisible="true">
+ <dc:Bounds x="775" y="95" width="50" height="50" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_180lm4y_di" bpmnElement="EndEvent_180lm4y">
+ <dc:Bounds x="782" y="202" width="36" height="36" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_10klpg8_di" bpmnElement="ScriptTask_10klpg9">
+ <dc:Bounds x="430" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_1igtc83_di" bpmnElement="ScriptTask_1igtc83">
+ <dc:Bounds x="900" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_0o1mi8u_di" bpmnElement="CallActivity_0o1mi8u">
+ <dc:Bounds x="1080" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="SubProcess_02p6q4s_di" bpmnElement="SubProcess_02p6q4s" isExpanded="true">
+ <dc:Bounds x="370" y="430" width="650" height="190" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1tcjlty_di" bpmnElement="SequenceFlow_1tcjlty">
+ <di:waypoint x="810" y="530" />
+ <di:waypoint x="882" y="530" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_09y0mpc_di" bpmnElement="SequenceFlow_09y0mpc">
+ <di:waypoint x="640" y="530" />
+ <di:waypoint x="710" y="530" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_05haut5_di" bpmnElement="SequenceFlow_05haut5">
+ <di:waypoint x="478" y="530" />
+ <di:waypoint x="540" y="530" />
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="StartEvent_1r4h504_di" bpmnElement="StartEvent_149ecdm">
+ <dc:Bounds x="442" y="512" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="421" y="553" width="78" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ScriptTask_0gov132_di" bpmnElement="ScriptTask_0gov132">
+ <dc:Bounds x="540" y="490" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="CallActivity_00psvtk_di" bpmnElement="CallActivity_00psvtk">
+ <dc:Bounds x="710" y="490" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="EndEvent_1vq2glg_di" bpmnElement="EndEvent_1vq2glg">
+ <dc:Bounds x="882" y="512" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="891" y="555" width="20" height="14" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNShape id="ServiceTask_0slpahe_di" bpmnElement="ServiceTask_0slpaht">
+ <dc:Bounds x="590" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ </bpmndi:BPMNPlane>
+ </bpmndi:BPMNDiagram>
+</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
index 22cf72b262..0bf14d7443 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PNFSoftwareUpgradeTest.java
@@ -1,7 +1,6 @@
/*-
* ============LICENSE_START=======================================================
* Copyright (C) 2020 Nordix Foundation.
- * Modifications Copyright (C) 2020 Huawei Technologies Co., Ltd.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java
new file mode 100644
index 0000000000..2423ad8465
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/bpmn/infrastructure/process/PnfHealthCheckTest.java
@@ -0,0 +1,234 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.process;
+
+import com.google.protobuf.Struct;
+import org.camunda.bpm.engine.runtime.ProcessInstance;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.aaiclient.client.aai.AAIVersion;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.ActionIdentifiers;
+import org.onap.ccsdk.cds.controllerblueprints.common.api.CommonHeader;
+import org.onap.ccsdk.cds.controllerblueprints.processing.api.ExecutionServiceInput;
+import org.onap.so.BaseBPMNTest;
+import org.onap.so.GrpcNettyServer;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames;
+import org.onap.so.bpmn.mock.FileUtil;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
+import static org.assertj.core.api.Assertions.fail;
+import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
+
+/**
+ * Basic Integration test for GenericPnfHealthCheck.bpmn workflow.
+ */
+public class PnfHealthCheckTest extends BaseBPMNTest {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+
+ private static final long WORKFLOW_WAIT_TIME = 1000L;
+
+ private static final String TEST_PROCESSINSTANCE_KEY = "GenericPnfHealthCheck";
+ private static final AAIVersion VERSION = AAIVersion.LATEST;
+ private static final Map<String, Object> executionVariables = new HashMap<>();
+ private static final String REQUEST_ID = "50ae41ad-049c-4fe2-9950-539f111120f5";
+ private static final String ACTION_NAME = "healthCheck";
+ private final String CLASS_NAME = getClass().getSimpleName();
+ private String requestObject;
+ private String responseObject;
+
+ @Autowired
+ private GrpcNettyServer grpcNettyServer;
+
+ @Before
+ public void setUp() {
+ executionVariables.clear();
+ grpcNettyServer.getDetailedMessages().clear();
+
+ requestObject = FileUtil.readResourceFile("request/" + CLASS_NAME + ".json");
+ responseObject = FileUtil.readResourceFile("response/" + CLASS_NAME + ".json");
+
+ executionVariables.put("bpmnRequest", requestObject);
+ executionVariables.put("requestId", REQUEST_ID);
+
+ /**
+ * This variable indicates that the flow was invoked asynchronously. It's injected by {@link WorkflowProcessor}.
+ */
+ executionVariables.put("isAsyncProcess", "true");
+ executionVariables.put(ExecutionVariableNames.PRC_CUSTOMIZATION_UUID, "38dc9a92-214c-11e7-93ae-92361f002680");
+
+ /**
+ * Temporary solution to add pnfCorrelationId to context. this value is getting from the request to SO api
+ * handler and then convert to CamundaInput
+ */
+ executionVariables.put(ExecutionVariableNames.PNF_CORRELATION_ID, "PNFDemo");
+ }
+
+
+ @Test
+ public void workflow_validInput_expectedOutput() throws InterruptedException {
+
+ mockCatalogDb();
+ mockRequestDb();
+ mockAai();
+
+ final String msoRequestId = UUID.randomUUID().toString();
+ executionVariables.put(ExecutionVariableNames.MSO_REQUEST_ID, msoRequestId);
+
+ final String testBusinessKey = UUID.randomUUID().toString();
+ logger.info("Test the process instance: {} with business key: {}", TEST_PROCESSINSTANCE_KEY, testBusinessKey);
+
+ ProcessInstance pi =
+ runtimeService.startProcessInstanceByKey(TEST_PROCESSINSTANCE_KEY, testBusinessKey, executionVariables);
+
+ int waitCount = 10;
+ while (!isProcessInstanceEnded() && waitCount >= 0) {
+ Thread.sleep(WORKFLOW_WAIT_TIME);
+ waitCount--;
+ }
+
+ // Layout is to reflect the bpmn visual layout
+ assertThat(pi).isEnded().hasPassedInOrder("pnfHealthCheck_startEvent", "ServiceTask_042uz7m",
+ "ScriptTask_10klpg9", "ServiceTask_0slpaht", "ExclusiveGateway_0x6h0yi", "ScriptTask_1igtc83",
+ "CallActivity_0o1mi8u", "pnfHealthCheck_endEvent");
+
+ List<ExecutionServiceInput> detailedMessages = grpcNettyServer.getDetailedMessages();
+ logger.debug("Size of detailedMessage is {}", detailedMessages.size());
+ assertThat(detailedMessages.size() == 1).isTrue();
+ int count = 0;
+ try {
+ for (ExecutionServiceInput eSI : detailedMessages) {
+ if (ACTION_NAME.equals(eSI.getActionIdentifiers().getActionName())
+ && eSI.getCommonHeader().getRequestId().equals(msoRequestId)) {
+ checkWithActionName(eSI, ACTION_NAME);
+ count++;
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ fail("PNFHealthCheck request exception", e);
+ }
+ assertThat(count == 1).isTrue();
+ }
+
+ private boolean isProcessInstanceEnded() {
+ return runtimeService.createProcessInstanceQuery().processDefinitionKey(TEST_PROCESSINSTANCE_KEY)
+ .singleResult() == null;
+ }
+
+ private void checkWithActionName(ExecutionServiceInput executionServiceInput, String action) {
+
+ logger.info("Checking the " + action + " request");
+ ActionIdentifiers actionIdentifiers = executionServiceInput.getActionIdentifiers();
+
+ /**
+ * the fields of actionIdentifiers should match the one in the response/PnfHealthCheck_catalogdb.json.
+ */
+ assertThat(actionIdentifiers.getBlueprintName()).isEqualTo("test_pnf_health_check_restconf");
+ assertThat(actionIdentifiers.getBlueprintVersion()).isEqualTo("1.0.0");
+ assertThat(actionIdentifiers.getActionName()).isEqualTo(action);
+ assertThat(actionIdentifiers.getMode()).isEqualTo("async");
+
+ CommonHeader commonHeader = executionServiceInput.getCommonHeader();
+ assertThat(commonHeader.getOriginatorId()).isEqualTo("SO");
+
+ Struct payload = executionServiceInput.getPayload();
+ Struct requeststruct = payload.getFieldsOrThrow(action + "-request").getStructValue();
+
+ assertThat(requeststruct.getFieldsOrThrow("resolution-key").getStringValue()).isEqualTo("PNFDemo");
+ Struct propertiesStruct = requeststruct.getFieldsOrThrow(action + "-properties").getStructValue();
+
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-name").getStringValue()).isEqualTo("PNFDemo");
+ assertThat(propertiesStruct.getFieldsOrThrow("service-model-uuid").getStringValue())
+ .isEqualTo("32daaac6-5017-4e1e-96c8-6a27dfbe1421");
+ assertThat(propertiesStruct.getFieldsOrThrow("pnf-customization-uuid").getStringValue())
+ .isEqualTo("38dc9a92-214c-11e7-93ae-92361f002680");
+ }
+
+ private void mockAai() {
+
+ String aaiPnfEntry =
+ "{ \n" + " \"pnf-name\":\"PNFDemo\",\n" + " \"pnf-id\":\"testtest\",\n" + " \"in-maint\":true,\n"
+ + " \"resource-version\":\"1541720264047\",\n" + " \"swVersion\":\"demo-1.1\",\n"
+ + " \"ipaddress-v4-oam\":\"1.1.1.1\",\n" + " \"ipaddress-v6-oam\":\"::/128\"\n" + "}";
+
+ /**
+ * PUT the PNF correlation ID to AAI.
+ */
+ wireMockServer.stubFor(put(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
+
+ /**
+ * Get the PNF entry from AAI.
+ */
+ wireMockServer.stubFor(
+ get(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")).willReturn(okJson(aaiPnfEntry)));
+
+ /**
+ * Post the pnf to AAI
+ */
+ wireMockServer.stubFor(post(urlEqualTo("/aai/" + VERSION + "/network/pnfs/pnf/PNFDemo")));
+ }
+
+ private void mockRequestDb() {
+ /**
+ * Update Request DB
+ */
+ wireMockServer.stubFor(put(urlEqualTo("/infraActiveRequests/" + REQUEST_ID)));
+
+ }
+
+ /**
+ * Mock the catalobdb rest interface.
+ */
+ private void mockCatalogDb() {
+
+ String catalogdbClientResponse = FileUtil.readResourceFile("response/" + CLASS_NAME + "_catalogdb.json");
+
+
+ /**
+ * Return valid json for the model UUID in the request file.
+ */
+ wireMockServer
+ .stubFor(get(urlEqualTo("/v2/serviceResources?serviceModelUuid=32daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(responseObject)));
+
+ /**
+ * Return valid json for the service model InvariantUUID as specified in the request file.
+ */
+ wireMockServer.stubFor(
+ get(urlEqualTo("/v2/serviceResources?serviceModelInvariantUuid=339b7a2f-9524-4dbf-9eee-f2e05521df3f"))
+ .willReturn(okJson(responseObject)));
+
+ /**
+ * Return valid spring data rest json for the service model UUID as specified in the request file.
+ */
+ wireMockServer.stubFor(get(urlEqualTo(
+ "/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=32daaac6-5017-4e1e-96c8-6a27dfbe1421"))
+ .willReturn(okJson(catalogdbClientResponse)));
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PnfHealthCheckTest.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PnfHealthCheckTest.json
new file mode 100644
index 0000000000..7cfe9f5c9c
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/request/PnfHealthCheckTest.json
@@ -0,0 +1,50 @@
+{
+ "requestDetails":{
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false,
+ "requestorId":"demo",
+ "productFamilyId":"SWUPid"
+ },
+ "modelInfo":{
+ "modelType":"service",
+ "modelInvariantUuid":"339b7a2f-9524-4dbf-9eee-f2e05521df3f",
+ "modelInvariantId":"339b7a2f-9524-4dbf-9eee-f2e05521df3f",
+ "modelUuid":"32daaac6-5017-4e1e-96c8-6a27dfbe1421",
+ "modelName":"PNF_int_service_2",
+ "modelVersion":"1.0"
+ },
+ "requestParameters":{
+ "userParams":[
+ {
+ "name":"aic_zone",
+ "value":"nova"
+ },
+ {
+ "name":"pnfId",
+ "value":"PNFDemo"
+ },
+ {
+ "name":"pnfName",
+ "value":"PNFDemo"
+ }
+ ],
+ "subscriptionServiceType":"SWUP",
+ "aLaCarte":false
+ },
+ "cloudConfiguration":{
+ "lcpCloudRegionId":"regionOne",
+ "tenantId":"09a63533072f4a579d5c99c3b8fe94c6"
+ },
+ "subscriberInfo":{
+ "globalSubscriberId":"ADemoCustomerInEric"
+ },
+ "project":{
+ "projectName":"Project-Demonstration"
+ },
+ "owningEntity":{
+ "owningEntityId":"5eae949c-1c50-4780-b8b5-7cbeb08856b4",
+ "owningEntityName":"OE-Demonstration"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest.json
new file mode 100644
index 0000000000..32539844ba
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest.json
@@ -0,0 +1,26 @@
+{
+ "serviceResources":{
+ "modelInfo":{
+ "modelInvariantId":"439b7a2f-9524-4dbf-9eee-f2e05521df3f",
+ "modelUuid":"42daaac6-5017-4e1e-96c8-6a27dfbe1421",
+ "modelName":"PNF_int_service_2",
+ "modelVersion":"1.0"
+ },
+ "serviceType":"NA",
+ "environmentContext":"Luna",
+ "serviceRole":"NA",
+ "workloadContext":"Oxygen",
+ "serviceVnfs":[
+
+ ],
+ "serviceNetworks":[
+
+ ],
+ "serviceAllottedResources":[
+
+ ],
+ "configResource":[
+
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest_catalogdb.json b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest_catalogdb.json
new file mode 100644
index 0000000000..fc9399d7cb
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/resources/response/PnfHealthCheckTest_catalogdb.json
@@ -0,0 +1,39 @@
+{
+ "_embedded": {
+ "pnfResourceCustomization": [
+ {
+ "modelCustomizationUUID": "38dc9a92-214c-11e7-93ae-92361f002680",
+ "modelInstanceName": "PNF routing",
+ "created": "2019-03-08 12:00:29.000",
+ "nfFunction": "routing",
+ "nfType": "routing",
+ "nfRole": "routing",
+ "nfNamingCode": "routing",
+ "multiStageDesign": null,
+ "resourceInput": null,
+ "blueprintName": "test_pnf_health_check_restconf",
+ "blueprintVersion": "1.0.0",
+ "skipPostInstConf": false,
+ "softwareVersion": "1.0.0",
+ "creationTimestamp": "2019-03-08T12:00:29.000+0000",
+ "controllerActor": "cds",
+ "_links": {
+ "self": {
+ "href": "http://localhost:41023/pnfResourceCustomization/38dc9a92-214c-11e7-93ae-92361f002680"
+ },
+ "pnfResourceCustomization": {
+ "href": "http://localhost:41023/pnfResourceCustomization/38dc9a92-214c-11e7-93ae-92361f002680"
+ },
+ "pnfResources": {
+ "href": "http://localhost:41023/pnfResourceCustomization/38dc9a92-214c-11e7-93ae-92361f002680/pnfResources"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:41023/pnfResourceCustomization/search/findPnfResourceCustomizationByModelUuid?SERVICE_MODEL_UUID=4df8b6de-2083-11e7-93ae-92361f002676"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/pom.xml b/bpmn/so-bpmn-tasks/pom.xml
index dec9560574..d1245ce92a 100644
--- a/bpmn/so-bpmn-tasks/pom.xml
+++ b/bpmn/so-bpmn-tasks/pom.xml
@@ -202,25 +202,6 @@
<version>${project.version}</version>
</dependency>
<dependency>
- <groupId>org.onap.sdnc.northbound</groupId>
- <artifactId>generic-resource-api-client</artifactId>
- <version>${sdnc.northbound.version}</version>
- <exclusions>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-annotations</artifactId>
- </exclusion>
- <exclusion>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-models</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <dependency>
<groupId>ch.vorburger.mariaDB4j</groupId>
<artifactId>mariaDB4j</artifactId>
<version>2.2.3</version>
@@ -252,5 +233,15 @@
<version>${grpc.version}</version>
<scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-optimization-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.so</groupId>
+ <artifactId>so-sdn-clients</artifactId>
+ <version>${project.version}</version>
+ </dependency>
</dependencies>
</project>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index f10b503ed3..71ea9fa719 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -440,7 +440,8 @@ public class SniroHomingV2 {
if (!candidates.isEmpty()) {
for (Candidate c : candidates) {
org.onap.so.client.sniro.beans.Candidate can = new org.onap.so.client.sniro.beans.Candidate();
- can.setIdentifierType(c.getIdentifierType());
+ can.setIdentifierType(
+ org.onap.so.client.sniro.beans.CandidateType.valueOf(c.getIdentifierType().name()));
can.setIdentifiers(c.getIdentifiers());
can.setCloudOwner(c.getCloudOwner());
candidateList.add(can);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index e3181c3e91..55edf0bb6c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -260,7 +260,7 @@ public class AAICreateTasks {
public void createPnf(BuildingBlockExecution execution) {
try {
Pnf pnf = extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
- aaiPnfResources.checkIfPnfExistsInAaiAndCanBeUsed(pnf.getPnfName());
+ aaiPnfResources.checkIfPnfExistsInAaiAndCanBeUsed(pnf);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
aaiPnfResources.createPnfAndConnectServiceInstance(pnf, serviceInstance);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index cc630232c2..6c989093ab 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
@@ -90,6 +90,13 @@ public class AAIUpdateTasks {
}
/**
+ * BPMN access method to update status of Pnf to Inventoried in AAI
+ */
+ public void updateOrchestrationStatusInventoriedPnf(BuildingBlockExecution execution) {
+ updateOrchestrationStatusForPnf(execution, OrchestrationStatus.INVENTORIED);
+ }
+
+ /**
* BPMN access method to update status of Pnf to Active in AAI
*/
public void updateOrchestrationStatusActivePnf(BuildingBlockExecution execution) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/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/appc/tasks/AppcOrchestratorPreProcessor.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
index b337564dab..1f05522011 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessor.java
@@ -78,6 +78,9 @@ public class AppcOrchestratorPreProcessor {
String identityUrl = execution.getVariable("identityUrl");
appcTaskRequest.setIdentityUrl(identityUrl);
+ String requestorId = gBBInput.getRequestContext().getRequestorId();
+ appcTaskRequest.setRequestorId(requestorId);
+
if (gBBInput.getRequestContext().getRequestParameters() != null) {
String payload = gBBInput.getRequestContext().getRequestParameters().getPayload();
if (payload == null) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java
new file mode 100644
index 0000000000..72a8590ad5
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/GenericPnfDispatcher.java
@@ -0,0 +1,174 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2020 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.JavaDelegate;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.core.json.JsonUtils;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.db.catalog.beans.PnfResourceCustomization;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
+
+/**
+ * This implementation of {@link JavaDelegate} is used to populate the execution object for pnf actions
+ */
+@Component
+public class GenericPnfDispatcher implements JavaDelegate {
+
+ private final Logger logger = LoggerFactory.getLogger(getClass());
+ private static final String SERVICE_INSTANCE_NAME = "serviceInstanceName";
+ private static final String BPMN_REQUEST = "bpmnRequest";
+ private static final String RESOURCE_CUSTOMIZATION_UUID_PARAM = "resource_customization_uuid";
+ private static final String PNF_NAME = "pnfName";
+
+ // ERROR CODE for variable not found in the delegation Context
+ private static final int ERROR_CODE = 601;
+
+ @Autowired
+ private PnfManagement pnfManagement;
+
+ @Autowired
+ private ExceptionBuilder exceptionUtil;
+
+ @Autowired
+ private CatalogDbClient catalogDbClient;
+
+ @Autowired
+ private ObjectMapper mapper;
+
+ @Override
+ public void execute(DelegateExecution delegateExecution) throws Exception {
+ logger.debug("Running execute block for activity id: {}, name: {}", delegateExecution.getCurrentActivityId(),
+ delegateExecution.getCurrentActivityName());
+
+ RequestDetails bpmnRequestDetails = requestVerification(delegateExecution);
+
+ final String serviceInstanceName = bpmnRequestDetails.getRequestInfo().getInstanceName();
+ final String pnfName;
+ if (delegateExecution.getVariable(PNF_NAME) == null
+ || String.valueOf(delegateExecution.getVariable(PNF_NAME)).trim().isEmpty()) {
+ pnfName = bpmnRequestDetails.getRequestParameters().getUserParamValue(PNF_NAME);
+ } else {
+ pnfName = String.valueOf(delegateExecution.getVariable(PNF_NAME));
+ }
+ final String serviceModelUuid = bpmnRequestDetails.getModelInfo().getModelUuid();
+ final List<Map<String, Object>> userParams = bpmnRequestDetails.getRequestParameters().getUserParams();
+ final Pnf pnf = getPnfByPnfName(delegateExecution, pnfName);
+ final List<PnfResourceCustomization> pnfCustomizations =
+ getPnfResourceCustomizations(delegateExecution, serviceModelUuid);
+ final PnfResourceCustomization pnfResourceCustomization = pnfCustomizations.get(0);
+ final String payload = bpmnRequestDetails.getRequestParameters().getPayload();
+
+ populateExecution(delegateExecution, bpmnRequestDetails, pnfResourceCustomization, pnf, serviceInstanceName,
+ pnfName, serviceModelUuid, userParams, payload);
+
+ logger.trace("Completed dispatcher request for PNF.");
+ }
+
+ private RequestDetails requestVerification(DelegateExecution delegateExecution) throws IOException {
+ RequestDetails bpmnRequestDetails = mapper.readValue(
+ JsonUtils.getJsonValue(String.valueOf(delegateExecution.getVariable(BPMN_REQUEST)), "requestDetails"),
+ RequestDetails.class);
+
+ throwIfNull(delegateExecution, bpmnRequestDetails.getModelInfo(), SERVICE_MODEL_INFO);
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestInfo(), "RequestInfo");
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters(), "RequestParameters");
+ throwIfNull(delegateExecution, bpmnRequestDetails.getRequestParameters().getUserParams(), "UserParams");
+
+ return bpmnRequestDetails;
+ }
+
+ private void populateExecution(DelegateExecution delegateExecution, RequestDetails bpmnRequestDetails,
+ PnfResourceCustomization pnfResourceCustomization, Pnf pnf, String serviceInstanceName, String pnfName,
+ String serviceModelUuid, List<Map<String, Object>> userParams, String payload) {
+
+ delegateExecution.setVariable(SERVICE_MODEL_INFO, bpmnRequestDetails.getModelInfo());
+ delegateExecution.setVariable(SERVICE_INSTANCE_NAME, serviceInstanceName);
+ delegateExecution.setVariable(PNF_CORRELATION_ID, pnfName);
+ delegateExecution.setVariable(MODEL_UUID, serviceModelUuid);
+ delegateExecution.setVariable(PNF_UUID, pnf.getPnfId());
+ delegateExecution.setVariable(PRC_BLUEPRINT_NAME, pnfResourceCustomization.getBlueprintName());
+ delegateExecution.setVariable(PRC_BLUEPRINT_VERSION, pnfResourceCustomization.getBlueprintVersion());
+ delegateExecution.setVariable(PRC_CUSTOMIZATION_UUID, pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(RESOURCE_CUSTOMIZATION_UUID_PARAM,
+ pnfResourceCustomization.getModelCustomizationUUID());
+ delegateExecution.setVariable(PRC_INSTANCE_NAME, pnfResourceCustomization.getModelInstanceName());
+ delegateExecution.setVariable(PRC_CONTROLLER_ACTOR, pnfResourceCustomization.getControllerActor());
+
+ for (Map<String, Object> param : userParams) {
+ if (param.containsKey("name") && param.containsKey("value")) {
+ delegateExecution.setVariable(param.get("name").toString(), param.get("value").toString());
+ }
+ }
+
+ delegateExecution.setVariable(REQUEST_PAYLOAD, payload);
+ }
+
+ private Pnf getPnfByPnfName(DelegateExecution delegateExecution, String pnfName) {
+ Optional<Pnf> pnfOptional = Optional.empty();
+ try {
+ pnfOptional = pnfManagement.getEntryFor(pnfName);
+ } catch (IOException e) {
+ throwExceptionWithWarn(delegateExecution, "Unable to fetch from AAI" + e.getMessage());
+ }
+ if (!pnfOptional.isPresent()) {
+ throwExceptionWithWarn(delegateExecution, "AAI entry for PNF: " + pnfName + " does not exist");
+ }
+ return pnfOptional.get();
+ }
+
+ private List<PnfResourceCustomization> getPnfResourceCustomizations(DelegateExecution delegateExecution,
+ String serviceModelUuid) {
+ List<PnfResourceCustomization> pnfCustomizations =
+ catalogDbClient.getPnfResourceCustomizationByModelUuid(serviceModelUuid);
+
+ if (pnfCustomizations == null || pnfCustomizations.isEmpty()) {
+ throwExceptionWithWarn(delegateExecution,
+ "Unable to find the PNF resource customizations of model service UUID: " + serviceModelUuid);
+ }
+ return pnfCustomizations;
+ }
+
+ private void throwIfNull(DelegateExecution delegateExecution, Object obj, String param) {
+ if (obj == null) {
+ throwExceptionWithWarn(delegateExecution,
+ "Unable to find the parameter: " + param + " in the execution context");
+ }
+ }
+
+ private void throwExceptionWithWarn(DelegateExecution delegateExecution, String exceptionMsg) {
+ logger.warn(exceptionMsg);
+ exceptionUtil.buildAndThrowWorkflowException(delegateExecution, ERROR_CODE, exceptionMsg);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapper.java
index 6af8c2f9c5..5b6043f303 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.util.UUID;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapper.java
index a9611cbde5..48a384c48a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.util.List;
import java.util.Map;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
index b1c95154c6..593c15d6cc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapper.java
index b5957b3009..69606393c3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.util.Map;
import java.util.UUID;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
index f6642ab76a..901187e231 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapper.java
@@ -20,7 +20,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.util.Map;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapper.java
index fd0af3a4dd..c2dcb8f290 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapper.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.util.ArrayList;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
index d22435c495..7f754e3f13 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ConfigBuildingBlocksDataObject.java
@@ -22,46 +22,68 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
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;
private ServiceInstancesRequest sIRequest;
+ private ReplaceInstanceRelatedInformation replaceInformation;
public ServiceInstancesRequest getsIRequest() {
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;
}
+
+ public ReplaceInstanceRelatedInformation getReplaceInformation() {
+ return replaceInformation;
+ }
+
+ public ConfigBuildingBlocksDataObject setReplaceInformation(ReplaceInstanceRelatedInformation replaceInformation) {
+ this.replaceInformation = replaceInformation;
+ return this;
+ }
+
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index e2dd73f9ec..f233de2baa 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -11,9 +11,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -24,9 +24,15 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.EnumSet;
-import java.util.Set;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
@@ -45,6 +51,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
+import java.util.EnumSet;
+import java.util.Set;
@Component
public class OrchestrationStatusValidator {
@@ -57,9 +65,6 @@ public class OrchestrationStatusValidator {
private static final String ORCHESTRATION_VALIDATION_FAIL =
"Orchestration Status Validation failed. ResourceType=(%s), TargetAction=(%s), OrchestrationStatus=(%s)";
private static final String ORCHESTRATION_STATUS_VALIDATION_RESULT = "orchestrationStatusValidationResult";
- private static final String ALACARTE = "aLaCarte";
- private static final String MULTI_STAGE_DESIGN_OFF = "false";
- private static final String MULTI_STAGE_DESIGN_ON = "true";
private static final String RESOURCE_EXIST_STATUS_MESSAGE =
"The %s was found to already exist, thus no new %s was created in the cloud via this request";
private static final String RESOURCE_NOT_EXIST_STATUS_MESSAGE =
@@ -79,20 +84,11 @@ public class OrchestrationStatusValidator {
/**
* This method validate's the status of the OrchestrationStatus against the buildingBlockDetail ResourceType
- *
- * @param execution
*/
public void validateOrchestrationStatus(BuildingBlockExecution execution) {
try {
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult =
- execution.getVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT);
-
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, null);
-
- boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
-
String buildingBlockFlowName = execution.getFlowToBeCalled();
-
BuildingBlockDetail buildingBlockDetail = catalogDbClient.getBuildingBlockDetail(buildingBlockFlowName);
if (buildingBlockDetail == null) {
@@ -100,63 +96,10 @@ public class OrchestrationStatusValidator {
String.format(BUILDING_BLOCK_DETAIL_NOT_FOUND, buildingBlockFlowName));
}
- OrchestrationStatus orchestrationStatus;
-
- switch (buildingBlockDetail.getResourceType()) {
- case SERVICE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- orchestrationStatus = serviceInstance.getOrchestrationStatus();
- break;
- case VNF:
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatus = genericVnf.getOrchestrationStatus();
- break;
- case VF_MODULE:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
- extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
- orchestrationStatus = vfModule.getOrchestrationStatus();
- break;
- case VOLUME_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup =
- extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
- orchestrationStatus = volumeGroup.getOrchestrationStatus();
- break;
- case NETWORK:
- org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network =
- extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
- orchestrationStatus = network.getOrchestrationStatus();
- break;
- case NETWORK_COLLECTION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInst =
- extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
- org.onap.so.bpmn.servicedecomposition.bbobjects.Collection networkCollection =
- serviceInst.getCollection();
- orchestrationStatus = networkCollection.getOrchestrationStatus();
- break;
- case CONFIGURATION:
- org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
- extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
- orchestrationStatus = configuration.getOrchestrationStatus();
- break;
- case INSTANCE_GROUP:
- org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup instanceGroup =
- extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
- orchestrationStatus = instanceGroup.getOrchestrationStatus();
- break;
- case NO_VALIDATE:
- // short circuit and exit method
- execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
- OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
- return;
- default:
- // can't currently get here, so not tested. Added in case enum is expanded
- // without a change to this
- // code
- throw new OrchestrationStatusValidationException(
- String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
- buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ OrchestrationStatus orchestrationStatus =
+ getOrchestrationStatus(execution, buildingBlockFlowName, buildingBlockDetail);
+ if (buildingBlockDetail.getResourceType().equals(ResourceType.NO_VALIDATE)) {
+ return;
}
if (orchestrationStatus == null) {
@@ -199,6 +142,66 @@ public class OrchestrationStatusValidator {
}
}
+ private OrchestrationStatus getOrchestrationStatus(BuildingBlockExecution execution, String buildingBlockFlowName,
+ BuildingBlockDetail buildingBlockDetail)
+ throws BBObjectNotFoundException, OrchestrationStatusValidationException {
+ OrchestrationStatus orchestrationStatus = null;
+
+ switch (buildingBlockDetail.getResourceType()) {
+ case SERVICE:
+ ServiceInstance serviceInstance =
+ extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ orchestrationStatus = serviceInstance.getOrchestrationStatus();
+ break;
+ case VNF:
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ orchestrationStatus = genericVnf.getOrchestrationStatus();
+ break;
+ case VF_MODULE:
+ VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ orchestrationStatus = vfModule.getOrchestrationStatus();
+ break;
+ case VOLUME_GROUP:
+ VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
+ orchestrationStatus = volumeGroup.getOrchestrationStatus();
+ break;
+ case NETWORK:
+ L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
+ orchestrationStatus = network.getOrchestrationStatus();
+ break;
+ case NETWORK_COLLECTION:
+ Collection networkCollection = getNetworkCollection(execution);
+ orchestrationStatus = networkCollection.getOrchestrationStatus();
+ break;
+ case CONFIGURATION:
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ orchestrationStatus = configuration.getOrchestrationStatus();
+ break;
+ case INSTANCE_GROUP:
+ InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
+ orchestrationStatus = instanceGroup.getOrchestrationStatus();
+ break;
+ case NO_VALIDATE:
+ // short circuit and exit method
+ execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT,
+ OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
+ break;
+ default:
+ // can't currently get here, so not tested. Added in case enum is expanded
+ // without a change to this
+ // code
+ throw new OrchestrationStatusValidationException(
+ String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName,
+ buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
+ }
+ return orchestrationStatus;
+ }
+
+ private Collection getNetworkCollection(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ ServiceInstance serviceInst = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ return serviceInst.getCollection();
+ }
+
private void updatedResourceStatus(BuildingBlockExecution execution, BuildingBlockDetail buildingBlockDetail) {
if (cloudResources.contains(buildingBlockDetail.getResourceType())) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java
new file mode 100644
index 0000000000..d9e8fa55fa
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ReplaceInstanceRelatedInformation.java
@@ -0,0 +1,16 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks;
+
+public class ReplaceInstanceRelatedInformation {
+
+ private String oldVolumeGroupName;
+
+ public String getOldVolumeGroupName() {
+ return oldVolumeGroupName;
+ }
+
+ public ReplaceInstanceRelatedInformation setOldVolumeGroupName(String oldVolumeGroupName) {
+ this.oldVolumeGroupName = oldVolumeGroupName;
+ return this;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 71e1abd564..985114abcd 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -37,6 +37,7 @@ import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
+import org.apache.commons.lang3.SerializationUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.aai.domain.yang.GenericVnf;
@@ -75,6 +76,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
@@ -143,6 +145,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 +161,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 +222,61 @@ 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());
+ ReplaceInstanceRelatedInformation replaceInfo = new ReplaceInstanceRelatedInformation();
if ((requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS))
&& resourceType.equals(WorkflowType.VFMODULE)) {
logger.debug("Build a BB list for replacing BB modules");
-
- 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).setReplaceInformation(replaceInfo));
+ 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)
+ .setReplaceInformation(replaceInfo));
+ flowsToExecute.addAll(configBuildingBlocks);
+ } else {
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey,
+ apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds,
+ requestDetails, false, null, null, false, replaceInfo);
+ 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, replaceInfo);
+ flowsToExecute.add(ebb);
+ }
}
} else {
boolean foundRelated = false;
@@ -284,11 +289,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 +308,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 +337,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 +363,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 +384,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 +439,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,
@@ -467,9 +461,8 @@ public class WorkflowAction {
return vnfcs;
}
- protected <T> List<T> getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) {
-
- List<T> configurations = new ArrayList<>();
+ protected <T> T getRelatedResourcesInVnfc(Vnfc vnfc, Class<T> resultClass, AAIObjectType type) throws Exception {
+ T configuration = null;
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VNFC, vnfc.getVnfcName());
AAIResultWrapper vnfcResultsWrapper = bbInputSetupUtils.getAAIResourceDepthOne(uri);
Optional<Relationships> relationshipsOp = vnfcResultsWrapper.getRelationships();
@@ -479,12 +472,19 @@ public class WorkflowAction {
Relationships relationships = relationshipsOp.get();
List<AAIResultWrapper> configurationResultWrappers =
this.getResultWrappersFromRelationships(relationships, type);
- for (AAIResultWrapper configurationResultWrapper : configurationResultWrappers) {
- Optional<T> configurationOp = configurationResultWrapper.asBean(resultClass);
- configurationOp.ifPresent(configurations::add);
+ if (configurationResultWrappers.size() > 1) {
+ String multipleRelationshipsError =
+ "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
+ throw new Exception(multipleRelationshipsError);
+ }
+ if (!configurationResultWrappers.isEmpty()) {
+ Optional<T> configurationOp = configurationResultWrappers.get(0).asBean(resultClass);
+ if (configurationOp.isPresent()) {
+ configuration = configurationOp.get();
+ }
}
}
- return configurations;
+ return configuration;
}
protected List<AAIResultWrapper> getResultWrappersFromRelationships(Relationships relationships,
@@ -511,7 +511,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) {
@@ -526,32 +526,26 @@ public class WorkflowAction {
List<org.onap.aai.domain.yang.Vnfc> vnfcs = getRelatedResourcesInVfModule(vnfId, vfModuleId,
org.onap.aai.domain.yang.Vnfc.class, AAIObjectType.VNFC);
for (org.onap.aai.domain.yang.Vnfc vnfc : vnfcs) {
- List<org.onap.aai.domain.yang.Configuration> configurations = getRelatedResourcesInVnfc(vnfc,
+ WorkflowResourceIds workflowIdsCopy = SerializationUtils.clone(dataObj.getWorkflowResourceIds());
+ org.onap.aai.domain.yang.Configuration configuration = getRelatedResourcesInVnfc(vnfc,
org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- if (configurations.size() > 1) {
- String multipleRelationshipsError =
- "Multiple relationships exist from VNFC " + vnfc.getVnfcName() + " to Configurations";
- buildAndThrowException(dataObj.getExecution(), "Exception in getConfigBuildingBlock: ",
- new Exception(multipleRelationshipsError));
- }
- for (org.onap.aai.domain.yang.Configuration configuration : configurations) {
- dataObj.getWorkflowResourceIds().setConfigurationId(configuration.getConfigurationId());
- for (OrchestrationFlow orchFlow : result) {
- dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
- dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
- dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
- String vnfcName = getVnfcNameForConfiguration(configuration);
- if (vnfcName == null || vnfcName.isEmpty()) {
- buildAndThrowException(dataObj.getExecution(), "Exception in create execution list "
- + ": VnfcName does not exist or is null while there is a configuration for the vfModule",
- new Exception("Vnfc and Configuration do not match"));
- }
- ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
- dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
- dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(),
- dataObj.getWorkflowResourceIds(), dataObj.getRequestDetails(), false, null, vnfcName, true);
- flowsToExecuteConfigs.add(ebb);
+ workflowIdsCopy.setConfigurationId(configuration.getConfigurationId());
+ for (OrchestrationFlow orchFlow : result) {
+ dataObj.getResourceKey().setVfModuleCustomizationId(vfModuleCustomizationUUID);
+ dataObj.getResourceKey().setCvnfModuleCustomizationId(vnfc.getModelCustomizationId());
+ dataObj.getResourceKey().setVnfCustomizationId(vnfCustomizationUUID);
+ String vnfcName = vnfc.getVnfcName();
+ if (vnfcName == null || vnfcName.isEmpty()) {
+ buildAndThrowException(dataObj.getExecution(), "Exception in create execution list "
+ + ": VnfcName does not exist or is null while there is a configuration for the vfModule",
+ new Exception("Vnfc and Configuration do not match"));
}
+ ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(),
+ dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(),
+ dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), workflowIdsCopy,
+ dataObj.getRequestDetails(), false, null, vnfcName, true, null);
+ flowsToExecuteConfigs.add(ebb);
+
}
}
return flowsToExecuteConfigs;
@@ -572,17 +566,18 @@ public class WorkflowAction {
boolean rebuildVolumeGroups = false;
if (dataObj.getRequestDetails().getRequestParameters() != null
&& dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups() != null) {
- rebuildVolumeGroups =
- dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups().booleanValue();
+ rebuildVolumeGroups = dataObj.getRequestDetails().getRequestParameters().getRebuildVolumeGroups();
}
-
+ String volumeGroupName = "";
Optional<VolumeGroup> volumeGroupFromVfModule =
bbInputSetupUtils.getRelatedVolumeGroupFromVfModule(vnfId, vfModuleId);
if (volumeGroupFromVfModule.isPresent()) {
String volumeGroupId = volumeGroupFromVfModule.get().getVolumeGroupId();
+ volumeGroupName = volumeGroupFromVfModule.get().getVolumeGroupName();
logger.debug("Volume group id of the existing volume group is: " + volumeGroupId);
volumeGroupExisted = true;
dataObj.getWorkflowResourceIds().setVolumeGroupId(volumeGroupId);
+ dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
}
List<OrchestrationFlow> orchFlows = dataObj.getOrchFlows();
@@ -595,6 +590,7 @@ public class WorkflowAction {
if (!volumeGroupExisted) {
String newVolumeGroupId = UUID.randomUUID().toString();
dataObj.getWorkflowResourceIds().setVolumeGroupId(newVolumeGroupId);
+ dataObj.getReplaceInformation().setOldVolumeGroupName(volumeGroupName);
logger.debug("newVolumeGroupId: " + newVolumeGroupId);
}
}
@@ -617,23 +613,6 @@ public class WorkflowAction {
return orchFlows;
}
- protected String getVnfcNameForConfiguration(org.onap.aai.domain.yang.Configuration configuration) {
- AAIResultWrapper wrapper = new AAIResultWrapper(configuration);
- Optional<Relationships> relationshipsOp = wrapper.getRelationships();
- if (!relationshipsOp.isPresent()) {
- logger.debug("No relationships were found for Configuration in AAI");
- return null;
- }
- Relationships relationships = relationshipsOp.get();
- List<AAIResultWrapper> vnfcResultWrappers = relationships.getByType(AAIObjectType.VNFC);
- if (vnfcResultWrappers.size() > 1 || vnfcResultWrappers.isEmpty()) {
- logger.debug("Too many vnfcs or no vnfc found that are related to configuration");
- }
- Optional<Vnfc> vnfcOp = vnfcResultWrappers.get(0).asBean(Vnfc.class);
- return vnfcOp.map(Vnfc::getVnfcName).orElse(null);
-
- }
-
protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) {
int count = 0;
for (Resource resource : vfModuleResources) {
@@ -664,11 +643,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 +663,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 +807,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 +921,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 +935,8 @@ public class WorkflowAction {
org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
- if (serviceInstanceMSO.getVnfs() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
- resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
- if (vnf.getVfModules() != null) {
- for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
- Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
- resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
- resourceList.add(resource);
- }
- }
- if (vnf.getVolumeGroups() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf
- .getVolumeGroups()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
- resourceList
- .add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
- }
- }
- }
- }
+ traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
+ traverseServiceInstanceMSOPnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
if (serviceInstanceMSO.getNetworks() != null) {
for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
.getNetworks()) {
@@ -999,6 +975,50 @@ public class WorkflowAction {
}
}
+ private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getVnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ traverseVnfModules(resourceList, aaiResourceIds, vnf);
+ if (vnf.getVolumeGroups() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
+ }
+ }
+ }
+ }
+
+ private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getPnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId()));
+ resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false));
+ }
+ }
+
+ private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
+ if (vnf.getVfModules() == null) {
+ return;
+ }
+ for (VfModule vfModule : vnf.getVfModules()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
+ resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
+ resourceList.add(resource);
+ }
+ }
+
private void traverseAAIVnf(DelegateExecution execution, List<Resource> resourceList, String serviceId,
String vnfId, List<Pair<WorkflowType, String>> aaiResourceIds) {
try {
@@ -1111,12 +1131,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) {
@@ -1371,7 +1388,7 @@ public class WorkflowAction {
resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType))
.forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource,
apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration)));
+ isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null)));
}
protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows,
@@ -1406,7 +1423,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 +1432,10 @@ public class WorkflowAction {
vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream()
.filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList()));
}
- for (int i = 0; i < vfModuleResourcesSorted.size(); i++) {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, vfModuleResourcesSorted.get(i),
- apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails,
- false, null, null, false));
+ for (Resource resource : vfModuleResourcesSorted) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId,
+ requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null,
+ false, null));
}
} else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) {
if (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
@@ -1438,8 +1455,9 @@ public class WorkflowAction {
requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails,
false, true);
} else {
- flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId,
- requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, false));
+ flowsToExecute
+ .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction,
+ false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null));
}
}
return flowsToExecute;
@@ -1448,15 +1466,19 @@ public class WorkflowAction {
protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId,
Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte,
String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails,
- boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration) {
+ boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration,
+ ReplaceInstanceRelatedInformation replaceInfo) {
BuildingBlock buildingBlock =
new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString())
.setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey)
.setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse(""));
- Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(action -> buildingBlock.setBpmnAction(action));
- Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(scope -> buildingBlock.setBpmnScope(scope));
-
+ Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction);
+ Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope);
+ String oldVolumeGroupName = "";
+ if (replaceInfo != null) {
+ oldVolumeGroupName = replaceInfo.getOldVolumeGroupName();
+ }
if (resource != null
&& (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE)
|| requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) {
@@ -1464,28 +1486,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).setOldVolumeGroupName(oldVolumeGroupName);
if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) {
- ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
- Optional.ofNullable(vnfcName).ifPresent(name -> configurationResourceKeys.setVnfcName(name));
- configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
- configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
- configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName);
executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys);
}
return executeBuildingBlock;
}
+ private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) {
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName);
+ configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId());
+ configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId());
+ configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId());
+ return configurationResourceKeys;
+ }
+
protected List<OrchestrationFlow> queryNorthBoundRequestCatalogDb(DelegateExecution execution, String requestAction,
WorkflowType resourceName, boolean aLaCarte, String cloudOwner) {
return this.queryNorthBoundRequestCatalogDb(execution, requestAction, resourceName, aLaCarte, cloudOwner, "");
@@ -1494,7 +1515,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 +1596,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 +1660,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 +1704,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 +1722,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..7420df144a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -20,20 +20,12 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Optional;
-import java.util.UUID;
-import javax.persistence.EntityNotFoundException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.onap.aai.domain.yang.GenericVnf;
-import org.onap.aai.domain.yang.InstanceGroup;
-import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.ServiceInstance;
-import org.onap.aai.domain.yang.VfModule;
-import org.onap.aai.domain.yang.Vnfc;
-import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.*;
+import org.onap.aaiclient.client.aai.AAIObjectType;
+import org.onap.aaiclient.client.aai.entities.Configuration;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
@@ -44,8 +36,6 @@ import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
-import org.onap.aaiclient.client.aai.AAIObjectType;
-import org.onap.aaiclient.client.aai.entities.Configuration;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -58,8 +48,13 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.persistence.EntityNotFoundException;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.stream.Collectors;
@Component
public class WorkflowActionBBTasks {
@@ -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,25 @@ public class WorkflowActionBBTasks {
}
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
- List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>();
- rollbackFlowsFiltered.addAll(rollbackFlows);
+ List<ExecuteBuildingBlock> rollbackFlowsFiltered = new ArrayList<>(rollbackFlows);
if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
- for (int i = 0; i < rollbackFlows.size(); i++) {
- if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign") && !rollbackFlows
- .get(i).getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
- } else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
+ for (ExecuteBuildingBlock rollbackFlow : rollbackFlows) {
+ if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Unassign")
+ && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
+ rollbackFlowsFiltered.remove(rollbackFlow);
+ } else if (rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("Delete")
+ && !rollbackFlow.getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")
&& ROLLBACKTOCREATED.equals(handlingCode)) {
- rollbackFlowsFiltered.remove(rollbackFlows.get(i));
+ rollbackFlowsFiltered.remove(rollbackFlow);
}
}
}
- List<ExecuteBuildingBlock> rollbackFlowsFilteredNonChangeBBs = new ArrayList();
+ 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 +354,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 +441,8 @@ public class WorkflowActionBBTasks {
ExecuteBuildingBlock addConfigBB = getExecuteBBForConfig(ADD_FABRIC_CONFIGURATION_BB, ebb,
configurationId, configurationResourceKeys);
flowsToExecute.add(addConfigBB);
- flowsToExecute.stream()
- .forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
- executeBB.getBuildingBlock().getBpmnFlowName()));
+ flowsToExecute.forEach(executeBB -> logger.info("Flows to Execute After Post Processing: {}",
+ executeBB.getBuildingBlock().getBpmnFlowName()));
execution.setVariable("flowsToExecute", flowsToExecute);
execution.setVariable(COMPLETED, false);
} else {
@@ -475,11 +459,10 @@ public class WorkflowActionBBTasks {
}
}
- protected String getConfigurationId(Vnfc vnfc) {
- List<Configuration> configurations =
+ protected String getConfigurationId(Vnfc vnfc) throws Exception {
+ Configuration configuration =
workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
- if (!configurations.isEmpty()) {
- Configuration configuration = configurations.get(0);
+ if (configuration != null) {
return configuration.getConfigurationId();
} else {
return UUID.randomUUID().toString();
@@ -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/main/java/org/onap/so/client/orchestration/AAIPnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
index 3b22cd9d81..3da17194ff 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIPnfResources.java
@@ -22,6 +22,7 @@ package org.onap.so.client.orchestration;
import com.google.common.base.Strings;
import java.util.Optional;
+import org.apache.commons.lang3.StringUtils;
import org.onap.aai.domain.yang.RelatedToProperty;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
@@ -68,11 +69,39 @@ public class AAIPnfResources {
injectionHelper.getAaiClient().update(pnfURI, aaiObjectMapper.mapPnf(pnfCopy));
}
- public void checkIfPnfExistsInAaiAndCanBeUsed(String pnfName) throws Exception {
- Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai = injectionHelper.getAaiClient()
- .get(org.onap.aai.domain.yang.Pnf.class, AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnfName));
+ public void checkIfPnfExistsInAaiAndCanBeUsed(Pnf pnf) throws Exception {
+ Optional<org.onap.aai.domain.yang.Pnf> pnfFromAai =
+ injectionHelper.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()));
if (pnfFromAai.isPresent()) {
checkIfPnfCanBeUsed(pnfFromAai.get());
+ updatePnfInAAI(pnf, pnfFromAai.get());
+ }
+ }
+
+ private void updatePnfInAAI(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
+ updatePnfFields(pnf, pnfFromAai);
+ injectionHelper.getAaiClient().update(AAIUriFactory.createResourceUri(AAIObjectType.PNF, pnf.getPnfName()),
+ pnfFromAai);
+ logger.debug("updatePnfInAAI: {}", pnfFromAai);
+ }
+
+ private void updatePnfFields(Pnf pnf, org.onap.aai.domain.yang.Pnf pnfFromAai) {
+ if (pnf.getModelInfoPnf() != null
+ && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelCustomizationUuid())) {
+ pnfFromAai.setModelCustomizationId(pnf.getModelInfoPnf().getModelCustomizationUuid());
+ }
+ if (pnf.getModelInfoPnf() != null && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelInvariantUuid())) {
+ pnfFromAai.setModelInvariantId(pnf.getModelInfoPnf().getModelInvariantUuid());
+ }
+ if (pnf.getModelInfoPnf() != null && StringUtils.isNotBlank(pnf.getModelInfoPnf().getModelUuid())) {
+ pnfFromAai.setModelVersionId(pnf.getModelInfoPnf().getModelUuid());
+ }
+ if (pnf.getOrchestrationStatus() != null && StringUtils.isNotBlank(pnf.getOrchestrationStatus().toString())) {
+ pnfFromAai.setOrchestrationStatus(pnf.getOrchestrationStatus().toString());
+ }
+ if (StringUtils.isNotBlank(pnf.getRole())) {
+ pnfFromAai.setNfRole(pnf.getRole());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
index 4aa6a1026a..da675bb498 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCConfigurationResources.java
@@ -21,6 +21,7 @@
package org.onap.so.client.orchestration;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -29,7 +30,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.net.URI;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
index 0123eb67be..dc59969492 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCNetworkResources.java
@@ -24,6 +24,7 @@ package org.onap.so.client.orchestration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -31,7 +32,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
index 960efea2f0..54efd23bf9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCServiceInstanceResources.java
@@ -22,6 +22,7 @@ package org.onap.so.client.orchestration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.ServiceTopologyOperationMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -29,7 +30,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
index 01511eaccc..c500374dc1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVfModuleResources.java
@@ -24,6 +24,7 @@ package org.onap.so.client.orchestration;
import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -36,7 +37,6 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
index 27edeed02a..d198756b1e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/SDNCVnfResources.java
@@ -25,6 +25,7 @@ package org.onap.so.client.orchestration;
import java.net.URI;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -35,7 +36,6 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
index a7dfe7f7a4..28d2abc792 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
@@ -161,6 +161,26 @@ public class AAIUpdateTasksTest extends BaseTaskTest {
}
@Test
+ public void updateOrchestrationStatusInventoriedPnfTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.INVENTORIED);
+
+ aaiUpdateTasks.updateOrchestrationStatusInventoriedPnf(execution);
+
+ verify(aaiPnfResources, times(1)).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.INVENTORIED);
+ }
+
+ @Test
+ public void updateOrchestrationStatusInventoriedPnfExceptionTest() throws Exception {
+ Pnf pnf = preparePnfAndExtractForPnf();
+ doThrow(RuntimeException.class).when(aaiPnfResources).updateOrchestrationStatusPnf(pnf,
+ OrchestrationStatus.INVENTORIED);
+
+ expectedException.expect(BpmnError.class);
+ aaiUpdateTasks.updateOrchestrationStatusInventoriedPnf(execution);
+ }
+
+ @Test
public void updateOrchestrationStatusActivePnfTest() throws Exception {
Pnf pnf = preparePnfAndExtractForPnf();
doNothing().when(aaiPnfResources).updateOrchestrationStatusPnf(pnf, OrchestrationStatus.ACTIVE);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
index 38c74eecc7..d7d6da209e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcOrchestratorPreProcessorTest.java
@@ -149,6 +149,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
private void fillRequiredAppcExecutionFields() {
RequestContext context = new RequestContext();
context.setMsoRequestId("TEST-MSO-ID");
+ context.setRequestorId("testRequestorId");
execution.setVariable("aicIdentity", "AIC-TEST");
execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
@@ -192,6 +193,7 @@ public class AppcOrchestratorPreProcessorTest extends BaseTaskTest {
"{\"request_parameters\":{\"host_ip_address\":\"10.10.10.10\"},\"configuration_parameters\":{\"name1\":\"value1\",\"name2\":\"value2\"}}");
context.setRequestParameters(requestParameters);
context.setMsoRequestId("TEST-MSO-ID");
+ context.setRequestorId("testRequestorId");
execution.setVariable("aicIdentity", "AIC-TEST");
execution.setVariable("vmIdList", "VM-ID-LIST-TEST");
execution.setVariable("vserverIdList", "VSERVER-ID-LIST");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
index 0eb0304cdf..d4f1660986 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GCTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import java.net.URI;
import java.net.URISyntaxException;
@@ -33,6 +33,8 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -78,81 +80,4 @@ public class GCTopologyOperationRequestMapperTest extends TestDataSetup {
Assert.assertEquals("MsoRequestId", genericInfo.getRequestInformation().getRequestId());
}
-
-
- private VpnBondingLink getVpnBondingLink() {
- VpnBondingLink vpnBondingLink = new VpnBondingLink();
- Configuration vrfConfiguration = getVRFConfiguration();
- vpnBondingLink.setVrfConfiguration(vrfConfiguration);
- Configuration vnrConfiguration = getVNRConfiguration();
- vpnBondingLink.setVnrConfiguration(vnrConfiguration);
- vpnBondingLink.setTransportServiceProxy(buildServiceProxy(buildServiceInstance(buildGenericVnf())));
- return vpnBondingLink;
- }
-
- private RequestContext getRequestContext() {
- RequestContext requestContext = new RequestContext();
- requestContext.setMsoRequestId("MsoRequestId");
- Map<String, Object> userParams = getUserParams();
- requestContext.setUserParams(userParams);
- return requestContext;
- }
-
- private Map<String, Object> getUserParams() {
- Map<String, Object> userParams = new HashMap<>();
- userParams.put("lppCustomerId", "lppCustomerId");
- return userParams;
- }
-
- private ServiceProxy buildServiceProxy(ServiceInstance serviceInstance) {
- ServiceProxy serviceProxy = new ServiceProxy();
- serviceProxy.setServiceInstance(serviceInstance);
- return serviceProxy;
- }
-
- private Configuration getVRFConfiguration() {
- Configuration vrfConfiguration = new Configuration();
- vrfConfiguration.setConfigurationId("ConfigurationId");
- vrfConfiguration.setConfigurationName("ConfigurationName");
- vrfConfiguration.setConfigurationSubType("ConfigurationSubType");
- vrfConfiguration.setConfigurationType("VRF-ENTRY");
- return vrfConfiguration;
- }
-
- public Configuration getVNRConfiguration() {
- Configuration vnrConfiguration = new Configuration();
- vnrConfiguration.setConfigurationId("ConfigurationId");
- vnrConfiguration.setConfigurationName("ConfigurationName");
- vnrConfiguration.setConfigurationSubType("ConfigurationSubType");
- vnrConfiguration.setConfigurationType("VNRConfiguration");
- L3Network l3Network = getL3Network();
- vnrConfiguration.setNetwork(l3Network);
- return vnrConfiguration;
- }
-
- public L3Network getL3Network() {
- L3Network l3Network = new L3Network();
- l3Network.setNetworkId("l3NetworkId");
- Subnet ipv4subnet = getSubnet("ipv4CidrMask", "ipv4NetworkStartAddress", "IPV4");
- Subnet ipv6subnet = getSubnet("ipv6CidrMask", "ipv6NetworkStartAddress", "IPV6");
- l3Network.getSubnets().add(ipv4subnet);
- l3Network.getSubnets().add(ipv6subnet);
- return l3Network;
- }
-
- private Subnet getSubnet(String ipv4CidrMask, String ipv4NetworkStartAddress, String ipv4) {
- Subnet ipv4subnet = new Subnet();
- ipv4subnet.setCidrMask(ipv4CidrMask);
- ipv4subnet.setNetworkStartAddress(ipv4NetworkStartAddress);
- ipv4subnet.setIpVersion(ipv4);
- return ipv4subnet;
- }
-
- private ServiceInstance buildServiceInstance(GenericVnf vnf) {
- ServiceInstance serviceInstance = new ServiceInstance();
- serviceInstance.setServiceInstanceId("ServiceInstanceId");
- List<GenericVnf> vnfs = serviceInstance.getVnfs();
- vnfs.add(vnf);
- return serviceInstance;
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapperTest.java
index 88a291e68b..92fc13b633 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/GeneralTopologyObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/GeneralTopologyObjectMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
@@ -47,6 +47,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumerat
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
index 76e915781f..0952a35ab0 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/NetworkTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -38,6 +38,8 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapperTest.java
index f4006ab5d5..bd5c234e50 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/ServiceTopologyOperationMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/ServiceTopologyOperationMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -33,6 +33,8 @@ import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.ServiceTopologyOperationMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
index 2fd684e0f0..e064300ab7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VfModuleTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
@@ -40,6 +40,8 @@ import org.mockito.InjectMocks;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
index 00836176f0..a042289281 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/mapper/VnfTopologyOperationRequestMapperTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc.mapper;
+package org.onap.so.bpmn.infrastructure.sdnc.mapper;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
@@ -35,6 +35,8 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GeneralTopologyObjectMapper;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/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..a7ee89f073 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -44,7 +44,9 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.serviceinstancebeans.ModelInfo;
@@ -53,7 +55,9 @@ import org.springframework.core.env.Environment;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
@@ -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);
@@ -422,6 +400,42 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToCreatedWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToCreated");
+ execution.setVariable("requestAction", EMPTY_STRING);
+ execution.setVariable("resourceName", EMPTY_STRING);
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
+
+ BuildingBlock buildingBlock1 = new BuildingBlock().setBpmnFlowName("AssignVfModuleBB");
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock1);
+ flowsToExecute.add(ebb1);
+
+ BuildingBlock buildingBlock2 = new BuildingBlock().setBpmnFlowName("CreateVfModuleBB");
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock2);
+ flowsToExecute.add(ebb2);
+
+ BuildingBlock buildingBlock3 = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock3);
+ flowsToExecute.add(ebb3);
+
+ BuildingBlock buildingBlock4 = new BuildingBlock().setBpmnFlowName("AddFabricConfigurationBB");
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock().setBuildingBlock(buildingBlock4);
+ flowsToExecute.add(ebb4);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 4);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(2, ebbs.size());
+ assertEquals("DeleteFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
@@ -429,18 +443,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 +472,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 +533,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 +567,55 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
assertEquals(2, ebbs.size());
}
+ @Test
+ public void postProcessingExecuteBBActivateVfModuleTest() throws CloneNotSupportedException {
+ BuildingBlock bbActivateVfModule = new BuildingBlock().setBpmnFlowName("ActivateVfModuleBB");
+ ExecuteBuildingBlock ebbActivateVfModule = new ExecuteBuildingBlock().setBuildingBlock(bbActivateVfModule);
+
+ WorkflowResourceIds resourceIdsActivateVfModule = new WorkflowResourceIds();
+ resourceIdsActivateVfModule.setServiceInstanceId("test-service-inbstance-id");
+ resourceIdsActivateVfModule.setVnfId("test-vnf-id");
+ resourceIdsActivateVfModule.setVfModuleId("test-vf-module-id");
+ resourceIdsActivateVfModule.setConfigurationId("");
+
+ RequestDetails requestDetails = new RequestDetails();
+
+ ebbActivateVfModule.setApiVersion("7");
+ ebbActivateVfModule.setaLaCarte(true);
+ ebbActivateVfModule.setRequestAction("createInstance");
+ ebbActivateVfModule.setVnfType("test-vnf-type");
+ ebbActivateVfModule.setRequestId("f6c00ae2-a205-4cbd-b055-02e553efde12");
+ ebbActivateVfModule.setRequestDetails(requestDetails);
+ ebbActivateVfModule.setWorkflowResourceIds(resourceIdsActivateVfModule);
+
+ ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
+ configurationResourceKeys.setCvnfcCustomizationUUID("07d64cd2-4427-4156-b11d-d14b96b3e4cb");
+ configurationResourceKeys.setVfModuleCustomizationUUID("50b61075-6ebb-4aab-a9fc-bedad9a2aa76");
+ configurationResourceKeys.setVnfResourceCustomizationUUID("a1d0e36e-34a9-431b-b5ba-4bbb72f63c7c");
+ configurationResourceKeys.setVnfcName("rdm54bvbgw5001vm018pim001");
+
+ ExecuteBuildingBlock ebbAddFabricConfig =
+ workflowActionBBTasks.getExecuteBBForConfig("AddFabricConfigurationBB", ebbActivateVfModule,
+ "cc7e12f9-967c-4362-8d14-e5b2bf0608a4", configurationResourceKeys);
+
+ assertEquals("7", ebbAddFabricConfig.getApiVersion());
+ assertTrue(ebbAddFabricConfig.isaLaCarte());
+ assertEquals("createInstance", ebbAddFabricConfig.getRequestAction());
+ assertEquals("test-vnf-type", ebbAddFabricConfig.getVnfType());
+ assertEquals("f6c00ae2-a205-4cbd-b055-02e553efde12", ebbAddFabricConfig.getRequestId());
+ assertEquals(requestDetails, ebbAddFabricConfig.getRequestDetails());
+ assertEquals("cc7e12f9-967c-4362-8d14-e5b2bf0608a4",
+ ebbAddFabricConfig.getWorkflowResourceIds().getConfigurationId());
+ assertEquals("test-service-inbstance-id", ebbAddFabricConfig.getWorkflowResourceIds().getServiceInstanceId());
+ assertEquals("test-vnf-id", ebbAddFabricConfig.getWorkflowResourceIds().getVnfId());
+ assertEquals("test-vf-module-id", ebbAddFabricConfig.getWorkflowResourceIds().getVfModuleId());
+
+ assertThat(ebbAddFabricConfig.getConfigurationResourceKeys()).isEqualTo(configurationResourceKeys);
+ assertThat(ebbAddFabricConfig.getWorkflowResourceIds())
+ .isNotEqualTo(ebbActivateVfModule.getWorkflowResourceIds());
+ assertThat(ebbAddFabricConfig.getWorkflowResourceIds().getConfigurationId())
+ .isNotEqualTo(ebbActivateVfModule.getWorkflowResourceIds().getConfigurationId());
+ }
@Test
public void checkRetryStatusTest() {
@@ -634,7 +678,7 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
- public void getConfigurationId() {
+ public void getConfigurationId() throws Exception {
org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
vnfc.setModelInvariantId("modelInvariantId");
vnfc.setVnfcName("testVnfcName");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/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..407a844c4e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -43,6 +43,7 @@ import static org.mockito.Mockito.doAnswer;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.when;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -116,6 +117,15 @@ import org.springframework.core.env.Environment;
public class WorkflowActionTest extends BaseTaskTest {
+ private static final String MACRO_ACTIVATE_DELETE_UNASSIGN_JSON = "Macro/ServiceMacroActivateDeleteUnassign.json";
+ private static final String MACRO_ASSIGN_JSON = "Macro/ServiceMacroAssign.json";
+ private static final String MACRO_ASSIGN_NO_CLOUD_JSON = "Macro/ServiceMacroAssignNoCloud.json";
+ private static final String VF_MODULE_CREATE_WITH_FABRIC_JSON = "VfModuleCreateWithFabric.json";
+ private static final String VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON =
+ "VfModuleReplaceRebuildVolumeGroups.json";
+ private static final String MACRO_CREATE_NETWORK_COLLECTION_JSON = "Macro/CreateNetworkCollection.json";
+ private static final String MACRO_VNF_MACRO_REPLACE_JSON = "Macro/VnfMacroReplace.json";
+
@Mock
protected Environment environment;
@InjectMocks
@@ -140,6 +150,11 @@ public class WorkflowActionTest extends BaseTaskTest {
"DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "UnassignVolumeGroupBB",
"AssignVolumeGroupBB", "ChangeModelVfModuleBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
"CreateVfModuleBB", "ActivateVfModuleBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
+ private List<OrchestrationFlow> replaceVfModuleWithFabricOrchFlows = createFlowList("DeleteFabricConfigurationBB",
+ "DeactivateVfModuleBB", "DeleteVfModuleATTBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB",
+ "UnassignVFModuleBB", "UnassignVolumeGroupBB", "AssignVolumeGroupBB", "AssignVfModuleBB",
+ "CreateVfModuleBB", "ActivateVfModuleBB", "AddFabricConfigurationBB", "CreateVolumeGroupBB",
+ "ActivateVolumeGroupBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
@Before
public void before() throws Exception {
@@ -158,13 +173,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteNetworkCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "Network";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/networks/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -183,13 +193,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteNetworkDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Network";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/networks/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -208,13 +213,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteServiceCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/serviceInstances/123");
@@ -230,87 +230,11 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
- public void selectExecutionListExceptionAlreadyBuiltTest() throws Exception {
- DelegateExecution delegateExecution = new DelegateExecutionFake();
- String gAction = "deleteInstance";
- String resource = "VfModule";
- delegateExecution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- delegateExecution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- delegateExecution.setVariable("bpmnRequest", bpmnRequest);
- delegateExecution.setVariable("aLaCarte", true);
- delegateExecution.setVariable("apiVersion", "7");
- delegateExecution.setVariable("requestUri",
- "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
- NorthBoundRequest northBoundRequest = new NorthBoundRequest();
- List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
- northBoundRequest.setOrchestrationFlowList(orchFlows);
-
- when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
- true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
-
- doAnswer(invocation -> {
- DelegateExecutionFake execution = invocation.getArgument(0);
- execution.setVariable("WorkflowException", "exception");
- execution.setVariable("WorkflowExceptionErrorMessage", "errorMessage");
- throw new BpmnError("WorkflowException");
- }).when(exceptionUtil).buildAndThrowWorkflowException(delegateExecution, 7000,
- "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations");
-
-
- org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
- vnf.setVnfId("vnf0");
- vnf.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
-
- org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
- vfModule.setModelCustomizationId("modelCustomizationId");
- when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
-
- List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
- vnfcs.add(vnfc);
- doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
-
- List<org.onap.aai.domain.yang.Configuration> configurations =
- new ArrayList<org.onap.aai.domain.yang.Configuration>();
- org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
- configuration.setConfigurationId("configurationId");
- configuration.setModelCustomizationId("modelCustimizationId");
- configuration.setConfigurationName("testConfigurationName");
- configurations.add(configuration);
- org.onap.aai.domain.yang.Configuration configuration1 = new org.onap.aai.domain.yang.Configuration();
- configuration1.setConfigurationId("configurationId");
- configuration1.setModelCustomizationId("modelCustimizationId");
- configuration1.setConfigurationName("testConfigurationName");
- configurations.add(configuration1);
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
-
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(any());
-
- thrown.expect(BpmnError.class);
- SPY_workflowAction.selectExecutionList(delegateExecution);
- assertEquals(
- "Exception in getConfigBuildingBlock: Multiple relationships exist from VNFC testVnfcName to Configurations",
- delegateExecution.getVariable("WorkflowException"));
- }
-
- @Test
public void selectExecutionListDuplicateNameExceptionTest() throws Exception {
String gAction = "createInstance";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri", "v6/serviceInstances");
- execution.setVariable("requestAction", gAction);
doThrow(new DuplicateNameException(
"serviceInstance with name (instanceName) and different version id (3c40d244-808e-42ca-b09a-256d83d19d0a) already exists. The name must be unique."))
@@ -329,16 +253,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroAssignTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
"AssignVolumeGroupBB", "AssignVfModuleBB");
@@ -383,16 +301,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroAssignNoCloudTest() throws Exception {
String gAction = "assignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssignNoCloud.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_NO_CLOUD_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "AssignNetworkBB", "AssignVnfBB",
"AssignVolumeGroupBB", "AssignVfModuleBB");
@@ -438,16 +350,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroActivateTest() throws Exception {
String gAction = "activateInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/si0");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows =
createFlowList("CreateNetworkBB", "ActivateNetworkBB", "CreateVolumeGroupBB", "ActivateVolumeGroupBB",
@@ -462,7 +368,6 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
vnf.setVnfId("vnf0");
-
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule2 = buildVfModule();
@@ -492,23 +397,16 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals("testVfModuleId2", ebbs.get(5).getWorkflowResourceIds().getVfModuleId());
assertEquals("vnf0", ebbs.get(6).getWorkflowResourceIds().getVnfId());
assertEquals("si0", ebbs.get(7).getWorkflowResourceIds().getServiceInstanceId());
-
}
@Test
public void selectExecutionListServiceMacroDeactivateTest() throws Exception {
String gAction = "deactivateInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
@@ -524,16 +422,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroEmptyServiceTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -556,16 +448,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateJustNetworkTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -592,16 +478,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateWithNetworkCollectionTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
northBoundRequest.setIsToplevelflow(true);
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
@@ -687,16 +567,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroCreateWithUserParams() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignServiceInstanceBB", "CreateNetworkCollectionBB",
"AssignNetworkBB", "AssignVnfBB", "AssignVolumeGroupBB", "AssignVfModuleBB", "CreateNetworkBB",
@@ -769,21 +643,16 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
- "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB",
- "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB",
+ "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB",
+ "UnassignServiceInstanceBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
@@ -792,7 +661,10 @@ public class WorkflowActionTest extends BaseTaskTest {
new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf =
new org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
vnf.setVnfId("vnfId123");
+ pnf.setPnfId("pnfId123");
org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule = buildVfModule();
vnf.getVfModules().add(vfModule);
@@ -805,6 +677,7 @@ public class WorkflowActionTest extends BaseTaskTest {
vnf.getVolumeGroups().add(volumeGroup);
serviceInstanceMSO.getVnfs().add(vnf);
+ serviceInstanceMSO.getPnfs().add(pnf);
doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
@@ -814,24 +687,53 @@ public class WorkflowActionTest extends BaseTaskTest {
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeactivateVfModuleBB", "DeleteVfModuleBB",
"DeleteVfModuleBB", "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB",
- "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB", "UnassignVolumeGroupBB",
- "UnassignVnfBB", "UnassignServiceInstanceBB");
+ "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignVfModuleBB", "UnassignVfModuleBB",
+ "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignServiceInstanceBB");
+ }
+
+ @Test
+ public void selectExecutionListServiceMacroDeleteWithPnfTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "Service";
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
+ execution.setVariable("requestUri", "v6/serviceInstances/123");
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivatePnfBB",
+ "DeactivateNetworkBB", "DeleteNetworkBB", "DeleteNetworkCollectionBB", "DeactivateServiceInstanceBB",
+ "UnassignVfModuleBB", "UnassignVolumeGroupBB", "UnassignVnfBB", "UnassignNetworkBB",
+ "UnassignServiceInstanceBB");
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
+
+ ServiceInstance serviceInstanceAAI = new ServiceInstance();
+ serviceInstanceAAI.setServiceInstanceId("aaisi123");
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf();
+ pnf.setPnfId("pnfId123");
+
+ serviceInstanceMSO.getPnfs().add(pnf);
+
+ doReturn(serviceInstanceAAI).when(bbSetupUtils).getAAIServiceInstanceById("123");
+ doReturn(serviceInstanceMSO).when(bbInputSetup).getExistingServiceInstance(serviceInstanceAAI);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ false, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEqualsBulkFlowName(ebbs, "DeactivatePnfBB", "DeactivateServiceInstanceBB", "UnassignServiceInstanceBB");
}
@Test
public void selectExecutionListServiceMacroUnassignTest() throws Exception {
String gAction = "unassignInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("UnassignVfModuleBB", "UnassignVolumeGroupBB",
"UnassignVnfBB", "UnassignNetworkBB", "UnassignServiceInstanceBB");
@@ -871,16 +773,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListServiceMacroDeleteNetworkCollectionTest() throws Exception {
String gAction = "deleteInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
"DeactivateVolumeGroupBB", "DeleteVolumeGroupBB", "DeactivateVnfBB", "DeactivateNetworkBB",
@@ -920,13 +816,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListVnfMacroRecreateTest() throws Exception {
String gAction = "recreateInstance";
String resource = "Vnf";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/recreate");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
@@ -974,13 +865,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListVnfMacroReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "Vnf";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/VnfMacroReplace.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_VNF_MACRO_REPLACE_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v7/serviceInstances/123/vnfs/1234/replace");
execution.setVariable("serviceInstanceId", "123");
execution.setVariable("vnfId", "1234");
@@ -1047,16 +933,10 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListNetworkCollectionMacroCreate() throws Exception {
String gAction = "createInstance";
String resource = "NetworkCollection";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("CreateNetworkCollectionBB", "AssignNetworkBB",
"CreateNetworkBB", "ActivateNetworkBB", "ActivateNetworkCollectionBB");
@@ -1084,13 +964,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListNetworkCollectionMacroDelete() throws Exception {
String gAction = "deleteInstance";
String resource = "NetworkCollection";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/CreateNetworkCollection.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_CREATE_NETWORK_COLLECTION_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123/networkCollections/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -1119,17 +994,11 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoFabricCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
-
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
"AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
@@ -1146,13 +1015,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleFabricCreateTest() throws Exception {
String gAction = "createInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1205,13 +1069,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
@@ -1231,13 +1090,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
@@ -1256,13 +1110,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleVolumeGroupToNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1289,13 +1138,8 @@ public class WorkflowActionTest extends BaseTaskTest {
throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1322,13 +1166,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1360,16 +1199,69 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void selectExecutionListALaCarteVfModuleWithFabricKeepVolumeGroupReplaceTest() throws Exception {
+ String gAction = "replaceInstance";
+ String resource = "VfModule";
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
+ execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
+ execution.setVariable("vfModuleId", "1234");
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModuleFromAAI = new org.onap.aai.domain.yang.VfModule();
+ vfModuleFromAAI.setModelCustomizationId("modelCustomizationId");
+ vfModuleFromAAI.setVfModuleId("1234");
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModuleFromAAI);
+
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupId("volumeGroupId");
+ doReturn(Optional.of(volumeGroup)).when(bbSetupUtils)
+ .getRelatedVolumeGroupFromVfModule("b80b16a5-f80d-4ffa-91c8-bd47c7438a3d", "1234");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setVolumeHeatEnv(new HeatEnvironment());
+ org.onap.so.db.catalog.beans.VfModule vfModule = new org.onap.so.db.catalog.beans.VfModule();
+ vfModule.setVolumeHeatTemplate(new HeatTemplate());
+ vfModuleCustomization.setVfModule(vfModule);
+ when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("9a6d01fd-19a7-490a-9800-460830a12e0b"))
+ .thenReturn(vfModuleCustomization);
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ vnfcs.add(vnfc);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(), any(), any());
+
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ doReturn(configuration).when(SPY_workflowAction).getRelatedResourcesInVnfc(any(), any(), any());
+
+ NorthBoundRequest northBoundRequest = new NorthBoundRequest();
+ northBoundRequest.setOrchestrationFlowList(replaceVfModuleWithFabricOrchFlows);
+ when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
+ true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
+ SPY_workflowAction.selectExecutionList(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+
+ assertEqualsBulkFlowName(ebbs, "DeleteFabricConfigurationBB", "DeactivateVfModuleBB", "DeleteVfModuleATTBB",
+ "UnassignVFModuleBB", "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
+ "AddFabricConfigurationBB", "ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
+ }
+
+ @Test
public void selectExecutionListALaCarteVfModuleKeepVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1403,13 +1295,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleNoVolumeGroupToVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1440,13 +1327,8 @@ public class WorkflowActionTest extends BaseTaskTest {
throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1476,13 +1358,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleReplaceRebuildVolumeGroups.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1518,13 +1395,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleRebuildVolumeGroupReplaceRetainAssignmentsTest() throws Exception {
String gAction = "replaceInstanceRetainAssignments";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest = new String(
- Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleReplaceRebuildVolumeGroups.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_REPLACE_REBUILD_VOLUME_GROUPS_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules/1234");
execution.setVariable("vnfId", "b80b16a5-f80d-4ffa-91c8-bd47c7438a3d");
@@ -1561,13 +1433,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception {
String gAction = "deleteInstance";
String resource = "VfModule";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
@@ -1596,18 +1463,13 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurations =
- new ArrayList<org.onap.aai.domain.yang.Configuration>();
org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
configuration.setConfigurationId("configurationId");
configuration.setModelCustomizationId("modelCustimizationId");
configuration.setConfigurationName("testConfigurationName");
- configurations.add(configuration);
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
+ doReturn(configuration).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
anyObject());
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
-
SPY_workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB",
@@ -1619,10 +1481,9 @@ public class WorkflowActionTest extends BaseTaskTest {
String gAction = "deleteInstance";
ObjectMapper mapper = new ObjectMapper();
WorkflowType resourceType = WorkflowType.VFMODULE;
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
execution.setVariable("bpmnRequest", bpmnRequest);
execution.setVariable("vnfId", "1234");
execution.setVariable("vfModuleId", "vfModuleId1234");
@@ -1647,19 +1508,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");
@@ -1674,22 +1526,92 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
- public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
+ public void getConfigBuildingBlocksTest() throws Exception {
String gAction = "deleteInstance";
- String resource = "VfModule";
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.disable(DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES);
+
+ WorkflowType resourceType = WorkflowType.VFMODULE;
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
execution.setVariable("requestAction", gAction);
String bpmnRequest =
new String(Files.readAllBytes(Paths.get("src/test/resources/__files/VfModuleCreateWithFabric.json")));
execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", true);
- execution.setVariable("apiVersion", "7");
+ execution.setVariable("vnfId", "1234");
+ execution.setVariable("vfModuleId", "vfModuleId1234");
+ execution.setVariable("requestUri",
+ "v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
+ ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
+ RequestDetails requestDetails = sIRequest.getRequestDetails();
+ String requestAction = "deleteInstance";
+ String requestId = "9c944122-d161-4280-8594-48c06a9d96d5";
+ boolean aLaCarte = true;
+ String apiVersion = "7";
+ String vnfType = "vnfType";
+ String key = "00d15ebb-c80e-43c1-80f0-90c40dde70b0";
+ String resourceId = "d1d35800-783d-42d3-82f6-d654c5054a6e";
+ Resource resourceKey = new Resource(resourceType, key, aLaCarte);
+ WorkflowResourceIds workflowResourceIds = SPY_workflowAction.populateResourceIdsFromApiHandler(execution);
+
+ List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
+ "UnassignVfModuleBB", "DeleteFabricConfigurationBB");
+
+ ConfigBuildingBlocksDataObject dataObj = new ConfigBuildingBlocksDataObject().setsIRequest(sIRequest)
+ .setOrchFlows(orchFlows).setRequestId(requestId).setResourceKey(resourceKey).setApiVersion(apiVersion)
+ .setResourceId(resourceId).setRequestAction(requestAction).setaLaCarte(aLaCarte).setVnfType(vnfType)
+ .setWorkflowResourceIds(workflowResourceIds).setRequestDetails(requestDetails).setExecution(execution);
+
+ org.onap.aai.domain.yang.GenericVnf vnf = new org.onap.aai.domain.yang.GenericVnf();
+ vnf.setVnfId("vnf0");
+ vnf.setModelCustomizationId("modelCustomizationId");
+ when(bbSetupUtils.getAAIGenericVnf(any())).thenReturn(vnf);
+
+ org.onap.aai.domain.yang.VfModule vfModule = new org.onap.aai.domain.yang.VfModule();
+ vfModule.setModelCustomizationId("modelCustomizationId");
+
+ org.onap.aai.domain.yang.Configuration config1 = new org.onap.aai.domain.yang.Configuration();
+ config1.setConfigurationId("config1");
+ org.onap.aai.domain.yang.Configuration config2 = new org.onap.aai.domain.yang.Configuration();
+ config2.setConfigurationId("config2");
+
+ List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
+ org.onap.aai.domain.yang.Vnfc vnfc1 = new org.onap.aai.domain.yang.Vnfc();
+ vnfc1.setVnfcName("zauk53avetd02svm001");
+ org.onap.aai.domain.yang.Vnfc vnfc2 = new org.onap.aai.domain.yang.Vnfc();
+ vnfc2.setVnfcName("zauk53avetd02tvm001");
+ vnfcs.add(vnfc1);
+ vnfcs.add(vnfc2);
+
+ when(bbSetupUtils.getAAIVfModule(any(), any())).thenReturn(vfModule);
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(any(), any(),
+ eq(org.onap.aai.domain.yang.Vnfc.class), eq(AAIObjectType.VNFC));
+ doReturn(config1).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc1),
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+ doReturn(config2).when(SPY_workflowAction).getRelatedResourcesInVnfc(eq(vnfc2),
+ eq(org.onap.aai.domain.yang.Configuration.class), eq(AAIObjectType.CONFIGURATION));
+
+ List<ExecuteBuildingBlock> results = SPY_workflowAction.getConfigBuildingBlocks(dataObj);
+
+ assertFalse(results.isEmpty());
+ assertEquals(2, results.size());
+ assertEquals("config1", results.get(0).getWorkflowResourceIds().getConfigurationId());
+ assertEquals("config2", results.get(1).getWorkflowResourceIds().getConfigurationId());
+ assertEquals("zauk53avetd02svm001", results.get(0).getConfigurationResourceKeys().getVnfcName());
+ assertEquals("zauk53avetd02tvm001", results.get(1).getConfigurationResourceKeys().getVnfcName());
+ }
+
+ @Test
+ public void selectExecutionListALaCarteVfModuleNoFabricDeleteTest() throws Exception {
+ String gAction = "deleteInstance";
+ String resource = "VfModule";
+ String bpmnRequest = readBpmnRequestFromFile(VF_MODULE_CREATE_WITH_FABRIC_JSON);
+ initExecution(gAction, bpmnRequest, true);
execution.setVariable("requestUri",
"v7/serviceInstances/f647e3ef-6d2e-4cd3-bff4-8df4634208de/vnfs/b80b16a5-f80d-4ffa-91c8-bd47c7438a3d/vfModules");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("DeactivateVfModuleBB", "DeleteVfModuleBB",
- "UnassignVfModuleBB", "DeactivateFabricConfigurationBB", "UnassignFabricConfigurationBB");
+ "UnassignVfModuleBB", "DeleteFabricConfigurationBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
@@ -1705,21 +1627,10 @@ public class WorkflowActionTest extends BaseTaskTest {
when(bbSetupUtils.getAAIVfModule(anyObject(), anyObject())).thenReturn(vfModule);
List<org.onap.aai.domain.yang.Vnfc> vnfcs = new ArrayList<org.onap.aai.domain.yang.Vnfc>();
- org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
- vnfc.setModelInvariantId("modelInvariantId");
- vnfc.setVnfcName("testVnfcName");
- vnfcs.add(vnfc);
- doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
- anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurations =
- new ArrayList<org.onap.aai.domain.yang.Configuration>();
- org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
- doReturn(configurations).when(SPY_workflowAction).getRelatedResourcesInVnfc(anyObject(), anyObject(),
+ doReturn(vnfcs).when(SPY_workflowAction).getRelatedResourcesInVfModule(anyObject(), anyObject(), anyObject(),
anyObject());
- doReturn("testName").when(SPY_workflowAction).getVnfcNameForConfiguration(anyObject());
-
SPY_workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "DeactivateVfModuleBB", "DeleteVfModuleBB", "UnassignVfModuleBB");
@@ -1729,13 +1640,8 @@ public class WorkflowActionTest extends BaseTaskTest {
public void selectExecutionListMacroResumeTest() throws Exception {
String gAction = "createInstance";
String resource = "Service";
- execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
- execution.setVariable("requestAction", gAction);
- String bpmnRequest =
- new String(Files.readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroAssign.json")));
- execution.setVariable("bpmnRequest", bpmnRequest);
- execution.setVariable("aLaCarte", false);
- execution.setVariable("apiVersion", "7");
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ASSIGN_JSON);
+ initExecution(gAction, bpmnRequest, false);
execution.setVariable("requestUri", "v6/serviceInstances/123");
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
@@ -1789,10 +1695,9 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(configurationResultWrappers).when(SPY_workflowAction).getResultWrappersFromRelationships(anyObject(),
anyObject());
- List<org.onap.aai.domain.yang.Configuration> configurationsList = SPY_workflowAction.getRelatedResourcesInVnfc(
- vnfc, org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
- assertEquals(1, configurationsList.size());
- assertEquals("testConfigurationId", configurationsList.get(0).getConfigurationId());
+ org.onap.aai.domain.yang.Configuration configuration = SPY_workflowAction.getRelatedResourcesInVnfc(vnfc,
+ org.onap.aai.domain.yang.Configuration.class, AAIObjectType.CONFIGURATION);
+ assertEquals("testConfigurationId", configuration.getConfigurationId());
}
/**
@@ -1816,33 +1721,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 +1755,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 =
@@ -2982,8 +2875,7 @@ public class WorkflowActionTest extends BaseTaskTest {
doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
doReturn(collectionResourceCustomization).when(catalogDbClient)
.getNetworkCollectionResourceCustomizationByID("123");
- String bpmnRequest = new String(Files
- .readAllBytes(Paths.get("src/test/resources/__files/Macro/ServiceMacroActivateDeleteUnassign.json")));
+ String bpmnRequest = readBpmnRequestFromFile(MACRO_ACTIVATE_DELETE_UNASSIGN_JSON);
ObjectMapper mapper = new ObjectMapper();
ServiceInstancesRequest sIRequest = mapper.readValue(bpmnRequest, ServiceInstancesRequest.class);
List<Resource> resourceCounter = new ArrayList<>();
@@ -3070,7 +2962,7 @@ public class WorkflowActionTest extends BaseTaskTest {
ExecuteBuildingBlock result = null;
try {
result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null,
- false, null, null, null, false, null, null, true);
+ false, null, null, null, false, null, null, true, null);
} catch (NullPointerException e) {
fail("NullPointerException should not be thrown when 'resource' is null");
}
@@ -3159,4 +3051,16 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(), flowNames[i]);
}
}
+
+ private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) {
+ execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
+ execution.setVariable("requestAction", gAction);
+ execution.setVariable("bpmnRequest", bpmnRequest);
+ execution.setVariable("aLaCarte", isAlaCarte);
+ execution.setVariable("apiVersion", "7");
+ }
+
+ private String readBpmnRequestFromFile(String fileName) throws IOException {
+ return new String(Files.readAllBytes(Paths.get("src/test/resources/__files/" + fileName)));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/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/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
index 59cd53edd5..b8be045f97 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIPnfResourcesTest.java
@@ -48,13 +48,18 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.aaiclient.client.aai.AAIResourcesClient;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoPnf;
import org.onap.so.client.aai.mapper.AAIObjectMapper;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@RunWith(MockitoJUnitRunner.Silent.class)
public class AAIPnfResourcesTest extends TestDataSetup {
+ public static final String TEST_VERSION = "testVersion";
private static final String PNF_NAME = "pnfTest";
+ public static final String TEST_CUSTOMIZATION_UUID = "testCustomizationUuid";
+ public static final String TEST_INVARIANT_UUID = "testInvariantUuid";
+ public static final String TEST_ROLE = "testRole";
private Pnf pnf;
private ServiceInstance serviceInstance;
@@ -110,42 +115,87 @@ public class AAIPnfResourcesTest extends TestDataSetup {
@Test
public void existingPnfInAaiWithInventoriedStatusCanBeUsed() throws Exception {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.INVENTORIED.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+ verify(aaiResourcesClientMock, times(1)).update(any(), any());
}
@Test
public void existingPnfInAaiWithNullStatusCanBeUsed() throws Exception {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
+ pnfTest.setRole("test");
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+ verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
+ }
+
+ @Test
+ public void existingPnfInAaiIsUpdated() throws Exception {
+ // given
+ org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(null);
+ Pnf pnfTest = getPnfWithTestValues();
+ when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
+ AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
+ // when
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
+ verify(aaiResourcesClientMock, times(1)).update(any(), eq(pnfFromAai));
+ verifyPnfFromAai(pnfFromAai);
+ }
+
+ private void verifyPnfFromAai(org.onap.aai.domain.yang.Pnf pnf) {
+ assertEquals(OrchestrationStatus.INVENTORIED.toString(), pnf.getOrchestrationStatus());
+ assertEquals(TEST_ROLE, pnf.getNfRole());
+ assertEquals(TEST_CUSTOMIZATION_UUID, pnf.getModelCustomizationId());
+ assertEquals(TEST_INVARIANT_UUID, pnf.getModelInvariantId());
+ assertEquals(TEST_VERSION, pnf.getModelVersionId());
+ }
+
+ private Pnf getPnfWithTestValues() {
+ Pnf pnfTest = createPnfWithDefaultName();
+ ModelInfoPnf modelInfoPnf = getModelInfoPnf();
+ pnfTest.setModelInfoPnf(modelInfoPnf);
+ pnfTest.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
+ pnfTest.setRole(TEST_ROLE);
+ return pnfTest;
+ }
+
+ private ModelInfoPnf getModelInfoPnf() {
+ ModelInfoPnf modelInfoPnf = new ModelInfoPnf();
+ modelInfoPnf.setModelCustomizationUuid(TEST_CUSTOMIZATION_UUID);
+ modelInfoPnf.setModelInvariantUuid(TEST_INVARIANT_UUID);
+ modelInfoPnf.setModelUuid(TEST_VERSION);
+ return modelInfoPnf;
}
@Test
public void existingPnfInAaiWithEmptyStatusCanBeUsed() throws Exception {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(Strings.EMPTY);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
}
@Test
public void existingPnfInAaiCanNotBeUsed() {
// given
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai = createPnf(OrchestrationStatus.ACTIVE.toString());
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
try {
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
} catch (Exception e) {
// then
assertThat(e.getMessage()).isEqualTo(String.format(
@@ -153,6 +203,7 @@ public class AAIPnfResourcesTest extends TestDataSetup {
+ "if status is not set or set as Inventoried",
PNF_NAME));
}
+ verify(aaiResourcesClientMock, times(0)).update(any(), any());
}
@Test
@@ -161,19 +212,21 @@ public class AAIPnfResourcesTest extends TestDataSetup {
final String relatedTo = "service-instance";
final String serviceInstanceId = "service-instance-id";
final String path = "src/test/resources/__files/BuildingBlocks/aaiPnf.json";
+ Pnf pnfTest = createPnfWithDefaultName();
org.onap.aai.domain.yang.Pnf pnfFromAai =
new ObjectMapper().readValue(new File(path), org.onap.aai.domain.yang.Pnf.class);
when(injectionHelperMock.getAaiClient().get(org.onap.aai.domain.yang.Pnf.class,
AAIUriFactory.createResourceUri(AAIObjectType.PNF, PNF_NAME))).thenReturn(Optional.of(pnfFromAai));
// when
try {
- testedObject.checkIfPnfExistsInAaiAndCanBeUsed(PNF_NAME);
+ testedObject.checkIfPnfExistsInAaiAndCanBeUsed(pnfTest);
} catch (Exception e) {
// then
assertThat(e.getMessage()).isEqualTo(String.format(
"Pnf with name %s exist with orchestration status %s and is related to %s service with certain service-instance-id: %s",
PNF_NAME, OrchestrationStatus.ACTIVE, relatedTo, serviceInstanceId));
}
+ verify(aaiResourcesClientMock, times(0)).update(any(), any());
}
private org.onap.aai.domain.yang.Pnf createPnf(String orchestrationStatus) {
@@ -182,4 +235,10 @@ public class AAIPnfResourcesTest extends TestDataSetup {
pnfFromAai.setOrchestrationStatus(orchestrationStatus);
return pnfFromAai;
}
+
+ private Pnf createPnfWithDefaultName() {
+ Pnf pnfTest = new Pnf();
+ pnfTest.setPnfName(PNF_NAME);
+ return pnfTest;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
index 9049fe1965..3429a16f0b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCConfigurationResourcesTest.java
@@ -35,6 +35,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.GCTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -45,7 +46,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.so.client.sdnc.mapper.GCTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCConfigurationResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
index 327bae5749..f86a712e33 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCNetworkResourcesTest.java
@@ -32,6 +32,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.NetworkTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -42,7 +43,6 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.NetworkTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCNetworkResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
index ad05ac0072..4282b0d158 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCServiceInstanceResourcesTest.java
@@ -35,6 +35,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.ServiceTopologyOperationMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -42,7 +43,6 @@ import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.ServiceTopologyOperationMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCServiceInstanceResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
index 14e993281a..813c2f7cd4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVfModuleResourcesTest.java
@@ -33,6 +33,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VfModuleTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -43,8 +44,7 @@ import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
-import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.VfModuleTopologyOperationRequestMapper;;
+import org.onap.so.client.sdnc.beans.SDNCSvcOperation;;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCVfModuleResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
index 0ccf056ddc..f9c380bc84 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/SDNCVnfResourcesTest.java
@@ -39,6 +39,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration;
import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation;
import org.onap.so.bpmn.common.data.TestDataSetup;
+import org.onap.so.bpmn.infrastructure.sdnc.mapper.VnfTopologyOperationRequestMapper;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -49,7 +50,6 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCSvcAction;
import org.onap.so.client.sdnc.beans.SDNCSvcOperation;
-import org.onap.so.client.sdnc.mapper.VnfTopologyOperationRequestMapper;
@RunWith(MockitoJUnitRunner.Silent.class)
public class SDNCVnfResourcesTest extends TestDataSetup {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
index 957c603dc9..191e0ac40e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequest.json
@@ -2,6 +2,7 @@
"ApplicationControllerTaskRequest": {
"controllerType": "TEST-CONTROLLER-NAME",
"action": "Lock",
+ "requestorId": "testRequestorId",
"identityUrl": "IDENTITY-URL-TEST",
"applicationControllerVnf": {
"vnfId": "TEST-VNF-ID",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
index 040c680d1c..724f096a4e 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/appcTaskRequestConfigModify.json
@@ -2,6 +2,7 @@
"ApplicationControllerTaskRequest": {
"controllerType": "APPC",
"action": "ConfigModify",
+ "requestorId": "testRequestorId",
"identityUrl": "IDENTITY-URL-TEST",
"applicationControllerVnf": {
"vnfId": "TEST-VNF-ID",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json
new file mode 100644
index 0000000000..ac047a9638
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/aaiVfModule.json
@@ -0,0 +1,40 @@
+{
+ "automated-assignment": false,
+ "heat-stack-id": "zauk53avetd02_base/5c7a8a55-edb8-458e-a7dc-2dbbc696682e",
+ "is-base-vf-module": true,
+ "model-customization-id": "521d5f9b-0b76-49d3-879e-fce8767f34eb",
+ "model-invariant-id": "f0ac6f78-543f-41ac-81c3-672a4d47001c",
+ "model-version-id": "215ea5bd-f0e0-4560-9f64-9a9716ff6178",
+ "module-index": 0,
+ "orchestration-status": "Active",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-link": "/aai/v20/network/vnfcs/vnfc/zauk53avetd02svm001",
+ "related-to": "vnfc",
+ "relationship-data": [
+ {
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "zauk53avetd02svm001"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ },
+ {
+ "related-link": "/aai/v20/network/vnfcs/vnfc/zauk53avetd02tvm001",
+ "related-to": "vnfc",
+ "relationship-data": [
+ {
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "zauk53avetd02tvm001"
+ }
+ ],
+ "relationship-label": "org.onap.relationships.inventory.Uses"
+ }
+ ]
+ },
+ "resource-version": "1595304004908",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/16b9c65d-70c7-47f0-aa03-7cdb8dfb76be/service-data/vnfs/vnf/9cf22c37-4f39-4fa5-a942-b72efc8f6450/vnf-data/vf-modules/vf-module/2cf0ecd4-737c-4a46-9097-adc2f0088483/vf-module-data/vf-module-topology/",
+ "vf-module-id": "2cf0ecd4-737c-4a46-9097-adc2f0088483",
+ "vf-module-name": "zauk53avetd02_base"
+} \ No newline at end of file
diff --git a/common/pom.xml b/common/pom.xml
index 6b54ad0e43..24baad746f 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -143,6 +143,10 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
diff --git a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
index c240957ae9..010e184618 100644
--- a/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
+++ b/common/src/main/java/org/onap/so/appc/orchestrator/service/beans/ApplicationControllerTaskRequest.java
@@ -11,6 +11,7 @@ public class ApplicationControllerTaskRequest implements Serializable {
private static final long serialVersionUID = -3150320542857627682L;
private Action action;
+ private String requestorId;
private String controllerType;
private String identityUrl;
private String operationsTimeout;
@@ -110,6 +111,14 @@ public class ApplicationControllerTaskRequest implements Serializable {
this.newSoftwareVersion = newSoftwareVersion;
}
+ public String getRequestorId() {
+ return requestorId;
+ }
+
+ public void setRequestorId(String requestorId) {
+ this.requestorId = requestorId;
+ }
+
}
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/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java b/common/src/main/java/org/onap/so/client/exception/MapperException.java
index 354c669d62..354c669d62 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/MapperException.java
+++ b/common/src/main/java/org/onap/so/client/exception/MapperException.java
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
index 7ae7de2ece..fff82ea5bc 100644
--- a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -22,8 +22,16 @@ public class ExternalTaskServiceUtils {
@Autowired
public Environment env;
- protected Set<ExternalTaskClient> taskClients = ConcurrentHashMap.newKeySet();
+ private static final long DEFAULT_LOCK_DURATION_LONG = 2700000;
+ private static final long DEFAULT_LOCK_DURATION_MEDIUM = 900000;
+ private static final long DEFAULT_LOCK_DURATION_SHORT = 300000;
+
+ private static final String LOCK_DURATION_LONG = "mso.workflow.topics.lockDurationLong";
+ private static final String LOCK_DURATION_MEDIUM = "mso.workflow.topics.lockDurationMedium";
+ private static final String LOCK_DURATION_SHORT = "mso.workflow.topics.lockDurationShort";
+
+ protected Set<ExternalTaskClient> taskClients = ConcurrentHashMap.newKeySet();
private static final Logger logger = LoggerFactory.getLogger(ExternalTaskServiceUtils.class);
@@ -74,4 +82,16 @@ public class ExternalTaskServiceUtils {
return taskClients;
}
+ public long getLockDurationLong() {
+ return env.getProperty(LOCK_DURATION_LONG, Long.class, new Long(DEFAULT_LOCK_DURATION_LONG));
+ }
+
+ public long getLockDurationMedium() {
+ return env.getProperty(LOCK_DURATION_MEDIUM, Long.class, new Long(DEFAULT_LOCK_DURATION_MEDIUM));
+ }
+
+ public long getLockDurationShort() {
+ return env.getProperty(LOCK_DURATION_SHORT, Long.class, new Long(DEFAULT_LOCK_DURATION_SHORT));
+ }
+
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
index 1cd23614b5..1f747e6c8c 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIClient.java
@@ -21,11 +21,13 @@
package org.onap.aaiclient.client.aai;
import java.net.URI;
+import java.util.HashMap;
+import java.util.Map;
import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.UriBuilder;
-import org.onap.so.client.RestClient;
import org.onap.aaiclient.client.graphinventory.GraphInventoryClient;
import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryUriComputationException;
+import org.onap.so.client.RestClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -36,11 +38,20 @@ public class AAIClient extends GraphInventoryClient {
protected AAIVersion version;
protected AAIClient() {
- super(AAIProperties.class);
+ super(AAIProperties.class, new HashMap<String, String>());
}
protected AAIClient(AAIVersion version) {
- super(AAIProperties.class);
+ super(AAIProperties.class, new HashMap<String, String>());
+ this.version = version;
+ }
+
+ protected AAIClient(Map<String, String> additionalHeaders) {
+ super(AAIProperties.class, additionalHeaders);
+ }
+
+ protected AAIClient(AAIVersion version, Map<String, String> additionalHeaders) {
+ super(AAIProperties.class, additionalHeaders);
this.version = version;
}
@@ -54,7 +65,7 @@ public class AAIClient extends GraphInventoryClient {
protected RestClient createClient(URI uri) {
try {
- return new AAIRestClient(getRestProperties(), constructPath(uri));
+ return new AAIRestClient(getRestProperties(), constructPath(uri), additionalHeaders);
} catch (GraphInventoryUriComputationException | NotFoundException e) {
logger.debug("failed to construct A&AI uri", e);
throw e;
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
index 238e87392f..378db87d9b 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIDSLQueryClient.java
@@ -26,16 +26,17 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.graphinventory.GraphInventoryQueryClient;
import org.onap.aaiclient.client.graphinventory.entities.DSLQuery;
import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+import com.google.common.collect.ImmutableMap;
public class AAIDSLQueryClient
extends GraphInventoryQueryClient<AAIDSLQueryClient, DSLQuery, AAIResultWrapper, AAIObjectType> {
public AAIDSLQueryClient() {
- super(new AAIClient());
+ super(new AAIClient(ImmutableMap.of("X-DslApiVersion", "V2")));
}
public AAIDSLQueryClient(AAIVersion version) {
- super(new AAIClient(version));
+ super(new AAIClient(version, ImmutableMap.of("X-DslApiVersion", "V2")));
}
@Override
@@ -53,5 +54,4 @@ public class AAIDSLQueryClient
public AAIObjectType createType(String name, String uri) {
return new AAIFluentTypeReverseLookup().fromName(name, uri);
}
-
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
index b3402fa221..2335a48d43 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIObjectType.java
@@ -63,6 +63,7 @@ import org.onap.aai.domain.yang.ServiceSubscription;
import org.onap.aai.domain.yang.SliceProfile;
import org.onap.aai.domain.yang.SpPartner;
import org.onap.aai.domain.yang.SriovPf;
+import org.onap.aai.domain.yang.SriovVf;
import org.onap.aai.domain.yang.Subnet;
import org.onap.aai.domain.yang.Tenant;
import org.onap.aai.domain.yang.TunnelXconnect;
@@ -184,6 +185,8 @@ public class AAIObjectType implements AAIObjectBase, GraphInventoryObjectType, S
new AAIObjectType(AAINamespaceConstants.NETWORK, AggregateRoute.class);
public static final AAIObjectType L_INTERFACE =
new AAIObjectType(AAIObjectType.VSERVER.uriTemplate(), LInterface.class);
+ public static final AAIObjectType SRIOV_VF =
+ new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(), SriovVf.class);
public static final AAIObjectType SUB_L_INTERFACE = new AAIObjectType(AAIObjectType.L_INTERFACE.uriTemplate(),
"/l-interfaces/l-interface/{sub-interface-name}", "sub-l-interface");
public static final AAIObjectType IMAGE = new AAIObjectType(AAIObjectType.CLOUD_REGION.uriTemplate(), Image.class);
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
index 9a8a2a53c0..0f69b0cc8f 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/aai/AAIRestClient.java
@@ -23,18 +23,20 @@ package org.onap.aaiclient.client.aai;
import java.net.URI;
import java.util.Map;
import java.util.Optional;
-import org.onap.so.client.ResponseExceptionMapper;
import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.aaiclient.client.graphinventory.GraphInventoryRestClient;
import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.so.client.ResponseExceptionMapper;
public class AAIRestClient extends GraphInventoryRestClient {
private final AAIProperties aaiProperties;
+ private final Map<String, String> additionalHeaders;
- protected AAIRestClient(AAIProperties props, URI uri) {
+ protected AAIRestClient(AAIProperties props, URI uri, Map<String, String> additionalHeaders) {
super(props, uri);
this.aaiProperties = props;
+ this.additionalHeaders = additionalHeaders;
}
@Override
@@ -46,6 +48,7 @@ public class AAIRestClient extends GraphInventoryRestClient {
protected void initializeHeaderMap(Map<String, String> headerMap) {
headerMap.put("X-FromAppId", aaiProperties.getSystemName());
headerMap.put("X-TransactionId", requestId);
+ headerMap.putAll(additionalHeaders);
String auth = aaiProperties.getAuth();
String key = aaiProperties.getKey();
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java
index a2bb8bc141..f8f977d117 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryClient.java
@@ -21,20 +21,25 @@
package org.onap.aaiclient.client.graphinventory;
import java.net.URI;
+import java.util.Map;
+import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
+import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
import org.onap.so.client.RestClient;
import org.onap.so.client.RestProperties;
import org.onap.so.client.RestPropertiesLoader;
-import org.onap.aaiclient.client.graphinventory.entities.uri.GraphInventoryUri;
-import org.onap.aaiclient.client.graphinventory.entities.uri.HttpAwareUri;
+import com.google.common.collect.ImmutableMap;
public abstract class GraphInventoryClient {
private RestProperties props;
+ protected final Map<String, String> additionalHeaders;
- protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass) {
+ protected GraphInventoryClient(Class<? extends RestProperties> propertiesClass,
+ Map<String, String> additionalHeaders) {
RestProperties props = RestPropertiesLoader.getInstance().getNewImpl(propertiesClass);
this.props = props;
+ this.additionalHeaders = additionalHeaders;
}
protected abstract URI constructPath(URI uri);
@@ -64,4 +69,8 @@ public abstract class GraphInventoryClient {
public abstract GraphInventoryVersion getVersion();
public abstract String getGraphDBName();
+
+ public Map<String, String> getAdditionalHeaders() {
+ return ImmutableMap.copyOf(this.additionalHeaders);
+ }
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java
index c749561e5f..a192e3828a 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/GraphInventoryQueryClient.java
@@ -138,4 +138,8 @@ public abstract class GraphInventoryQueryClient<S, I, Wrapper extends GraphInven
}
return clone;
}
+
+ public GraphInventoryClient getClient() {
+ return this.client;
+ }
}
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java
index c071e24391..5c88e8e42e 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLNodeBase.java
@@ -22,13 +22,17 @@ package org.onap.aaiclient.client.graphinventory.entities;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedHashSet;
import java.util.List;
+import java.util.stream.Collectors;
import org.onap.aaiclient.client.aai.entities.QueryStep;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep {
protected final String nodeName;
+ protected final Collection<String> fields;
protected final List<DSLNodeKey> nodeKeys;
protected final StringBuilder query;
protected boolean output = false;
@@ -37,6 +41,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = "";
this.nodeKeys = new ArrayList<>();
this.query = new StringBuilder();
+ this.fields = new LinkedHashSet<>();
}
@@ -44,6 +49,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = name.typeName();
this.nodeKeys = new ArrayList<>();
this.query = new StringBuilder();
+ this.fields = new LinkedHashSet<>();
query.append(nodeName);
}
@@ -51,6 +57,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = name.typeName();
this.nodeKeys = Arrays.asList(key);
this.query = new StringBuilder();
+ this.fields = new LinkedHashSet<>();
query.append(nodeName);
}
@@ -58,6 +65,7 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
this.nodeName = copy.nodeName;
this.nodeKeys = copy.nodeKeys;
this.query = new StringBuilder(copy.query);
+ this.fields = copy.fields;
this.output = copy.output;
}
@@ -67,6 +75,12 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
return new DSLOutputNode(this);
}
+ public DSLOutputNode output(String... fields) {
+ this.output = true;
+ this.fields.addAll(Arrays.asList(fields));
+ return new DSLOutputNode(this);
+ }
+
public T and(DSLNodeKey... key) {
this.nodeKeys.addAll(Arrays.asList(key));
@@ -77,7 +91,13 @@ public abstract class DSLNodeBase<T extends DSLNodeBase<?>> implements QueryStep
public String build() {
StringBuilder result = new StringBuilder(query);
if (output) {
- result.append("*");
+ if (fields.isEmpty()) {
+ result.append("*");
+ } else {
+ String items =
+ fields.stream().map(item -> String.format("'%s'", item)).collect(Collectors.joining(", "));
+ result.append("{").append(items).append("}");
+ }
}
for (DSLNodeKey key : nodeKeys) {
result.append(key.build());
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java
index 762203258a..c56ce0bfee 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/DSLQueryBuilder.java
@@ -24,6 +24,7 @@ import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import java.util.function.Consumer;
import java.util.stream.Collectors;
import org.onap.aaiclient.client.aai.entities.QueryStep;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
@@ -49,9 +50,20 @@ public class DSLQueryBuilder<S, E> {
}
public DSLQueryBuilder<S, Node> output() {
+ callOnLambda(item -> item.output());
+ return (DSLQueryBuilder<S, Node>) this;
+ }
+
+ public DSLQueryBuilder<S, Node> output(String... fields) {
+ callOnLambda(item -> item.output(fields));
+ return (DSLQueryBuilder<S, Node>) this;
+ }
+
+ protected void callOnLambda(Consumer<DSLNodeBase> consumer) {
+
Object obj = steps.get(steps.size() - 1);
if (obj instanceof DSLNodeBase) {
- ((DSLNodeBase) steps.get(steps.size() - 1)).output();
+ consumer.accept((DSLNodeBase) steps.get(steps.size() - 1));
} else if (obj.getClass().getName().contains("$$Lambda$")) {
// process lambda expressions
for (Field f : obj.getClass().getDeclaredFields()) {
@@ -60,7 +72,7 @@ public class DSLQueryBuilder<S, E> {
try {
o = f.get(obj);
if (o instanceof DSLQueryBuilder && ((DSLQueryBuilder) o).steps.get(0) instanceof DSLNodeBase) {
- ((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)).output();
+ consumer.accept(((DSLNodeBase) ((DSLQueryBuilder) o).steps.get(0)));
}
} catch (IllegalArgumentException | IllegalAccessException e) {
}
@@ -68,7 +80,6 @@ public class DSLQueryBuilder<S, E> {
break;
}
}
- return (DSLQueryBuilder<S, Node>) this;
}
@SafeVarargs
diff --git a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java
index 48feba25df..881b7e9a8e 100644
--- a/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java
+++ b/graph-inventory/aai-client/src/main/java/org/onap/aaiclient/client/graphinventory/entities/GraphInventoryRelationships.java
@@ -27,6 +27,7 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.function.Predicate;
+import java.util.function.UnaryOperator;
import org.onap.aaiclient.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectName;
import org.onap.aaiclient.client.graphinventory.GraphInventoryObjectType;
@@ -56,6 +57,11 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory
return this.getAll(Optional.of(type));
}
+ public List<Wrapper> getByType(GraphInventoryObjectName type, UnaryOperator<Uri> func) {
+
+ return this.getAll(Optional.of(type), func);
+ }
+
public List<Wrapper> getAll() {
return this.getAll(Optional.empty());
@@ -99,6 +105,10 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory
protected List<Wrapper> getAll(final Optional<GraphInventoryObjectName> type) {
+ return getAll(type, UnaryOperator.identity());
+ }
+
+ protected List<Wrapper> getAll(final Optional<GraphInventoryObjectName> type, UnaryOperator<Uri> func) {
List<Uri> relatedLinks;
if (type.isPresent()) {
relatedLinks = this.getRelatedUris(type.get());
@@ -107,7 +117,7 @@ public abstract class GraphInventoryRelationships<Wrapper extends GraphInventory
}
ArrayList<Wrapper> result = new ArrayList<>();
for (Uri link : relatedLinks) {
- result.add(this.get(link));
+ result.add(this.get(func.apply(link)));
}
return result;
}
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java
new file mode 100644
index 0000000000..36fc1db57c
--- /dev/null
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIDSLQueryClientTest.java
@@ -0,0 +1,17 @@
+package org.onap.aaiclient.client.aai;
+
+import static org.junit.Assert.assertEquals;
+import java.net.URISyntaxException;
+import org.junit.Test;
+
+public class AAIDSLQueryClientTest {
+
+
+
+ @Test
+ public void verifyHeadersTest() throws URISyntaxException {
+
+ AAIDSLQueryClient client = new AAIDSLQueryClient();
+ assertEquals("V2", client.getClient().getAdditionalHeaders().get("X-DslApiVersion"));
+ }
+}
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java
index 86738beabb..b73454fe67 100644
--- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/AAIRestClientTest.java
@@ -20,6 +20,13 @@
package org.onap.aaiclient.client.aai;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
+import static com.github.tomakehurst.wiremock.client.WireMock.getRequestedFor;
+import static com.github.tomakehurst.wiremock.client.WireMock.matching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static org.hamcrest.CoreMatchers.containsString;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
@@ -30,6 +37,7 @@ import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.HashMap;
import javax.ws.rs.core.Response;
import org.junit.Rule;
import org.junit.Test;
@@ -37,10 +45,12 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.client.RestClientSSL;
+import org.onap.aaiclient.client.defaultproperties.DefaultAAIPropertiesImpl;
import org.onap.aaiclient.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.aaiclient.client.graphinventory.exceptions.GraphInventoryPatchDepthExceededException;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import com.google.common.collect.ImmutableMap;
@RunWith(MockitoJUnitRunner.class)
public class AAIRestClientTest {
@@ -53,9 +63,12 @@ public class AAIRestClientTest {
@Rule
public ExpectedException thrown = ExpectedException.none();
+ @Rule
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
@Test
public void failPatchOnComplexObject() throws URISyntaxException {
- AAIRestClient client = new AAIRestClient(props, new URI(""));
+ AAIRestClient client = new AAIRestClient(props, new URI(""), new HashMap<String, String>());
this.thrown.expect(GraphInventoryPatchDepthExceededException.class);
this.thrown.expectMessage(containsString("Object exceeds allowed depth for update action"));
client.patch(
@@ -64,7 +77,7 @@ public class AAIRestClientTest {
@Test
public void verifyPatchValidation() throws URISyntaxException {
- AAIRestClient client = new AAIRestClient(props, new URI(""));
+ AAIRestClient client = new AAIRestClient(props, new URI(""), new HashMap<String, String>());
AAIRestClient spy = spy(client);
GraphInventoryPatchConverter patchValidatorMock = mock(GraphInventoryPatchConverter.class);
doReturn(patchValidatorMock).when(spy).getPatchConverter();
@@ -73,4 +86,14 @@ public class AAIRestClientTest {
spy.patch(payload);
verify(patchValidatorMock, times(1)).convertPatchFormat(eq((Object) payload));
}
+
+ @Test
+ public void verifyAdditionalHeadersTest() throws URISyntaxException {
+ AAIRestClient client = new AAIRestClient(new DefaultAAIPropertiesImpl(wireMockRule.port()), new URI("/test"),
+ ImmutableMap.of("test", "value"));
+ wireMockRule.stubFor(get(urlPathEqualTo("/test")).willReturn(aResponse().withStatus(200)));
+ client.get();
+ wireMockRule.verify(getRequestedFor(urlPathEqualTo("/test")).withHeader("X-FromAppId", equalTo("MSO"))
+ .withHeader("X-TransactionId", matching(".*")).withHeader("test", equalTo("value")));
+ }
}
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
index 965770c796..b0b0c6aca9 100644
--- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/DSLQueryBuilderTest.java
@@ -26,6 +26,7 @@ import org.junit.Test;
import org.onap.aaiclient.client.graphinventory.entities.DSLNodeKey;
import org.onap.aaiclient.client.graphinventory.entities.DSLQueryBuilder;
import org.onap.aaiclient.client.graphinventory.entities.DSLStartNode;
+import org.onap.aaiclient.client.graphinventory.entities.Node;
import org.onap.aaiclient.client.graphinventory.entities.Output;
import org.onap.aaiclient.client.graphinventory.entities.Start;
import org.onap.aaiclient.client.graphinventory.entities.TraversalBuilder;
@@ -146,4 +147,23 @@ public class DSLQueryBuilderTest {
"generic-vnf*('vnf-id', 'vnfId') > " + "[ pserver* > complex*, " + "vserver > pserver* > complex* ]",
builder.build().get());
}
+
+ @Test
+ public void selectOutputFilterTest() {
+ DSLQueryBuilder<Output, Output> builder = TraversalBuilder
+ .traversal(new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "CloudOwner"))
+ .output("cloud-region-id", "a", "b"));
+ builder.to(__.node(AAIObjectType.PSERVER)).output("x", "y", "z");
+
+ assertEquals("cloud-region{'cloud-region-id', 'a', 'b'}('cloud-owner', 'CloudOwner') > pserver{'x', 'y', 'z'}",
+ builder.build().toString());
+ }
+
+ @Test
+ public void selectOutputFilterOnNodeTest() {
+ DSLStartNode node = new DSLStartNode(AAIObjectType.CLOUD_REGION, __.key("cloud-owner", "CloudOwner"));
+ DSLQueryBuilder<Start, Node> builder = TraversalBuilder.fragment(node).output("cloud-region-id");
+
+ assertEquals("cloud-region{'cloud-region-id'}('cloud-owner', 'CloudOwner')", builder.build().toString());
+ }
}
diff --git a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java
index 10162f83ee..9e106fab85 100644
--- a/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java
+++ b/graph-inventory/aai-client/src/test/java/org/onap/aaiclient/client/aai/entities/RelationshipsTest.java
@@ -21,12 +21,15 @@
package org.onap.aaiclient.client.aai.entities;
import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.doReturn;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.List;
import org.junit.Test;
+import org.mockito.ArgumentCaptor;
+import org.mockito.Mockito;
import org.onap.aaiclient.client.aai.AAIObjectType;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
@@ -53,4 +56,27 @@ public class RelationshipsTest {
}
+ @Test
+ public void getByTypeTest() throws IOException {
+ final String content = new String(Files.readAllBytes(Paths.get(AAI_JSON_FILE_LOCATION + "e2e-complex.json")));
+
+ AAIResultWrapper wrapper = new AAIResultWrapper(content);
+ Relationships relationships = wrapper.getRelationships().get();
+
+ Relationships spy = Mockito.spy(relationships);
+ ArgumentCaptor<AAIResourceUri> argument = ArgumentCaptor.forClass(AAIResourceUri.class);
+ doReturn(new AAIResultWrapper("{}")).when(spy).get(argument.capture());
+
+ spy.getByType(AAIObjectType.VCE, uri -> uri.nodesOnly(true));
+
+ assertTrue(argument.getAllValues().stream().allMatch(item -> item.build().toString().contains("nodes-only")));
+
+ argument = ArgumentCaptor.forClass(AAIResourceUri.class);
+
+ doReturn(new AAIResultWrapper("{}")).when(spy).get(argument.capture());
+ spy.getByType(AAIObjectType.VCE);
+
+ assertTrue(argument.getAllValues().stream().allMatch(item -> !item.build().toString().contains("?")));
+
+ }
}
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
index 23a1a812df..4a8b7d90c6 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/FluentGenerator.java
@@ -325,13 +325,8 @@ public class FluentGenerator {
String value;
String name;
- if (params.group(2) != null) {
- name = params.group(2);
- } else {
- name = params.group(1);
- }
value = params.group(1);
-
+ name = params.group(2);
name = CaseFormat.LOWER_HYPHEN.to(CaseFormat.LOWER_CAMEL, name);
classFields.add(FieldSpec.builder(String.class, name, Modifier.PUBLIC, Modifier.FINAL)
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
index 8be22e1dcc..d27794c127 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/Patterns.java
@@ -7,5 +7,5 @@ public class Patterns {
public static final Pattern pluralPattern = Pattern.compile(".*(?<partial>/(?<name>[^{]*$))");
public static final Pattern singularPattern = Pattern.compile(".*(?<partial>/(?<name>[^/{}]*)/\\{.*$)");
public static final Pattern topLevelPattern = Pattern.compile("^/([^/]+)/.*");
- public static final Pattern urlTemplatePattern = Pattern.compile("\\{([^}.]+(?:\\.([^}]+))?)\\}");
+ public static final Pattern urlTemplatePattern = Pattern.compile("\\{((?:.+\\.)?([^}.]+))\\}");
}
diff --git a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
index 42305488bc..ec09af8a4e 100644
--- a/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
+++ b/graph-inventory/fluent-builder-maven-plugin/src/main/java/org/onap/graphinventory/generate/SwaggerConverter.java
@@ -125,8 +125,6 @@ public class SwaggerConverter {
}
}
- log.debug(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(output));
-
for (Map.Entry<String, ObjectType> item : output.entrySet()) {
if (item.getValue().getType().equals("plural")) {
@@ -156,7 +154,7 @@ public class SwaggerConverter {
Matcher templates = Patterns.urlTemplatePattern.matcher(item.getValue().getPartialUri());
List<String> localFields = new ArrayList<>();
while (templates.find()) {
- localFields.add(templates.group(1));
+ localFields.add(templates.group(2));
}
item.getValue().setFields(item.getValue().getFields().stream()
.filter(f -> localFields.contains(f.getName())).collect(Collectors.toList()));
@@ -166,6 +164,8 @@ public class SwaggerConverter {
output.values().stream().filter(item -> item.getType().equals("plural"))
.forEach(item -> item.getChildren().clear());
+ log.debug(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(output));
+
return output;
}
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
index af1258e963..65e8b438ad 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/ResponseHandler.java
@@ -32,6 +32,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
+import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -43,6 +44,7 @@ public class ResponseHandler {
String responseBody = camundaResponse.getBody();
CamundaResponse response = null;
ObjectMapper mapper = new ObjectMapper();
+ mapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
try {
response = mapper.readValue(responseBody, CamundaResponse.class);
} catch (IOException | NullPointerException e) {
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index 2f25d409d2..eb7b73caab 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -244,6 +244,10 @@
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</exclusion>
+ <exclusion>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </exclusion>
</exclusions>
</dependency>
<dependency>
@@ -265,7 +269,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/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index f39a95e92c..b59f298022 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -9,6 +9,8 @@
* ================================================================================
* Modifications Copyright (c) 2020 Nokia
* ================================================================================
+ * Modifications Copyright (c) 2020 Nordix
+ * ================================================================================
* 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
@@ -25,7 +27,28 @@
package org.onap.so.apihandlerinfra;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+import javax.transaction.Transactional;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
@@ -39,35 +62,13 @@ import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.logging.filter.base.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.serviceinstancebeans.ModelType;
-import org.onap.so.serviceinstancebeans.RequestReferences;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
-import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import javax.transaction.Transactional;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.IOException;
-import java.util.HashMap;
-import io.swagger.v3.oas.annotations.OpenAPIDefinition;
-import io.swagger.v3.oas.annotations.Operation;
-import io.swagger.v3.oas.annotations.info.Info;
-import io.swagger.v3.oas.annotations.media.ArraySchema;
-import io.swagger.v3.oas.annotations.media.Content;
-import io.swagger.v3.oas.annotations.media.Schema;
-import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/instanceManagement")
@@ -75,8 +76,8 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse;
description = "Infrastructure API Requests for Instance Management"))
public class InstanceManagement {
- private static Logger logger = LoggerFactory.getLogger(InstanceManagement.class);
- private static String uriPrefix = "/instanceManagement/";
+ private static final Logger LOG = LoggerFactory.getLogger(InstanceManagement.class);
+ private static final String URI_PREFIX = "/instanceManagement/";
private static final String SAVE_TO_DB = "save instance to db";
@Autowired
@@ -102,13 +103,13 @@ public class InstanceManagement {
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@PathParam("workflowUuid") String workflowUuid, @Context ContainerRequestContext requestContext)
throws ApiException {
- String requestId = requestHandlerUtils.getRequestId(requestContext);
- HashMap<String, String> instanceIdMap = new HashMap<>();
+ final String requestId = requestHandlerUtils.getRequestId(requestContext);
+ final Map<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("vnfInstanceId", vnfInstanceId);
instanceIdMap.put("workflowUuid", workflowUuid);
return processCustomWorkflowRequest(request, Action.inPlaceSoftwareUpdate, instanceIdMap, version, requestId,
- requestContext);
+ requestContext, true);
}
@POST
@@ -122,34 +123,61 @@ public class InstanceManagement {
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("pnfName") String pnfName,
@PathParam("workflowUuid") String workflowUuid, @Context ContainerRequestContext requestContext)
throws ApiException {
- String requestId = requestHandlerUtils.getRequestId(requestContext);
- HashMap<String, String> instanceIdMap = new HashMap<>();
+ final String requestId = requestHandlerUtils.getRequestId(requestContext);
+ final Map<String, String> instanceIdMap = new HashMap<>();
instanceIdMap.put("serviceInstanceId", serviceInstanceId);
instanceIdMap.put("pnfName", pnfName);
instanceIdMap.put("workflowUuid", workflowUuid);
- return processPNFCustomWorkflowRequest(request, Action.forCustomWorkflow, instanceIdMap, version, requestId,
- requestContext);
+ return processCustomWorkflowRequest(request, Action.forCustomWorkflow, instanceIdMap, version, requestId,
+ requestContext, false);
+ }
+
+ @POST
+ @Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/workflows/{workflowUuid}")
+ @Consumes(MediaType.APPLICATION_JSON)
+ @Produces(MediaType.APPLICATION_JSON)
+ @Operation(description = "Execute custom Service Level workflow", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
+ @Transactional
+ public Response executeServiceLevelCustomWorkflow(String request, @PathParam("version") String version,
+ @PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("workflowUuid") String workflowUuid,
+ @Context ContainerRequestContext requestContext) throws ApiException {
+ final String requestId = requestHandlerUtils.getRequestId(requestContext);
+ final Map<String, String> instanceIdMap = new HashMap<>();
+ instanceIdMap.put("serviceInstanceId", serviceInstanceId);
+ instanceIdMap.put("workflowUuid", workflowUuid);
+ return processCustomWorkflowRequest(request, Action.forCustomWorkflow, instanceIdMap, version, requestId,
+ requestContext, false);
}
- private Response processCustomWorkflowRequest(String requestJSON, Actions action,
- HashMap<String, String> instanceIdMap, String version, String requestId,
- ContainerRequestContext requestContext) throws ApiException {
- String serviceInstanceId;
- boolean aLaCarte = true;
- ServiceInstancesRequest sir;
- String apiVersion = version.substring(1);
+ private Response processCustomWorkflowRequest(final String requestJSON, final Actions action,
+ final Map<String, String> instanceIdMap, final String version, final String requestId,
+ final ContainerRequestContext requestContext, final boolean aLaCarte) throws ApiException {
+ String pnfName = null;
+ String vnfType = null;
+ String workflowUuid = null;
+ String vnfInstanceId = null;
+ String svcInstanceId = null;
+ final String apiVersion = version.substring(1);
- String requestUri = requestHandlerUtils.getRequestUri(requestContext, uriPrefix);
+ if (instanceIdMap != null && !instanceIdMap.isEmpty()) {
+ pnfName = instanceIdMap.get("pnfName");
+ workflowUuid = instanceIdMap.get("workflowUuid");
+ vnfInstanceId = instanceIdMap.get("vnfInstanceId");
+ svcInstanceId = instanceIdMap.get("serviceInstanceId");
+ }
- sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
- String requestScope = requestHandlerUtils.deriveRequestScope(action, sir, requestUri);
- InfraActiveRequests currentActiveReq =
- msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
+ final String requestUri = requestHandlerUtils.getRequestUri(requestContext, URI_PREFIX);
+ final ServiceInstancesRequest svcInsReq =
+ requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
+ final String requestScope = requestHandlerUtils.deriveRequestScope(action, svcInsReq, requestUri);
+ InfraActiveRequests currentActiveReq = msoRequest.createRequestObject(svcInsReq, action, requestId,
+ Status.IN_PROGRESS, requestJSON, requestScope);
try {
requestHandlerUtils.validateHeaders(requestContext);
} catch (ValidationException e) {
- logger.error("Exception occurred", e);
+ LOG.error("Exception occurred", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -160,42 +188,18 @@ public class InstanceManagement {
throw validateException;
}
- requestHandlerUtils.parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId,
+ requestHandlerUtils.parseRequest(svcInsReq, instanceIdMap, action, version, requestJSON, aLaCarte, requestId,
currentActiveReq);
requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
- String vnfType = msoRequest.getVnfType(sir, requestScope);
-
- if (requestScope.equalsIgnoreCase(ModelType.vnf.name()) && vnfType != null) {
+ if (requestScope.equalsIgnoreCase(ModelType.vnf.name())) {
+ vnfType = msoRequest.getVnfType(svcInsReq, requestScope);
currentActiveReq.setVnfType(vnfType);
}
checkDuplicateAndBuildError(action, instanceIdMap, requestScope, currentActiveReq);
-
- ServiceInstancesResponse serviceResponse = new ServiceInstancesResponse();
-
- RequestReferences referencesResponse = new RequestReferences();
-
- referencesResponse.setRequestId(requestId);
-
- serviceResponse.setRequestReferences(referencesResponse);
- boolean isBaseVfModule = false;
-
- String workflowUuid = null;
- if (instanceIdMap != null) {
- workflowUuid = instanceIdMap.get("workflowUuid");
- }
-
- RecipeLookupResult recipeLookupResult = getInstanceManagementWorkflowRecipe(currentActiveReq, workflowUuid);
-
- String serviceInstanceType = requestHandlerUtils.getServiceType(requestScope, sir, true);
-
- serviceInstanceId = requestHandlerUtils.setServiceInstanceId(requestScope, sir);
- String vnfId = "";
-
- if (sir.getVnfInstanceId() != null) {
- vnfId = sir.getVnfInstanceId();
- }
+ final RecipeLookupResult recipeLookupResult =
+ getInstanceManagementWorkflowRecipe(currentActiveReq, workflowUuid);
currentActiveReq = setWorkflowNameAndOperationName(currentActiveReq, workflowUuid);
saveCurrentActiveRequest(currentActiveReq);
@@ -203,11 +207,11 @@ public class InstanceManagement {
RequestClientParameter requestClientParameter;
try {
requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
- .setBaseVfModule(isBaseVfModule).setRecipeTimeout(recipeLookupResult.getRecipeTimeout())
- .setRequestAction(action.toString()).setServiceInstanceId(serviceInstanceId).setVnfId(vnfId)
- .setServiceType(serviceInstanceType).setVnfType(vnfType)
+ .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString())
+ .setServiceInstanceId(svcInstanceId).setVnfId(vnfInstanceId).setVnfType(vnfType)
+ .setPnfCorrelationId(pnfName).setApiVersion(apiVersion)
.setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action))
- .setApiVersion(apiVersion).setALaCarte(aLaCarte).setRequestUri(requestUri).build();
+ .setALaCarte(aLaCarte).setRequestUri(requestUri).build();
} catch (IOException e) {
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
@@ -232,7 +236,7 @@ public class InstanceManagement {
}
}
- private void checkDuplicateAndBuildError(Actions action, HashMap<String, String> instanceIdMap, String requestScope,
+ private void checkDuplicateAndBuildError(Actions action, Map<String, String> instanceIdMap, String requestScope,
InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup =
@@ -248,74 +252,6 @@ public class InstanceManagement {
}
}
- private Response processPNFCustomWorkflowRequest(String requestJSON, Actions action,
- HashMap<String, String> instanceIdMap, String version, String requestId,
- ContainerRequestContext requestContext) throws ApiException {
- boolean aLaCarte = false;
- ServiceInstancesRequest sir;
- String apiVersion = version.substring(1);
-
- String serviceInstanceId = "";
- String pnfName = "";
- String workflowUuid = "";
- if (instanceIdMap != null) {
- serviceInstanceId = instanceIdMap.get("serviceInstanceId");
- pnfName = instanceIdMap.get("pnfName");
- workflowUuid = instanceIdMap.get("workflowUuid");
- }
-
- String requestUri = requestHandlerUtils.getRequestUri(requestContext, uriPrefix);
- sir = requestHandlerUtils.convertJsonToServiceInstanceRequest(requestJSON, action, requestId, requestUri);
- sir.setServiceInstanceId(serviceInstanceId);
- sir.setPnfName(pnfName);
- String requestScope = ModelType.pnf.name();
- InfraActiveRequests currentActiveReq =
- msoRequest.createRequestObject(sir, action, requestId, Status.IN_PROGRESS, requestJSON, requestScope);
-
- try {
- requestHandlerUtils.validateHeaders(requestContext);
- } catch (ValidationException e) {
- logger.error("Exception occurred", e);
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
- throw validateException;
- }
-
- requestHandlerUtils.parseRequest(sir, instanceIdMap, action, version, requestJSON, aLaCarte, requestId,
- currentActiveReq);
- requestHandlerUtils.setInstanceId(currentActiveReq, requestScope, null, instanceIdMap);
-
- checkDuplicateAndBuildError(action, instanceIdMap, requestScope, currentActiveReq);
-
- RecipeLookupResult recipeLookupResult = getInstanceManagementWorkflowRecipe(currentActiveReq, workflowUuid);
-
- currentActiveReq = setWorkflowNameAndOperationName(currentActiveReq, workflowUuid);
- saveCurrentActiveRequest(currentActiveReq);
-
- RequestClientParameter requestClientParameter;
- try {
- requestClientParameter = new RequestClientParameter.Builder().setRequestId(requestId)
- .setRecipeTimeout(recipeLookupResult.getRecipeTimeout()).setRequestAction(action.toString())
- .setServiceInstanceId(serviceInstanceId).setPnfCorrelationId(pnfName)
- .setRequestDetails(requestHandlerUtils.mapJSONtoMSOStyle(requestJSON, null, aLaCarte, action))
- .setApiVersion(apiVersion).setRequestUri(requestUri).build();
- } catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_RESPONSE_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
- throw new ValidateException.Builder("Unable to generate RequestClientParamter object" + e.getMessage(),
- HttpStatus.SC_INTERNAL_SERVER_ERROR, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo)
- .build();
- }
- return requestHandlerUtils.postBPELRequest(currentActiveReq, requestClientParameter,
- recipeLookupResult.getOrchestrationURI(), requestScope);
- }
-
private RecipeLookupResult getInstanceManagementWorkflowRecipe(InfraActiveRequests currentActiveReq,
String workflowUuid) throws ApiException {
RecipeLookupResult recipeLookupResult;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
index f3c3ec5ff1..4ac8b73698 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
@@ -154,9 +154,8 @@ public class MsoRequest {
// Parse request JSON
- public void parse(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action,
- String version, String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag)
- throws ValidationException, IOException {
+ public void parse(ServiceInstancesRequest sir, Map<String, String> instanceIdMap, Actions action, String version,
+ String originalRequestJSON, int reqVersion, Boolean aLaCarteFlag) throws ValidationException, IOException {
logger.debug("Validating the Service Instance request");
List<ValidationRule> rules = new ArrayList<>();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index a61975f529..a68309f199 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -261,8 +261,8 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
}
- public InfraActiveRequests duplicateCheck(Actions action, HashMap<String, String> instanceIdMap,
- String instanceName, String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
+ public InfraActiveRequests duplicateCheck(Actions action, Map<String, String> instanceIdMap, String instanceName,
+ String requestScope, InfraActiveRequests currentActiveReq) throws ApiException {
InfraActiveRequests dup = null;
try {
if (!(instanceName == null && "service".equals(requestScope) && (action == Action.createInstance
@@ -332,7 +332,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
}
- public void parseRequest(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action,
+ public void parseRequest(ServiceInstancesRequest sir, Map<String, String> instanceIdMap, Actions action,
String version, String requestJSON, Boolean aLaCarte, String requestId,
InfraActiveRequests currentActiveReq) throws ValidateException, RequestDbFailureException {
int reqVersion = Integer.parseInt(version.substring(1));
@@ -354,7 +354,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
public void buildErrorOnDuplicateRecord(InfraActiveRequests currentActiveReq, Actions action,
- HashMap<String, String> instanceIdMap, String instanceName, String requestScope, InfraActiveRequests dup)
+ Map<String, String> instanceIdMap, String instanceName, String requestScope, InfraActiveRequests dup)
throws ApiException {
String instance = null;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index 357497591d..0f7cf5fc6a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -81,12 +81,13 @@ public class WorkflowSpecificationsHandler {
@Transactional
public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId,
- @QueryParam("pnfModelVersionId") String pnfModelVersionId, @PathParam("version") String version)
+ @QueryParam("pnfModelVersionId") String pnfModelVersionId,
+ @QueryParam("resourceTarget") String resourceTarget, @PathParam("version") String version)
throws Exception {
String apiVersion = version.substring(1);
List<Workflow> workflows = new ArrayList<>();
- if (vnfModelVersionId == null && pnfModelVersionId == null) {
+ if (vnfModelVersionId == null && pnfModelVersionId == null && resourceTarget == null) {
workflows.addAll(queryWorkflowSpecificationsForAll());
} else {
// 1. query workflow specifications for given vnfModelVersionId if need.
@@ -106,6 +107,16 @@ public class WorkflowSpecificationsHandler {
workflows.addAll(pnfWorkflows);
}
}
+
+ // 3. query workflow specifications for given resourceTarget
+ if (resourceTarget != null) {
+ List<Workflow> workflowsForResourceTarget = queryWorkflowsForResourceTarget(resourceTarget);
+ logger.debug(
+ "Retrieved " + workflowsForResourceTarget.size() + " workflows for given resource target.");
+ if (workflowsForResourceTarget.size() > 0) {
+ workflows.addAll(workflowsForResourceTarget);
+ }
+ }
}
// Deduplication
@@ -119,11 +130,16 @@ public class WorkflowSpecificationsHandler {
apiVersion);
}
+ /**
+ * @deprecated As of G release, workflows for all resource types (pnf,vnf,service) can be fetched using
+ * /workflowSpecifications/{version:[vV]1}/workflows?resourceTarget={resourceType} API
+ */
@Path("/{version:[vV]1}/pnfWorkflows")
@GET
@Operation(description = "Finds pnf workflow specifications", responses = @ApiResponse(
content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
+ @Deprecated
public Response getWorkflowsSpecForPnf(@PathParam("version") String version) throws Exception {
final String pnf_resource = "pnf";
@@ -132,7 +148,7 @@ public class WorkflowSpecificationsHandler {
ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
- List<Workflow> workflows = catalogDbClient.findWorkflowByResourceTarget(pnf_resource);
+ List<Workflow> workflows = queryWorkflowsForResourceTarget(pnf_resource);
Optional<String> optional = getResponseByWorkflowSpec(workflows);
return builder.buildResponse(HttpStatus.SC_OK, "", optional.isPresent() ? optional.get() : EMPTY_BODY,
@@ -296,4 +312,11 @@ public class WorkflowSpecificationsHandler {
List<Workflow> workflows = catalogDbClient.findWorkflowByPnfModelUUID(pnfModelVersionId);
return workflows;
}
+
+ private List<Workflow> queryWorkflowsForResourceTarget(String resourceTarget) {
+ List<Workflow> workflows = catalogDbClient.findWorkflowByResourceTarget(resourceTarget);
+ return workflows;
+ }
+
+
}
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/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
index c806e9fc1b..fec512ac44 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandler.java
@@ -163,12 +163,14 @@ public abstract class AbstractRestHandler {
try {
URL aUrl = new URL(url);
String aPath = aUrl.getPath();
- if (aPath.indexOf("/v") == -1) {
- version = aPath.substring(aPath.indexOf("/V"), aPath.indexOf("/V") + 4);
- } else {
- version = aPath.substring(aPath.indexOf("/v"), aPath.indexOf("/v") + 4);
- }
- String selfLinkPath = Constants.ORCHESTRATION_REQUESTS_PATH.concat(version).concat(requestId);
+ int indexOfVersion = Math.max(aPath.indexOf("/V"), aPath.indexOf("/v"));
+ version = aPath.substring(indexOfVersion, indexOfVersion + 4);
+
+ String pathWithSOAction = aPath.substring(0, indexOfVersion);
+ String pathWithoutSOAction = pathWithSOAction.substring(0, pathWithSOAction.lastIndexOf("/"));
+
+ String selfLinkPath =
+ pathWithoutSOAction.concat(Constants.ORCHESTRATION_REQUESTS_PATH).concat(version).concat(requestId);
selfLinkUrl = Optional.of(new URL(aUrl.getProtocol(), aUrl.getHost(), aUrl.getPort(), selfLinkPath));
} catch (Exception e) {
selfLinkUrl = Optional.empty(); // ignore
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
index 2cf01f9390..55a68ff7df 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/InstanceIdMapValidation.java
@@ -21,7 +21,7 @@
package org.onap.so.apihandlerinfra.validation;
-import java.util.HashMap;
+import java.util.Map;
import org.onap.so.apihandler.common.CommonConstants;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -31,6 +31,7 @@ public class InstanceIdMapValidation implements ValidationRule {
private static final String Service_InstanceId = "serviceInstanceId";
private static final String Vnf_InstanceId = "vnfInstanceId";
+ private static final String PNF_NAME = "pnfName";
private static final String vfModule_InstanceId = "vfModuleInstanceId";
private static final String volume_Group_InstanceId = "volumeGroupInstanceId";
@@ -39,7 +40,7 @@ public class InstanceIdMapValidation implements ValidationRule {
@Override
public ValidationInformation validate(ValidationInformation info) throws ValidationException {
- HashMap<String, String> instanceIdMap = info.getInstanceIdMap();
+ Map<String, String> instanceIdMap = info.getInstanceIdMap();
ServiceInstancesRequest sir = info.getSir();
if (instanceIdMap != null) {
if (instanceIdMap.get(Service_InstanceId) != null) {
@@ -90,6 +91,10 @@ public class InstanceIdMapValidation implements ValidationRule {
}
sir.setInstanceGroupId(instanceIdMap.get(CommonConstants.INSTANCE_GROUP_INSTANCE_ID));
}
+
+ if (instanceIdMap.get(PNF_NAME) != null) {
+ sir.setPnfName(instanceIdMap.get(PNF_NAME));
+ }
}
return info;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java
index 68b2a78a85..ee4fde02eb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ValidationInformation.java
@@ -21,7 +21,7 @@
package org.onap.so.apihandlerinfra.validation;
-import java.util.HashMap;
+import java.util.Map;
import org.onap.so.apihandlerinfra.Actions;
import org.onap.so.serviceinstancebeans.LineOfBusiness;
import org.onap.so.serviceinstancebeans.OwningEntity;
@@ -34,7 +34,7 @@ import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
public class ValidationInformation {
ServiceInstancesRequest sir;
- HashMap<String, String> instanceIdMap;
+ Map<String, String> instanceIdMap;
Actions action;
int reqVersion;
String requestScope;
@@ -53,7 +53,7 @@ public class ValidationInformation {
OwningEntity owningEntity;
Service userParams;
- public ValidationInformation(ServiceInstancesRequest sir, HashMap<String, String> instanceIdMap, Actions action,
+ public ValidationInformation(ServiceInstancesRequest sir, Map<String, String> instanceIdMap, Actions action,
int reqVersion, Boolean aLaCarteFlag, RequestParameters requestParameters) {
this.sir = sir;
this.instanceIdMap = instanceIdMap;
@@ -71,11 +71,11 @@ public class ValidationInformation {
this.sir = value;
}
- public HashMap<String, String> getInstanceIdMap() {
+ public Map<String, String> getInstanceIdMap() {
return this.instanceIdMap;
}
- public void setInstanceIdMap(HashMap<String, String> value) {
+ public void setInstanceIdMap(Map<String, String> value) {
this.instanceIdMap = value;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
index 5da16f4326..0ca98883c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
@@ -70,6 +70,10 @@ public abstract class BaseTest {
return "http://localhost:" + port + uri;
}
+ protected String createURLWithPort(String uri, String orchestrationPath) {
+ return "http://localhost:" + port + orchestrationPath + uri;
+ }
+
protected String createURLWithPort(String uri, int iPort) {
return "http://localhost:" + iPort + uri;
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
index 081f235db1..7b2e502892 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
@@ -29,10 +29,12 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
-import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_PARTNER_NAME;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
+import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -46,7 +48,6 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.RequestReferences;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.springframework.beans.factory.annotation.Autowired;
@@ -57,8 +58,6 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.util.ResourceUtils;
import org.springframework.web.util.UriComponentsBuilder;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.ObjectMapper;
public class InstanceManagementTest extends BaseTest {
@@ -72,6 +71,7 @@ public class InstanceManagementTest extends BaseTest {
private String wiremockPort;
private final String instanceManagementUri = "/onap/so/infra/instanceManagement/";
+ private final String orchestration_path = "/onap/so/infra";
private String uri;
private URL selfLink;
@@ -93,7 +93,7 @@ public class InstanceManagementTest extends BaseTest {
headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
- initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
+ initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH, orchestration_path));
initialPort = initialUrl.getPort();
} catch (MalformedURLException e) {
e.printStackTrace();
@@ -208,6 +208,35 @@ public class InstanceManagementTest extends BaseTest {
}
@Test
+ public void executeServiceLevelCustomWorkflow() throws IOException {
+ wireMockServer.stubFor(post(urlPathEqualTo("/mso/async/services/testingServiceLevelWorkflow"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBodyFile("Camunda/TestResponse.json").withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching(
+ ".*/workflow/search/findByArtifactUUID[?]artifactUUID=81526781-e55c-4cb7-adb3-97e09d9c76bf"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb("workflow_ServiceLevel_Response.json"))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ // expected response
+ ServiceInstancesResponse expectedResponse = new ServiceInstancesResponse();
+ RequestReferences requestReferences = new RequestReferences();
+ requestReferences.setInstanceId("1882939");
+ requestReferences.setRequestSelfLink(createExpectedSelfLink("v1", "32807a28-1a14-4b88-b7b3-2950918aa76d"));
+ expectedResponse.setRequestReferences(requestReferences);
+ uri = instanceManagementUri + "v1"
+ + "/serviceInstances/5df8b6de-2083-11e7-93ae-92361f002676/workflows/81526781-e55c-4cb7-adb3-97e09d9c76bf";
+ ResponseEntity<String> response =
+ sendRequest(inputStream("/ExecuteServiceLevelCustomWorkflow.json"), uri, HttpMethod.POST, headers);
+
+ assertEquals(Response.Status.ACCEPTED.getStatusCode(), response.getStatusCode().value());
+
+ ServiceInstancesResponse realResponse = mapper.readValue(response.getBody(), ServiceInstancesResponse.class);
+ assertThat(realResponse, sameBeanAs(expectedResponse).ignoring("requestReferences.requestId"));
+ }
+
+ @Test
public void workflowAndOperationNameTest() {
wireMockServer.stubFor(get(urlMatching(
".*/workflow/search/findByArtifactUUID[?]artifactUUID=71526781-e55c-4cb7-adb3-97e09d9c76be"))
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 9b892af869..7711608288 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -133,7 +133,6 @@ public class OrchestrationRequestsTest extends BaseTest {
testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
RequestProcessingData e = new RequestProcessingData();
e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- e.setTag("pincFabricConfigRequest");
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
HashMap<String, String> data1 = new HashMap<String, String>();
data1.put("requestAction", "assign");
@@ -210,7 +209,6 @@ public class OrchestrationRequestsTest extends BaseTest {
testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
RequestProcessingData e = new RequestProcessingData();
e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- e.setTag("pincFabricConfigRequest");
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
HashMap<String, String> data1 = new HashMap<String, String>();
data1.put("requestAction", "assign");
@@ -256,7 +254,6 @@ public class OrchestrationRequestsTest extends BaseTest {
testResponse.getRequest().setRequestProcessingData(new ArrayList<RequestProcessingData>());
RequestProcessingData e = new RequestProcessingData();
e.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- e.setTag("pincFabricConfigRequest");
List<HashMap<String, String>> data = new ArrayList<HashMap<String, String>>();
HashMap<String, String> data1 = new HashMap<String, String>();
data1.put("requestAction", "assign");
@@ -463,13 +460,11 @@ public class OrchestrationRequestsTest extends BaseTest {
HashMap<String, String> secondExpectedMap = new HashMap<>();
List<RequestProcessingData> expectedDataList = new ArrayList<>();
entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
- entry.setTag("pincFabricConfigRequest");
expectedMap.put("requestAction", "assign");
- expectedMap.put("pincFabricId", "testId");
+ expectedMap.put("fabricId", "testId");
expectedList.add(expectedMap);
entry.setDataPairs(expectedList);
secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
- secondEntry.setTag("pincFabricConfig");
secondExpectedMap.put("requestAction", "unassign");
secondExpectedList.add(secondExpectedMap);
secondEntry.setDataPairs(secondExpectedList);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index ef90b22b01..33d86a2cc6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -1,8 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +13,8 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
* ============LICENSE_END=========================================================
*/
@@ -97,6 +97,8 @@ public class ServiceInstancesTest extends BaseTest {
private final String servInstanceuri = "/onap/so/infra/serviceInstantiation/";
private final String servInstanceUriPrev7 = "/onap/so/infra/serviceInstances/";
+ private final String orchestration_path = "/onap/so/infra";
+
private String uri;
private URL selfLink;
private URL initialUrl;
@@ -115,7 +117,7 @@ public class ServiceInstancesTest extends BaseTest {
headers.set(ONAP_PARTNER_NAME, "VID");
headers.set(REQUESTOR_ID, "xxxxxx");
try { // generate one-time port number to avoid RANDOM port number later.
- initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH));
+ initialUrl = new URL(createURLWithPort(Constants.ORCHESTRATION_REQUESTS_PATH, orchestration_path));
initialPort = initialUrl.getPort();
} catch (MalformedURLException e) {
e.printStackTrace();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
index 4ab88f40f6..1fa71cefc2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandlerTest.java
@@ -58,6 +58,9 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
@Autowired
WorkflowSpecificationsHandler workflowSpecificationsHandler;
+ @Autowired
+ ObjectMapper mapper;
+
@Value("${wiremock.server.port}")
private String wiremockPort;
@@ -152,7 +155,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WorkflowSpecifications expectedResponse = mapper.readValue(
@@ -306,7 +308,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
WorkflowSpecifications workflowSpecifications =
workflowSpecificationsHandler.mapWorkflowsToWorkflowSpecifications(workflows);
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
String workflowSpecificationsJson = mapper.writeValueAsString(workflowSpecifications);
@@ -349,7 +350,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WorkflowSpecifications expectedResponse = mapper.readValue(
@@ -367,6 +367,52 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
}
@Test
+ public void queryWorkflowSpecificationsByResourceTarget_Test_Success() throws JSONException, IOException {
+
+ String URL_PATH = basePath + "/v1/workflows";
+ HttpHeaders headers = new HttpHeaders();
+ headers.set("Accept", MediaType.APPLICATION_JSON);
+ headers.set("Content-Type", MediaType.APPLICATION_JSON);
+ HttpEntity<String> entity = new HttpEntity<String>(null, headers);
+ String WORKFLOW_QUERY = "/workflow/search/findByResourceTarget[?]resourceTarget=service";
+ String WORKFLOW_SPEC_QUERY = "/workflow/5/workflowActivitySpecSequence";
+ String JSON_FILE_PATH = "src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json";
+ String MOCK_RESP_FILE = "WorkflowSpecificationsForServiceWorkflows_Response.json";
+ String MOCK_RESP_SPEC_FILE = "Empty_workflowActivitySpecSequence_Response.json";
+
+ wireMockServer.stubFor(get(urlMatching(WORKFLOW_QUERY))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(MOCK_RESP_FILE))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ wireMockServer.stubFor(get(urlMatching(WORKFLOW_SPEC_QUERY))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(getWiremockResponseForCatalogdb(MOCK_RESP_SPEC_FILE))
+ .withStatus(org.apache.http.HttpStatus.SC_OK)));
+
+ UriComponentsBuilder builder =
+ UriComponentsBuilder.fromHttpUrl(createURLWithPort(URL_PATH)).queryParam("resourceTarget", "service");
+
+ ResponseEntity<String> response =
+ restTemplate.exchange(builder.toUriString(), HttpMethod.GET, entity, String.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+
+ mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
+
+ WorkflowSpecifications expectedResponse = mapper
+ .readValue(new String(Files.readAllBytes(Paths.get(JSON_FILE_PATH))), WorkflowSpecifications.class);
+ WorkflowSpecifications realResponse = mapper.readValue(response.getBody(), WorkflowSpecifications.class);
+
+ assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
+ assertThat(expectedResponse, sameBeanAs(realResponse));
+ assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
+ assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
+ assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
+ assertEquals("1.0.0", response.getHeaders().get("X-LatestVersion").get(0));
+ }
+
+ @Test
public void testWorkflowSpecificationsForPnf_Success() throws JSONException, IOException {
final String urlPath = basePath + "/v1/pnfWorkflows";
@@ -397,7 +443,6 @@ public class WorkflowSpecificationsHandlerTest extends BaseTest {
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
- ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WorkflowSpecifications expectedResponse = mapper.readValue(
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
index d39192cdf0..6c643c77d7 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/infra/rest/handler/AbstractRestHandlerTest.java
@@ -61,4 +61,15 @@ public class AbstractRestHandlerTest {
restHandler.createResponse("instanceId", "requestId", mockRequestContext);
assertThat(actualResponse, sameBeanAs(expectedResponse));
}
+
+ @Test
+ public void test_buildSelfLinkUrl() throws MalformedURLException {
+ String initialLink = "http://some.domain.com:30277/onap/so/infra/serviceInstantiation/v7/serviceInstances";
+ String requestId = "4d0437c3-ee48-4361-a4f7-e1613c82493a";
+ Optional<URL> expectedLink = Optional.of(new URL(
+ "http://some.domain.com:30277/onap/so/infra/orchestrationRequests/v7/4d0437c3-ee48-4361-a4f7-e1613c82493a"));
+ Optional<URL> resultURL = restHandler.buildSelfLinkUrl(initialLink, requestId);
+
+ assertThat(resultURL, sameBeanAs(expectedLink));
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
index 79caa33419..a84b2dbe11 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
@@ -4,21 +4,18 @@
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
"name": "requestAction",
- "value": "assign",
- "tag": "pincFabricConfigRequest"
+ "value": "assign"
},{
"id": 2,
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
- "name": "pincFabricId",
- "value": "testId",
- "tag": "pincFabricConfigRequest"
+ "name": "fabricId",
+ "value": "testId"
},{
"id": 3,
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca715",
"name": "requestAction",
- "value": "unassign",
- "tag": "pincFabricConfig"
+ "value": "unassign"
}
] \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
index af28007900..6ebe55201a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
@@ -3,6 +3,5 @@
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
"name": "requestAction",
- "value": "assign",
- "tag": "pincFabricConfigRequest"
+ "value": "assign"
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
index c746020e7f..c3554c86a5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingDataArray.json
@@ -3,6 +3,5 @@
"soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
"groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
"name": "requestAction",
- "value": "assign",
- "tag": "pincFabricConfigRequest"
+ "value": "assign"
}]
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecuteServiceLevelCustomWorkflow.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecuteServiceLevelCustomWorkflow.json
new file mode 100644
index 0000000000..e466ac08a3
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/ExecuteServiceLevelCustomWorkflow.json
@@ -0,0 +1,39 @@
+{
+ "requestDetails":{
+ "subscriberInfo":{
+ "globalSubscriberId":"Test"
+ },
+ "requestInfo":{
+ "suppressRollback": false,
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "requestorId": "demo",
+ "instanceName":"testInstanceName",
+ "source":"VID"
+ },
+ "cloudConfiguration":{
+ "lcpCloudRegionId": "RegionOne",
+ "tenantId": "7320ec4a5b9d4589ba7c4412ccfd290f",
+ "cloudOwner": "CloudOwner"
+ },
+ "requestParameters":{
+ "subscriptionServiceType": "test",
+ "userParams":[],
+ "aLaCarte": false,
+ "payload": "{\"k1\": \"v1\"}"
+ },
+ "project":{
+ "projectName": "PNFSWUProject"
+ },
+ "owningEntity":{
+ "owningEntityId":"67f2e84c-734d-4e90-a1e4-d2ffa2e75849",
+ "owningEntityName":"OE-Test"
+ },
+ "modelInfo":{
+ "modelVersion": "2.0",
+ "modelVersionId": "d88da85c-d9e8-4f73-b837-3a72a431622b",
+ "modelInvariantId": "fe41489e-1563-46a3-b90a-1db629e4375b",
+ "modelName": "Demo_svc",
+ "modelType": "service"
+ }
+ }
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json
new file mode 100644
index 0000000000..aaaad17470
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForService.json
@@ -0,0 +1,20 @@
+{
+ "workflowSpecificationList": [
+ {
+ "workflowSpecification": {
+ "artifactInfo": {
+ "artifactType": "workflow",
+ "artifactUuid": "a1fe8726-66d5-3e7f-2212-7e5h662e9255",
+ "artifactName": "DummyServiceWorkflow",
+ "artifactVersion": "1.0",
+ "artifactDescription": "Dummy Service Workflow to test custom Service workflow",
+ "workflowName": "Dummy Service Workflow",
+ "operationName": "DummyServiceWorkflow",
+ "workflowSource": "native",
+ "workflowResourceTarget": "service"
+ },
+ "workflowInputParameters": []
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json
new file mode 100644
index 0000000000..9a836e033b
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/WorkflowSpecificationsForServiceWorkflows_Response.json
@@ -0,0 +1,41 @@
+{
+ "_embedded": {
+ "workflow": [
+ {
+ "artifactChecksum": "MANUAL RECORD",
+ "artifactName": "DummyServiceWorkflow",
+ "artifactUUID": "a1fe8726-66d5-3e7f-2212-7e5h662e9255",
+ "body": null,
+ "created": "2020-06-29T08:28:15.000+0000",
+ "description": "Dummy Service Workflow to test custom Service workflow",
+ "id": 4,
+ "name": "Dummy Service Workflow",
+ "operationName": "DummyServiceWorkflow",
+ "pnfResourceWorkflow": null,
+ "resourceTarget": "service",
+ "source": "native",
+ "timeoutMinutes": null,
+ "version": 1.0,
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findByResourceTarget?resourceTarget=service"
+ },
+ "workflow": {
+ "href": "http://localhost:8090/workflow/5"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/5/workflowActivitySpecSequence"
+ }
+ }
+ }
+ ]
+ },
+ "_links": {
+ "self": {
+ "href": "http://localhost:8090/workflow/search/findByResourceTarget?resourceTarget=service"
+ },
+ "workflowActivitySpecSequence": {
+ "href": "http://localhost:8090/workflow/5/workflowActivitySpecSequence"
+ }
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_ServiceLevel_Response.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_ServiceLevel_Response.json
new file mode 100644
index 0000000000..133c724b43
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/__files/catalogdb/workflow_ServiceLevel_Response.json
@@ -0,0 +1,6 @@
+{
+ "artifactUUID": "81526781-e55c-4cb7-adb3-97e09d9c76bf",
+ "artifactName": "testingServiceLevelWorkflow.bpmn",
+ "name": "testingServiceLevelWorkflow",
+ "operationName": "testServiceLevelOperation"
+}
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index 1862bd15ff..f895738788 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -103,30 +103,6 @@
</build>
</image>
<image>
- <name>${docker.image.prefix}/ve-vnfm-adapter</name>
- <build>
- <cleanup>try</cleanup>
- <dockerFile>docker-files/Dockerfile.so-app</dockerFile>
- <tags>
- <tag>${project.version}</tag>
- <tag>${project.version}-${maven.build.timestamp}</tag>
- <tag>${project.docker.latesttag.version}</tag>
- </tags>
- <assembly>
- <inline>
- <dependencySets>
- <dependencySet>
- <includes>
- <include>org.onap.so.adapters:etsi-sol002-adapter</include>
- </includes>
- <outputFileNameMapping>app.jar</outputFileNameMapping>
- </dependencySet>
- </dependencySets>
- </inline>
- </assembly>
- </build>
- </image>
- <image>
<name>${docker.image.prefix}/catalog-db-adapter</name>
<build>
<cleanup>try</cleanup>
diff --git a/pom.xml b/pom.xml
index 264b3d9020..68559c99c4 100644
--- a/pom.xml
+++ b/pom.xml
@@ -28,6 +28,8 @@
<module>mso-api-handlers</module>
<module>adapters</module>
<module>asdc-controller</module>
+ <module>so-optimization-clients</module>
+ <module>so-sdn-clients</module>
<module>bpmn</module>
<module>cloudify-client</module>
<module>cxf-logging</module>
@@ -71,7 +73,7 @@
<format.skipValidate>false</format.skipValidate>
<format.skipExecute>true</format.skipExecute>
<io.fabric8.version>0.33.0</io.fabric8.version>
- <appc.client.version>1.7.1</appc.client.version>
+ <appc.client.version>1.8.0-SNAPSHOT</appc.client.version>
<bowman.client.version>0.8.0</bowman.client.version>
<aaf.cadi.version>2.1.15</aaf.cadi.version>
</properties>
@@ -867,17 +869,17 @@
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-slf4j</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.7</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-base</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.7</version>
</dependency>
<dependency>
<groupId>org.onap.logging-analytics</groupId>
<artifactId>logging-filter-spring</artifactId>
- <version>1.6.7-SNAPSHOT</version>
+ <version>1.6.7</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
@@ -913,7 +915,7 @@
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
- <version>1.23</version>
+ <version>1.26</version>
</dependency>
<dependency>
<groupId>javax.interceptor</groupId>
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-sdn-clients/pom.xml b/so-sdn-clients/pom.xml
new file mode 100644
index 0000000000..c9b417b230
--- /dev/null
+++ b/so-sdn-clients/pom.xml
@@ -0,0 +1,173 @@
+<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-sdn-clients</artifactId>
+ <properties>
+ <sdnc.northbound.version>1.5.2</sdnc.northbound.version>
+ </properties>
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>default-test</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/UnitTestSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <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>
+ <pluginManagement>
+ <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>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <versionRange>[1.0.0,)</versionRange>
+ <goals>
+ <goal>unpack</goal>
+ </goals>
+ </pluginExecutionFilter>
+ <action>
+ <execute />
+ </action>
+ </pluginExecution>
+ </pluginExecutions>
+ </lifecycleMappingMetadata>
+ </configuration>
+ </plugin>
+ </plugins>
+ </pluginManagement>
+ </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.onap.sdnc.northbound</groupId>
+ <artifactId>generic-resource-api-client</artifactId>
+ <version>${sdnc.northbound.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>jsr311-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>io.swagger</groupId>
+ <artifactId>swagger-models</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ <dependency>
+ <groupId>ch.vorburger.mariaDB4j</groupId>
+ <artifactId>mariaDB4j</artifactId>
+ <version>2.2.3</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>2.6</version>
+ </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>org.onap.so</groupId>
+ <artifactId>aai-client</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.mariadb.jdbc</groupId>
+ <artifactId>mariadb-java-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-common</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.core</groupId>
+ <artifactId>jersey-client</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.inject</groupId>
+ <artifactId>jersey-hk2</artifactId>
+ <version>2.26</version>
+ </dependency>
+ <dependency>
+ <groupId>org.glassfish.jersey.media</groupId>
+ <artifactId>jersey-media-json-jackson</artifactId>
+ </dependency>
+ </dependencies>
+</project>
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 7d2fc10d0b..7d2fc10d0b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
index 01ac675d83..01ac675d83 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/SdnCommonTasks.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
index 15076fa45a..15076fa45a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCProperties.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
index 2c8bdd931c..2c8bdd931c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCRequest.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
index d6216c509d..d6216c509d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcAction.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
index 4edbf37bad..4edbf37bad 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/beans/SDNCSvcOperation.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
index ae9fe6ad70..ae9fe6ad70 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdnc/endpoint/SDNCTopology.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
index 9b857dc08c..9b857dc08c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOHealthCheckClient.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
index 83624dec63..d4af90267d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidator.java
@@ -22,7 +22,6 @@ package org.onap.so.client.sdno;
import java.io.IOException;
import java.util.UUID;
-import org.onap.aai.domain.yang.GenericVnf;
public interface SDNOValidator {
@@ -38,18 +37,4 @@ public interface SDNOValidator {
*/
public boolean healthDiagnostic(String vnfId, UUID uuid, String requestingUserId) throws IOException, Exception;
-
- /**
- * Issues a health diagnostic request for a given GenericVnf to SDN-O
- *
- * @param genericVnf
- * @param uuid
- * @param requestingUserId
- * @return diagnostic result
- * @throws IOException
- * @throws Exception
- */
- public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId)
- throws IOException, Exception;
-
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
index 9fc95a6f3f..d2a87db70a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/SDNOValidatorImpl.java
@@ -61,18 +61,6 @@ public class SDNOValidatorImpl implements SDNOValidator {
return status;
}
- @Override
- public boolean healthDiagnostic(GenericVnf genericVnf, UUID uuid, String requestingUserId)
- throws IOException, Exception {
-
- SDNO requestDiagnostic = buildRequestDiagnostic(genericVnf, uuid, requestingUserId);
- ObjectMapper mapper = new ObjectMapper();
- String json = mapper.writeValueAsString(requestDiagnostic);
- this.submitRequest(json);
- boolean status = this.pollForResponse(uuid.toString());
- return status;
- }
-
protected SDNO buildRequestDiagnostic(GenericVnf vnf, UUID uuid, String requestingUserId) {
Optional<String> nfRole;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
index 7e98355b4d..7e98355b4d 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/AAIParamList.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/Body.java
index 8c40b749a6..8c40b749a6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Body.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/Body.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/Input.java
index c8122c06f6..c8122c06f6 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/Input.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/Input.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
index 485f64673f..485f64673f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/RequestHdCustom.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
index b1b75ab412..b1b75ab412 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/RequestHealthDiagnostic.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
index 8b84cf6659..8b84cf6659 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/ResultInfo.java
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
index 46e2c1d1fc..46e2c1d1fc 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
+++ b/so-sdn-clients/src/main/java/org/onap/so/client/sdno/beans/SDNO.java
diff --git a/so-sdn-clients/src/test/java/org/onap/so/BaseIntegrationTest.java b/so-sdn-clients/src/test/java/org/onap/so/BaseIntegrationTest.java
new file mode 100644
index 0000000000..9c25b1f002
--- /dev/null
+++ b/so-sdn-clients/src/test/java/org/onap/so/BaseIntegrationTest.java
@@ -0,0 +1,60 @@
+/*-
+ * ============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.sdnc.SDNCClient;
+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 SDNCClient SPY_sdncClient;
+
+ @Autowired
+ protected WireMockServer wireMockServer;
+
+ @Before
+ public void baseTestBefore() {
+ wireMockServer.resetAll();
+ }
+
+}
+
+
diff --git a/so-sdn-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/so-sdn-clients/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
new file mode 100644
index 0000000000..62d9ecee44
--- /dev/null
+++ b/so-sdn-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-sdn-clients/src/test/java/org/onap/so/IntegrationTestSuite.java b/so-sdn-clients/src/test/java/org/onap/so/IntegrationTestSuite.java
new file mode 100644
index 0000000000..50bbc1845f
--- /dev/null
+++ b/so-sdn-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-sdn-clients/src/test/java/org/onap/so/TestApplication.java b/so-sdn-clients/src/test/java/org/onap/so/TestApplication.java
new file mode 100644
index 0000000000..fe965b4444
--- /dev/null
+++ b/so-sdn-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/so-sdn-clients/src/test/java/org/onap/so/UnitTestSuite.java b/so-sdn-clients/src/test/java/org/onap/so/UnitTestSuite.java
new file mode 100644
index 0000000000..890c81daeb
--- /dev/null
+++ b/so-sdn-clients/src/test/java/org/onap/so/UnitTestSuite.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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({"**/*Test.class"})
+public class UnitTestSuite {
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
index a8816e1b04..a8816e1b04 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdn/common/SdnCommonTasksTest.java
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
index 0b338bde1d..0b338bde1d 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdnc/SDNCClientIT.java
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
index 750e578558..7345b8161b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOHealthCheckClientTest.java
@@ -33,7 +33,7 @@ public class SDNOHealthCheckClientTest {
- private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/health-check/";
+ private final String fileLocation = "src/test/resources/__files/sdno/health-check/";
private static final String userId = "test-user";
private static final Optional<String> clliCode = Optional.of("test-clli");
private static final String requestId = "test-request-id";
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java
index b91f83c1b7..8d2993ec43 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOValidatorIT.java
@@ -55,7 +55,7 @@ public class SDNOValidatorIT extends BaseIntegrationTest {
@Mock
private Consumer mrConsumer;
private SDNOHealthCheckDmaapConsumer dmaapConsumer;
- private final String fileLocation = "src/test/resources/org/onap/so/client/sdno/";
+ private final String fileLocation = "src/test/resources/__files/sdno/client/";
private final String uuid = "xyz123";
@Rule
public ExpectedException thrown = ExpectedException.none();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java b/so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
index c2278c26f9..c2278c26f9 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
+++ b/so-sdn-clients/src/test/java/org/onap/so/client/sdno/SDNOValidatorImplTest.java
diff --git a/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json
new file mode 100644
index 0000000000..9c50c2f11b
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiEcompModelInformation.json
@@ -0,0 +1,7 @@
+{
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
new file mode 100644
index 0000000000..91d64b98ca
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformation.json
@@ -0,0 +1,54 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : null,
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : null
+ },
+ "network-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "network-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ } ]
+ },
+ "network-name" : "TEST_NETWORK_NAME",
+ "network-instance-group-id" : "networkInstanceGroupId"
+ },
+ "request-information" : {
+ "notification-url" : null,
+ "order-version" : null,
+ "request-action" : "CreateNetworkInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "assign"
+ },
+ "network-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : "modelCustomizationUUID",
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "from-preload": null,
+ "network-id" : "TEST_NETWORK_ID",
+ "network-type" : null
+ }
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
new file mode 100644
index 0000000000..95a2af3880
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationNoNetworkName.json
@@ -0,0 +1,53 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : null,
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : null
+ },
+ "network-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "network-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ } ]
+ },
+ "network-instance-group-id" : "networkInstanceGroupId"
+ },
+ "request-information" : {
+ "notification-url" : null,
+ "order-version" : null,
+ "request-action" : "CreateNetworkInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "assign"
+ },
+ "network-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : "modelCustomizationUUID",
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "from-preload": null,
+ "network-id" : "TEST_NETWORK_ID",
+ "network-type" : null
+ }
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
new file mode 100644
index 0000000000..a7cf1e1434
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiNetworkOperationInformationUnAssign.json
@@ -0,0 +1,54 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : null,
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : null
+ },
+ "network-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "network-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ } ]
+ },
+ "network-name" : "TEST_NETWORK_NAME",
+ "network-instance-group-id" : "networkInstanceGroupId"
+ },
+ "request-information" : {
+ "notification-url" : null,
+ "order-version" : null,
+ "request-action" : "DeleteNetworkInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : null,
+ "svc-action" : "unassign"
+ },
+ "network-information" : {
+ "onap-model-information" : {
+ "model-name" : "modelName",
+ "model-version" : "modelVersion",
+ "model-customization-uuid" : "modelCustomizationUUID",
+ "model-uuid" : "modelUuid",
+ "model-invariant-uuid" : "modelInvariantUuid"
+ },
+ "from-preload": null,
+ "network-id" : "TEST_NETWORK_ID",
+ "network-type" : null
+ }
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
new file mode 100644
index 0000000000..53c1997126
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationAssign.json
@@ -0,0 +1,74 @@
+{
+ "service-information" : {
+ "onap-model-information" : {
+ "model-name" : "serviceModelName",
+ "model-version" : "serviceModelVersion",
+ "model-customization-uuid" : null,
+ "model-uuid" : "serviceModelUuid",
+ "model-invariant-uuid" : "serviceModelInvariantUuid"
+ },
+ "subscriber-name" : null,
+ "subscription-service-type" : "productFamilyId",
+ "service-id" : "serviceInstanceId",
+ "global-customer-id" : "globalCustomerId",
+ "service-instance-id" : "serviceInstanceId"
+ },
+ "vf-module-request-input" : {
+ "aic-clli" : null,
+ "aic-cloud-region" : null,
+ "tenant" : null,
+ "vf-module-input-parameters" : {
+ "param" : [ {
+ "name" : "key1",
+ "value" : "value1"
+ },
+ {
+ "name" : "key2",
+ "value" : "value2"
+ },
+ {
+ "name" : "volume-group-id",
+ "value" : "volumeGroupId"
+ } ]
+ },
+ "vf-module-name" : "testVfModuleName"
+ },
+ "request-information" : {
+ "request-action" : "CreateVfModuleInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null,
+ "order-version" : null,
+ "notification-url" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : "http://localhost:8080",
+ "svc-action" : "assign"
+ },
+ "vf-module-information" : {
+ "onap-model-information" : {
+ "model-name" : "vfModuleModelName",
+ "model-version" : "vfModuleModelVersion",
+ "model-customization-uuid" : "vfModuleModelCustomizationUuid",
+ "model-uuid" : "vfModuleModelUuid",
+ "model-invariant-uuid" : "vfModuleModelInvariantUuid"
+ },
+ "vf-module-id" : "testVfModuleId",
+ "from-preload" : true,
+ "vf-module-type": "vfModuleModelName"
+
+ },
+ "vnf-information" : {
+ "onap-model-information" : {
+ "model-name" : "vnfModelName",
+ "model-version" : "vnfModelVersion",
+ "model-customization-uuid" : "vnfModelCustomizationUuid",
+ "model-uuid" : "vnfModelUuid",
+ "model-invariant-uuid" : "vnfModelInvariantUuid"
+ },
+ "vnf-id" : "testVnfId",
+ "vnf-type" : "testVnfType",
+ "vnf-name" : "testVnfName"
+ }
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
new file mode 100644
index 0000000000..9f93c0df1f
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/BuildingBlocks/genericResourceApiVfModuleOperationInformationUnassign.json
@@ -0,0 +1,31 @@
+{
+ "service-information" : {
+ "service-instance-id" : "serviceInstanceId",
+ "service-id" : "serviceInstanceId"
+ },
+ "vf-module-request-input" : {
+ "vf-module-name" : "testVfModuleName",
+ "vf-module-input-parameters" : {}
+ },
+ "request-information" : {
+ "request-action" : "DeleteVfModuleInstance",
+ "source" : "MSO",
+ "request-id" : "sdncReqId",
+ "order-number" : null,
+ "order-version" : null,
+ "notification-url" : null
+ },
+ "sdnc-request-header" : {
+ "svc-request-id" : "svcRequestId",
+ "svc-notification-url" : "http://localhost:8080",
+ "svc-action" : "unassign"
+ },
+ "vf-module-information" : {
+ "vf-module-id" : "testVfModuleId",
+ "from-preload": true
+ },
+ "vnf-information" : {
+ "vnf-id" : "testVnfId",
+ "vnf-type" : "testVnfType"
+ }
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientGetResponse.json b/so-sdn-clients/src/test/resources/__files/SDNCClientGetResponse.json
new file mode 100644
index 0000000000..a18b6aa54e
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientGetResponse.json
@@ -0,0 +1,27 @@
+{
+ "vnf-topology": {
+ "tenant": "0422ffb57ba042c0800a29dc85ca70f8",
+ "vnf-topology-identifier-structure": {
+ "vnf-id": "66dac89b-2a5b-4cb9-b22e-a7e4488fb3db",
+ "vnf-type": "InfraMSO_vSAMP10a_Service/InfraMSO_vSAMP10a-2 0",
+ "vnf-name": "MSO-DEV-VNF-1806HF1-InfraMSO_vSAMP10a-1XXX-GR_21"
+ },
+ "aic-clli": "AUSTTXGR",
+ "vnf-resource-assignments": {
+ "availability-zones": {
+ "availability-zone": [
+ "AZ-MN02"
+ ],
+ "max-count": 1
+ }
+ },
+ "aic-cloud-region": "mtn6",
+ "onap-model-information": {
+ "model-customization-uuid": "034226ae-879a-46b5-855c-d02babcb6cb6",
+ "model-uuid": "cb79c25f-b30d-4d95-afb5-97be4021f3db",
+ "model-invariant-uuid": "e93d3a7a-446d-486b-ae48-d474a9156064",
+ "model-name": "InfraMSO_vSAMP10a-2",
+ "model-version": "1.0"
+ }
+ }
+} \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponse.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponse.json
new file mode 100644
index 0000000000..0de25616e3
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponse.json
@@ -0,0 +1,127 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ },
+ {
+ "vnf-parameter-name": "additionalParams",
+ "vnf-parameter-value": "{\"image_id\": \"DUMMYVNF\",\"instance_type\": \"m1.small\",\"ftp_address\": \"ftp://0.0.0.0:2100/\"}"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_gateway_ip_1",
+ "vnf-parameter-value": "0.0.0.0"
+ },
+ {
+ "vnf-parameter-name": "availability_zone_1"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_gateway_ip_2"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_prefix_length",
+ "vnf-parameter-value": "28"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_OMCN_vLC_P4_prefix_length",
+ "vnf-parameter-value": "28"
+ },
+ {
+ "vnf-parameter-name": "gpbs",
+ "vnf-parameter-value": "2"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_ip_2",
+ "vnf-parameter-value": "192.0.0.1"
+ },
+ {
+ "vnf-parameter-name": "internal_mtu",
+ "vnf-parameter-value": "1500"
+ },
+ {
+ "vnf-parameter-name": "storage_drbd_sync_rate",
+ "vnf-parameter-value": "0"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_MEDIA_vLC_P3_net_id",
+ "vnf-parameter-value": "ONAPMME_MEDIA_vLC_P3"
+ },
+ {
+ "vnf-parameter-name": "extVirtualLinks",
+ "vnf-parameter-value": "[{\"id\":\"ac1ed33d-8dc1-4800-8ce8-309b99c38eec\",\"tenant\":{\"cloudOwner\":\"CloudOwner\",\"regionName\":\"RegionOne\",\"tenantId\":\"80c26954-2536-4bca-9e20-10f8a2c9c2ad\"},\"resourceId\":\"8ef8cd54-75fd-4372-a6dd-2e05ea8fbd9b\",\"extCps\":[{\"cpdId\":\"f449292f-2f0f-4656-baa3-a18d86bac80f\",\"cpConfig\":[{\"cpInstanceId\":\"07876709-b66f-465c-99a7-0f4d026197f2\",\"linkPortId\":null,\"cpProtocolData\":null}]}],\"extLinkPorts\":null}]"
+ },
+ {
+ "vnf-parameter-name": "vnfIpAddress",
+ "vnf-parameter-value": "127.0.0.0"
+ },
+ {
+ "vnf-parameter-name": "node_type",
+ "vnf-parameter-value": "sgsnl"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_SIG_vLC_P2_net_id",
+ "vnf-parameter-value": "ONAPMME_SIG_vLC_P2"
+ },
+ {
+ "vnf-parameter-name": "updateOss",
+ "vnf-parameter-value": "false"
+ },
+ {
+ "vnf-parameter-name": "tmo",
+ "vnf-parameter-value": "0"
+ },
+ {
+ "vnf-parameter-name": "ss7",
+ "vnf-parameter-value": "Not_Applicable"
+ },
+ {
+ "vnf-parameter-name": "ONAPMME_OMCN_vLC_P4_net_id",
+ "vnf-parameter-value": "ONAPMME_OMCN_vLC_P4"
+ },
+ {
+ "vnf-parameter-name": "key_name"
+ },
+ {
+ "vnf-parameter-name": "fsb_admin_dns_server_ip_2"
+ },
+ {
+ "vnf-parameter-name": "time_zone",
+ "vnf-parameter-value": "GMT"
+ },
+ {
+ "vnf-parameter-name": "enableRollback",
+ "vnf-parameter-value": "false"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json
new file mode 100644
index 0000000000..c2cf2b2f28
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidAdditionalAndExtVmData.json
@@ -0,0 +1,47 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ },
+ {
+ "vnf-parameter-name": "additionalParams",
+ "vnf-parameter-value": "[\"abc\"]"
+ },
+ {
+ "vnf-parameter-name": "extVirtualLinks",
+ "vnf-parameter-value": "{\"def\":\"123\"}"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json
new file mode 100644
index 0000000000..552adb9125
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidData.json
@@ -0,0 +1,39 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "vnf-parameter-name": "extra_console",
+ "vnf-parameter-value": "ttyS1"
+ },
+ {
+ "vnf-parameter-name": "vnfUsername",
+ "vnf-parameter-value": "vnf_user"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json
new file mode 100644
index 0000000000..e19ad1c9d3
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPrelaodDataResponseWithInvalidVnfParamsTag.json
@@ -0,0 +1,34 @@
+{
+ "vnf-preload-list": [
+ {
+ "vnf-name": "GENERIC_VNF_NAME",
+ "vnf-type": "SIMPLE",
+ "preload-data":
+ {
+ "network-topology-information":
+ {
+ },
+ "vnf-topology-information":
+ {
+ "vnf-topology-identifier":
+ {
+ "service-type": "vCPE",
+ "vnf-type": "SIMPLE",
+ "vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-name": "GENERIC_VNF_NAME",
+ "generic-vnf-type": "SIMPLE"
+ },
+ "vnf-parameters": [
+ {
+ "hello": "world"
+ }
+ ]
+ },
+ "oper-status":
+ {
+ "order-status": "PendingAssignment"
+ }
+ }
+ }
+ ]
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPut200Response.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPut200Response.json
new file mode 100644
index 0000000000..286ce4c844
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPut200Response.json
@@ -0,0 +1,15 @@
+{
+ "output": {
+ "svc-request-id": "5d24d40e-4c77-4c06-94a3-6d168c47a57c",
+ "network-response-information": {
+ "instance-id": "4063e0aa-af13-4872-8473-b40c94f9316b",
+ "object-path": "restconf/config/GENERIC-RESOURCE-API:services/service/2c9c7996-75a7-4f92-becc-9e13e8bd288a/service-data/networks/network/4063e0aa-af13-4872-8473-b40c94f9316b/network-data/network-topology/"
+ },
+ "response-code": "200",
+ "service-response-information": {
+ "instance-id": "2c9c7996-75a7-4f92-becc-9e13e8bd288a"
+ },
+ "response-message": "",
+ "ack-final-indicator": "Y"
+ }
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPut200ResponseNotFinal.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPut200ResponseNotFinal.json
new file mode 100644
index 0000000000..deb4de0219
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPut200ResponseNotFinal.json
@@ -0,0 +1,15 @@
+{
+ "output": {
+ "svc-request-id": "5d24d40e-4c77-4c06-94a3-6d168c47a57c",
+ "network-response-information": {
+ "instance-id": "4063e0aa-af13-4872-8473-b40c94f9316b",
+ "object-path": "restconf/config/GENERIC-RESOURCE-API:services/service/2c9c7996-75a7-4f92-becc-9e13e8bd288a/service-data/networks/network/4063e0aa-af13-4872-8473-b40c94f9316b/network-data/network-topology/"
+ },
+ "response-code": "200",
+ "service-response-information": {
+ "instance-id": "2c9c7996-75a7-4f92-becc-9e13e8bd288a"
+ },
+ "response-message": "",
+ "ack-final-indicator": "N"
+ }
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientPut404Response.json b/so-sdn-clients/src/test/resources/__files/SDNCClientPut404Response.json
new file mode 100644
index 0000000000..cf0254886d
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientPut404Response.json
@@ -0,0 +1,8 @@
+{
+ "output": {
+ "svc-request-id": "086a7a09-1470-4977-8b3e-307488b8811a",
+ "response-code": "404",
+ "response-message": "invalid input: the service-instance does not have any service data in SDNC",
+ "ack-final-indicator": "Y"
+ }
+}
diff --git a/so-sdn-clients/src/test/resources/__files/SDNCClientResponseIncorrectPath.json b/so-sdn-clients/src/test/resources/__files/SDNCClientResponseIncorrectPath.json
new file mode 100644
index 0000000000..7e263b4465
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/__files/SDNCClientResponseIncorrectPath.json
@@ -0,0 +1,29 @@
+{
+ "vnf-topology": {
+ "tenant": "0422ffb57ba042c0800a29dc85ca70f8",
+ "vnf-topology-identifier-structure": {
+ "vnf-id": "66dac89b-2a5b-4cb9-b22e-a7e4488fb3db",
+ "vnf-type": "InfraMSO_vSAMP10a_Service/InfraMSO_vSAMP10a-2 0",
+ "vnf-name": "MSO-DEV-VNF-1806HF1-InfraMSO_vSAMP10a-1XXX-GR_21"
+ },
+ "aic-clli": "AUSTTXGR",
+ "vnf-resource-assignments": {
+ "availability-zones": {
+ "availability-zone": [
+ {
+ "test":"AZ-MN02"
+ }
+ ],
+ "max-count": 1
+ }
+ },
+ "aic-cloud-region": "mtn6",
+ "onap-model-information": {
+ "model-customization-uuid": "034226ae-879a-46b5-855c-d02babcb6cb6",
+ "model-uuid": "cb79c25f-b30d-4d95-afb5-97be4021f3db",
+ "model-invariant-uuid": "e93d3a7a-446d-486b-ae48-d474a9156064",
+ "model-name": "InfraMSO_vSAMP10a-2",
+ "model-version": "1.0"
+ }
+ }
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json b/so-sdn-clients/src/test/resources/__files/sdno/client/output-failure.json
index 8cf0a820cd..8cf0a820cd 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-failure.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/client/output-failure.json
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json b/so-sdn-clients/src/test/resources/__files/sdno/client/output-success.json
index a6794327d8..a6794327d8 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/output-success.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/client/output-success.json
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json b/so-sdn-clients/src/test/resources/__files/sdno/client/response.json
index 2355e86938..2355e86938 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/response.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/client/response.json
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-lport-mirror-post-check-request.json
index 2c46b5a8cb..2c46b5a8cb 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-post-check-request.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-lport-mirror-post-check-request.json
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-lport-mirror-pre-check-request.json
index bf168b0028..bf168b0028 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-lport-mirror-pre-check-request.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-lport-mirror-pre-check-request.json
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-port-mirror-post-check-request.json
index 89e505e7d0..89e505e7d0 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-post-check-request.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-port-mirror-post-check-request.json
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-port-mirror-pre-check-request.json
index 86897c8a1f..86897c8a1f 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/org/onap/so/client/sdno/health-check/custom-port-mirror-pre-check-request.json
+++ b/so-sdn-clients/src/test/resources/__files/sdno/health-check/custom-port-mirror-pre-check-request.json
diff --git a/so-sdn-clients/src/test/resources/application-test.yaml b/so-sdn-clients/src/test/resources/application-test.yaml
new file mode 100644
index 0000000000..b64fc3318b
--- /dev/null
+++ b/so-sdn-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: att-aic
+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-sdn-clients/src/test/resources/dmaap.properties b/so-sdn-clients/src/test/resources/dmaap.properties
new file mode 100644
index 0000000000..5593455da3
--- /dev/null
+++ b/so-sdn-clients/src/test/resources/dmaap.properties
@@ -0,0 +1,10 @@
+sdno.health-check.dmaap.username=testuser
+sdno.health-check.dmaap.password=eHQ1cUJrOUc
+sdno.health-check.dmaap.subscriber.topic=com.att.sdno.test-health-diagnostic-v02
+sdno.health-check.dmaap.publisher.topic=com.att.sdno.test-health-diagnostic-v02
+ruby.create-ticket-request.dmaap.username=testuser
+ruby.create-ticket-request.dmaap.password=eHQ1cUJrOUc
+ruby.create-ticket-request.publisher.topic=com.att.pdas.st1.msoCMFallout-v1
+ruby.create-ticket-request.dmaap.auth=81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
+sdno.health-check.dmaap.auth=81B7E3533B91A6706830611FB9A8ECE529BBCCE754B1F1520FA7C8698B42F97235BEFA993A387E664D6352C63A6185D68DA7F0B1D360637CBA102CB166E3E62C11EB1F75386D3506BCECE51E54
+mso.msoKey=07a7159d3bf51a0e53be7a8f89699be7 \ No newline at end of file
diff --git a/so-sdn-clients/src/test/resources/schema.sql b/so-sdn-clients/src/test/resources/schema.sql
new file mode 100644
index 0000000000..5ae6a2d972
--- /dev/null
+++ b/so-sdn-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": [],