aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java14
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java6
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java8
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java2
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java20
-rw-r--r--adapters/mso-adapters-rest-interface/.gitignore1
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java3
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/CatalogDbAdapterRest.java4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.3__ScaleOutRecipe.sql (renamed from adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql)2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__CreateTableControllerSelectionRefence.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql8
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java23
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java78
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql7
-rw-r--r--adapters/mso-openstack-adapters/.gitignore3
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java14
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java13
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java60
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java10
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java8
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java9
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java13
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java6
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml4
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml4
-rw-r--r--adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java2
-rw-r--r--adapters/mso-vfc-adapter/src/test/resources/application-test.yaml4
-rw-r--r--asdc-controller/src/test/resources/application-test.yaml4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy53
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy39
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java30
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java18
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java19
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy76
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json1
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json33
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml3
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java2
-rw-r--r--bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json108
-rw-r--r--bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java11
-rw-r--r--bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json19
-rw-r--r--bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json42
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java7
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java18
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java78
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn92
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn31
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn80
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn31
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn61
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn101
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java57
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java2
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java53
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java4
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy8
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java6
-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/AAIQueryTasks.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java35
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java39
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java56
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java34
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json1
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json6
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json12
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml3
-rw-r--r--cloudify-client/.gitignore1
-rw-r--r--common/.gitignore1
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java4
-rw-r--r--common/src/main/java/org/onap/so/client/RestRequest.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java24
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java52
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java126
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java80
-rw-r--r--common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java141
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java19
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java10
-rw-r--r--common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java53
-rw-r--r--deployment-configs/.gitignore1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/.gitignore1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java3
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java51
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java146
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java421
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java53
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java37
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java58
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java28
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java3
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java12
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java (renamed from mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java)120
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java106
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java83
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java33
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java37
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java80
-rw-r--r--mso-catalog-db/src/test/resources/data.sql6
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql13
-rw-r--r--packages/docker/pom.xml4
-rw-r--r--packages/docker/src/main/docker/docker-files/scripts/start-app.sh2
169 files changed, 2035 insertions, 1840 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java
index 5560282fda..b32ca1833f 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloud/CloudConfig.java
@@ -24,7 +24,6 @@ import java.util.Optional;
import com.fasterxml.jackson.annotation.JsonRootName;
-import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -51,7 +50,7 @@ import org.springframework.stereotype.Component;
public class CloudConfig {
private static final String CLOUD_SITE_VERSION = "2.5";
- private static final String DEFAULT_CLOUD_SITE_ID = "default";
+ private static final String DEFAULT_CLOUD_SITE_ID = "DEFAULT";
@Autowired
private CatalogDbClient catalogDbClient;
@@ -108,17 +107,6 @@ public class CloudConfig {
}
}
- /**
- * Get a specific CloudIdentity, based on an ID.
- *
- * @param id
- * the ID to match
- * @return a CloudIdentity, or null of no match found
- */
- public CloudIdentity getIdentityService(String id) {
- return catalogDbClient.getCloudIdentity(id);
- }
-
/**
* Get a specific CloudifyManager, based on an ID.
* @param id the ID to match
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index 59996fa3d1..677f6395ff 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -1376,9 +1376,9 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin{
protected OpenstackConfig getOpenstackConfig (CloudSite cloudSite, String tenantId) {
OpenstackConfig openstackConfig = new OpenstackConfig();
openstackConfig.setRegion (cloudSite.getRegionId());
- openstackConfig.setAuthUrl (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getIdentityUrl());
- openstackConfig.setUsername (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getMsoId());
- openstackConfig.setPassword (CryptoUtils.decryptCloudConfigPassword(cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getMsoPass()));
+ openstackConfig.setAuthUrl (cloudSite.getIdentityService().getIdentityUrl());
+ openstackConfig.setUsername (cloudSite.getIdentityService().getMsoId());
+ openstackConfig.setPassword (CryptoUtils.decryptCloudConfigPassword(cloudSite.getIdentityService().getMsoPass()));
openstackConfig.setTenantName (tenantId);
return openstackConfig;
}
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index 1d5b1a006d..6b66970ea0 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -382,7 +382,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
OpenStackRequest <Stack> request = heatClient.getStacks ().create (stack);
// Begin X-Auth-User
// Obtain an MSO token for the tenant
- CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId());
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
// cloudIdentity.getMsoId(), cloudIdentity.getMsoPass()
//req
request.header ("X-Auth-User", cloudIdentity.getMsoId ());
@@ -965,7 +965,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
}
// Obtain an MSO token for the tenant
- CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId());
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
LOGGER.debug("Found: " + cloudIdentity.toString());
MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
@@ -1488,7 +1488,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin{
String keystone_url = null;
try {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(() -> new MsoCloudSiteNotFound(cloudSiteId));
- CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId());
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
keystone_url = cloudIdentity.getIdentityUrl();
} catch (Exception e) {
throw new MsoCloudSiteNotFound(cloudSiteId);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
index 2f2a457bed..759c116e05 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoKeystoneUtils.java
@@ -138,7 +138,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
// Add MSO User to the tenant as a member and
// apply tenant metadata if supported by the cloud site
try {
- CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSiteOpt.get().getIdentityServiceId());
+ CloudIdentity cloudIdentity = cloudSiteOpt.get().getIdentityService();
User msoUser = findUserByNameOrId (keystoneAdminClient, cloudIdentity.getMsoId ());
Role memberRole = findRoleByNameOrId (keystoneAdminClient, cloudIdentity.getMemberRole ());
@@ -221,7 +221,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
}
Map <String, String> metadata = new HashMap <String, String> ();
- if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getTenantMetadata ()) {
+ if (cloudSite.getIdentityService().getTenantMetadata ()) {
OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ());
Metadata tenantMetadata = executeAndRecordOpenstackRequest (request);
if (tenantMetadata != null) {
@@ -267,7 +267,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
}
Map <String, String> metadata = new HashMap <String, String> ();
- if (cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getTenantMetadata ()) {
+ if (cloudSite.getIdentityService().getTenantMetadata ()) {
OpenStackRequest <Metadata> request = keystoneAdminClient.tenants ().showMetadata (tenant.getId ());
Metadata tenantMetadata = executeAndRecordOpenstackRequest (request);
if (tenantMetadata != null) {
@@ -401,7 +401,7 @@ public class MsoKeystoneUtils extends MsoTenantUtils {
* @return an authenticated Keystone object
*/
public Keystone getKeystoneAdminClient (CloudSite cloudSite) throws MsoException {
- CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId());
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
String cloudId = cloudIdentity.getId ();
String adminTenantName = cloudIdentity.getAdminTenant ();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
index 18ed94112c..a9f0a39235 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoNeutronUtils.java
@@ -375,7 +375,7 @@ public class MsoNeutronUtils extends MsoCommonUtils
}
// Obtain an MSO token for the tenant from the identity service
- CloudIdentity cloudIdentity = cloudConfig.getIdentityService(cloudSite.getIdentityServiceId());
+ CloudIdentity cloudIdentity = cloudSite.getIdentityService();
MsoTenantUtils tenantUtils = tenantUtilsFactory.getTenantUtilsByServerType(cloudIdentity.getIdentityServerType());
final String keystoneUrl = tenantUtils.getKeystoneUrl(cloudId, cloudIdentity);
Keystone keystoneTenantClient = new Keystone(keystoneUrl);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java
index da9f79aa89..79934ccd28 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoTenantUtilsFactory.java
@@ -42,7 +42,7 @@ public class MsoTenantUtilsFactory {
CloudSite cloudSite = cloudConfig.getCloudSite(cloudSiteId).orElseThrow(
() -> new MsoCloudSiteNotFound(cloudSiteId));
- return getTenantUtilsByServerType(cloudConfig.getIdentityService(cloudSite.getIdentityServiceId()).getIdentityServerType());
+ return getTenantUtilsByServerType(cloudSite.getIdentityService().getIdentityServerType());
}
public MsoTenantUtils getTenantUtilsByServerType(ServerType serverType) {
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
index 36a50fd77e..087ac6f17b 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/BaseTest.java
@@ -76,7 +76,7 @@ public abstract class BaseTest extends TestDataSetup {
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse()
+ stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java
index 012805e774..c3777ca810 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/adapter_utils/tests/MsoHeatUtilsRefactorTest.java
@@ -74,7 +74,7 @@ public class MsoHeatUtilsRefactorTest extends BaseTest {
cloudSite.setIdentityService(identity);
- stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse()
+ stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java
index c6db998b2b..ea25fe580d 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/cloud/CloudConfigTest.java
@@ -56,26 +56,6 @@ public class CloudConfigTest extends BaseTest{
assertEquals ("3.0", site1.getCloudVersion());
}
-
- /**
- * This method implements a test for the getIdentityServices method.
- * @throws MsoException
- */
- @Test
- public final void testGetIdentityServices () throws MsoException {
-
- CloudIdentity identity1 = con.getIdentityService("mtn13");
-
- assertEquals("m93945", identity1.getMsoId());
- assertEquals("93937EA01B94A10A49279D4572B48369", identity1.getMsoPass());
- assertEquals("admin", identity1.getAdminTenant());
- assertEquals("admin", identity1.getMemberRole());
- assertTrue(identity1.getIdentityUrl().contains("http://localhost:"));
- assertEquals(ServerType.KEYSTONE, identity1.getIdentityServerType());
- assertEquals(AuthenticationType.USERNAME_PASSWORD, identity1.getIdentityAuthenticationType());
-
- }
-
/**
* This method implements a test for the getCloudSite method.
*/
diff --git a/adapters/mso-adapters-rest-interface/.gitignore b/adapters/mso-adapters-rest-interface/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/adapters/mso-adapters-rest-interface/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
index 4afc24ea10..a2256f724a 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/catalogrest/QueryServiceNetworks.java
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Modifications Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -28,7 +30,6 @@ import java.util.Map;
import javax.xml.bind.annotation.XmlRootElement;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 a69e66cc69..d77fb097ae 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
@@ -4,6 +4,8 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* ================================================================================
+ * Copyright (C) 2018 IBM.
+ * ================================================================================
* 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
@@ -99,8 +101,6 @@ import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfRecipeRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
import org.onap.so.db.catalog.rest.beans.ServiceMacroHolder;
-import org.onap.so.logger.MessageEnum;
-import org.onap.so.logger.MsoLogger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.3__ScaleOutRecipe.sql
index b3d8b98176..3ae135fc56 100644
--- a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.2__ScaleOutRecipe.sql
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.3__ScaleOutRecipe.sql
@@ -1,5 +1,5 @@
use catalogdb;
-INSERT INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID)
+INSERT IGNORE INTO vnf_components_recipe (VNF_COMPONENT_TYPE, ACTION, VERSION, DESCRIPTION, ORCHESTRATION_URI, RECIPE_TIMEOUT, VF_MODULE_MODEL_UUID)
VALUES
('vfModule', 'scaleOut', '1', 'Gr api recipe to scale out vfModule', '/mso/async/services/WorkflowActionBB', '180', 'GR-API-DEFAULT');
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__CreateTableControllerSelectionRefence.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__CreateTableControllerSelectionRefence.sql
new file mode 100644
index 0000000000..dbeba53acc
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__CreateTableControllerSelectionRefence.sql
@@ -0,0 +1,8 @@
+use catalogdb;
+
+CREATE TABLE IF NOT EXISTS `controller_selection_reference` (
+ `VNF_TYPE` VARCHAR(50) NOT NULL,
+ `CONTROLLER_NAME` VARCHAR(100) NOT NULL,
+ `ACTION_CATEGORY` VARCHAR(15) NOT NULL,
+ PRIMARY KEY (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`)
+ ) ENGINE = InnoDB DEFAULT CHARSET=latin1;
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql
new file mode 100644
index 0000000000..126710e879
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.6__Remove1802StyleAssignNetwork.sql
@@ -0,0 +1,8 @@
+use catalogdb;
+
+DELETE FROM building_block_detail WHERE BUILDING_BLOCK_NAME = 'AssignNetwork1802BB';
+DELETE FROM building_block_detail WHERE BUILDING_BLOCK_NAME = 'UnassignNetwork1802BB';
+
+UPDATE orchestration_flow_reference SET `FLOW_NAME`='UnassignNetworkBB' WHERE `COMPOSITE_ACTION`='Network-Delete' and `FLOW_NAME`='UnassignNetwork1802BB';
+UPDATE orchestration_flow_reference SET `FLOW_NAME`='AssignNetworkBB' WHERE `COMPOSITE_ACTION`='Network-Create' and `FLOW_NAME`='AssignNetwork1802BB';
+
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
index 9ed61b33a3..0606848b04 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CloudConfigTest.java
@@ -21,33 +21,16 @@
package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import java.net.URI;
-import java.util.List;
-
import javax.transaction.Transactional;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.catalogdb.CatalogDBApplication;
import org.onap.so.db.catalog.beans.AuthenticationType;
-import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
-import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
-import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.ServerType;
-import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logger.MsoLogger;
-import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -55,15 +38,9 @@ import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
-import org.springframework.http.client.BufferingClientHttpRequestFactory;
-import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
import org.springframework.web.util.UriComponentsBuilder;
-import uk.co.blackpepper.bowman.Client;
-import uk.co.blackpepper.bowman.ClientFactory;
-import uk.co.blackpepper.bowman.Configuration;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
new file mode 100644
index 0000000000..f75adc62c0
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -0,0 +1,78 @@
+package org.onap.so.db.catalog.client;
+
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.catalogdb.CatalogDBApplication;
+import org.onap.so.db.catalog.beans.CloudIdentity;
+import org.onap.so.db.catalog.beans.CloudSite;
+import org.onap.so.db.catalog.beans.CloudifyManager;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.context.embedded.LocalServerPort;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+import java.util.UUID;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = CatalogDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class CatalogDbClientTest {
+ public static final String MTN13 = "mtn13";
+ @LocalServerPort
+ private int port;
+ @Autowired
+ CatalogDbClient client;
+
+ @Before
+ public void setPort() {
+ client.removePortFromEndpoint();
+ client.setPortToEndpoint(Integer.toString(port));
+ }
+
+ @Test
+ public void testGetCloudSiteHappyPath() throws Exception {
+ CloudSite cloudSite = client.getCloudSite(MTN13);
+ Assert.assertNotNull(cloudSite);
+ Assert.assertNotNull(cloudSite.getIdentityService());
+ Assert.assertEquals("MDT13", cloudSite.getClli());
+ Assert.assertEquals("mtn13", cloudSite.getRegionId());
+ Assert.assertEquals("MTN13", cloudSite.getIdentityServiceId());
+ }
+
+ @Test
+ public void testGetCloudSiteNotFound() throws Exception {
+ CloudSite cloudSite = client.getCloudSite(UUID.randomUUID().toString());
+ Assert.assertNull(cloudSite);
+ }
+
+ @Test
+ public void testGetCloudifyManagerHappyPath() throws Exception {
+ CloudifyManager cloudifyManager = client.getCloudifyManager("mtn13");
+ Assert.assertNotNull(cloudifyManager);
+ Assert.assertEquals("http://localhost:28090/v2.0", cloudifyManager.getCloudifyUrl());
+
+ }
+
+ @Test
+ public void testGetCloudifyManagerNotFound() throws Exception {
+ CloudifyManager cloudifyManager = client.getCloudifyManager(UUID.randomUUID().toString());
+ Assert.assertNull(cloudifyManager);
+ }
+
+
+
+ @Test
+ public void testGetCloudSiteByClliAndAicVersionHappyPath() throws Exception{
+ CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13","2.5");
+ Assert.assertNotNull(cloudSite);
+ }
+
+ @Test
+ public void testGetCloudSiteByClliAndAicVersionNotFound() throws Exception{
+ CloudSite cloudSite = client.getCloudSiteByClliAndAicVersion("MDT13","232496239746328");
+ Assert.assertNull(cloudSite);
+ }
+}
diff --git a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 4106e8ac6d..c3969b4a51 100644
--- a/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-catalog-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -183,3 +183,10 @@ insert into allotted_resource_customization_to_service(service_model_uuid, resou
insert into vnf_components(vnf_id, component_type, heat_template_id, heat_environment_id, creation_timestamp) values
('13961', 'VOLUME', '13843', '13961', '2016-05-19 20:22:02');
+
+
+INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08');
+
+INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
+
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); \ No newline at end of file
diff --git a/adapters/mso-openstack-adapters/.gitignore b/adapters/mso-openstack-adapters/.gitignore
index 2af7cefb0a..3467f05c98 100644
--- a/adapters/mso-openstack-adapters/.gitignore
+++ b/adapters/mso-openstack-adapters/.gitignore
@@ -21,4 +21,5 @@ build/
nbbuild/
dist/
nbdist/
-.nb-gradle/ \ No newline at end of file
+.nb-gradle/
+/bin/
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
index ed64abd982..fbafdd052e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
@@ -2,6 +2,8 @@ package db.migration;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import org.flywaydb.core.api.MigrationVersion;
@@ -14,10 +16,12 @@ import org.onap.so.db.catalog.beans.CloudifyManager;
import org.onap.so.logger.MsoLogger;
import java.io.FileInputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
+import java.sql.SQLException;
import java.sql.Statement;
import java.util.Collection;
@@ -74,8 +78,8 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
this.cloudConfig = cloudConfig;
}
- private CloudConfig loadCloudConfig(InputStream stream) throws Exception {
- ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
+ private CloudConfig loadCloudConfig(InputStream stream) throws JsonMappingException, IOException {
+ ObjectMapper mapper = new ObjectMapper(new YAMLFactory());
R__CloudConfigMigration cloudConfigMigration =
mapper.readValue(stream, R__CloudConfigMigration.class);
CloudConfig cloudConfig = cloudConfigMigration.getCloudConfig();
@@ -92,7 +96,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
return "/application" + profile + ".yaml";
}
- private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws Exception {
+ private void migrateCloudIdentity(Collection<CloudIdentity> entities, Connection connection) throws SQLException {
LOGGER.debug("Starting migration for CloudConfig-->IdentityService");
String insert = "INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`) " +
"VALUES (?,?,?,?,?,?,?,?,?,?);";
@@ -122,7 +126,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
}
}
- private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws Exception {
+ private void migrateCloudSite(Collection<CloudSite> entities, Connection connection) throws SQLException {
LOGGER.debug("Starting migration for CloudConfig-->CloudSite");
String insert = "INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`) " +
"VALUES (?,?,?,?,?,?,?,?,?);";
@@ -151,7 +155,7 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro
}
}
- private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws Exception {
+ private void migrateCloudifyManagers(Collection<CloudifyManager> entities, Connection connection) throws SQLException {
String insert = "INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`)" +
" VALUES (?,?,?,?,?,?);";
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
index 83db2add0a..500b0b32e3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
@@ -66,7 +66,10 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger ();
private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth";
private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
-
+ private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: ";
+ private static final String CREATE_NETWORK_ERROR_MSG="Error sending createNetwork notification ";
+ private static final String CREATE_NETWORK_EXCEPTON_MSG="Exception sending createNetwork notification";
+ private static final String MSO_INTERNAL_ERROR_MSG="MsoInternalError";
@Autowired
private Environment environment;
@@ -160,7 +163,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
subnetIdMap,
networkRollback);
} catch (NetworkException e) {
- LOGGER.debug ("Got a NetworkException on createNetwork: ", e);
+ LOGGER.debug (NETWORK_EXCEPTION_MSG, e);
MsoExceptionCategory exCat = null;
String eMsg = null;
try {
@@ -174,9 +177,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
NetworkAdapterNotify notifyPort = getNotifyEP (notificationUrl);
notifyPort.createNetworkNotification (messageId, false, exCat, eMsg, null, null, null, null);
} catch (Exception e1) {
- error = "Error sending createNetwork notification " + e1.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e1);
- alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
+ error = CREATE_NETWORK_ERROR_MSG + e1.getMessage ();
+ LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError,CREATE_NETWORK_EXCEPTON_MSG, e1);
+ alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error);
}
return;
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
index e473c4c76a..707af7b6be 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/MSONetworkAdapterImplTest.java
@@ -23,8 +23,6 @@ package org.onap.so.adapters.network;
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.adapters.vnf.BaseRestTestUtils;
-import org.onap.so.cloud.CloudConfig;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
@@ -62,14 +60,10 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
public static final String NETWORK_ID = "43173f6a-d699-414b-888f-ab243dda6dfe";
public static final String NETWORK_NAME = "vUSP-23804-T-01-dpa2b_EVUSP-CORE-VIF-TSIG0_net_0";
- @Autowired
- private CloudConfig cloudConfig;
+
@Test
public void createNetworkByModelNameNeutronModeGetNetworkException() throws IOException{
-
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenstackGet("/mockPublicUrl/v2.0/networks",HttpStatus.SC_INTERNAL_SERVER_ERROR);
@@ -83,8 +77,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameNeutronModeCreateNetworkException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc");
@@ -102,8 +94,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameNeutronMode() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork_404("dvspg-VCE_VPE-mtjnj40avbc");
@@ -121,8 +111,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistNeutronMode() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json");
@@ -136,8 +124,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistNeutronModeFailIfExistTrue() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetAllNeutronNetworks_200("OpenstackGetNeutronNetworks.json");
@@ -151,8 +137,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatMode() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc");
@@ -170,8 +154,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistHeatMode() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
@@ -187,8 +169,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameAlreadyExistHeatModeFailIfExistTrue() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", "dvspg-VCE_VPE-mtjnj40avbc");
@@ -203,8 +183,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatModeQueryNetworkException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenstackGet("/mockPublicUrl/stacks/dvspg-VCE_VPE-mtjnj40avbc",HttpStatus.SC_INTERNAL_SERVER_ERROR);
@@ -218,8 +196,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameHeatModeCreateNetworkException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStack_404("dvspg-VCE_VPE-mtjnj40avbc");
@@ -235,8 +211,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void createNetworkByModelNameCloudSiteNotPresentError() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackPostStack_200("OpenstackResponse_Stack.json");
@@ -252,8 +226,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkHeatModeSuccess() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
@@ -271,8 +243,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkDeleteStackException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
@@ -290,8 +260,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkError() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackDeleteOrUpdateComplete_200("OpenstackResponse_Stack_DeleteComplete.json");
@@ -310,8 +278,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkNeureonMode() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
@@ -327,8 +293,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void deleteNetworkNeutronModeDeleteStackException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
@@ -346,8 +310,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronModeSuccess() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
@@ -362,8 +324,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronUpdateException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
@@ -378,8 +338,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkHeatUpdateException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_NAME);
@@ -395,8 +353,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkHeatQueryException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStack_500(NETWORK_NAME);
@@ -410,8 +366,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkHeatStackNotFound() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStack_404(NETWORK_NAME);
@@ -425,8 +379,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronQueryException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
@@ -440,8 +392,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void updateNetworkNeutronStackNotFound() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_NOT_FOUND);
@@ -455,8 +405,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkHeatModesuccess() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackCreated_200("OpenstackResponse_Stack_Created.json", NETWORK_ID);
@@ -470,8 +418,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkHeatModeQueryException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStack_500(NETWORK_ID);
@@ -485,8 +431,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkNeutronModeSuccess() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork("GetNeutronNetwork.json",NETWORK_ID,HttpStatus.SC_OK);
@@ -500,8 +444,6 @@ public class MSONetworkAdapterImplTest extends BaseRestTestUtils {
@Test
public void queryNetworkNeutronModeException() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetNeutronNetwork(NETWORK_ID,HttpStatus.SC_INTERNAL_SERVER_ERROR);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
index a29f2df96a..2a4564bcb2 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
@@ -58,7 +58,6 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.adapters.vnf.BaseRestTestUtils;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
-import org.onap.so.cloud.CloudConfig;
import org.onap.so.entity.MsoRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
@@ -71,8 +70,6 @@ import com.fasterxml.jackson.databind.JsonMappingException;
public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Autowired
- private CloudConfig cloudConfig;
- @Autowired
private JettisonStyleMapperProvider jettisonTypeObjectMapper;
private static final String CLOUDSITE_ID = "mtn13";
private static final String TENANT_ID = "ba38bc24a2ef4fb2ad2810c894f1938f";
@@ -86,7 +83,6 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testCreateNetwork() throws JSONException, JsonParseException, JsonMappingException, IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateNetworkRequest request = new CreateNetworkRequest();
request.setBackout(true);
request.setSkipAAI(true);
@@ -128,7 +124,7 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testCreateNetwork_JSON() throws JSONException, JsonParseException, JsonMappingException, IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
mockOpenStackResponseAccess(wireMockPort);
@@ -157,7 +153,6 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testDeleteNetwork() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
DeleteNetworkRequest request = new DeleteNetworkRequest();
MsoRequest msoReq = new MsoRequest();
@@ -197,7 +192,6 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testQueryNetwork_Exception() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
MsoRequest msoReq = new MsoRequest();
msoReq.setRequestId(MSO_REQUEST_ID);
msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
@@ -216,7 +210,6 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testQueryNetwork() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
mockOpenStackResponseAccess(wireMockPort);
mockOpenStackGetStackVfModule_200();
@@ -235,7 +228,6 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
@Test
public void testUpdateNetwork() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
UpdateNetworkRequest request = new UpdateNetworkRequest();
MsoRequest msoReq = new MsoRequest();
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
index ea21687bc5..405118cb30 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/TenantAdapterRestTest.java
@@ -53,7 +53,6 @@ import org.onap.so.adapters.tenantrest.DeleteTenantRequest;
import org.onap.so.adapters.tenantrest.DeleteTenantResponse;
import org.onap.so.adapters.vnf.BaseRestTestUtils;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
-import org.onap.so.cloud.CloudConfig;
import org.onap.so.entity.MsoRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
@@ -66,14 +65,11 @@ import com.fasterxml.jackson.databind.JsonMappingException;
public class TenantAdapterRestTest extends BaseRestTestUtils {
@Autowired
- private CloudConfig cloudConfig;
- @Autowired
private JettisonStyleMapperProvider jettisonTypeObjectMapper;
@Test
public void testCreateTenantCreated() throws JsonParseException, JsonMappingException, IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateTenantRequest request = new CreateTenantRequest();
String cloudSiteId = "MTN13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
@@ -125,7 +121,6 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
@Test
public void testCreateTenantExists() throws JsonParseException, JsonMappingException, IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateTenantRequest request = new CreateTenantRequest();
String cloudSiteId = "MTN13";
String requestId = "62265093-277d-4388-9ba6-449838ade586";
@@ -171,7 +166,6 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
@Test
public void testDeleteTenant() throws IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
DeleteTenantRequest request = new DeleteTenantRequest();
String cloudSiteId = "mtn13";
String tenantId = "tenantId";
@@ -210,7 +204,6 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
@Test
public void testDeleteTenantFails() throws IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
DeleteTenantRequest request = new DeleteTenantRequest();
String cloudSiteId = "mtn13";
String tenantId = "tenantId";
@@ -247,7 +240,6 @@ public class TenantAdapterRestTest extends BaseRestTestUtils {
@Test
public void testQuaryTenant() {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
index d2b6d4f633..a2f57ef06f 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java
@@ -29,6 +29,7 @@ import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.openstack.MsoOpenstackAdaptersApplication;
+import org.onap.so.cloud.CloudConfig;
import org.onap.so.db.catalog.beans.AuthenticationType;
import org.onap.so.db.catalog.beans.CloudIdentity;
import org.onap.so.db.catalog.beans.CloudSite;
@@ -63,7 +64,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
public class BaseRestTestUtils {
@Value("${wiremock.server.port}")
protected int wireMockPort;
-
+ @Autowired
+ CloudConfig cloudConfig;
+
@Autowired
@Qualifier("JettisonStyle")
protected TestRestTemplate restTemplate;
@@ -134,7 +137,7 @@ public class BaseRestTestUtils {
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
- stubFor(get(urlPathEqualTo("/cloudSite/default")).willReturn(aResponse()
+ stubFor(get(urlPathEqualTo("/cloudSite/DEFAULT")).willReturn(aResponse()
.withBody(getBody(mapper.writeValueAsString(cloudSite),wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
@@ -142,6 +145,8 @@ public class BaseRestTestUtils {
.withBody(getBody(mapper.writeValueAsString(identity),wireMockPort, ""))
.withHeader(org.apache.http.HttpHeaders.CONTENT_TYPE,MediaType.APPLICATION_JSON)
.withStatus(HttpStatus.SC_OK)));
+ cloudConfig.getCloudSite("MTN13").get().getIdentityService().setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
+
}
protected static String getBody(String body, int port, String urlPath) throws IOException {
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
index 93841a5037..c502620920 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VnfAdapterRestTest.java
@@ -37,7 +37,6 @@ import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.adapters.vnfrest.VfModuleExceptionResponse;
import org.onap.so.adapters.vnfrest.VfModuleRollback;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
-import org.onap.so.cloud.CloudConfig;
import org.onap.so.entity.MsoRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
@@ -75,8 +74,7 @@ import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess;
public class VnfAdapterRestTest extends BaseRestTestUtils {
- @Autowired
- private CloudConfig cloudConfig;
+
@Autowired
private JettisonStyleMapperProvider jettisonTypeObjectMapper;
private static final String MESSAGE_ID = "62265093-277d-4388-9ba6-449838ade586-1517252396874";
@@ -164,7 +162,6 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
public void testCreateVfModuleWithEnableBridgeNull()
throws JSONException, JsonParseException, JsonMappingException, IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateVfModuleRequest request = new CreateVfModuleRequest();
request.setBackout(true);
request.setSkipAAI(true);
@@ -232,7 +229,6 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
@Test
public void testCreateVfModuleFail() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateVfModuleRequest request = new CreateVfModuleRequest();
request.setBackout(true);
request.setSkipAAI(true);
@@ -331,7 +327,6 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
@Test
public void testDeleteVfModule() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
DeleteVfModuleRequest request = new DeleteVfModuleRequest();
MsoRequest msoRequest = new MsoRequest();
String vfModuleStackId = "stackId";
@@ -382,7 +377,6 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
@Test
public void testUpdateVfModule() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
UpdateVfModuleRequest request = new UpdateVfModuleRequest();
MsoRequest msoRequest = new MsoRequest();
String vfModuleStackId = "vfModuleStackId";
@@ -449,8 +443,7 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
@Test
public void testRollbackVfModule() throws IOException {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
-
+
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(MSO_REQUEST_ID);
msoRequest.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
@@ -488,7 +481,6 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
@Test
public void testQueryVfModule() throws IOException{
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
String testUrl = createURLWithPort("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID);
String testUri = UriBuilder.fromPath("/services/rest/v1/vnfs/" + AAI_VNF_ID + "/vf-modules/" + VF_MODULE_ID )
.host("localhost").port(wireMockPort).scheme("http")
@@ -512,7 +504,6 @@ public class VnfAdapterRestTest extends BaseRestTestUtils {
}
private CreateVfModuleRequest populateCreateVfModuleRequest(){
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateVfModuleRequest request = new CreateVfModuleRequest();
request.setBackout(true);
request.setSkipAAI(true);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
index d8177363f4..68982799f1 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/VolumeGroupAdapterCommon.java
@@ -25,17 +25,14 @@ import org.onap.so.adapters.vnfrest.DeleteVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.RollbackVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.VolumeGroupRollback;
-import org.onap.so.cloud.CloudConfig;
import org.onap.so.entity.MsoRequest;
-import org.springframework.beans.factory.annotation.Autowired;
import java.util.HashMap;
import java.util.Map;
public class VolumeGroupAdapterCommon extends BaseRestTestUtils {
- @Autowired
- protected CloudConfig cloudConfig;
+
protected static final String MSO_REQUEST_ID = "62265093-277d-4388-9ba6-449838ade586";
protected static final String MSO_SERVICE_INSTANCE_ID = "4147e06f-1b89-49c5-b21f-4faf8dc9805a";
@@ -93,7 +90,6 @@ public class VolumeGroupAdapterCommon extends BaseRestTestUtils {
}
protected CreateVolumeGroupRequest buildCreateVfModuleRequest() {
- cloudConfig.getIdentityService("MTN13").setIdentityUrl("http://localhost:" + wireMockPort + "/v2.0");
CreateVolumeGroupRequest request = new CreateVolumeGroupRequest();
request.setCloudSiteId(CLOUDSITE_ID);
request.setTenantId(TENANT_ID);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
index 2b4e7808b5..102b52985c 100644
--- a/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
+++ b/adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
@@ -6,6 +6,10 @@ server:
max-threads: 50
ssl-enable: false
mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
logPath: logs
site-name: localSite
spring:
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
index 6a5db78f8b..49582ec513 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
+++ b/adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
@@ -6,6 +6,10 @@ server:
max-threads: 50
ssl-enable: false
mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
logPath: logs
site-name: localSite
infra-requests:
diff --git a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java
index 10fa02a1d1..d53e467865 100644
--- a/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java
+++ b/adapters/mso-vfc-adapter/src/test/java/org/onap/so/adapters/vfc/rest/HealthCheckHandlerTest.java
@@ -26,10 +26,10 @@ import static org.junit.Assert.*;
import javax.ws.rs.core.Response;
-import org.json.JSONException;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.onap.so.adapters.vfc.MSOVfcApplication;
+import org.springframework.boot.configurationprocessor.json.JSONException;
import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.web.client.TestRestTemplate;
diff --git a/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml b/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml
index 64de62c2d6..d558d247d7 100644
--- a/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml
+++ b/adapters/mso-vfc-adapter/src/test/resources/application-test.yaml
@@ -5,6 +5,10 @@ server:
max-threads: 50
ssl-enable: false
mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
logPath: logs
site-name: localSite
infra-requests:
diff --git a/asdc-controller/src/test/resources/application-test.yaml b/asdc-controller/src/test/resources/application-test.yaml
index 99ca630695..9cfc500618 100644
--- a/asdc-controller/src/test/resources/application-test.yaml
+++ b/asdc-controller/src/test/resources/application-test.yaml
@@ -51,6 +51,10 @@ management:
enabled: true
mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
logPath: logs
catalog:
db:
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index c7fcc5c5d3..35e68bb79f 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Intel Corp. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 7c5ffca4ab..8ce633845b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2018 Intel Corp. All rights reserved.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -82,20 +82,20 @@ class OofUtils {
//ServiceInstance Info
ServiceInstance serviceInstance = decomposition.getServiceInstance()
def serviceInstanceId = ""
- def serviceInstanceName = ""
+ def serviceName = ""
serviceInstanceId = execution.getVariable("serviceInstanceId")
- serviceInstanceName = execution.getVariable("serviceInstanceName")
+ serviceName = execution.getVariable("subscriptionServiceType")
if (serviceInstanceId == null || serviceInstanceId == "null") {
utils.log("DEBUG", "Unable to obtain Service Instance Id", isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
- "obtain Service Instance Id, execution.getVariable(\"serviceInstanceName\") is null")
+ "obtain Service Instance Id, execution.getVariable(\"serviceInstanceId\") is null")
}
- if (serviceInstanceName == null || serviceInstanceName == "null") {
- utils.log("DEBUG", "Unable to obtain Service Instance Name", isDebugEnabled)
+ if (serviceName == null || serviceName == "null") {
+ utils.log("DEBUG", "Unable to obtain Service Name", isDebugEnabled)
exceptionUtil.buildAndThrowWorkflowException(execution, 400, "Internal Error - Unable to " +
- "obtain Service Instance Name, execution.getVariable(\"serviceInstanceName\") is null")
+ "obtain Service Name, execution.getVariable(\"subscriptionServiceType\") is null")
}
//Model Info
ModelInfo model = decomposition.getModelInfo()
@@ -144,24 +144,12 @@ class OofUtils {
utils.log("DEBUG", "Allotted Resource: " + resource.toString(),
isDebugEnabled)
def serviceResourceId = resource.getResourceId()
- def resourceModuleName = resource.getNfFunction()
- utils.log("DEBUG", "resourceModuleName: " + resourceModuleName,
- isDebugEnabled)
- def resourceModelInvariantId = "no-resourceModelInvariantId"
- def resourceModelVersionId = "no-resourceModelVersionId"
-
- List modelIdLst = execution.getVariable("homingModelIds")
- utils.log("DEBUG", "Incoming modelIdLst is: " + modelIdLst.toString(), isDebugEnabled)
- for (Map modelId : modelIdLst )
- if (resourceModuleName == modelId.resourceModuleName) {
- resourceModelInvariantId = modelId.resourceModelInvariantId
- resourceModelVersionId = modelId.resourceModelVersionId
- }
-
- def resourceModelName = "" //Optional
- def resourceModelVersion = "" //Optional
- def resourceModelType = "" //Optional
- def tenantId = "" //Optional
+ def resourceModelInvariantId = resource.getModelInfo().getModelInvariantUuid()
+ def resourceModelVersionId = resource.getModelInfo().getModelUuid()
+ def resourceModelName = resource.getModelInfo().getModelName()
+ def resourceModelVersion = resource.getModelInfo().getModelVersion()
+ def resourceModelType = resource.getModelInfo().getModelType()
+ def tenantId = execution.getVariable("tenantId")
def requiredCandidatesJson = ""
requiredCandidatesJson = createCandidateJson(
@@ -171,7 +159,7 @@ class OofUtils {
String demand =
" {\n" +
- " \"resourceModuleName\": \"${resourceModuleName}\",\n" +
+ " \"resourceModuleName\": \"${resourceModelName}\",\n" +
" \"serviceResourceId\": \"${serviceResourceId}\",\n" +
" \"tenantId\": \"${tenantId}\",\n" +
" \"resourceModelInfo\": {\n" +
@@ -191,21 +179,18 @@ class OofUtils {
isDebugEnabled)
ModelInfo vnfResourceModelInfo = vnfResource.getModelInfo()
def serviceResourceId = vnfResource.getResourceId()
- def resourceModuleName = vnfResource.getNfFunction()
- utils.log("DEBUG", "resourceModuleName: " + resourceModuleName,
- isDebugEnabled)
def resourceModelInvariantId = vnfResourceModelInfo.getModelInvariantUuid()
def resourceModelName = vnfResourceModelInfo.getModelName()
def resourceModelVersion = vnfResourceModelInfo.getModelVersion()
def resourceModelVersionId = vnfResourceModelInfo.getModelUuid()
def resourceModelType = vnfResourceModelInfo.getModelType()
- def tenantId = "" //Optional
+ def tenantId = execution.getVariable("tenantId")
def requiredCandidatesJson = ""
String placementDemand =
" {\n" +
- " \"resourceModuleName\": \"${resourceModuleName}\",\n" +
+ " \"resourceModuleName\": \"${resourceModelName}\",\n" +
" \"serviceResourceId\": \"${serviceResourceId}\",\n" +
" \"tenantId\": \"${tenantId}\",\n" +
" \"resourceModelInfo\": {\n" +
@@ -297,7 +282,7 @@ class OofUtils {
" },\n" +
" \"serviceInfo\": {\n" +
" \"serviceInstanceId\": \"${serviceInstanceId}\",\n" +
- " \"serviceName\": \"${serviceInstanceName}\",\n" +
+ " \"serviceName\": \"${serviceName}\",\n" +
" \"modelInfo\": {\n" +
" \"modelType\": \"${modelType}\",\n" +
" \"modelInvariantId\": \"${modelInvariantId}\",\n" +
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
index ba450c1b12..58c8f27de9 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterUtils.groovy
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -281,14 +281,14 @@ class SDNCAdapterUtils {
}
boolean isAic3 = execution.getVariable("isAic3")
-
+
if(isAic3) {
nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")
}
else {
nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC2.X")
}
-
+
String content = """
<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:sdncadapterworkflow="http://openecomp.com/mso/workflow/schema/v1"
xmlns:sdncadapter="http://domain2.openecomp.com/workflow/sdnc/adapter/schema/v1">
@@ -319,7 +319,7 @@ class SDNCAdapterUtils {
/**
* Builds an SDNC "reserve" request and stores it in the specified execution
- * variable.
+ * variable.
* @param execution the execution
* @param action the type of action: reserve, turnup, etc
* @param resultVar the execution variable in which the result will be stored
@@ -424,7 +424,7 @@ class SDNCAdapterUtils {
if (additionalData == null) {
additionalData = ""
}
-
+
if(isAic3) {
nnsl2HomingInformation = updateHomingInfo(nnsl2HomingInformation, "AIC3.0")
}
@@ -470,7 +470,7 @@ class SDNCAdapterUtils {
exceptionUtil.buildAndThrowWorkflowException(execution, 5000, "Internal Error")
}
}
-
+
public String updateHomingInfo(String homingInfo, String aicVersion) {
String newHomingInfo
if(homingInfo == null || homingInfo.trim().length() == 0) {
@@ -480,7 +480,7 @@ class SDNCAdapterUtils {
newHomingInfo = homingInfo.substring(0, homingInfo.indexOf("</l2-homing-information>")) + "<aic-version>" + aicVersion + "</aic-version></l2-homing-information>"
}
}
-
+
/**
* Builds a topology SDNC request and return String request.
* As V2 will use 1607-style request, region instead of aic clli code
@@ -506,7 +506,7 @@ class SDNCAdapterUtils {
} else {
hdrRequestId = testHdrRequestId
}
-
+
String requestId = ""
try {
requestId = execution.getVariable("mso-request-id")
@@ -561,6 +561,9 @@ class SDNCAdapterUtils {
int subscriberNameEnd = siRelatedLink.indexOf("/service-subscriptions/")
subscriberName = siRelatedLink.substring(subscriberNameStart + 19, subscriberNameEnd)
subscriberName = UriUtils.decode(subscriberName,"UTF-8")
+ }else{
+ serviceType = execution.getVariable("serviceType")
+ subscriberName = execution.getVariable("subscriberName")
}
String content =
@@ -635,11 +638,11 @@ class SDNCAdapterUtils {
requestId = execution.getVariable("mso-request-id")
if (requestId == null) {
requestId = execution.getVariable("msoRequestId")
- }
+ }
} else {
requestId = testRequestId
- }
-
+ }
+
String aicCloudRegion = cloudRegionId
String tenantId = ""
if (utils.nodeExists(requestXML, "tenant-id")) {
@@ -717,7 +720,7 @@ class SDNCAdapterUtils {
String content =
"""<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
- xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1"
xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
<sdncadapter:RequestHeader>
<sdncadapter:RequestId>${MsoUtils.xmlEscape(hdrRequestId)}</sdncadapter:RequestId>
@@ -993,7 +996,7 @@ class SDNCAdapterUtils {
exceptionUtil.buildAndThrowWorkflowException(execution, 400, msg)
}
}
-
+
public String modelInfoToEcompModelInformation(String jsonModelInfo) {
String modelInvariantUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelInvariantUuid")
String modelUuid = jsonUtil.getJsonValue(jsonModelInfo, "modelUuid")
@@ -1004,11 +1007,11 @@ class SDNCAdapterUtils {
String modelCustomizationString = ""
if (modelCustomizationUuid != null) {
modelCustomizationString = "<model-customization-uuid>${MsoUtils.xmlEscape(modelCustomizationUuid)}</model-customization-uuid>"
- }
+ }
String modelVersion = jsonUtil.getJsonValue(jsonModelInfo, "modelVersion")
if (modelVersion == null) {
modelVersion = ""
- }
+ }
String modelName = jsonUtil.getJsonValue(jsonModelInfo, "modelName")
String ecompModelInformation =
"""<onap-model-information>
@@ -1019,6 +1022,6 @@ class SDNCAdapterUtils {
<model-name>${MsoUtils.xmlEscape(modelName)}</model-name>
</onap-model-information>"""
- return ecompModelInformation
- }
+ return ecompModelInformation
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java
index 937c79be1d..978f1e9324 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/CtagAssignment.java
@@ -37,13 +37,13 @@ public class CtagAssignment implements Serializable, ShallowCopy<CtagAssignment>
@Id
@JsonProperty("vlan-id-inner")
- private long vlanIdInner;
+ private Long vlanIdInner;
- public long getVlanIdInner() {
+ public Long getVlanIdInner() {
return vlanIdInner;
}
- public void setVlanIdInner(long vlanIdInner) {
+ public void setVlanIdInner(Long vlanIdInner) {
this.vlanIdInner = vlanIdInner;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
index 218763a006..17bd4f545b 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
@@ -62,7 +62,7 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
@JsonProperty("platform")
private Platform platform;
@JsonProperty("cascaded")
- private boolean cascaded;
+ private Boolean cascaded;
@JsonProperty("cloud-params")
private Map<String, String> cloudParams = new HashMap<>();
@JsonProperty("cloud-context")
@@ -104,9 +104,9 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
@JsonProperty("vdisk-units")
private String vdiskUnits;
@JsonProperty("in-maint")
- private boolean inMaint;
+ private Boolean inMaint;
@JsonProperty("is-closed-loop-disabled")
- private boolean isClosedLoopDisabled;
+ private Boolean isClosedLoopDisabled;
@JsonProperty("summary-status")
private String summaryStatus;
@JsonProperty("encrypted-access-flag")
@@ -138,7 +138,7 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
@JsonProperty("instance-groups")
private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>();
@JsonProperty("call-homing")
- private boolean callHoming;
+ private Boolean callHoming;
public List<InstanceGroup> getInstanceGroups() {
@@ -309,19 +309,19 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
this.vdiskUnits = vdiskUnits;
}
- public boolean isInMaint() {
+ public Boolean isInMaint() {
return inMaint;
}
- public void setInMaint(boolean inMaint) {
+ public void setInMaint(Boolean inMaint) {
this.inMaint = inMaint;
}
- public boolean isClosedLoopDisabled() {
+ public Boolean isIsClosedLoopDisabled() {
return isClosedLoopDisabled;
}
- public void setClosedLoopDisabled(boolean isClosedLoopDisabled) {
+ public void setClosedLoopDisabled(Boolean isClosedLoopDisabled) {
this.isClosedLoopDisabled = isClosedLoopDisabled;
}
@@ -453,11 +453,11 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
this.platform = platform;
}
- public boolean isCascaded() {
+ public Boolean isCascaded() {
return cascaded;
}
- public void setCascaded(boolean cascaded) {
+ public void setCascaded(Boolean cascaded) {
this.cascaded = cascaded;
}
@@ -485,11 +485,11 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
this.cloudRegion = cloudRegion;
}
- public boolean isCallHoming() {
+ public Boolean isCallHoming() {
return callHoming;
}
- public void setCallHoming(boolean callHoming) {
+ public void setCallHoming(Boolean callHoming) {
this.callHoming = callHoming;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java
index 51cd998073..5f43ba076a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/L3Network.java
@@ -46,7 +46,7 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
@JsonProperty("network-id")
private String networkId;
@JsonProperty("cascaded")
- private boolean cascaded;
+ private Boolean cascaded;
@JsonProperty("cloud-params")
private Map<String, String> cloudParams = new HashMap<>();
@JsonProperty("network-name")
@@ -60,7 +60,7 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
@JsonProperty("network-role")
private String networkRole;
@JsonProperty("is-bound-to-vpn")
- private boolean isBoundToVpn;
+ private Boolean isBoundToVpn;
@JsonProperty("service-id")
private String serviceId;
@JsonProperty("network-role-instance")
@@ -82,11 +82,11 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
@JsonProperty("physical-network-name")
private String physicalNetworkName;
@JsonProperty("is-provider-network")
- private boolean isProviderNetwork;
+ private Boolean isProviderNetwork;
@JsonProperty("is-shared-network")
- private boolean isSharedNetwork;
+ private Boolean isSharedNetwork;
@JsonProperty("is-external-network")
- private boolean isExternalNetwork;
+ private Boolean isExternalNetwork;
@JsonProperty("self-link")
private String selflink;
@JsonProperty("operational-status")
@@ -142,10 +142,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
public void setNetworkRole(String networkRole) {
this.networkRole = networkRole;
}
- public boolean isBoundToVpn() {
+ public Boolean isIsBoundToVpn() {
return isBoundToVpn;
}
- public void setIsBoundToVpn(boolean isBoundToVpn) {
+ public void setIsBoundToVpn(Boolean isBoundToVpn) {
this.isBoundToVpn = isBoundToVpn;
}
public String getServiceId() {
@@ -202,22 +202,22 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
public void setPhysicalNetworkName(String physicalNetworkName) {
this.physicalNetworkName = physicalNetworkName;
}
- public boolean isProviderNetwork() {
+ public Boolean isIsProviderNetwork() {
return isProviderNetwork;
}
- public void setIsProviderNetwork(boolean isProviderNetwork) {
+ public void setIsProviderNetwork(Boolean isProviderNetwork) {
this.isProviderNetwork = isProviderNetwork;
}
- public boolean isSharedNetwork() {
+ public Boolean isIsSharedNetwork() {
return isSharedNetwork;
}
- public void setIsSharedNetwork(boolean isSharedNetwork) {
+ public void setIsSharedNetwork(Boolean isSharedNetwork) {
this.isSharedNetwork = isSharedNetwork;
}
- public boolean isExternalNetwork() {
+ public Boolean isIsExternalNetwork() {
return isExternalNetwork;
}
- public void setIsExternalNetwork(boolean isExternalNetwork) {
+ public void setIsExternalNetwork(Boolean isExternalNetwork) {
this.isExternalNetwork = isExternalNetwork;
}
public String getSelflink() {
@@ -242,10 +242,10 @@ public class L3Network implements Serializable, ShallowCopy<L3Network> {
public List<SegmentationAssignment> getSegmentationAssignments() {
return segmentationAssignments;
}
- public boolean isCascaded() {
+ public Boolean isCascaded() {
return cascaded;
}
- public void setIsCascaded(boolean cascaded) {
+ public void setIsCascaded(Boolean cascaded) {
this.cascaded = cascaded;
}
public Map<String, String> getCloudParams() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
index 4bba39ee62..f102c15062 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LInterface.java
@@ -57,13 +57,13 @@ public class LInterface implements Serializable, ShallowCopy<LInterface>{
@JsonProperty("interface-description")
private String interfaceDescription;
@JsonProperty("is-port-mirrored")
- private boolean isPortMirrored;
+ private Boolean isPortMirrored;
@JsonProperty("in-maint")
- private boolean inMaint;
+ private Boolean inMaint;
@JsonProperty("prov-status")
private String provStatus;
@JsonProperty("is-ip-unnumbered")
- private boolean isIpUnnumbered;
+ private Boolean isIpUnnumbered;
@JsonProperty("allowed-address-pairs")
private String allowedAddressPairs;
@JsonProperty("vlans")
@@ -131,13 +131,13 @@ public class LInterface implements Serializable, ShallowCopy<LInterface>{
public void setInterfaceDescription(String interfaceDescription) {
this.interfaceDescription = interfaceDescription;
}
- public boolean isPortMirrored() {
+ public Boolean isIsPortMirrored() {
return isPortMirrored;
}
- public void setPortMirrored(boolean isPortMirrored) {
+ public void setPortMirrored(Boolean isPortMirrored) {
this.isPortMirrored = isPortMirrored;
}
- public boolean isInMaint() {
+ public Boolean isInMaint() {
return inMaint;
}
public void setInMaint(boolean inMaint) {
@@ -149,10 +149,10 @@ public class LInterface implements Serializable, ShallowCopy<LInterface>{
public void setProvStatus(String provStatus) {
this.provStatus = provStatus;
}
- public boolean isIpUnnumbered() {
+ public Boolean isIsIpUnnumbered() {
return isIpUnnumbered;
}
- public void setIpUnnumbered(boolean isIpUnnumbered) {
+ public void setIpUnnumbered(Boolean isIpUnnumbered) {
this.isIpUnnumbered = isIpUnnumbered;
}
public String getAllowedAddressPairs() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java
index 8a3248e92c..f69f4628fa 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/LagInterface.java
@@ -53,7 +53,7 @@ public class LagInterface implements Serializable, ShallowCopy<LagInterface>{
@JsonProperty("prov-status")
private String provStatus;
@JsonProperty("in-maint")
- private boolean inMaint;
+ private Boolean inMaint;
@JsonProperty("l-interfaces")
private List<LInterface> lInterfaces = new ArrayList<>();
@@ -99,7 +99,7 @@ public class LagInterface implements Serializable, ShallowCopy<LagInterface>{
public void setProvStatus(String provStatus) {
this.provStatus = provStatus;
}
- public boolean isInMaint() {
+ public Boolean isInMaint() {
return inMaint;
}
public void setInMaint(boolean inMaint) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java
index 4f54139386..742a541352 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/PhysicalLink.java
@@ -48,9 +48,9 @@ public class PhysicalLink implements Serializable, ShallowCopy<PhysicalLink> {
@JsonProperty("management-option")
private String managementOption;
@JsonProperty("bandwidth-up")
- private int bandwidthUp;
+ private Integer bandwidthUp;
@JsonProperty("bandwidth-down")
- private int bandwidthDown;
+ private Integer bandwidthDown;
@JsonProperty("bandwidth-units")
private String bandwidthUnits;
@JsonProperty("wan-port")
@@ -99,19 +99,19 @@ public class PhysicalLink implements Serializable, ShallowCopy<PhysicalLink> {
this.managementOption = managementOption;
}
- public int getBandwidthUp(){
+ public Integer getBandwidthUp(){
return bandwidthUp;
}
- public void setBandwidthUp(int bandwidthUp){
+ public void setBandwidthUp(Integer bandwidthUp){
this.bandwidthUp = bandwidthUp;
}
- public int getBandwidthDown(){
+ public Integer getBandwidthDown(){
return bandwidthDown;
}
- public void setBandwidthDown(int bandwidthDown){
+ public void setBandwidthDown(Integer bandwidthDown){
this.bandwidthDown = bandwidthDown;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java
index cb23f3a3b9..7277438102 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Subnet.java
@@ -57,7 +57,7 @@ public class Subnet implements Serializable, ShallowCopy<Subnet>{
@JsonProperty("orchestration-status")
private OrchestrationStatus orchestrationStatus;
@JsonProperty("dhcp-enabled")
- private boolean dhcpEnabled;
+ private Boolean dhcpEnabled;
@JsonProperty("dhcp-start")
private String dhcpStart;
@JsonProperty("dhcp-end")
@@ -119,10 +119,10 @@ public class Subnet implements Serializable, ShallowCopy<Subnet>{
public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
this.orchestrationStatus = orchestrationStatus;
}
- public boolean isDhcpEnabled() {
+ public Boolean isDhcpEnabled() {
return dhcpEnabled;
}
- public void setDhcpEnabled(boolean dhcpEnabled) {
+ public void setDhcpEnabled(Boolean dhcpEnabled) {
this.dhcpEnabled = dhcpEnabled;
}
public String getDhcpStart() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
index fba78d7a87..469bc991b4 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VfModule.java
@@ -50,7 +50,7 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> {
@JsonProperty("cloud-params")
private Map<String, String> cloudParams = new HashMap<>();
@JsonProperty("cascaded")
- private boolean cascaded;
+ private Boolean cascaded;
@JsonProperty("heat-stack-id")
private String heatStackId;
@JsonProperty("contrail-service-instance-fqdn")
@@ -116,7 +116,7 @@ public class VfModule implements Serializable, ShallowCopy<VfModule> {
public void setCloudParams(Map<String, String> cloudParams) {
this.cloudParams = cloudParams;
}
- public boolean isCascaded() {
+ public Boolean isCascaded() {
return cascaded;
}
public void setCascaded(boolean cascaded) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
index 65eeedc44c..a0788d4b0d 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/Vlan.java
@@ -59,11 +59,11 @@ public class Vlan implements Serializable, ShallowCopy<Vlan>{
@JsonProperty("orchestration-status")
private OrchestrationStatus orchestrationStatus;
@JsonProperty("in-maint")
- private boolean inMaint;
+ private Boolean inMaint;
@JsonProperty("prov-status")
private String provStatus;
@JsonProperty("is-ip-unnumbered")
- private boolean isIpUnnumbered;
+ private Boolean isIpUnnumbered;
@JsonProperty("l3-interface-ipv4-address-list")
private List<L3InterfaceIpv4AddressList> l3InterfaceIpv4AddressList = new ArrayList<L3InterfaceIpv4AddressList>();
@JsonProperty("l3-interface-ipv6-address-list")
@@ -123,7 +123,7 @@ public class Vlan implements Serializable, ShallowCopy<Vlan>{
public void setOrchestrationStatus(OrchestrationStatus orchestrationStatus) {
this.orchestrationStatus = orchestrationStatus;
}
- public boolean isInMaint() {
+ public Boolean isInMaint() {
return inMaint;
}
public void setInMaint(boolean inMaint) {
@@ -135,10 +135,10 @@ public class Vlan implements Serializable, ShallowCopy<Vlan>{
public void setProvStatus(String provStatus) {
this.provStatus = provStatus;
}
- public boolean isIpUnnumbered() {
+ public Boolean isIsIpUnnumbered() {
return isIpUnnumbered;
}
- public void setIpUnnumbered(boolean isIpUnnumbered) {
+ public void setIpUnnumbered(Boolean isIpUnnumbered) {
this.isIpUnnumbered = isIpUnnumbered;
}
public List<L3InterfaceIpv4AddressList> getL3InterfaceIpv4AddressList() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java
index 565a151077..99a643a129 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/VolumeGroup.java
@@ -52,7 +52,7 @@ public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> {
@JsonProperty("cloud-params")
private Map<String, String> cloudParams = new HashMap<>();
@JsonProperty("cascaded")
- private boolean cascaded;
+ private Boolean cascaded;
@JsonProperty("heat-stack-id")
private String heatStackId;
@JsonProperty("model-info-vf-module")
@@ -100,7 +100,7 @@ public class VolumeGroup implements Serializable, ShallowCopy<VolumeGroup> {
public void setCloudParams(Map<String, String> cloudParams) {
this.cloudParams = cloudParams;
}
- public boolean isCascaded() {
+ public Boolean isCascaded() {
return cascaded;
}
public void setCascaded(boolean cascaded) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java
index 38f974168e..7b11e9f68e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/BuildingBlock.java
@@ -37,7 +37,7 @@ public class BuildingBlock implements Serializable{
@JsonProperty("key")
private String key;
@JsonProperty("is-virtual-link")
- private boolean isVirtualLink;
+ private Boolean isVirtualLink;
@JsonProperty("virtual-link-key")
private String virtualLinkKey;
@@ -59,10 +59,10 @@ public class BuildingBlock implements Serializable{
public void setKey(String key) {
this.key = key;
}
- public boolean getIsVirtualLink() {
+ public Boolean getIsVirtualLink() {
return isVirtualLink;
}
- public void setIsVirtualLink(boolean isVirtualLink) {
+ public void setIsVirtualLink(Boolean isVirtualLink) {
this.isVirtualLink = isVirtualLink;
}
public String getVirtualLinkKey() {
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 36a24bd1e1..0d04b5e7a1 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
@@ -35,8 +35,8 @@ public class ExecuteBuildingBlock implements Serializable{
private String resourceId;
private String requestAction;
private String vnfType;
- private boolean aLaCarte;
- private boolean homing;
+ private Boolean aLaCarte;
+ private Boolean homing;
private WorkflowResourceIds workflowResourceIds;
private RequestDetails requestDetails;
@@ -70,10 +70,10 @@ public class ExecuteBuildingBlock implements Serializable{
public void setRequestAction(String requestAction) {
this.requestAction = requestAction;
}
- public boolean isaLaCarte() {
+ public Boolean isaLaCarte() {
return aLaCarte;
}
- public void setaLaCarte(boolean aLaCarte) {
+ public void setaLaCarte(Boolean aLaCarte) {
this.aLaCarte = aLaCarte;
}
public String getVnfType() {
@@ -82,10 +82,10 @@ public class ExecuteBuildingBlock implements Serializable{
public void setVnfType(String vnfType) {
this.vnfType = vnfType;
}
- public boolean isHoming() {
+ public Boolean isHoming() {
return homing;
}
- public void setHoming(boolean homing) {
+ public void setHoming(Boolean homing) {
this.homing = homing;
}
public WorkflowResourceIds getWorkflowResourceIds() {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java
index d594c73638..8f1262f70e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/generalobjects/OrchestrationContext.java
@@ -32,13 +32,13 @@ public class OrchestrationContext implements Serializable {
private static final long serialVersionUID = 6843015923244810369L;
@JsonProperty("is-rollback-enabled")
- private boolean isRollbackEnabled;
+ private Boolean isRollbackEnabled;
- public boolean getIsRollbackEnabled() {
+ public Boolean getIsRollbackEnabled() {
return this.isRollbackEnabled;
}
- public void setIsRollbackEnabled(boolean isRollbackEnabled) {
+ public void setIsRollbackEnabled(Boolean isRollbackEnabled) {
this.isRollbackEnabled = isRollbackEnabled;
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java
index 17e42b4396..3c8f0e933f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/homingobjects/SolutionInfo.java
@@ -33,28 +33,28 @@ public class SolutionInfo implements Serializable {
private static final long serialVersionUID = 6903399488466840832L;
@JsonProperty("solution-id") //identifies which solution
- private int solutionId;
+ private Integer solutionId;
@JsonProperty("homed")
- private boolean homed;
+ private Boolean homed;
@JsonProperty("is-rehome")
- private boolean isRehome;
+ private Boolean isRehome;
@JsonProperty("targeted-cloud")
private CloudRegion targetedCloudRegion;
- public boolean isHomed() {
+ public Boolean isHomed() {
return homed;
}
- public void setHomed(boolean homed) {
+ public void setHomed(Boolean homed) {
this.homed = homed;
}
- public boolean isRehome() {
+ public Boolean isRehome() {
return isRehome;
}
- public void setRehome(boolean isRehome) {
+ public void setRehome(Boolean isRehome) {
this.isRehome = isRehome;
}
@@ -63,7 +63,7 @@ public class SolutionInfo implements Serializable {
* given resource or resource pair.
* i.e. 1, 2, 3....
*/
- public int getSolutionId() {
+ public Integer getSolutionId() {
return solutionId;
}
@@ -72,7 +72,7 @@ public class SolutionInfo implements Serializable {
* given resource or resource pair.
* i.e. 1, 2, 3....
*/
- public void setSolutionId(int solutionId) {
+ public void setSolutionId(Integer solutionId) {
this.solutionId = solutionId;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java
index 349010781d..cb6fabde30 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoCollection.java
@@ -43,7 +43,7 @@ public class ModelInfoCollection implements Serializable {
@JsonProperty("description")
private String description;
@JsonProperty("quantity")
- private int quantity;
+ private Integer quantity;
public String getModelCustomizationUUID() {
return modelCustomizationUUID;
@@ -87,10 +87,10 @@ public class ModelInfoCollection implements Serializable {
public void setDescription(String description) {
this.description = description;
}
- public int getQuantity() {
+ public Integer getQuantity() {
return quantity;
}
- public void setQuantity(int quantity) {
+ public void setQuantity(Integer quantity) {
this.quantity = quantity;
}
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 b5203c676a..e8e1982911 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
@@ -141,8 +141,8 @@ public class BBInputSetup implements JavaDelegate {
String resourceId = executeBB.getResourceId();
String requestAction = executeBB.getRequestAction();
String vnfType = executeBB.getVnfType();
- boolean aLaCarte = executeBB.isaLaCarte();
- boolean homing = executeBB.isHoming();
+ boolean aLaCarte = Boolean.TRUE.equals(executeBB.isaLaCarte());
+ boolean homing = Boolean.TRUE.equals(executeBB.isHoming());
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
outputBB = this.getGBB(executeBB, lookupKeyMap, requestAction, aLaCarte, resourceId, vnfType);
ObjectMapper mapper = new ObjectMapper();
@@ -346,13 +346,15 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo vnfModelInfo = new ModelInfo();
vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
this.mapCatalogVnf(tempVnf, vnfModelInfo, service);
- for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
- String volumeGroupCustId =
- this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER,
- cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
- if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
- break;
+ if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) == null) {
+ for(VolumeGroup volumeGroup : tempVnf.getVolumeGroups()) {
+ String volumeGroupCustId =
+ this.bbInputSetupUtils.getAAIVolumeGroup(CLOUD_OWNER,
+ cloudConfiguration.getLcpCloudRegionId(), volumeGroup.getVolumeGroupId()).getModelCustomizationId();
+ if(modelInfo.getModelCustomizationId().equalsIgnoreCase(volumeGroupCustId)) {
+ lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroup.getVolumeGroupId());
+ break;
+ }
}
}
break;
@@ -705,7 +707,7 @@ public class BBInputSetup implements JavaDelegate {
}
}
ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer,
- project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(),
+ project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer);
} else {
@@ -877,7 +879,7 @@ public class BBInputSetup implements JavaDelegate {
if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) {
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
ModelInfo networkModelInfo = new ModelInfo();
- if(!executeBB.getBuildingBlock().getIsVirtualLink()) {
+ if(!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink())) {
NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
if (networkCust != null) {
networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
new file mode 100644
index 0000000000..768bee578c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
@@ -0,0 +1,19 @@
+package org.openecomp.mso.bpmn.common.workflow.service;
+
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+/**
+ * Exception thrown when an error occurs while processing the workflow.
+ * This encapsulates the workflow response so that the same can be sent back to api handler.
+ */
+public class WorkflowProcessorException extends RuntimeException {
+ WorkflowResponse workflowResponse;
+
+ public WorkflowProcessorException(WorkflowResponse workflowResponse) {
+ this.workflowResponse = workflowResponse;
+ }
+
+ public WorkflowResponse getWorkflowResponse() {
+ return workflowResponse;
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy
new file mode 100644
index 0000000000..5deec5b434
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/DecomposeServiceTest.groovy
@@ -0,0 +1,76 @@
+/*-
+ * ============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.bpmn.common.scripts
+
+import org.junit.Before
+import org.mockito.MockitoAnnotations
+import org.onap.so.bpmn.core.domain.ModelInfo
+import org.onap.so.bpmn.core.domain.NetworkResource
+import org.onap.so.bpmn.core.domain.ServiceDecomposition
+import org.onap.so.bpmn.core.json.DecomposeJsonUtil
+import org.onap.so.bpmn.core.domain.ServiceInstance
+
+import org.onap.so.bpmn.mock.FileUtil
+import static org.mockito.Mockito.*
+import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
+import static org.junit.Assert.*;
+import org.junit.Test;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+class DecomposeServiceTest {
+
+ @Test
+ public void testDecomposeService() {
+
+ String catalogDbResponse = FileUtil.readResourceFile("__files/decomposition/catalogDbResponse.json");
+
+ ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setInstanceId("serviceInstanceID");
+ serviceDecomposition.setServiceType("");
+ serviceDecomposition.setServiceRole("");
+
+ ArrayList networkResources = new ArrayList();
+ NetworkResource networkResource = new NetworkResource();
+ networkResource.setNetworkType("testNetworkType");
+ networkResource.setNetworkRole("testNetworkRole");
+ networkResource.setNetworkScope("testNetworkScope");
+ networkResource.setToscaNodeType("testToscaModelType")
+ networkResource.setNetworkTechnology("testNetworkTechnology");
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelName("testModleName");
+ modelInfo.setModelUuid("testModelUuid")
+ modelInfo.setModelInvariantUuid("testModelInvariantId")
+ modelInfo.setModelVersion("testModelVersion");
+ modelInfo.setModelCustomizationUuid("testModelCustomizationUuid");
+ modelInfo.setModelInstanceName("testModelInstanceName");
+ networkResource.setModelInfo(modelInfo);
+
+ networkResources.add(networkResource);
+ serviceDecomposition.setNetworkResources(networkResources)
+ serviceDecomposition.setServiceInstance(serviceInstance);
+
+ ServiceDecomposition serviceDecompositionExtracted = DecomposeJsonUtil.jsonToServiceDecomposition(catalogDbResponse, "serviceInstanceID")
+
+ assertThat(serviceDecompositionExtracted, sameBeanAs(serviceDecomposition).ignoring("modelInfo").ignoring("vnfResources").ignoring("allottedResources").ignoring("networkResources.resourceId"));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java
index 801314b2ae..eac6c0a8b7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/BBPojoTest.java
@@ -21,7 +21,6 @@
package org.onap.so.bpmn.servicedecomposition;
import org.junit.Test;
-import org.onap.so.BaseTest;
import com.openpojo.reflection.PojoClass;
import com.openpojo.reflection.PojoClassFilter;
@@ -30,12 +29,13 @@ import com.openpojo.reflection.filters.FilterPackageInfo;
import com.openpojo.validation.Validator;
import com.openpojo.validation.ValidatorBuilder;
import com.openpojo.validation.rule.impl.GetterMustExistRule;
+import com.openpojo.validation.rule.impl.NoPrimitivesRule;
import com.openpojo.validation.rule.impl.SerializableMustHaveSerialVersionUIDRule;
import com.openpojo.validation.test.impl.GetterTester;
import com.openpojo.validation.test.impl.SetterTester;
-public class BBPojoTest extends BaseTest{
+public class BBPojoTest {
private PojoClassFilter filterTestClasses = new FilterTestClasses();
@Test
@@ -52,6 +52,7 @@ public class BBPojoTest extends BaseTest{
.with(new GetterMustExistRule())
.with(new SetterTester())
.with(new GetterTester())
+ .with(new NoPrimitivesRule())
.with(new SerializableMustHaveSerialVersionUIDRule())
.build();
validator.validate(pojoPackage, new FilterPackageInfo(), filterTestClasses, new FilterNonConcrete());
@@ -62,4 +63,4 @@ public class BBPojoTest extends BaseTest{
return !pojoClass.getSourcePath().contains("/test-classes/");
}
}
-} \ No newline at end of file
+}
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 0abbb2dbe2..c18dcf5cfa 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
@@ -79,7 +79,7 @@ import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class BBInputSetupMapperLayerTest {
- @InjectMocks
+
BBInputSetupMapperLayer bbInputSetupMapperLayer = new BBInputSetupMapperLayer();
ObjectMapper mapper = new ObjectMapper();
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 a821d69754..489163b23a 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
@@ -425,7 +425,7 @@ public class BBInputSetupTest {
doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId);
doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
- project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(),
+ project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
executeBB, requestAction, customer);
@@ -475,7 +475,7 @@ public class BBInputSetupTest {
doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId);
doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer);
doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
- project, owningEntity, lookupKeyMap, resourceId, executeBB.isaLaCarte(),
+ project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
executeBB, requestAction,customer);
@@ -518,7 +518,7 @@ public class BBInputSetupTest {
doReturn(customer).when(SPY_bbInputSetup).getCustomerAndServiceSubscription(requestDetails, resourceId);
doReturn(serviceSubscription).when(SPY_bbInputSetup).getServiceSubscription(requestDetails, customer);
doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
- null, null, lookupKeyMap, resourceId, executeBB.isaLaCarte(),
+ null, null, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
executeBB, requestAction,customer);
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json
index e4c8a8f59b..cd9cf06029 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/GenericVnfExpected.json
@@ -8,7 +8,6 @@
"vf-module-id":"vfModuleId",
"vf-module-name":"vfModuleName",
"orchestration-status":"PRECREATED",
- "cascaded":false,
"heat-stack-id":"heatStackId",
"contrail-service-instance-fqdn":"contrailServiceInstanceFqdn",
"module-index":1,"selflink":"selflink",
@@ -19,7 +18,6 @@
"volume-groups":[],
"line-of-business":null,
"platform":null,
- "cascaded":false,
"cloud-params":{},
"cloud-context":null,
"solution":null,
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json
index a7e2ade10b..c6c5c790a8 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/ModelInfoCollection.json
@@ -5,6 +5,5 @@
"collection-function":"function",
"collection-role":"role",
"collection-type":"type",
- "description":"description",
- "quantity":0
+ "description":"description"
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
index f807276773..bcc565dc75 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/ExecuteBuildingBlock/VolumeGroup.json
@@ -4,6 +4,5 @@
"vnf-type":"vnfType",
"orchestration-status":"PRECREATED",
"cloud-params":{},
- "cascaded":false,
"heat-stack-id":"heatStackId"
}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json b/bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json
new file mode 100644
index 0000000000..087233d08b
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/resources/__files/decomposition/catalogDbResponse.json
@@ -0,0 +1,33 @@
+{
+ "serviceResources": {
+ "serviceType": "",
+ "workloadContext": "testWorkloadContext",
+ "serviceAllottedResources": [],
+ "modelInfo": {
+ "modelInvariantUuid": "testModelInvariantId",
+ "modelName": "testModleName",
+ "modelVersion": "testModelVersion",
+ "modelUuid": "testModelUuid"
+ },
+ "environmentContext": "testEnvironmentContent",
+ "serviceRole": "",
+ "serviceVnfs": [],
+ "serviceNetworks": [
+ {
+ "toscaNodeType": "testToscaModelType",
+ "networkTechnology": "testNetworkTechnology",
+ "networkScope": "testNetworkScope",
+ "modelInfo": {
+ "modelInvariantUuid": "testModelInvariantId",
+ "modelName": "testModleName",
+ "modelVersion": "testModelVersion",
+ "modelCustomizationUuid": "testModelCustomizationUuid",
+ "modelInstanceName": "testModelInstanceName",
+ "modelUuid": "testModelUuid"
+ },
+ "networkRole": "testNetworkRole",
+ "networkType": "testNetworkType"
+ }
+ ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index 715ddaa937..f039441738 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -31,6 +31,9 @@ log:
vnfAdapterRestV1: 'true'
mso:
adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
completemsoprocess:
endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess
db:
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
index 099f084637..5e7a4796c4 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java
@@ -69,7 +69,7 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable {
private OwningEntity owningEntity;
@JsonProperty("serviceVnfs")
private List <VnfResource> vnfResources;
- @JsonProperty("networkResource")
+ @JsonProperty("serviceNetworks")
private List <NetworkResource> networkResources;
@JsonProperty("serviceAllottedResources")
private List <AllottedResource> allottedResources;
diff --git a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
index 82470f125b..5d8d55152c 100644
--- a/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
+++ b/bpmn/MSOCoreBPMN/src/test/java/org/onap/so/bpmn/core/domain/ServiceDecompositionTest.java
@@ -103,6 +103,8 @@ public class ServiceDecompositionTest {
serviceDecomp.addResource(allottedResource);
serviceDecomp.addResource(configResource);
+ System.out.println(serviceDecomp.toJsonString());
+
assertThat(serviceDecomp.getServiceResource(vnfResource.getResourceId()), sameBeanAs(vnfResource));
assertThat(serviceDecomp.getServiceResource(networkResource.getResourceId()), sameBeanAs(networkResource));
assertThat(serviceDecomp.getServiceResource(allottedResource.getResourceId()), sameBeanAs(allottedResource));
diff --git a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json
index c424293ca2..f094e99782 100644
--- a/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json
+++ b/bpmn/MSOCoreBPMN/src/test/resources/json-examples/ServiceDecompositionExpected.json
@@ -1,51 +1,59 @@
{
- "serviceResources" : {
- "modelInfo" : {
- "modelName" : "modelName",
- "modelUuid" : "modelUuid",
- "modelInvariantUuid" : "modelInvariantUuid",
- "modelVersion" : "modelVersion",
- "modelCustomizationUuid" : "modelCustomizationUuid",
- "modelCustomizationName" : "modelCustomizationName",
- "modelInstanceName" : "modelInstanceName",
- "modelType" : "modelType"
- },
- "serviceType" : "serviceType",
- "serviceRole" : "serviceRole",
- "project" : {},
- "owningEntity" : {},
- "serviceInstance" : {
- "serviceInstanceId" : "serviceInstanceId"
- },
- "serviceVnfs" : [
- {
- "resourceId" : "vnfResourceId",
- "resourceType" : "VNF",
- "resourceInstance" : {},
- "homingSolution" : {
- "license" : {},
- "rehome" : false
- },
- "vfModules" : []
- }
- ],
- "networkResource" : [
- {
- "resourceId" : "networkResourceId",
- "resourceType" : "NETWORK"
- }
- ],
- "serviceAllottedResources" : [
- {
- "resourceId" : "allottedResourceId",
- "resourceType" : "ALLOTTED_RESOURCE"
- }
- ],
- "configResource" : [
- {
- "resourceId" : "configResourceId",
- "resourceType" : "CONFIGURATION"
- }
- ]
- }
-}
+ "serviceResources" : {
+ "serviceInstance" : {
+ "instanceId" : "serviceInstanceId",
+ "customer" : { }
+ },
+ "modelInfo" : {
+ "modelName" : "modelName",
+ "modelUuid" : "modelUuid",
+ "modelInvariantUuid" : "modelInvariantUuid",
+ "modelVersion" : "modelVersion",
+ "modelCustomizationUuid" : "modelCustomizationUuid",
+ "modelCustomizationName" : "modelCustomizationName",
+ "modelInstanceName" : "modelInstanceName",
+ "modelType" : "modelType"
+ },
+ "serviceType" : "serviceType",
+ "serviceRole" : "serviceRole",
+ "project" : { },
+ "owningEntity" : { },
+ "serviceVnfs" : [ {
+ "resourceId" : "vnfResourceId",
+ "resourceType" : "VNF",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ },
+ "vfModules" : [ ]
+ } ],
+ "serviceNetworks" : [ {
+ "resourceId" : "networkResourceId",
+ "resourceType" : "NETWORK",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ }
+ } ],
+ "serviceAllottedResources" : [ {
+ "resourceId" : "allottedResourceId",
+ "resourceType" : "ALLOTTED_RESOURCE",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ }
+ } ],
+ "configResource" : [ {
+ "resourceId" : "configResourceId",
+ "resourceType" : "CONFIGURATION",
+ "resourceInstance" : { },
+ "homingSolution" : {
+ "license" : { },
+ "rehome" : false
+ }
+ } ]
+ }
+} \ No newline at end of file
diff --git a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
index bbdaa94581..17ede2f2ff 100644
--- a/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
+++ b/bpmn/MSORESTClient/src/test/java/org/onap/so/rest/RESTClientTest.java
@@ -51,7 +51,8 @@ public class RESTClientTest {
private String jsonResponseAsString;
@Rule
- public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(28090));
+ public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().dynamicPort());
+
@Before
public void before() throws Exception {
@@ -62,7 +63,7 @@ public class RESTClientTest {
jsonResponse = new JSONObject();
jsonResponse.put("response", "responseValue");
jsonResponseAsString = jsonResponse.toString();
- restClient = new RESTClient("http://localhost:28090/example", "localhost", 28090);
+ restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example", "localhost", wireMockRule.port());
}
@Test
@@ -79,9 +80,9 @@ public class RESTClientTest {
assertEquals(1, restClient.getParameters().size());
restClient.addAuthorizationHeader("token");
assertEquals("[token]", restClient.getHeaders().get("Authorization").toString());
- assertEquals("http://localhost:28090/example", restClient.getURL());
- restClient = new RESTClient("http://localhost:28090/example1");
- assertEquals("http://localhost:28090/example1", restClient.getURL());
+ assertEquals("http://localhost:" + wireMockRule.port() + "/example", restClient.getURL());
+ restClient = new RESTClient("http://localhost:" + wireMockRule.port() + "/example1");
+ assertEquals("http://localhost:" + wireMockRule.port() + "/example1", restClient.getURL());
}
@Test
diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json
deleted file mode 100644
index b8c123eb15..0000000000
--- a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterface.json
+++ /dev/null
@@ -1,19 +0,0 @@
-{
- "interface-name": "Xe-7/1/10",
- "port-description": "VVIG EGRESS",
- "resource-version": "1494002035673",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "physical-link",
- "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe",
- "relationship-data": [
- {
- "relationship-key": "physical-link.link-name",
- "relationship-value": "L4YS.999964..ATI_EGRESS"
- }
- ]
- }
- ]
- }
-}
diff --git a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json b/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json
deleted file mode 100644
index 9ea3869121..0000000000
--- a/bpmn/att-services-bpmn/src/test/resources/__files/dhv/DHVChangeSpeed/getPInterfaces.json
+++ /dev/null
@@ -1,42 +0,0 @@
-{
- "p-interface": [
- {
- "interface-name": "Xe-7/1/10",
- "port-description": "VVIG EGRESS",
- "resource-version": "1494002035673",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "physical-link",
- "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe",
- "relationship-data": [
- {
- "relationship-key": "physical-link.link-name",
- "relationship-value": "L4YS.999964..ATI_EGRESS"
- }
- ]
- }
- ]
- }
- },
- {
- "interface-name": "Xe-8/2/11",
- "port-description": "VVIG EGRESS",
- "resource-version": "1494002035673",
- "relationship-list": {
- "relationship": [
- {
- "related-to": "physical-link",
- "related-link": "/aai/v11/network/physical-links/physical-link/testPhysicalLinkUcpe2",
- "relationship-data": [
- {
- "relationship-key": "physical-link.link-name",
- "relationship-value": "L4YS.999964..ATI_EGRESS"
- }
- ]
- }
- ]
- }
- }
- ]
-} \ No newline at end of file
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 cfd07d8c39..ef72149d10 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
@@ -40,6 +40,7 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContext;
import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.logger.MsoLogger;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -92,7 +93,6 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
/**
* Asynchronous JAX-RS method that starts a process instance.
- * @param asyncResponse an object that will receive the asynchronous response
* @param processKey the process key
* @param variableMap input variables to the process
* @return
@@ -114,7 +114,10 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
processor.startProcess(processKey, variableMap);
WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
return Response.status(202).entity(response).build();
- } catch (Exception e) {
+ } catch (WorkflowProcessorException e) {
+ WorkflowResponse response = e.getWorkflowResponse();
+ return Response.status(500).entity(response).build();
+ }catch (Exception e) {
WorkflowResponse response = buildUnkownError(getRequestId(inputVariables),e.getMessage());
return Response.status(500).entity(response).build();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index edc05afba2..da24ba14fd 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -28,11 +28,10 @@ import java.util.UUID;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.runtime.ProcessInstance;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
-import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
-import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
import org.onap.so.logger.MsoLogger;
+import org.openecomp.mso.bpmn.common.workflow.service.WorkflowProcessorException;
import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
@@ -79,13 +78,12 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
msoLogger.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.InternalError,
logMarker + "Error in starting the process: " + e.getMessage());
- WorkflowCallbackResponse callbackResponse = new WorkflowCallbackResponse();
- callbackResponse.setStatusCode(500);
- callbackResponse.setMessage("Fail");
- callbackResponse.setResponse("Error occurred while executing the process: " + e);
-
- WorkflowContextHolder.getInstance().processCallback(processKey, processInstanceId,
- getRequestId(inputVariables), callbackResponse);
+ WorkflowResponse workflowResponse = new WorkflowResponse();
+ workflowResponse.setResponse("Error occurred while executing the process: " + e);
+ workflowResponse.setProcessInstanceID(processInstanceId);
+ workflowResponse.setMessageCode(500);
+ workflowResponse.setMessage("Fail");
+ throw new WorkflowProcessorException(workflowResponse);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
new file mode 100644
index 0000000000..ff5e18c210
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResourceExceptionHandlingTest.java
@@ -0,0 +1,78 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 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.bpmn.common.workflow.service;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
+import javax.ws.rs.core.Response;
+
+import org.camunda.bpm.engine.test.Deployment;
+import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.junit.Test;
+import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
+
+
+public class WorkflowAsyncResourceExceptionHandlingTest {
+
+ @Test
+ @Deployment(resources = { "testAsyncResource.bpmn" })
+ public void asyncRequestSuccess() throws InterruptedException {
+ VariableMapImpl variableMap = new VariableMapImpl();
+
+ Map<String, Object> variableValueType = new HashMap<>();
+
+ Map<String, Object> requestMsg = new HashMap<>();
+ requestMsg.put("value", "");
+ requestMsg.put("type", "String");
+
+ Map<String, Object> msorequestId = new HashMap<>();
+ msorequestId.put("type", "String");
+ msorequestId.put("value",UUID.randomUUID().toString());
+
+ Map<String, Object> timeout = new HashMap<>();
+ timeout.put("type", "String");
+ timeout.put("value","5");
+
+ variableValueType.put("testAsyncRequestMsg", requestMsg);
+ variableValueType.put("mso-request-id", msorequestId);
+ variableValueType.put("mso-service-request-timeout", timeout);
+
+ variableMap.put("variables", variableValueType);
+ WorkflowAsyncResource workflowAsyncResource = new WorkflowAsyncResource();
+ workflowAsyncResource.setProcessor(new WorkflowProcessor());
+ Response res = workflowAsyncResource.startProcessInstanceByKey("randomKey", variableMap);
+ assertEquals(500,res.getStatus());
+ WorkflowResponse workflowResponse = (WorkflowResponse)res.getEntity();
+ assertNotNull(workflowResponse);
+ assertEquals(500, workflowResponse.getMessageCode());
+ assertTrue(workflowResponse.getResponse().startsWith("Error occurred while executing the process:"));
+ assertEquals("Fail", workflowResponse.getMessage());
+
+
+ }
+
+}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn
deleted file mode 100644
index cb4be0279e..0000000000
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetwork1802BB.bpmn
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
- <bpmn2:process id="AssignNetwork1802BB" name="AssignNetwork1802BB" isExecutable="true">
- <bpmn2:startEvent id="AssignNetworkBB_start" name="Start Flow">
- <bpmn2:outgoing>SequenceFlow_11op1ih</bpmn2:outgoing>
- </bpmn2:startEvent>
- <bpmn2:serviceTask id="ServiceTask_get_cloud_region" name="Process cloud region by version&#10;" camunda:expression="${AssignNetworkBBUtils.getCloudRegion(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_11op1ih</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_32</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:serviceTask id="ServiceTask_assign_network_sdnc" name="Assign Network (SDNC)" camunda:expression="${SDNCAssignTasks.assignNetwork(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_32</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0do51t8</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_32" name="" sourceRef="ServiceTask_get_cloud_region" targetRef="ServiceTask_assign_network_sdnc" />
- <bpmn2:sequenceFlow id="SequenceFlow_0do51t8" sourceRef="ServiceTask_assign_network_sdnc" targetRef="ServiceTask_assign_network_aai" />
- <bpmn2:serviceTask id="ServiceTask_assign_network_aai" name="Assign Network (AAI)" camunda:expression="${AAIUpdateTasks.updateOrchestrationStatusAssignedNetwork(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_0do51t8</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_0ln3hj3</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:endEvent id="AssignNetworkBB_end" name="End Flow">
- <bpmn2:incoming>SequenceFlow_0ln3hj3</bpmn2:incoming>
- </bpmn2:endEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_0ln3hj3" sourceRef="ServiceTask_assign_network_aai" targetRef="AssignNetworkBB_end" />
- <bpmn2:sequenceFlow id="SequenceFlow_11op1ih" sourceRef="AssignNetworkBB_start" targetRef="ServiceTask_get_cloud_region" />
- <bpmn2:textAnnotation id="TextAnnotation_0dnksb2"> <bpmn2:text>sets Cloud Region on BB execution for SDNC assign</bpmn2:text>
-</bpmn2:textAnnotation>
- <bpmn2:association id="Association_1rsqd3z" sourceRef="ServiceTask_get_cloud_region" targetRef="TextAnnotation_0dnksb2" />
- </bpmn2:process>
- <bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
- <bpmn2:error id="Error_1" name="java.lang.Exception" errorCode="java.lang.Exception" />
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="AssignNetwork1802BB">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_47" bpmnElement="AssignNetworkBB_start">
- <dc:Bounds x="1167" y="246" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1160" y="287" width="49" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1wo7ke9_di" bpmnElement="ServiceTask_get_cloud_region">
- <dc:Bounds x="1298" y="224" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_1ofnl0p_di" bpmnElement="ServiceTask_assign_network_sdnc">
- <dc:Bounds x="1449" y="229" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="BPMNEdge_SequenceFlow_53" bpmnElement="SequenceFlow_32">
- <di:waypoint xsi:type="dc:Point" x="1398" y="264" />
- <di:waypoint xsi:type="dc:Point" x="1446" y="264" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1422" y="249" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0do51t8_di" bpmnElement="SequenceFlow_0do51t8">
- <di:waypoint xsi:type="dc:Point" x="1499" y="309" />
- <di:waypoint xsi:type="dc:Point" x="1499" y="378" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1514" y="343.5" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="TextAnnotation_0dnksb2_di" bpmnElement="TextAnnotation_0dnksb2">
- <dc:Bounds x="1393" y="153" width="212" height="30" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="Association_1rsqd3z_di" bpmnElement="Association_1rsqd3z">
- <di:waypoint xsi:type="dc:Point" x="1397" y="233" />
- <di:waypoint xsi:type="dc:Point" x="1475" y="183" />
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_18yks1p_di" bpmnElement="ServiceTask_assign_network_aai">
- <dc:Bounds x="1449" y="378" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_083u1a5_di" bpmnElement="AssignNetworkBB_end">
- <dc:Bounds x="1481" y="512" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1476" y="552" width="45" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0ln3hj3_di" bpmnElement="SequenceFlow_0ln3hj3">
- <di:waypoint xsi:type="dc:Point" x="1499" y="458" />
- <di:waypoint xsi:type="dc:Point" x="1499" y="512" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1514" y="475" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_11op1ih_di" bpmnElement="SequenceFlow_11op1ih">
- <di:waypoint xsi:type="dc:Point" x="1203" y="264" />
- <di:waypoint xsi:type="dc:Point" x="1298" y="264" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="1205.5" y="249" width="90" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn2:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn
index 79cbe68a3a..57c342455d 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignNetworkBB.bpmn
@@ -23,13 +23,13 @@
<bpmn2:incoming>SequenceFlow_0do51t8</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_0ln3hj3</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:exclusiveGateway id="networkFoundByName_ExclusiveGateway" name="skip if network found by name or to be created by SDNC" default="SequenceFlow_0gkr871">
+ <bpmn2:exclusiveGateway id="networkFoundByName_ExclusiveGateway" name="skip if network found by name" default="SequenceFlow_0gkr871">
<bpmn2:incoming>SequenceFlow_11op1ih</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_017131q</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_0gkr871</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
<bpmn2:sequenceFlow id="SequenceFlow_017131q" name="Yes" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_get_cloud_region">
- <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{AssignNetwork.skipNetworkCreationInAAI(execution.getVariable("gBuildingBlockExecution")) == true}]]></bpmn2:conditionExpression>
+ <bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression"><![CDATA[#{AssignNetwork.networkFoundByName(execution.getVariable("gBuildingBlockExecution")) == true}]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="SequenceFlow_0gkr871" name="No" sourceRef="networkFoundByName_ExclusiveGateway" targetRef="ServiceTask_put_network_in_AAI" />
<bpmn2:endEvent id="AssignNetworkBB_end" name="End Flow">
@@ -111,7 +111,7 @@
<bpmndi:BPMNShape id="ExclusiveGateway_19hvq7h_di" bpmnElement="networkFoundByName_ExclusiveGateway" isMarkerVisible="true">
<dc:Bounds x="838" y="-112" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="821" y="-176" width="83" height="24" />
+ <dc:Bounds x="833" y="-169" width="85" height="48" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_017131q_di" bpmnElement="SequenceFlow_017131q">
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn
index b91e2df8f7..0d2d829b6b 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateNetworkBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="CreateNetworkBB" name="CreateNetworkBB" isExecutable="true">
<bpmn2:startEvent id="createNetwork_startEvent" name="Start Flow">
<bpmn2:outgoing>SequenceFlow_1maepy7</bpmn2:outgoing>
@@ -31,11 +31,7 @@
<bpmn2:sequenceFlow id="SequenceFlow_1yy4aik" sourceRef="QueryNetworkPolicy_ServiceTask" targetRef="QueryNetworkTableRef_ServiceTask" />
<bpmn2:sequenceFlow id="SequenceFlow_0innva6" sourceRef="Create_Network_ServiceTask" targetRef="Update_Network_AAI_ServiceTask" />
<bpmn2:sequenceFlow id="SequenceFlow_0sissul" sourceRef="Update_Network_AAI_ServiceTask" targetRef="createNetwork_EndEvent" />
- <bpmn2:serviceTask id="QueryNetworkById_ServiceTask" name="Re-Query Network in AAI" camunda:expression="${AAIQueryTasks.getNetworkWrapperById(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_1maepy7</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_06rq9pi</bpmn2:outgoing>
- </bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_1maepy7" sourceRef="createNetwork_startEvent" targetRef="QueryNetworkById_ServiceTask" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1maepy7" sourceRef="createNetwork_startEvent" targetRef="ServiceTask_get_cloud_region" />
<bpmn2:intermediateThrowEvent id="ThrowEvent_ToCollectAAIData" name="ThrowEvent_ToCollectAAIData">
<bpmn2:incoming>SequenceFlow_03ebe6c</bpmn2:incoming>
<bpmn2:linkEventDefinition name="CatchEvent_Collect_AAI_Data" />
@@ -56,10 +52,9 @@
<bpmn2:sequenceFlow id="SequenceFlow_1oc7wcr" sourceRef="CatchEvent_Collect_AAI_Data" targetRef="QueryVpnBinding_ServiceTask" />
<bpmn2:sequenceFlow id="SequenceFlow_1eqfh23" sourceRef="CatchEvent_Create_Network" targetRef="Create_Network_ServiceTask" />
<bpmn2:serviceTask id="ServiceTask_get_cloud_region" name="Process cloud region by version&#10;" camunda:expression="${AssignNetworkBBUtils.getCloudRegion(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_06rq9pi</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1maepy7</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_03ebe6c</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_06rq9pi" sourceRef="QueryNetworkById_ServiceTask" targetRef="ServiceTask_get_cloud_region" />
<bpmn2:sequenceFlow id="SequenceFlow_03ebe6c" sourceRef="ServiceTask_get_cloud_region" targetRef="ThrowEvent_ToCollectAAIData" />
</bpmn2:process>
<bpmn2:error id="Error_2" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
@@ -121,14 +116,11 @@
<dc:Bounds x="628" y="319" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_08q9eo4_di" bpmnElement="QueryNetworkById_ServiceTask">
- <dc:Bounds x="346" y="-77" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1maepy7_di" bpmnElement="SequenceFlow_1maepy7">
<di:waypoint xsi:type="dc:Point" x="272" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="346" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="426" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="309" y="-52" width="0" height="0" />
+ <dc:Bounds x="304" y="-52" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateThrowEvent_0fexg2g_di" bpmnElement="ThrowEvent_ToCollectAAIData">
@@ -177,20 +169,13 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_02qnccl_di" bpmnElement="ServiceTask_get_cloud_region">
- <dc:Bounds x="499" y="-77" width="100" height="80" />
+ <dc:Bounds x="426" y="-77" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_06rq9pi_di" bpmnElement="SequenceFlow_06rq9pi">
- <di:waypoint xsi:type="dc:Point" x="446" y="-37" />
- <di:waypoint xsi:type="dc:Point" x="499" y="-37" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="473" y="-62" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_03ebe6c_di" bpmnElement="SequenceFlow_03ebe6c">
- <di:waypoint xsi:type="dc:Point" x="599" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="526" y="-37" />
<di:waypoint xsi:type="dc:Point" x="666" y="-37" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="633" y="-52" width="0" height="0" />
+ <dc:Bounds x="551" y="-52" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
index abc017c957..bd24eeaed7 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVfModuleBB.bpmn
@@ -29,7 +29,7 @@
<camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
- <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="heatStackId" target="heatStackId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_16g4dz0</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0ecr393</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
index a95dc9ce73..ffe74d1295 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/CreateVolumeGroupBB.bpmn
@@ -28,7 +28,7 @@
<camunda:in source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
- <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="heatStackId" target="heatStackId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_0kfkpbh</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_06flg6h</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
index 07d0b18938..832a96cae7 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/DeleteVfModuleBB.bpmn
@@ -24,7 +24,7 @@
<camunda:out source="WorkflowException" target="WorkflowException" />
<camunda:in source="deleteVfModuleRequest" target="deleteVfModuleRequest" />
<camunda:in source="VNFREST_Request" target="VNFREST_Request" />
- <camunda:out source="gBuildingBlockExecution" target="gBuildingBlockExecution" />
+ <camunda:out source="heatStackId" target="heatStackId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_08tvhtf</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_02lpx87</bpmn:outgoing>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn
deleted file mode 100644
index 212e735dd1..0000000000
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetwork1802BB.bpmn
+++ /dev/null
@@ -1,80 +0,0 @@
-<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2">
- <bpmn:process id="UnassignNetwork1802BB" name="UnassignNetwork1802BB" isExecutable="true">
- <bpmn:startEvent id="Start_UnassignNetworkBB" name="start">
- <bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing>
- </bpmn:startEvent>
- <bpmn:serviceTask id="Task_SNDCUnAssign" name="Call SDNC Adapter Topology UnAssign" camunda:expression="${SDNCUnassignTasks.unassignNetwork(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0le4vrj</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1ks8kmt</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:endEvent id="End_UnassignNetworkBB" name="end">
- <bpmn:incoming>SequenceFlow_1ks8kmt</bpmn:incoming>
- </bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_VfModuleRelatioship" />
- <bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SNDCUnAssign" targetRef="End_UnassignNetworkBB" />
- <bpmn:serviceTask id="Task_VfModuleRelatioship" name="Veriyf &#39;vf-module&#39; relationship exists" camunda:expression="${UnassignNetworkBB.checkRelationshipRelatedTo(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;vf-module&#34;)}">
- <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0mxe1a7</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_0mxe1a7" sourceRef="Task_VfModuleRelatioship" targetRef="Task_GetCloudRegionVersion" />
- <bpmn:sequenceFlow id="SequenceFlow_0le4vrj" sourceRef="Task_GetCloudRegionVersion" targetRef="Task_SNDCUnAssign" />
- <bpmn:serviceTask id="Task_GetCloudRegionVersion" name="Get Sdnc Cloud Region Version" camunda:expression="${UnassignNetworkBB.getCloudSdncRegion(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0mxe1a7</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_0le4vrj</bpmn:outgoing>
- </bpmn:serviceTask>
- </bpmn:process>
- <bpmndi:BPMNDiagram id="BPMNDiagram_1">
- <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignNetwork1802BB">
- <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_UnassignNetworkBB">
- <dc:Bounds x="288" y="119" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="295" y="155" width="22" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="ServiceTask_0m0ikey_di" bpmnElement="Task_SNDCUnAssign">
- <dc:Bounds x="665" y="97" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNShape id="EndEvent_1h93h9d_di" bpmnElement="End_UnassignNetworkBB">
- <dc:Bounds x="817" y="119" width="36" height="36" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="826" y="159" width="18" height="14" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2">
- <di:waypoint xsi:type="dc:Point" x="324" y="137" />
- <di:waypoint xsi:type="dc:Point" x="375" y="137" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="304.5" y="122" width="90" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt">
- <di:waypoint xsi:type="dc:Point" x="765" y="137" />
- <di:waypoint xsi:type="dc:Point" x="817" y="137" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="791" y="122" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_194x6el_di" bpmnElement="Task_VfModuleRelatioship">
- <dc:Bounds x="375" y="97" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_0mxe1a7_di" bpmnElement="SequenceFlow_0mxe1a7">
- <di:waypoint xsi:type="dc:Point" x="475" y="137" />
- <di:waypoint xsi:type="dc:Point" x="524" y="137" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="500" y="122" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_0le4vrj_di" bpmnElement="SequenceFlow_0le4vrj">
- <di:waypoint xsi:type="dc:Point" x="624" y="137" />
- <di:waypoint xsi:type="dc:Point" x="665" y="137" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="645" y="122" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1ev9w69_di" bpmnElement="Task_GetCloudRegionVersion">
- <dc:Bounds x="524" y="97" width="100" height="80" />
- </bpmndi:BPMNShape>
- </bpmndi:BPMNPlane>
- </bpmndi:BPMNDiagram>
-</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn
index 208e41f174..fb250fc03f 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UnassignNetworkBB.bpmn
@@ -1,5 +1,5 @@
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="UnassignNetworkBB" name="UnassignNetworkBB" isExecutable="true">
<bpmn:startEvent id="Start_UnassignNetworkBB" name="start">
<bpmn:outgoing>SequenceFlow_0zaz9o2</bpmn:outgoing>
@@ -11,7 +11,7 @@
<bpmn:endEvent id="End_UnassignNetworkBB" name="end">
<bpmn:incoming>SequenceFlow_0csh9dc</bpmn:incoming>
</bpmn:endEvent>
- <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_GetL3NetworkById" />
+ <bpmn:sequenceFlow id="SequenceFlow_0zaz9o2" sourceRef="Start_UnassignNetworkBB" targetRef="Task_VfModuleRelatioship" />
<bpmn:sequenceFlow id="SequenceFlow_1ks8kmt" sourceRef="Task_SNDCUnAssign" targetRef="Task_DeleteNetwork" />
<bpmn:sequenceFlow id="SequenceFlow_0csh9dc" sourceRef="Task_DeleteNetwork" targetRef="End_UnassignNetworkBB" />
<bpmn:serviceTask id="Task_DeleteNetwork" name="Delete Network (AAI)" camunda:expression="${AAIDeleteTasks.deleteNetwork(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
@@ -19,15 +19,10 @@
<bpmn:outgoing>SequenceFlow_0csh9dc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_VfModuleRelatioship" name="Veriyf &#39;vf-module&#39; relationship exists" camunda:expression="${UnassignNetworkBB.checkRelationshipRelatedTo(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)), &#34;vf-module&#34;)}">
- <bpmn:incoming>SequenceFlow_1gd5h4c</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0mxe1a7</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0mxe1a7" sourceRef="Task_VfModuleRelatioship" targetRef="Task_GetCloudRegionVersion" />
- <bpmn:sequenceFlow id="SequenceFlow_1gd5h4c" sourceRef="Task_GetL3NetworkById" targetRef="Task_VfModuleRelatioship" />
- <bpmn:serviceTask id="Task_GetL3NetworkById" name="Get L3Network by networkId (AAI)" camunda:expression="${AAIQueryTasks.getNetworkWrapperById(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn:incoming>SequenceFlow_0zaz9o2</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1gd5h4c</bpmn:outgoing>
- </bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0le4vrj" sourceRef="Task_GetCloudRegionVersion" targetRef="Task_SNDCUnAssign" />
<bpmn:serviceTask id="Task_GetCloudRegionVersion" name="Get Sdnc Cloud Region Version" camunda:expression="${UnassignNetworkBB.getCloudSdncRegion(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0mxe1a7</bpmn:incoming>
@@ -37,9 +32,9 @@
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="UnassignNetworkBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_UnassignNetworkBB">
- <dc:Bounds x="145" y="119" width="36" height="36" />
+ <dc:Bounds x="269" y="119" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="152" y="155" width="22" height="12" />
+ <dc:Bounds x="276" y="155" width="23" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0m0ikey_di" bpmnElement="Task_SNDCUnAssign">
@@ -52,10 +47,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0zaz9o2_di" bpmnElement="SequenceFlow_0zaz9o2">
- <di:waypoint xsi:type="dc:Point" x="181" y="137" />
- <di:waypoint xsi:type="dc:Point" x="232" y="137" />
+ <di:waypoint xsi:type="dc:Point" x="305" y="137" />
+ <di:waypoint xsi:type="dc:Point" x="375" y="137" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="207" y="122" width="0" height="0" />
+ <dc:Bounds x="295" y="122" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ks8kmt_di" bpmnElement="SequenceFlow_1ks8kmt">
@@ -85,16 +80,6 @@
<dc:Bounds x="500" y="122" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1gd5h4c_di" bpmnElement="SequenceFlow_1gd5h4c">
- <di:waypoint xsi:type="dc:Point" x="332" y="137" />
- <di:waypoint xsi:type="dc:Point" x="375" y="137" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="354" y="122" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_1scptd7_di" bpmnElement="Task_GetL3NetworkById">
- <dc:Bounds x="232" y="97" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0le4vrj_di" bpmnElement="SequenceFlow_0le4vrj">
<di:waypoint xsi:type="dc:Point" x="624" y="137" />
<di:waypoint xsi:type="dc:Point" x="665" y="137" />
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn
index 9f431212b1..daf0358683 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/UpdateNetworkBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.4.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_MagIIMOUEeW8asg-vCEgWQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="UpdateNetworkBB" name="UpdateNetworkBB" isExecutable="true">
<bpmn2:startEvent id="UpdateNetworkBB_Start" name="Start">
<bpmn2:outgoing>SequenceFlow_074w2et</bpmn2:outgoing>
@@ -14,20 +14,15 @@
<bpmn2:linkEventDefinition name="SDNC_to_AAI" />
</bpmn2:intermediateThrowEvent>
<bpmn2:sequenceFlow id="SequenceFlow_04yezm3" sourceRef="SDNCChangeAssignNetwork" targetRef="SDNC_End" />
- <bpmn2:serviceTask id="QueryNetworkAAI" name="Re-Query Network (AAI)" camunda:expression="${AAIQueryTasks.getNetworkWrapperById(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_1trqq6d</bpmn2:incoming>
- <bpmn2:outgoing>SequenceFlow_03janqs</bpmn2:outgoing>
- </bpmn2:serviceTask>
<bpmn2:intermediateCatchEvent id="AAI_Start" name="To AAI">
<bpmn2:outgoing>SequenceFlow_1trqq6d</bpmn2:outgoing>
<bpmn2:linkEventDefinition name="SDNC_to_AAI" />
</bpmn2:intermediateCatchEvent>
- <bpmn2:sequenceFlow id="SequenceFlow_1trqq6d" sourceRef="AAI_Start" targetRef="QueryNetworkAAI" />
+ <bpmn2:sequenceFlow id="SequenceFlow_1trqq6d" sourceRef="AAI_Start" targetRef="QueryVpnBindingAAI" />
<bpmn2:serviceTask id="QueryVpnBindingAAI" name="Query Vpn Binding (AAI)" camunda:expression="${AAIQueryTasks.queryNetworkVpnBinding(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
- <bpmn2:incoming>SequenceFlow_03janqs</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_1trqq6d</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1io4cl7</bpmn2:outgoing>
</bpmn2:serviceTask>
- <bpmn2:sequenceFlow id="SequenceFlow_03janqs" sourceRef="QueryNetworkAAI" targetRef="QueryVpnBindingAAI" />
<bpmn2:serviceTask id="QueryNetworkPolicyAAI" name="Query Network Policy (AAI)" camunda:expression="${AAIQueryTasks.queryNetworkPolicy(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn2:incoming>SequenceFlow_1io4cl7</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_16fm47t</bpmn2:outgoing>
@@ -107,32 +102,22 @@
<dc:Bounds x="432.5" y="74" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0d05e4a_di" bpmnElement="QueryNetworkAAI">
- <dc:Bounds x="104" y="193" width="100" height="80" />
- </bpmndi:BPMNShape>
<bpmndi:BPMNShape id="IntermediateCatchEvent_1hbb3j8_di" bpmnElement="AAI_Start">
- <dc:Bounds x="-1" y="215" width="36" height="36" />
+ <dc:Bounds x="144" y="215" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="2" y="255" width="33" height="12" />
+ <dc:Bounds x="147" y="255" width="33" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1trqq6d_di" bpmnElement="SequenceFlow_1trqq6d">
- <di:waypoint xsi:type="dc:Point" x="35" y="233" />
- <di:waypoint xsi:type="dc:Point" x="104" y="233" />
+ <di:waypoint xsi:type="dc:Point" x="180" y="233" />
+ <di:waypoint xsi:type="dc:Point" x="280" y="233" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="69.5" y="212" width="0" height="12" />
+ <dc:Bounds x="185" y="212" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_09dctlw_di" bpmnElement="QueryVpnBindingAAI">
<dc:Bounds x="280" y="193" width="100" height="80" />
</bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_03janqs_di" bpmnElement="SequenceFlow_03janqs">
- <di:waypoint xsi:type="dc:Point" x="204" y="233" />
- <di:waypoint xsi:type="dc:Point" x="280" y="233" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="242" y="212" width="0" height="12" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1slp95d_di" bpmnElement="QueryNetworkPolicyAAI">
<dc:Bounds x="455" y="193" width="100" height="80" />
</bpmndi:BPMNShape>
@@ -167,42 +152,42 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="IntermediateCatchEvent_0sx0nb6_di" bpmnElement="AIC_Start">
- <dc:Bounds x="-1" y="332" width="36" height="36" />
+ <dc:Bounds x="144" y="332" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="1" y="372" width="34" height="12" />
+ <dc:Bounds x="146" y="372" width="34" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_196cgux_di" bpmnElement="SequenceFlow_196cgux">
- <di:waypoint xsi:type="dc:Point" x="35" y="350" />
- <di:waypoint xsi:type="dc:Point" x="104" y="350" />
+ <di:waypoint xsi:type="dc:Point" x="180" y="350" />
+ <di:waypoint xsi:type="dc:Point" x="248" y="350" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="69.5" y="329" width="0" height="12" />
+ <dc:Bounds x="169" y="329" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0i66n9g_di" bpmnElement="UpdateNetworkAdapter">
- <dc:Bounds x="104" y="310" width="100" height="80" />
+ <dc:Bounds x="248" y="310" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0hsvgje_di" bpmnElement="SequenceFlow_0hsvgje">
- <di:waypoint xsi:type="dc:Point" x="204" y="350" />
- <di:waypoint xsi:type="dc:Point" x="278" y="350" />
+ <di:waypoint xsi:type="dc:Point" x="348" y="350" />
+ <di:waypoint xsi:type="dc:Point" x="422" y="350" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="241" y="329" width="0" height="12" />
+ <dc:Bounds x="340" y="329" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1ydm5u9_di" bpmnElement="UpdateNetworkAAI">
- <dc:Bounds x="278" y="310" width="100" height="80" />
+ <dc:Bounds x="422" y="310" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_0fsts2w_di" bpmnElement="UpdateNetworkBB_End">
- <dc:Bounds x="493" y="332" width="36" height="36" />
+ <dc:Bounds x="637" y="332" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="502" y="372" width="19" height="12" />
+ <dc:Bounds x="646" y="372" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0fhfitm_di" bpmnElement="SequenceFlow_0fhfitm">
- <di:waypoint xsi:type="dc:Point" x="378" y="350" />
- <di:waypoint xsi:type="dc:Point" x="493" y="350" />
+ <di:waypoint xsi:type="dc:Point" x="522" y="350" />
+ <di:waypoint xsi:type="dc:Point" x="637" y="350" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="435.5" y="329" width="0" height="12" />
+ <dc:Bounds x="535" y="329" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="SubProcess_11x1b8w_di" bpmnElement="SubProcess_1srp3f9" isExpanded="true">
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index 6544387775..13dad149cd 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.2">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -18,10 +18,10 @@
<camunda:in source="retryCount" target="retryCount" />
<camunda:out source="WorkflowExceptionErrorMessage" target="WorkflowExceptionErrorMessage" />
</bpmn:extensionElements>
- <bpmn:incoming>SequenceFlow_0mqrkxv</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0mew9im</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_07h9d4y</bpmn:outgoing>
</bpmn:callActivity>
- <bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="Call_ExecuteBB" />
+ <bpmn:sequenceFlow id="SequenceFlow_0mqrkxv" sourceRef="Task_SelectBB" targetRef="ServiceTask_0e2p0xs" />
<bpmn:serviceTask id="Task_SelectBB" name="Select BB" camunda:expression="${WorkflowActionBBTasks.selectBB(execution)}">
<bpmn:incoming>SequenceFlow_1atzsgn</bpmn:incoming>
<bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
@@ -185,14 +185,19 @@
<bpmn:sequenceFlow id="SequenceFlow_11d126w" sourceRef="StartEvent_runtimeError" targetRef="ServiceTask_HandleRuntimeError" />
<bpmn:sequenceFlow id="SequenceFlow_0w4sx88" sourceRef="ServiceTask_HandleRuntimeError" targetRef="EndEvent__runtimeError" />
</bpmn:subProcess>
+ <bpmn:serviceTask id="ServiceTask_0e2p0xs" name="Update Flow Statistics" camunda:expression="${WorkflowActionBBTasks.updateFlowStatistics(execution)}">
+ <bpmn:incoming>SequenceFlow_0mqrkxv</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0mew9im</bpmn:outgoing>
+ </bpmn:serviceTask>
+ <bpmn:sequenceFlow id="SequenceFlow_0mew9im" sourceRef="ServiceTask_0e2p0xs" targetRef="Call_ExecuteBB" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="WorkflowActionBB">
<bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="Start_WorkflowActionBB">
- <dc:Bounds x="-52" y="102" width="36" height="36" />
+ <dc:Bounds x="-241" y="102" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-45" y="138" width="22" height="12" />
+ <dc:Bounds x="-234" y="138" width="23" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="EndEvent_1uv6erv_di" bpmnElement="End_WorkflowActionBB">
@@ -202,24 +207,24 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint xsi:type="dc:Point" x="-16" y="120" />
- <di:waypoint xsi:type="dc:Point" x="17" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-205" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-172" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-44.5" y="98.5" width="90" height="13" />
+ <dc:Bounds x="-233" y="99" width="90" height="13" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_03m7z4y_di" bpmnElement="Call_ExecuteBB">
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
- <di:waypoint xsi:type="dc:Point" x="528" y="120" />
- <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="400" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="544" y="99" width="0" height="0" />
+ <dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1snenqk_di" bpmnElement="Task_SelectBB">
- <dc:Bounds x="428" y="80" width="100" height="80" />
+ <dc:Bounds x="239" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0m1zt0q_di" bpmnElement="ExclusiveGateway_Finished" isMarkerVisible="true">
<dc:Bounds x="692" y="95" width="50" height="50" />
@@ -243,10 +248,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_0kn8jt8_di" bpmnElement="Task_RetrieveBBExectuionList">
- <dc:Bounds x="17" y="80" width="100" height="80" />
+ <dc:Bounds x="-172" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync">
- <dc:Bounds x="235" y="-7" width="100" height="80" />
+ <dc:Bounds x="46" y="-7" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_SetupCompleteMsoProcess">
<dc:Bounds x="900" y="210" width="100" height="80" />
@@ -288,26 +293,26 @@
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
<di:waypoint xsi:type="dc:Point" x="717" y="145" />
<di:waypoint xsi:type="dc:Point" x="717" y="262" />
- <di:waypoint xsi:type="dc:Point" x="528" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="638.5121951219512" y="272" width="74" height="13" />
+ <dc:Bounds x="597.5" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
- <di:waypoint xsi:type="dc:Point" x="478" y="222" />
- <di:waypoint xsi:type="dc:Point" x="478" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="160" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="448" y="191" width="90" height="0" />
+ <dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_19t1oyr_di" bpmnElement="Task_RollbackExecutionPath">
- <dc:Bounds x="428" y="222" width="100" height="80" />
+ <dc:Bounds x="239" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9">
- <di:waypoint xsi:type="dc:Point" x="117" y="120" />
- <di:waypoint xsi:type="dc:Point" x="150" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-72" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-39" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="134" y="105" width="0" height="0" />
+ <dc:Bounds x="-100" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
@@ -337,12 +342,12 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint xsi:type="dc:Point" x="335" y="33" />
- <di:waypoint xsi:type="dc:Point" x="382" y="33" />
- <di:waypoint xsi:type="dc:Point" x="382" y="120" />
- <di:waypoint xsi:type="dc:Point" x="428" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="146" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="193" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="193" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="397" y="76.5" width="0" height="0" />
+ <dc:Bounds x="163" y="77" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
@@ -356,34 +361,34 @@
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_005hi8o_di" bpmnElement="SequenceFlow_005hi8o">
<di:waypoint xsi:type="dc:Point" x="667" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="478" y="-36" />
- <di:waypoint xsi:type="dc:Point" x="478" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="573" y="-57" width="0" height="0" />
+ <dc:Bounds x="433" y="-51" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1c1v3p1_di" bpmnElement="Task_0a31dkf">
<dc:Bounds x="667" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0ptb1yi_di" bpmnElement="ExclusiveGateway_isTopLevelFlow" isMarkerVisible="true">
- <dc:Bounds x="150" y="95" width="50" height="50" />
+ <dc:Bounds x="-39" y="95" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="144" y="145" width="61" height="24" />
+ <dc:Bounds x="-45" y="145" width="61" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint xsi:type="dc:Point" x="176" y="96" />
- <di:waypoint xsi:type="dc:Point" x="176" y="33" />
- <di:waypoint xsi:type="dc:Point" x="235" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="-13" y="96" />
+ <di:waypoint xsi:type="dc:Point" x="-13" y="33" />
+ <di:waypoint xsi:type="dc:Point" x="46" y="33" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="182" y="54.5" width="18" height="12" />
+ <dc:Bounds x="-7" y="55" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint xsi:type="dc:Point" x="200" y="120" />
- <di:waypoint xsi:type="dc:Point" x="428" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="11" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="308" y="95" width="12" height="12" />
+ <dc:Bounds x="119" y="95" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_001g41v_di" bpmnElement="ExclusiveGateway_isTopLevelFlowAbort" isMarkerVisible="true">
@@ -435,11 +440,11 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint xsi:type="dc:Point" x="478" y="302" />
- <di:waypoint xsi:type="dc:Point" x="478" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="302" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="368" />
<di:waypoint xsi:type="dc:Point" x="741" y="368" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="495" y="324.65" width="62" height="24" />
+ <dc:Bounds x="340.85361216730035" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ServiceTask_1h154rn_di" bpmnElement="Task_UpdateDb">
@@ -545,6 +550,16 @@
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ServiceTask_0e2p0xs_di" bpmnElement="ServiceTask_0e2p0xs">
+ <dc:Bounds x="400" y="80" width="100" height="80" />
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
+ <di:waypoint xsi:type="dc:Point" x="500" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="560" y="120" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="530" y="99" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java
deleted file mode 100644
index 14cac8343e..0000000000
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/AssignNetwork1802BBTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-
-import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.doThrow;
-
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.camunda.bpm.engine.test.Deployment;
-import org.junit.Test;
-import org.onap.so.bpmn.BaseBPMNTest;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
-
-
-public class AssignNetwork1802BBTest extends BaseBPMNTest{
- @Test
- @Deployment(resources = { "subprocess/AssignNetworkRollbackBB.bpmn"})
- public void sunnyDayAssignNetwork_Test() throws InterruptedException {
-
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetwork1802BB",variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("AssignNetworkBB_start","ServiceTask_get_cloud_region","ServiceTask_assign_network_sdnc","ServiceTask_assign_network_aai","AssignNetworkBB_end");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayAssignNetwork_Test() throws Exception {
-
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(aaiUpdateTasks).updateOrchestrationStatusAssignedNetwork(any(BuildingBlockExecution.class));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("AssignNetwork1802BB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("AssignNetworkBB_start", "ServiceTask_get_cloud_region", "ServiceTask_assign_network_sdnc", "ServiceTask_assign_network_aai")
- .hasNotPassed("AssignNetworkBB_end");
- assertThat(pi).isEnded();
- }
-}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java
index cb3ab32884..13f8a6f812 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateNetworkBBTest.java
@@ -36,7 +36,7 @@ public class CreateNetworkBBTest extends BaseBPMNTest{
ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB",variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "QueryNetworkById_ServiceTask", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent");
+ assertThat(pi).isStarted().hasPassedInOrder("createNetwork_startEvent", "ServiceTask_get_cloud_region", "QueryVpnBinding_ServiceTask", "QueryNetworkPolicy_ServiceTask", "QueryNetworkTableRef_ServiceTask", "Create_Network_ServiceTask", "Update_Network_AAI_ServiceTask", "createNetwork_EndEvent");
assertThat(pi).isEnded();
}
@@ -47,7 +47,7 @@ public class CreateNetworkBBTest extends BaseBPMNTest{
ProcessInstance pi = runtimeService.startProcessInstanceByKey("CreateNetworkBB", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
- .hasPassedInOrder("createNetwork_startEvent","QueryNetworkById_ServiceTask")
+ .hasPassedInOrder("createNetwork_startEvent")
.hasNotPassed("End Flow");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java
index eb372fb6a7..57388efc2e 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/CreateVolumeGroupBBTest.java
@@ -61,8 +61,6 @@ public class CreateVolumeGroupBBTest extends BaseBPMNTest{
.hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter", "Vnf_Adapter")
.hasNotPassed("UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
assertThat(pi).isEnded();
- assertThat(pi).hasPassedInOrder("CreateVolumeGroupBB_Start", "QueryVfModuleSDNC", "CreateVolumeGroupVnfAdapter")
- .hasNotPassed("Vnf_Adapter", "UpdateVolumeGroupAAI", "CreateVolumeGroupBB_End");
}
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java
deleted file mode 100644
index 2c5381de09..0000000000
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetwork1802BBTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.bpmn.infrastructure.bpmn.subprocess;
-
-import static org.camunda.bpm.engine.test.assertions.bpmn.BpmnAwareAssertions.assertThat;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.doThrow;
-
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.runtime.ProcessInstance;
-import org.junit.Test;
-import org.onap.so.bpmn.BaseBPMNTest;
-import org.onap.so.bpmn.common.BuildingBlockExecution;
-
-public class UnassignNetwork1802BBTest extends BaseBPMNTest {
- @Test
- public void sunnyDayAssignNetwork_Test() throws InterruptedException {
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB",variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","End_UnassignNetworkBB");
- assertThat(pi).isEnded();
- }
-
- @Test
- public void rainyDayAssignNetwork_Test() throws Exception {
- doThrow(new BpmnError("7000", "TESTING ERRORS")).when(unassignNetworkBB).checkRelationshipRelatedTo(any(BuildingBlockExecution.class), eq("vf-module"));
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetwork1802BB", variables);
- assertThat(pi).isNotNull();
- assertThat(pi).isStarted()
- .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship")
- .hasNotPassed("End_UnassignNetworkBB");
- assertThat(pi).isEnded();
- }
-} \ No newline at end of file
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java
index fd95e00031..b6f7cbeb48 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UnassignNetworkBBTest.java
@@ -36,7 +36,7 @@ public class UnassignNetworkBBTest extends BaseBPMNTest {
public void sunnyDayAssignNetwork_Test() throws InterruptedException {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB",variables);
assertThat(pi).isNotNull();
- assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_GetL3NetworkById","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","Task_DeleteNetwork","End_UnassignNetworkBB");
+ assertThat(pi).isStarted().hasPassedInOrder("Start_UnassignNetworkBB","Task_VfModuleRelatioship","Task_GetCloudRegionVersion","Task_SNDCUnAssign","Task_DeleteNetwork","End_UnassignNetworkBB");
assertThat(pi).isEnded();
}
@@ -46,7 +46,7 @@ public class UnassignNetworkBBTest extends BaseBPMNTest {
ProcessInstance pi = runtimeService.startProcessInstanceByKey("UnassignNetworkBB", variables);
assertThat(pi).isNotNull();
assertThat(pi).isStarted()
- .hasPassedInOrder("Start_UnassignNetworkBB", "Task_GetL3NetworkById", "Task_VfModuleRelatioship")
+ .hasPassedInOrder("Start_UnassignNetworkBB", "Task_VfModuleRelatioship")
.hasNotPassed("End_UnassignNetworkBB");
assertThat(pi).isEnded();
}
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java
index 853f713bd1..9fff0eb458 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/UpdateNetworkBBTest.java
@@ -38,7 +38,7 @@ public class UpdateNetworkBBTest extends BaseBPMNTest {
assertThat(processInstance).isNotNull();
assertThat(processInstance).isStarted().hasPassedInOrder(
"UpdateNetworkBB_Start", "SDNCChangeAssignNetwork",
- "QueryNetworkAAI", "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI",
+ "QueryVpnBindingAAI", "QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI",
"UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End");
assertThat(processInstance).isEnded();
}
@@ -49,8 +49,8 @@ public class UpdateNetworkBBTest extends BaseBPMNTest {
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("UpdateNetworkBB", variables);
assertThat(processInstance).isStarted().hasPassedInOrder(
- "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork",
- "QueryNetworkAAI", "QueryVpnBindingAAI")
+ "UpdateNetworkBB_Start", "SDNCChangeAssignNetwork",
+ "QueryVpnBindingAAI")
.hasNotPassed("QueryNetworkPolicyAAI", "QueryNetworkTableRefAAI",
"UpdateNetworkAdapter", "UpdateNetworkAAI", "UpdateNetworkBB_End");
assertThat(processInstance).isEnded();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
index 3702862a04..589bbe9c4f 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareModelofE2EServiceInstance.groovy
@@ -140,9 +140,9 @@ public class DoCompareModelofE2EServiceInstance extends AbstractServiceTaskProce
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
- ServiceInstance si = wrapper.asBean(ServiceInstance.class)
- execution.setVariable("model-invariant-id-original", si.getModelInvariantId())
- execution.setVariable("model-version-id-original", si.getModelVersionId())
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId())
+ execution.setVariable("model-version-id-original", si.get().getModelVersionId())
}catch(BpmnError e) {
throw e;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
index 4939173d65..913970b051 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateE2EServiceInstance.groovy
@@ -319,8 +319,8 @@ public class DoCreateE2EServiceInstance extends AbstractServiceTaskProcessor {
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
- ServiceInstance si = wrapper.asBean(ServiceInstance.class)
- execution.setVariable("serviceInstanceName", si.getServiceInstanceName())
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName())
}catch(BpmnError e) {
throw e;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
index a376e581fe..731d9c24de 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstance.groovy
@@ -330,6 +330,10 @@ public class DoCreateNetworkInstance extends AbstractServiceTaskProcessor {
if(!resourceClient.exists(uri)){
exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai")
+ }else{
+ Map<String, String> keys = uri.getURIKeys()
+ execution.setVariable("serviceType", keys.get("service-type"))
+ execution.setVariable("subscriberName", keys.get("global-customer-id"))
}
}catch(BpmnError e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
index c7e3eb437c..a79483f6e9 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteServiceInstance.groovy
@@ -310,11 +310,11 @@ public class DoDeleteServiceInstance extends AbstractServiceTaskProcessor {
uriList.addAll(wrapper.getRelationships().get().getRelatedAAIUris(AAIObjectType.L3_NETWORK))
if(uriList.isEmpty){
- ServiceInstance si = wrapper.asBean(ServiceInstance.class)
- String orchestrationStatus = si.getOrchestrationStatus()
- String serviceType = si.getServiceType()
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ String orchestrationStatus = si.get().getOrchestrationStatus()
+ String serviceType = si.get().getServiceType()
execution.setVariable("serviceType", serviceType)
- execution.setVariable("serviceRole", si.getServiceRole())
+ execution.setVariable("serviceRole", si.get().getServiceRole())
if("TRANSPORT".equalsIgnoreCase(serviceType)){
if("PendingDelete".equals(orchestrationStatus)){
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
index 4f6fbf9966..d7f2087c05 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateNetworkInstance.groovy
@@ -328,6 +328,10 @@ public class DoUpdateNetworkInstance extends AbstractServiceTaskProcessor {
if(!resourceClient.exists(uri)){
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Service Instance not found in aai")
+ }else{
+ Map<String, String> keys = uri.getURIKeys()
+ execution.setVariable("serviceType", keys.get("service-type"))
+ execution.setVariable("subscriberName", keys.get("global-customer-id"))
}
}catch(BpmnError e) {
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
index ac8e506e1f..20ced72002 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/UpdateCustomE2EServiceInstance.groovy
@@ -177,10 +177,10 @@ public class UpdateCustomE2EServiceInstance extends AbstractServiceTaskProcessor
AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, serviceInstanceId)
AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class)
- ServiceInstance si = wrapper.asBean(ServiceInstance.class)
- execution.setVariable("serviceInstanceName", si.getServiceInstanceName())
- execution.setVariable("model-invariant-id-original", si.getModelInvariantId())
- execution.setVariable("model-version-id-original", si.getModelVersionId())
+ Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class)
+ execution.setVariable("serviceInstanceName", si.get().getServiceInstanceName())
+ execution.setVariable("model-invariant-id-original", si.get().getModelInvariantId())
+ execution.setVariable("model-version-id-original", si.get().getModelVersionId())
JSONObject ob = new JSONObject(wrapper.getJson())
JSONArray ar = ob.getJSONObject("relationship-list").getJSONArray("relationship")
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 b7f45c05b5..66de6b389d 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
@@ -75,6 +75,7 @@ import org.springframework.web.util.UriUtils;
*/
@Component("SniroHoming")
public class SniroHomingV2 {
+
private static final MsoLogger log = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, SniroHomingV2.class);
private JsonUtils jsonUtils = new JsonUtils();
@Autowired
@@ -135,8 +136,11 @@ public class SniroHomingV2 {
placementInfo.put("placementDemands", placementDemands);
request.setPlacementInformation(placementInfo.toString());
+ JSONObject licenseInfo = new JSONObject();
+
JSONArray licenseDemands = buildLicenseDemands(serviceInstance);
- request.setLicenseInformation(licenseDemands.toString());
+ licenseInfo.put("licenseDemands", licenseDemands);
+ request.setLicenseInformation(licenseInfo.toString());
if(placementDemands.length() > 0 || licenseDemands.length() > 0){
client.postDemands(request);
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 79613047e5..e534142471 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
@@ -162,7 +162,7 @@ public class AAICreateTasks {
try {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- execution.setVariable("callHoming", vnf.isCallHoming());
+ execution.setVariable("callHoming", Boolean.TRUE.equals(vnf.isCallHoming()));
aaiVnfResources.createVnfandConnectServiceInstance(vnf, serviceInstance);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
index beffa25249..0079b351f2 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIQueryTasks.java
@@ -49,7 +49,6 @@ import org.springframework.stereotype.Component;
public class AAIQueryTasks {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIQueryTasks.class);
- private static final String NETWORK_RESULT_WRAPPER_KEY = "l3NetworkAAIResultWrapper";
private static final String ERROR_MSG = "No relationships were returned from AAIResultWrapper.getRelationships()";
@Autowired
private ExtractPojosForBB extractPojosForBB;
@@ -58,23 +57,6 @@ public class AAIQueryTasks {
@Autowired
private AAINetworkResources aaiNetworkResources;
private static final ModelMapper modelMapper = new ModelMapper();
-
- /**
- * BPMN access method to query L3Network object in AAI by it's Id
- *
- * @param execution
- * @throws Exception
- */
- public void getNetworkWrapperById(BuildingBlockExecution execution) {
- try {
- L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
- execution.getLookupMap().get(ResourceKey.NETWORK_ID));
- AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
- execution.setVariable(NETWORK_RESULT_WRAPPER_KEY, aaiResultWrapper);
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- }
/**
* BPMN access method to query data for VPN bindings from the AAI result wrapper.
@@ -85,9 +67,9 @@ public class AAIQueryTasks {
public void queryNetworkVpnBinding(BuildingBlockExecution execution) {
try {
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
-
- AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
@@ -120,7 +102,9 @@ public class AAIQueryTasks {
public void getNetworkVpnBinding(BuildingBlockExecution execution) {
try {
- AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
CreateNetworkRequest createNetworkRequest = execution.getVariable("createNetworkRequest");
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
@@ -174,9 +158,9 @@ public class AAIQueryTasks {
*/
public void queryNetworkPolicy(BuildingBlockExecution execution) {
try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
-
- AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
@@ -187,7 +171,7 @@ public class AAIQueryTasks {
for(AAIResourceUri netPolicyUri : netPoliciesUriList) {
Optional<NetworkPolicy> oNetPolicy = aaiNetworkResources.getNetworkPolicy(netPolicyUri);
if(oNetPolicy.isPresent()) {
- l3Network.getNetworkPolicies().add(modelMapper.map(oNetPolicy.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy.class));
+ l3network.getNetworkPolicies().add(modelMapper.map(oNetPolicy.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy.class));
}
}
}
@@ -205,9 +189,9 @@ public class AAIQueryTasks {
*/
public void queryNetworkTableRef(BuildingBlockExecution execution) {
try {
- L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
-
- AAIResultWrapper aaiResultWrapper = execution.getVariable(NETWORK_RESULT_WRAPPER_KEY);
+ L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,
+ execution.getLookupMap().get(ResourceKey.NETWORK_ID));
+ AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<Relationships> networkRelationships = aaiResultWrapper.getRelationships();
if (!networkRelationships.isPresent()) {
throw (new Exception(ERROR_MSG));
@@ -219,7 +203,7 @@ public class AAIQueryTasks {
Optional<RouteTableReference> oRouteTableReference = aaiNetworkResources.getRouteTable(routeTableUri);
if(oRouteTableReference.isPresent()) {
org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference mappedRouteTableReference = modelMapper.map(oRouteTableReference.get(), org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference.class);
- l3Network.getContrailNetworkRouteTableReferences().add(mappedRouteTableReference);
+ l3network.getContrailNetworkRouteTableReferences().add(mappedRouteTableReference);
}
}
}
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 9c1fba62e9..b059a77641 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
@@ -144,9 +144,11 @@ public class AAIUpdateTasks {
public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
+ String heatStackId = execution.getVariable("heatStackId");
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
CloudRegion cloudRegion = gBBInput.getCloudRegion();
+ volumeGroup.setHeatStackId(heatStackId);
aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
} catch (Exception ex) {
@@ -296,8 +298,10 @@ public class AAIUpdateTasks {
public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {
try {
+ String heatStackId = execution.getVariable("heatStackId");
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ vfModule.setHeatStackId(heatStackId);
aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
index 0b712452fd..554af37924 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/vnf/tasks/VnfAdapterImpl.java
@@ -65,6 +65,7 @@ public class VnfAdapterImpl {
execution.setVariable("isDebugLogEnabled", "true");
execution.setVariable("mso-request-id", gBBInput.getRequestContext().getMsoRequestId());
execution.setVariable("mso-service-instance-id", serviceInstance.getServiceInstanceId());
+ execution.setVariable("heatStackId", null);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
@@ -80,23 +81,25 @@ public class VnfAdapterImpl {
String heatStackId = ((CreateVfModuleResponse) vnfRestResponse).getVfModuleStackId();
if(!StringUtils.isEmpty(heatStackId)) {
vfModule.setHeatStackId(heatStackId);
+ execution.setVariable("heatStackId", heatStackId);
}
} else if(vnfRestResponse instanceof DeleteVfModuleResponse) {
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
Boolean vfModuleDelete = ((DeleteVfModuleResponse) vnfRestResponse).getVfModuleDeleted();
if(null!= vfModuleDelete && vfModuleDelete) {
vfModule.setHeatStackId(null);
+ execution.setVariable("heatStackId", null);
}
} else if(vnfRestResponse instanceof CreateVolumeGroupResponse) {
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
String heatStackId = ((CreateVolumeGroupResponse) vnfRestResponse).getVolumeGroupStackId();
if(!StringUtils.isEmpty(heatStackId)) {
volumeGroup.setHeatStackId(heatStackId);
+ execution.setVariable("heatStackId", heatStackId);
}else{
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "HeatStackId is missing from create VolumeGroup Vnf Adapter response.");
}
- }
- execution.setVariable("generalBuildingBlock", execution.getGeneralBuildingBlock());
+ }
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
index 06c65020f5..7c9e000a44 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetwork.java
@@ -21,10 +21,8 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
-import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
@@ -35,30 +33,9 @@ public class AssignNetwork {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
AssignNetwork.class);
- @Autowired
- private ExceptionBuilder exceptionUtil;
+
@Autowired
private ExtractPojosForBB extractPojosForBB;
-
- /**
- * Check if there are collection(s)
- * @param execution
- * @return boolean
- */
- public boolean hasCollection(BuildingBlockExecution execution) {
- boolean hasCollection = false;
- try {
- ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID,
- execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- if (serviceInstance.getCollection() != null){
- hasCollection = true;
- msoLogger.debug("there are collections to create");
- }
- } catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
- }
- return hasCollection;
- }
/**
* Check if network was found by name
@@ -80,14 +57,4 @@ public class AssignNetwork {
}
return networkFound;
}
-
- /**
- * BPMN access method. Return flag if BPMN flow should skip AAI interaction
- * @param execution
- * @return TRUE if network collection was NOT present OR network WAS found by name
- */
- public boolean skipNetworkCreationInAAI(BuildingBlockExecution execution) {
-
- return !hasCollection(execution) || networkFoundByName(execution);
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
index 95d52d6f2a..39f4c7822a 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCAssignTasks.java
@@ -79,7 +79,7 @@ public class SDNCAssignTasks {
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
- String response = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, vnf.isCallHoming());
+ String response = sdncVnfResources.assignVnf(vnf, serviceInstance, customer, cloudRegion, requestContext, Boolean.TRUE.equals(vnf.isCallHoming()));
execution.setVariable("SDNCResponse", response);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
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 c6a63e1431..b2b071e1ee 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
@@ -88,6 +88,7 @@ public class WorkflowAction {
private static final String VOLUMEGROUP = "VolumeGroup";
private static final String NETWORK = "Network";
private static final String NETWORKCOLLECTION = "NetworkCollection";
+ private static final String CONFIGURATION = "Configuration";
private static final String ASSIGNINSTANCE = "assignInstance";
private static final String CREATEINSTANCE = "createInstance";
private static final String USERPARAMSERVICE = "service";
@@ -136,6 +137,7 @@ public class WorkflowAction {
RequestDetails requestDetails = sIRequest.getRequestDetails();
Resource resource = extractResourceIdAndTypeFromUri(uri);
WorkflowType resourceType = resource.getResourceType();
+ execution.setVariable("resourceName", resourceType.toString());
String resourceId = "";
if (resource.isGenerated()) {
resourceId = validateResourceIdInAAI(resource.getResourceId(), resourceType,
@@ -240,7 +242,7 @@ public class WorkflowAction {
}
if (resourceType == WorkflowType.SERVICE
&& (requestAction.equals(CREATEINSTANCE) || requestAction.equals(ASSIGNINSTANCE))
- && !resourceCounter.stream().filter(x -> VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
+ && !resourceCounter.stream().filter(x -> WorkflowType.VNF.equals(x.getResourceType())).collect(Collectors.toList()).isEmpty()) {
execution.setVariable("homing", true);
execution.setVariable("calledHoming", false);
}
@@ -687,7 +689,7 @@ public class WorkflowAction {
for (ExecuteBuildingBlock ebb : orchFlows) {
if (ebb.getBuildingBlock().getBpmnFlowName().equals("AssignNetworkBB")) {
String key = ebb.getBuildingBlock().getKey();
- boolean isVirtualLink = ebb.getBuildingBlock().getIsVirtualLink();
+ boolean isVirtualLink = Boolean.TRUE.equals(ebb.getBuildingBlock().getIsVirtualLink());
String virtualLinkKey = ebb.getBuildingBlock().getVirtualLinkKey();
sortedOrchFlows.add(ebb);
for (ExecuteBuildingBlock ebb2 : orchFlows) {
@@ -802,6 +804,12 @@ public class WorkflowAction {
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
+ } else if (orchFlow.getFlowName().contains(CONFIGURATION)) {
+ for (int i = 0; i < resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType()).collect(Collectors.toList()).size(); i++) {
+ flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resourceCounter.stream().filter(x -> WorkflowType.CONFIGURATION == x.getResourceType())
+ .collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
+ requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
+ }
} else {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
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 ee6af61d0f..101a355c2f 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
@@ -81,6 +81,45 @@ public class WorkflowActionBBTasks {
execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
}
}
+
+ public void updateFlowStatistics(DelegateExecution execution) {
+ int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ if(currentSequence > 1) {
+ InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
+ requestDbclient.updateInfraActiveRequests(request);
+ }
+ }
+
+ protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
+ List<ExecuteBuildingBlock> flowsToExecute = (List<ExecuteBuildingBlock>) execution
+ .getVariable("flowsToExecute");
+ String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
+ ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
+ ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
+ int completedBBs = currentSequence - 1;
+ int totalBBs = flowsToExecute.size();
+ int remainingBBs = totalBBs - completedBBs;
+ String statusMessage = this.getStatusMessage(completedBB.getBuildingBlock().getBpmnFlowName(),
+ nextBB.getBuildingBlock().getBpmnFlowName(), completedBBs, remainingBBs);
+ Long percentProgress = this.getPercentProgress(completedBBs, totalBBs);
+ request.setStatusMessage(statusMessage);
+ request.setProgress(percentProgress);
+ request.setLastModifiedBy("CamundaBPMN");
+ return request;
+ }
+
+ protected Long getPercentProgress(int completedBBs, int totalBBs) {
+ double ratio = (completedBBs / (totalBBs * 1.0));
+ int percentProgress = (int) (ratio * 95);
+ return new Long(percentProgress + 5);
+ }
+
+ protected String getStatusMessage(String completedBB, String nextBB, int completedBBs, int remainingBBs) {
+ return "Execution of " + completedBB + " has completed successfully, next invoking " + nextBB
+ + " (Execution Path progress: BBs completed = " + completedBBs + "; BBs remaining = " + remainingBBs
+ + ").";
+ }
public void sendSyncAck(DelegateExecution execution) {
final String requestId = (String) execution.getVariable(G_REQUEST_ID);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
index 94dfdcc747..8661c8e91e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
@@ -96,6 +96,7 @@ public class AAIObjectMapper {
map().setModelInvariantId(source.getModelInfoVfModule().getModelInvariantUUID());
map().setModelVersionId(source.getModelInfoVfModule().getModelUUID());
map().setPersonaModelVersion(source.getModelInfoVfModule().getModelInvariantUUID());
+ map().setIsBaseVfModule(source.getModelInfoVfModule().getIsBaseBoolean());
}
});
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index ee8f503e42..056ac3f6e5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -24,6 +24,7 @@ import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import org.modelmapper.ModelMapper;
@@ -36,7 +37,13 @@ import org.onap.so.adapters.nwrest.ProviderVlanNetwork;
import org.onap.so.adapters.nwrest.RollbackNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.bpmn.core.UrnPropertiesReader;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.*;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.NetworkPolicy;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.RouteTableReference;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VpnBinding;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoNetwork;
@@ -273,8 +280,8 @@ public class NetworkAdapterObjectMapper {
private ContrailNetwork buildContrailNetwork(L3Network l3Network, Customer customer){
ContrailNetwork contrailNetwork = new ContrailNetwork();
- contrailNetwork.setExternal(Boolean.toString(l3Network.isExternalNetwork()));
- contrailNetwork.setShared(Boolean.toString(l3Network.isSharedNetwork()));
+ contrailNetwork.setExternal(Optional.ofNullable(l3Network.isIsExternalNetwork()).orElse(false).toString());
+ contrailNetwork.setShared(Optional.ofNullable(l3Network.isIsSharedNetwork()).orElse(false).toString());
contrailNetwork.setPolicyFqdns(buildPolicyFqdns(l3Network.getNetworkPolicies()));
contrailNetwork.setRouteTableFqdns(buildRouteTableFqdns(l3Network.getContrailNetworkRouteTableReferences()));
if(customer!= null)
@@ -335,7 +342,7 @@ public class NetworkAdapterObjectMapper {
private void setFlowFlags(UpdateNetworkRequest updateNetworkRequest, OrchestrationContext orchestrationContext){
updateNetworkRequest.setSkipAAI(true);
//revert suppressRollabck=TRUE into backout=FALSE and vice versa
- updateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled()));
+ updateNetworkRequest.setBackout(!Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
//NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
index 501e64f4d4..87852e9922 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
@@ -27,6 +27,7 @@ import org.onap.so.bpmn.infrastructure.flowspecific.tasks.AssignNetworkBBUtils;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.adapter.network.mapper.NetworkAdapterObjectMapper;
+import org.onap.so.client.db.request.RequestsDbClient;
import org.onap.so.client.orchestration.AAICollectionResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
import org.onap.so.client.orchestration.AAINetworkResources;
@@ -108,6 +109,9 @@ public abstract class BaseTaskTest extends TestDataSetup {
@MockBean
protected CatalogDbClient catalogDbClient;
+ @MockBean
+ protected RequestsDbClient requestsDbClient;
+
@Mock
protected BBInputSetupUtils bbSetupUtils;
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 c9433a6212..b45752957e 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
@@ -204,11 +204,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
@Test
public void updateHeatStackIdVfModuleTest() throws Exception {
+ execution.setVariable("heatStackId", "newHeatStackId");
doNothing().when(aaiVfModuleResources).updateHeatStackIdVfModule(vfModule, genericVnf);
aaiUpdateTasks.updateHeatStackIdVfModule(execution);
verify(aaiVfModuleResources, times(1)).updateHeatStackIdVfModule(vfModule, genericVnf);
+ assertEquals("newHeatStackId", vfModule.getHeatStackId());
}
@Test
@@ -270,11 +272,13 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
}
@Test
public void updateHeatStackIdVolumeGroupTest() throws Exception {
+ execution.setVariable("heatStackId", "newHeatStackId");
doNothing().when(aaiVolumeGroupResources).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
aaiUpdateTasks.updateHeatStackIdVolumeGroup(execution);
verify(aaiVolumeGroupResources, times(1)).updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
+ assertEquals("newHeatStackId", volumeGroup.getHeatStackId());
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
index a206140014..6e5bd314d8 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/AssignNetworkTest.java
@@ -25,7 +25,6 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
@@ -36,80 +35,33 @@ public class AssignNetworkTest extends BaseTaskTest {
@Autowired
private AssignNetwork assignNetwork;
- private ServiceInstance serviceInstance;
private L3Network network;
@Before
public void before() {
- serviceInstance = setServiceInstance();
network = setL3Network();
}
@Test
- public void hasCollectionTest() throws Exception {
- setServiceInstance();
- //collection present by default base test setup
- boolean hasCollection = assignNetwork.hasCollection(execution);
- assertEquals(true, hasCollection);
-
- boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
- assertEquals(false, skip);
- }
-
- @Test
- public void hasNoCollectionTest() throws Exception {
- //clear collection
+ public void networkNotFoundTest() throws Exception {
+ //network status to PRECREATED - when it was NOT found by name
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
- } catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
- }
- serviceInstance.setCollection(null);
- boolean hasCollection = assignNetwork.hasCollection(execution);
- assertEquals(false, hasCollection);
-
- boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
- assertEquals(true, skip);
- }
-
- @Test
- public void hasNoCollectionNoNetworkTest() throws Exception {
- //clear collection and updated network status to PRECREATED - when it was NOT found by name
- try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
} catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
}
- serviceInstance.setCollection(null);
+
network.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
- boolean hasCollection = assignNetwork.hasCollection(execution);
boolean networkFound = assignNetwork.networkFoundByName(execution);
- assertEquals(false, hasCollection);
assertEquals(false, networkFound);
-
- boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
- assertEquals(true, skip);
}
@Test
- public void hasNetworkNoCollectionTest() throws Exception {
- //clear collection and updated network status to INVENTORIED - when it was found by name
+ public void networkFoundTest() throws Exception {
try {
- serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID,execution.getLookupMap().get(ResourceKey.NETWORK_ID));
} catch(BBObjectNotFoundException e) {
- serviceInstance = setServiceInstance();
}
- serviceInstance.setCollection(null);
- network.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- boolean hasCollection = assignNetwork.hasCollection(execution);
boolean networkFound = assignNetwork.networkFoundByName(execution);
- assertEquals(false, hasCollection);
assertEquals(true, networkFound);
-
- boolean skip = assignNetwork.skipNetworkCreationInAAI(execution);
- assertEquals(true, skip);
}
-
}
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 d856b5e184..27173b7502 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
@@ -37,6 +37,7 @@ import org.junit.rules.ExpectedException;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.db.request.beans.InfraActiveRequests;
import org.springframework.beans.factory.annotation.Autowired;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -80,6 +81,32 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void getUpdatedRequestTest() throws Exception{
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("CreateNetworkBB");
+ flowsToExecute.add(ebb1);
+ ebb1.setBuildingBlock(bb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("ActivateNetworkBB");
+ flowsToExecute.add(ebb2);
+ ebb2.setBuildingBlock(bb2);
+ String requestId = "requestId";
+ execution.setVariable("mso-request-id", requestId);
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ int currentSequence = 2;
+ String expectedStatusMessage = "Execution of CreateNetworkBB has completed successfully, next invoking ActivateNetworkBB (Execution Path progress: BBs completed = 1; BBs remaining = 1).";
+ Long expectedLong = new Long(52);
+ InfraActiveRequests mockedRequest = new InfraActiveRequests();
+ when(requestsDbClient.getInfraActiveRequestbyRequestId(requestId)).thenReturn(mockedRequest);
+ InfraActiveRequests actual = workflowActionBBTasks.getUpdatedRequest(execution, currentSequence);
+ assertEquals(expectedStatusMessage, actual.getStatusMessage());
+ assertEquals(expectedLong, actual.getProgress());
+ }
+
+ @Test
public void select2BBTest() throws Exception{
String gAction = "Delete-Network-Collection";
execution.setVariable("mso-request-id", "00f704ca-c5e5-4f95-a72c-6889db7b0688");
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 283f8881c7..3869988c40 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
@@ -427,14 +427,20 @@ public class WorkflowActionTest extends BaseTaskTest {
orch12.setFlowName("ActivateVfModuleBB");
orchFlows.add(orch12);
OrchestrationFlow orch13 = new OrchestrationFlow();
- orch13.setFlowName("ActivateVnfBB");
+ orch13.setFlowName("AssignFabricConfigurationBB");
orchFlows.add(orch13);
OrchestrationFlow orch14 = new OrchestrationFlow();
- orch14.setFlowName("ActivateNetworkCollectionBB");
+ orch14.setFlowName("ActivateFabricConfigurationBB");
orchFlows.add(orch14);
OrchestrationFlow orch15 = new OrchestrationFlow();
- orch15.setFlowName("ActivateServiceInstanceBB");
+ orch15.setFlowName("ActivateVnfBB");
orchFlows.add(orch15);
+ OrchestrationFlow orch16 = new OrchestrationFlow();
+ orch16.setFlowName("ActivateNetworkCollectionBB");
+ orchFlows.add(orch16);
+ OrchestrationFlow orch17 = new OrchestrationFlow();
+ orch17.setFlowName("ActivateServiceInstanceBB");
+ orchFlows.add(orch17);
Service service = new Service();
doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a");
@@ -772,7 +778,7 @@ public class WorkflowActionTest extends BaseTaskTest {
assertEquals(UUID.randomUUID().toString().length(),ebbs.get(14).getWorkflowResourceIds().getVnfId().length());
assertEquals(ebbs.get(15).getBuildingBlock().getBpmnFlowName(),"ActivateServiceInstanceBB");
assertEquals(3,ebbs.get(0).getWorkflowResourceIds().getServiceInstanceId().length());
-
+ assertEquals(true, execution.getVariable("homing"));
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
index 6edda44c0a..0355006d15 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
@@ -63,7 +63,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.ObjectWriter;
-public class AAIObjectMapperTest{
+public class AAIObjectMapperTest {
private AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
private final static String JSON_FILE_LOCATION = "src/test/resources/__files/BuildingBlocks/";
@@ -245,6 +245,32 @@ public class AAIObjectMapperTest{
assertThat(reqMapper1, sameBeanAs(AAIVfModule));
}
+
+ @Test
+ public void vfModuleBaseMap() throws Exception {
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleId("a");
+ vfModule.setVfModuleName("b");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ ModelInfoVfModule modelInfoVfModule = new ModelInfoVfModule();
+ modelInfoVfModule.setModelCustomizationUUID("f");
+ modelInfoVfModule.setModelInvariantUUID("g");
+ modelInfoVfModule.setModelUUID("h");
+ modelInfoVfModule.setIsBaseBoolean(true);
+ vfModule.setModelInfoVfModule(modelInfoVfModule);
+
+ org.onap.aai.domain.yang.VfModule AAIVfModule = aaiObjectMapper.mapVfModule(vfModule);
+
+ String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiVfModuleBaseMap.json")));
+
+ ObjectMapper omapper = new ObjectMapper();
+ org.onap.aai.domain.yang.VfModule reqMapper1 = omapper.readValue(
+ jsonToCompare,
+ org.onap.aai.domain.yang.VfModule.class);
+
+ assertThat(reqMapper1, sameBeanAs(AAIVfModule));
+
+ }
@Test
public void testMapInstanceGroup() {
@@ -317,7 +343,7 @@ public class AAIObjectMapperTest{
l3Network.setContrailNetworkFqdn("contrailNetworkFqdn");
l3Network.setIsBoundToVpn(false);
l3Network.setIsCascaded(false);
- l3Network.setIsExternalNetwork(false);
+ l3Network.setIsSharedNetwork(false);
l3Network.setHeatStackId("heatStackId");
l3Network.setOperationalStatus("operationalStatus");
l3Network.setPhysicalNetworkName("physicalNetworkName");
@@ -403,7 +429,7 @@ public class AAIObjectMapperTest{
l3Network.setPhysicalNetworkName("physicalNetwork_name");
l3Network.setIsProviderNetwork(true);
l3Network.setIsSharedNetwork(false);
- l3Network.setIsExternalNetwork(false);
+ l3Network.setIsExternalNetwork(true);
l3Network.setSelflink("self_link");
l3Network.setOperationalStatus("operationalStatus");
@@ -536,7 +562,7 @@ public class AAIObjectMapperTest{
AAIObjectMapper aaiObjectMapper = new AAIObjectMapper();
org.onap.aai.domain.yang.CtagAssignments v12CtagAssingments = aaiObjectMapper.mapToAAICtagAssignmentList(ctagAssignments);
- assertEquals(ctagAssignments.get(0).getVlanIdInner(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner());
+ assertEquals(ctagAssignments.get(0).getVlanIdInner().longValue(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner());
String jsonToCompare = new String(Files.readAllBytes(Paths.get(JSON_FILE_LOCATION + "aaiCtagAssingmentsMapped_to_aai.json")));
ObjectMapper omapper = new ObjectMapper();
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index 96fbe7ffb7..fddba98f4c 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -187,6 +187,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{
Subnet actualSubnet = new Subnet();
actualSubnet.setSubnetId("subnetId");
+ actualSubnet.setDhcpEnabled(false);
actualSubnet.setIpVersion("4");
RouteTarget routeTarget = new RouteTarget();
@@ -231,7 +232,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup{
expectedUpdateNetworkRequest.setNetworkParams(userInput);
expectedUpdateNetworkRequest.setMsoRequest(msoRequest);
expectedUpdateNetworkRequest.setSkipAAI(true);
- expectedUpdateNetworkRequest.setBackout(!Boolean.valueOf(orchestrationContext.getIsRollbackEnabled()));
+ expectedUpdateNetworkRequest.setBackout(!Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
expectedUpdateNetworkRequest.setMessageId("messageId");
expectedUpdateNetworkRequest.setNotificationUrl("http://localhost:28080/mso/WorkflowMesssage/NetworkAResponse/messageId");
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json
index 81362e3dca..d6c08fbaee 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped.json
@@ -14,7 +14,6 @@
"physicalNetworkName": "physicalNetworkName",
"isProviderNetwork": false,
"isSharedNetwork": false,
- "isExternalNetwork": false,
"selflink": "selflink",
"operationalStatus": "operationalStatus"
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json
index 7a30ade095..bca5f94294 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiL3NetworkMapped_to_aai.json
@@ -5,7 +5,7 @@
"networkRole" : "dmz_direct",
"networkTechnology" : "contrail",
"neutronNetworkId" : null,
- "isBoundToVpn" : false,
+ "isBoundToVpn" : true,
"serviceId" : "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
"networkRoleInstance" : 1,
"resourceVersion" : null,
@@ -20,9 +20,9 @@
"widgetModelId" : "widgetModel_id",
"widgetModelVersion" : "widgetModel_version",
"physicalNetworkName" : "physicalNetwork_name",
- "isProviderNetwork" : false,
+ "isProviderNetwork" : true,
"isSharedNetwork" : false,
- "isExternalNetwork" : false,
+ "isExternalNetwork" : true,
"selflink" : "self_link",
"operationalStatus" : "operationalStatus",
"subnets" : {
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json
new file mode 100644
index 0000000000..9637e00fe1
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/aaiVfModuleBaseMap.json
@@ -0,0 +1,12 @@
+{
+
+ "modelCustomizationId" : "f",
+ "vfModuleId" : "a",
+ "vfModuleName" : "b",
+ "modelInvariantId" : "g",
+ "modelVersionId" : "h",
+ "orchestrationStatus" : "Assigned",
+ "personaModelVersion" : "g",
+ "isBaseVfModule" : true
+
+} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
index ac8446cbb9..8a3ce7f099 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
+++ b/bpmn/so-bpmn-tasks/src/test/resources/application-test.yaml
@@ -31,6 +31,9 @@ log:
vnfAdapterRestV1: 'true'
mso:
adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
completemsoprocess:
endpoint: http://localhost:${wiremock.server.port}/CompleteMsoProcess
db:
diff --git a/cloudify-client/.gitignore b/cloudify-client/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/cloudify-client/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/common/.gitignore b/common/.gitignore
index a791146dad..c2a96233ca 100644
--- a/common/.gitignore
+++ b/common/.gitignore
@@ -1 +1,2 @@
/tattletale-jar/
+/bin/
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index 79fd7df7ce..0f4bbea03c 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -153,6 +153,10 @@ public abstract class RestClient {
}
return builder;
}
+
+ protected WebTarget getWebTarget() {
+ return this.webTarget;
+ }
protected abstract void initializeHeaderMap(Map<String, String> headerMap);
diff --git a/common/src/main/java/org/onap/so/client/RestRequest.java b/common/src/main/java/org/onap/so/client/RestRequest.java
index 985d7cc885..4788acfa7c 100644
--- a/common/src/main/java/org/onap/so/client/RestRequest.java
+++ b/common/src/main/java/org/onap/so/client/RestRequest.java
@@ -73,7 +73,7 @@ public class RestRequest implements Callable<Response> {
mapper.get().map(response);
} catch (NotFoundException e) {
if (this.client.props.mapNotFoundToEmpty() && "GET".equals(method)) {
- msoLogger.error(e);
+ msoLogger.debug("RestClient recieved not found on URL: " + this.client.getWebTarget().getUri());
return response;
} else {
throw e;
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
index 9087995f97..36e67e2e09 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
@@ -35,19 +35,19 @@ import com.fasterxml.jackson.databind.ObjectMapper;
public class AAIResultWrapper implements Serializable {
private static final long serialVersionUID = 5895841925807816737L;
- private final Optional<String> jsonBody;
+ private final String jsonBody;
private final ObjectMapper mapper;
public AAIResultWrapper(String json) {
- this.jsonBody = Optional.ofNullable(json);
+ this.jsonBody = json;
this.mapper = new AAICommonObjectMapperProvider().getMapper();
}
public Optional<Relationships> getRelationships() {
final String path = "$.relationship-list";
- if (!jsonBody.isPresent()) {
+ if (isEmpty()) {
return Optional.empty();
}
- Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody.get(), path);
+ Optional<String> result = JsonPathUtil.getInstance().locateResult(jsonBody, path);
if (result.isPresent()) {
return Optional.of(new Relationships(result.get()));
} else {
@@ -56,33 +56,37 @@ public class AAIResultWrapper implements Serializable {
}
public String getJson() {
- return jsonBody.orElse("{}");
+ if(jsonBody == null) {
+ return "{}";
+ } else {
+ return jsonBody;
+ }
}
public Map<String, Object> asMap() {
- if (!this.jsonBody.isPresent()) {
+ if (isEmpty()) {
return new HashMap<>();
}
try {
- return mapper.readValue(this.jsonBody.get(), new TypeReference<Map<String, Object>>(){});
+ return mapper.readValue(this.jsonBody, new TypeReference<Map<String, Object>>(){});
} catch (IOException e) {
return new HashMap<>();
}
}
public <T> Optional<T> asBean(Class<T> clazz) {
- if (!this.jsonBody.isPresent()) {
+ if (isEmpty()) {
return Optional.empty();
}
try {
- return Optional.of(mapper.readValue(this.jsonBody.get(), clazz));
+ return Optional.of(mapper.readValue(this.jsonBody, clazz));
} catch (IOException e) {
return Optional.empty();
}
}
public boolean isEmpty() {
- return !this.jsonBody.isPresent();
+ return jsonBody == null;
}
@Override
public String toString() {
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
index 2a7c8ee78c..192b593603 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AAIUriFactory.java
@@ -31,7 +31,12 @@ public class AAIUriFactory {
/**
* values are filled into the URI template specified in {@link AAIObjectType} in order
- *
+ * <br>
+ * There are two special lookups performed on certain types when a single value is specified:
+ * <br>
+ * Service Instance and AllottedResources
+ * <br>
+ * These can be retrieved without all their required keys but an HTTP call is required to do so
* @param type
* @param values
* @return
@@ -39,6 +44,8 @@ public class AAIUriFactory {
public static AAIResourceUri createResourceUri(AAIObjectType type, Object... values) {
if (AAIObjectType.SERVICE_INSTANCE.equals(type)) {
return new ServiceInstanceUri(values);
+ } else if (AAIObjectType.ALLOTTED_RESOURCE.equals(type)) {
+ return new AllottedResourceLookupUri(values);
} else {
return new AAISimpleUri(type, values);
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java
new file mode 100644
index 0000000000..e063bf8935
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/AllottedResourceLookupUri.java
@@ -0,0 +1,52 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai.entities.uri;
+
+import java.net.URI;
+import java.util.Optional;
+
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+
+public class AllottedResourceLookupUri extends HttpLookupUri {
+
+ protected AllottedResourceLookupUri(Object... values) {
+ super(AAIObjectType.ALLOTTED_RESOURCE, values);
+ }
+ protected AllottedResourceLookupUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
+ super(AAIObjectType.ALLOTTED_RESOURCE, builder, cachedValue, values);
+ }
+
+ @Override
+ public ServiceInstanceUri clone() {
+ return new ServiceInstanceUri(this.internalURI.clone(), this.getCachedValue(), values);
+ }
+
+ public AAIResourcesClient getResourcesClient() {
+ return new AAIResourcesClient();
+ }
+ @Override
+ public URI buildNoNetwork() {
+ return super.build(new String[]{"NONE", "NONE", "NONE", (String)this.values[0]});
+ }
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
new file mode 100644
index 0000000000..884f8c6ac4
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/HttpLookupUri.java
@@ -0,0 +1,126 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.aai.entities.uri;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.Optional;
+
+import javax.ws.rs.BadRequestException;
+import javax.ws.rs.NotFoundException;
+import javax.ws.rs.core.UriBuilder;
+
+import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.AAIResourcesClient;
+import org.onap.so.client.aai.entities.Results;
+import org.onap.so.client.graphinventory.Format;
+import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
+import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
+
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public abstract class HttpLookupUri extends AAISimpleUri implements HttpAwareUri {
+
+ private Optional<String> cachedValue = Optional.empty();
+ private final AAIObjectType aaiType;
+ protected HttpLookupUri(AAIObjectType type, Object... values) {
+ super(type, values);
+ this.aaiType = type;
+ }
+ protected HttpLookupUri(AAIObjectType type, UriBuilder builder, Optional<String> cachedValue, Object... values) {
+ super(type, builder, values);
+ this.cachedValue = cachedValue;
+ this.aaiType = type;
+ }
+ protected String getObjectById(Object id) throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
+ if (!this.getCachedValue().isPresent()) {
+ AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(aaiType, id).format(Format.PATHED);
+ String resultJson;
+ try {
+ resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson();
+ } catch (BadRequestException e) {
+ throw new GraphInventoryUriNotFoundException(aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build());
+
+ }
+ try {
+ cachedValue = extractRelatedLink(resultJson);
+ if (!cachedValue.isPresent()) {
+ throw new GraphInventoryUriNotFoundException(aaiType.typeName() + " " + id + " not found at: " + serviceInstanceUri.build());
+ }
+ } catch (IOException e) {
+ throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e);
+ }
+ }
+ Optional<String> cachedValueOpt = this.getCachedValue();
+ return cachedValueOpt.isPresent() ? cachedValueOpt.get() : "";
+ }
+
+ protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
+ Optional<String> result;
+ ObjectMapper mapper = new ObjectMapper();
+
+ Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
+ if (results.getResult().size() == 1) {
+ String uriString = results.getResult().get(0).get("resource-link");
+ URI uri = UriBuilder.fromUri(uriString).build();
+ String rawPath = uri.getRawPath();
+ result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
+ } else if (results.getResult().isEmpty()) {
+ result = Optional.empty();
+ } else {
+ throw new IllegalStateException("more than one result returned");
+ }
+
+ return result;
+ }
+
+ protected Optional<String> getCachedValue() {
+ return this.cachedValue;
+ }
+
+ @Override
+ public URI build() {
+ try {
+ if (this.values.length == 1) {
+ String uri = getObjectById(this.values[0]);
+ Map<String, String> map = getURIKeys(uri);
+ return super.build(map.values().toArray(values));
+ }
+ } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
+ throw new GraphInventoryUriComputationException(e);
+ }
+ return super.build();
+ }
+
+ @Override
+ public abstract HttpLookupUri clone();
+
+ public AAIResourcesClient getResourcesClient() {
+ return new AAIResourcesClient();
+ }
+ @Override
+ public abstract URI buildNoNetwork();
+}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
index a132e15d1f..00a213b264 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUri.java
@@ -20,97 +20,21 @@
package org.onap.so.client.aai.entities.uri;
-import java.io.IOException;
import java.net.URI;
-import java.util.Arrays;
-import java.util.Map;
import java.util.Optional;
-import javax.ws.rs.BadRequestException;
-import javax.ws.rs.NotFoundException;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.AAIResourcesClient;
-import org.onap.so.client.aai.entities.Results;
-import org.onap.so.client.graphinventory.Format;
-import org.onap.so.client.graphinventory.entities.uri.HttpAwareUri;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryPayloadException;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriComputationException;
-import org.onap.so.client.graphinventory.exceptions.GraphInventoryUriNotFoundException;
-import com.fasterxml.jackson.core.type.TypeReference;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class ServiceInstanceUri extends AAISimpleUri implements HttpAwareUri {
-
- private Optional<String> cachedValue = Optional.empty();
+public class ServiceInstanceUri extends HttpLookupUri {
protected ServiceInstanceUri(Object... values) {
super(AAIObjectType.SERVICE_INSTANCE, values);
}
protected ServiceInstanceUri(UriBuilder builder, Optional<String> cachedValue, Object... values) {
- super(AAIObjectType.SERVICE_INSTANCE, builder, values);
- this.cachedValue = cachedValue;
- }
- protected String getSerivceInstance(Object id) throws GraphInventoryUriNotFoundException, GraphInventoryPayloadException {
- if (!this.getCachedValue().isPresent()) {
- AAIResourceUri serviceInstanceUri = AAIUriFactory.createNodesUri(AAIObjectType.SERVICE_INSTANCE, id).format(Format.PATHED);
- String resultJson;
- try {
- resultJson = this.getResourcesClient().get(serviceInstanceUri, NotFoundException.class).getJson();
- } catch (BadRequestException e) {
- throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
-
- }
- try {
- cachedValue = extractRelatedLink(resultJson);
- if (!cachedValue.isPresent()) {
- throw new GraphInventoryUriNotFoundException("Service instance " + id + " not found at: " + serviceInstanceUri.build());
- }
- } catch (IOException e) {
- throw new GraphInventoryPayloadException("could not map payload: " + resultJson, e);
- }
- }
- Optional<String> cachedValueOpt = this.getCachedValue();
- return cachedValueOpt.isPresent() ? cachedValueOpt.get() : "";
- }
-
- protected Optional<String> extractRelatedLink(String jsonString) throws IOException {
- Optional<String> result;
- ObjectMapper mapper = new ObjectMapper();
-
- Results<Map<String, String>> results = mapper.readValue(jsonString, new TypeReference<Results<Map<String, String>>>(){});
- if (results.getResult().size() == 1) {
- String uriString = results.getResult().get(0).get("resource-link");
- URI uri = UriBuilder.fromUri(uriString).build();
- String rawPath = uri.getRawPath();
- result = Optional.of(rawPath.replaceAll("/aai/v\\d+", ""));
- } else if (results.getResult().isEmpty()) {
- result = Optional.empty();
- } else {
- throw new IllegalStateException("more than one result returned");
- }
-
- return result;
- }
-
- protected Optional<String> getCachedValue() {
- return this.cachedValue;
- }
-
- @Override
- public URI build() {
- try {
- if (this.values.length == 1) {
- String uri = getSerivceInstance(this.values[0]);
- Map<String, String> map = getURIKeys(uri);
- return super.build(map.values().toArray(values));
- }
- } catch (GraphInventoryUriNotFoundException | GraphInventoryPayloadException e) {
- throw new GraphInventoryUriComputationException(e);
- }
- return super.build();
+ super(AAIObjectType.SERVICE_INSTANCE, builder, cachedValue, values);
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java b/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java
deleted file mode 100644
index af21949277..0000000000
--- a/common/src/main/java/org/onap/so/client/aai/objects/AAIServiceInstance.java
+++ /dev/null
@@ -1,141 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.client.aai.objects;
-
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.entities.AAIEntityObject;
-import org.onap.so.client.aai.entities.uri.AAIResourceUri;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-
-import com.fasterxml.jackson.annotation.JsonProperty;
-
-public class AAIServiceInstance implements AAIEntityObject {
-
- @JsonProperty("service-instance-id")
- private String serviceInstanceId;
- @JsonProperty("service-instance-name")
- private String serviceInstanceName;
- @JsonProperty("service-type")
- private String serviceType;
- @JsonProperty("service-role")
- private String serviceRole;
- @JsonProperty("orchestration-status")
- private String oStatus;
- @JsonProperty("model-invariant-id")
- private String modelInvariantUuid;
- @JsonProperty("model-version-id")
- private String modelUuid;
- @JsonProperty("environment-context")
- private String environmentContext;
- @JsonProperty("workload-context")
- private String workloadContext;
-
- public String getServiceInstanceName() {
- return serviceInstanceName;
- }
-
- public void setServiceInstanceName(String serviceInstanceName) {
- this.serviceInstanceName = serviceInstanceName;
- }
-
- public String getServiceType() {
- return serviceType;
- }
-
- public void setServiceType(String serviceType) {
- this.serviceType = serviceType;
- }
-
- public String getServiceRole() {
- return serviceRole;
- }
-
- public void setServiceRole(String serviceRole) {
- this.serviceRole = serviceRole;
- }
-
- public String getoStatus() {
- return oStatus;
- }
-
- public void setoStatus(String oStatus) {
- this.oStatus = oStatus;
- }
-
- public String getModelInvariantUuid() {
- return modelInvariantUuid;
- }
-
- public void setModelInvariantUuid(String modelInvariantUuid) {
- this.modelInvariantUuid = modelInvariantUuid;
- }
-
- public String getModelUuid() {
- return modelUuid;
- }
-
- public void setModelUuid(String modelUuid) {
- this.modelUuid = modelUuid;
- }
-
- public String getEnvironmentContext() {
- return environmentContext;
- }
-
- public void setEnvironmentContext(String environmentContext) {
- this.environmentContext = environmentContext;
- }
-
- public String getWorkloadContext() {
- return workloadContext;
- }
-
- public void setWorkloadContext(String workloadContext) {
- this.workloadContext = workloadContext;
- }
-
- public String getServiceInstanceId() {
- return serviceInstanceId;
- }
-
- public void setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- }
-
- public AAIServiceInstance withServiceInstance(String serviceInstanceId) {
- this.setServiceInstanceId(serviceInstanceId);
- return this;
- }
-
- @Override
- public AAIResourceUri getUri() {
- AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, this.serviceInstanceId);
- return uri;
- }
- @Override
- public String toString() {
- return "AAIServiceInstance [serviceInstanceId=" + serviceInstanceId + ", serviceInstanceName="
- + serviceInstanceName + ", serviceType=" + serviceType + ", serviceRole=" + serviceRole + ", oStatus="
- + oStatus + ", modelInvariantUuid=" + modelInvariantUuid + ", modelUuid=" + modelUuid
- + ", environmentContext=" + environmentContext + ", workloadContext=" + workloadContext + "]";
- }
-
-}
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
index ff940a0dea..e40c25a2e2 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
@@ -20,9 +20,10 @@
package org.onap.so.client.aai.entities;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
import java.io.IOException;
+import java.io.Serializable;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.HashMap;
@@ -30,11 +31,15 @@ import java.util.Map;
import java.util.Optional;
import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.runners.MockitoJUnitRunner;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.springframework.util.SerializationUtils;
+
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonMappingException;
@@ -43,7 +48,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class AAIResultWrapperTest {
String json;
-
+ @Rule
+ public ExpectedException thrown= ExpectedException.none();
+
AAIResultWrapper aaiResultWrapper;
AAIResultWrapper aaiResultWrapperEmpty;
@@ -57,6 +64,14 @@ public class AAIResultWrapperTest {
}
@Test
+ public void testAAIResultWrapperIsSerializable() throws IOException {
+ AAIResultWrapper original = new AAIResultWrapper("");
+ byte[] serialized = SerializationUtils.serialize(original);
+ AAIResultWrapper deserialized = (AAIResultWrapper) SerializationUtils.deserialize(serialized);
+ assertEquals(deserialized.getJson(), original.getJson());
+ }
+
+ @Test
public void testGetRelationshipsEmpty() {
Optional<Relationships> relationships = aaiResultWrapperEmpty.getRelationships();
assertEquals("Compare relationships", Optional.empty(), relationships);
diff --git a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
index 2cd7848cfa..26f9d871fd 100644
--- a/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/entities/uri/ServiceInstanceUriTest.java
@@ -84,7 +84,7 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
- doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class));
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getObjectById(any(Object.class));
final URI result = spy.build();
final URI expected = UriBuilder.fromPath("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").build();
@@ -97,7 +97,7 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
- doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getSerivceInstance(any(Object.class));
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3").when(spy).getObjectById(any(Object.class));
final URI result = spy.resourceVersion("1234").build();
final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
@@ -110,7 +110,7 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
- doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").when(spy).getSerivceInstance(any(Object.class));
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").when(spy).getObjectById(any(Object.class));
final URI result = spy.build();
final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%20space").build();
@@ -123,7 +123,7 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
- doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space").when(spy).getSerivceInstance(any(Object.class));
+ doReturn("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3%28space").when(spy).getObjectById(any(Object.class));
assertThat(spy.getURIKeys().values(), contains("key1", "key2", "key3(space"));
@@ -133,7 +133,7 @@ public class ServiceInstanceUriTest {
ServiceInstanceUri instance = new ServiceInstanceUri("key1");
ServiceInstanceUri spy = spy(instance);
String uri = "/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3";
- doReturn(uri).when(spy).getSerivceInstance(any(Object.class));
+ doReturn(uri).when(spy).getObjectById(any(Object.class));
doReturn(Optional.of(uri)).when(spy).getCachedValue();
final URI result = spy.resourceVersion("1234").clone().build();
final URI expected = UriBuilder.fromUri("/business/customers/customer/key1/service-subscriptions/service-subscription/key2/service-instances/service-instance/key3?resource-version=1234").build();
diff --git a/common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java b/common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java
deleted file mode 100644
index 4b080252b2..0000000000
--- a/common/src/test/java/org/onap/so/client/aai/objects/AAIServiceInstanceTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
-* ============LICENSE_START=======================================================
- * ONAP : SO
- * ================================================================================
- * Copyright (C) 2018 TechMahindra
- * ================================================================================
- * 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.aai.objects;
-
-import static org.junit.Assert.*;
-
-import org.junit.Test;
-
-public class AAIServiceInstanceTest {
-
- @Test
- public void test() {
- AAIServiceInstance aaiSI= new AAIServiceInstance();
- aaiSI.setEnvironmentContext("environmentContext");
- aaiSI.setModelInvariantUuid("modelInvariantUuid");
- aaiSI.setModelUuid("modelUuid");
- aaiSI.setoStatus("oStatus");
- aaiSI.setServiceInstanceId("serviceInstanceId");
- aaiSI.setServiceInstanceName("serviceInstanceName");
- aaiSI.setServiceRole("serviceRole");
- aaiSI.setServiceType("serviceType");
- aaiSI.setWorkloadContext("workloadContext");
- assertEquals(aaiSI.getEnvironmentContext(), "environmentContext");
- assertEquals(aaiSI.getModelInvariantUuid(), "modelInvariantUuid");
- assertEquals(aaiSI.getModelUuid(), "modelUuid");
- assertEquals(aaiSI.getoStatus(), "oStatus");
- assertEquals(aaiSI.getServiceInstanceId(), "serviceInstanceId");
- assertEquals(aaiSI.getServiceInstanceName(), "serviceInstanceName");
- assertEquals(aaiSI.getServiceRole(), "serviceRole");
- assertEquals(aaiSI.getServiceType(), "serviceType");
- assertEquals(aaiSI.getWorkloadContext(), "workloadContext");
- aaiSI.withServiceInstance("serviceInstanceId");
- assert(aaiSI.getUri()!=null);
- }
-
-}
diff --git a/deployment-configs/.gitignore b/deployment-configs/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/deployment-configs/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
index e920db2fd2..8dba63b44b 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandlerinfra/Action.java
@@ -41,5 +41,7 @@ public enum Action {
assignInstance,
unassignInstance,
compareModel,
- scaleInstance
+ scaleInstance,
+ deactivateAndCloudDelete,
+ scaleOut
}
diff --git a/mso-api-handlers/mso-api-handler-infra/.gitignore b/mso-api-handlers/mso-api-handler-infra/.gitignore
new file mode 100644
index 0000000000..ae3c172604
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/.gitignore
@@ -0,0 +1 @@
+/bin/
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index 923909e39b..8f8cf0898d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -61,6 +61,7 @@ import org.onap.so.db.request.beans.OperationStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoAlarmLogger;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.RequestDetails;
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 66afcf3738..1a1b45ac8e 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
@@ -62,10 +62,10 @@ import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
import org.onap.so.apihandlerinfra.vnfbeans.VnfInputs;
import org.onap.so.apihandlerinfra.vnfbeans.VnfRequest;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.InstanceDirection;
import org.onap.so.serviceinstancebeans.ModelInfo;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 014739d581..753b4c48d4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -52,6 +52,7 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoAlarmLogger;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
import org.onap.so.serviceinstancebeans.InstanceReferences;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index 910b9f70cb..cfe32a3833 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -40,7 +40,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.RequestsDbClient;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
@@ -51,7 +51,6 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestReferences;
import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantSyncResponse;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
index a14554c8a1..3b7a326f3e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -44,7 +44,7 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.Constants;
import org.onap.so.apihandlerinfra.Messages;
-import org.onap.so.apihandlerinfra.RequestsDbClient;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
index b35b669208..b13008b3d3 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
@@ -30,7 +30,7 @@ import javax.ws.rs.core.MultivaluedMap;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.apihandlerinfra.Constants;
-import org.onap.so.apihandlerinfra.RequestsDbClient;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
index 461acab96d..2427dd2734 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRunnable.java
@@ -32,8 +32,6 @@ import org.onap.so.apihandlerinfra.tenantisolation.process.CreateVnfOperationalE
import org.onap.so.apihandlerinfra.tenantisolation.process.DeactivateVnfOperationalEnvironment;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.OperationalEnvironment;
-import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
@@ -46,7 +44,7 @@ import org.springframework.stereotype.Component;
@Scope("prototype")
public class TenantIsolationRunnable {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRunnable.class);
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.APIH, TenantIsolationRunnable.class);
@Autowired
private RequestsDBHelper requestDb;
@@ -60,10 +58,6 @@ public class TenantIsolationRunnable {
private DeactivateVnfOperationalEnvironment deactivateVnfOpEnv;
@Autowired
private ActivateVnfStatusOperationalEnvironment activateVnfStatusOpEnv;
- @Autowired
- private OperationalEnvDistributionStatusRepository distributionStatusRepository;
- @Autowired
- private OperationalEnvServiceModelStatusRepository modelStatusRepository;
@Async
public void run(Action action, String operationalEnvType, CloudOrchestrationRequest cor, String requestId) throws ApiException {
@@ -83,11 +77,11 @@ public class TenantIsolationRunnable {
throw validateException;
}
} else if(Action.activate.equals(action)) {
- activateVnfOpEnv.execute(requestId, cor, distributionStatusRepository, modelStatusRepository);
+ activateVnfOpEnv.execute(requestId, cor);
} else if(Action.deactivate.equals(action)) {
deactivateVnfOpEnv.execute(requestId, cor);
} else if(Action.distributionStatus.equals(action)) {
- activateVnfStatusOpEnv.execute(requestId, cor, distributionStatusRepository, modelStatusRepository);
+ activateVnfStatusOpEnv.execute(requestId, cor);
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.DataError).build();
ValidateException validateException = new ValidateException.Builder("Invalid Action specified: " + action,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
index 903639c8f5..e89b5c8d42 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
@@ -21,13 +21,13 @@
package org.onap.so.apihandlerinfra.tenantisolation.process;
import java.util.List;
-import java.util.Optional;
import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
@@ -40,8 +40,6 @@ import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
@@ -53,7 +51,7 @@ import org.springframework.stereotype.Component;
@Component
public class ActivateVnfOperationalEnvironment {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfOperationalEnvironment.class);
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.APIH, ActivateVnfOperationalEnvironment.class);
private static final int DEFAULT_ACTIVATE_RETRY_COUNT = 3;
private static final String DISTRIBUTION_STATUS_SENT = "SENT";
@@ -69,16 +67,16 @@ public class ActivateVnfOperationalEnvironment {
@Value("${mso.tenant.isolation.retry.count}")
private String sdcRetryCount;
+ @Autowired
+ RequestsDbClient client;
+
/**
* The Point-Of-Entry from APIH with VID request to send activate request
* @param requestId - String
* @param request - CloudOrchestrationRequest object
- * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
- * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
* @return void - nothing
*/
- public void execute(String requestId, CloudOrchestrationRequest request, OperationalEnvDistributionStatusRepository distributionStatusRepository,
- OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException{
+ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException{
String operationalEnvironmentId = request.getOperationalEnvironmentId();
String vidWorkloadContext = request.getRequestDetails().getRequestParameters().getWorkloadContext();
@@ -96,7 +94,7 @@ public class ActivateVnfOperationalEnvironment {
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
}
- processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext, distributionStatusRepository, modelStatusRepository);
+ processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
}
@@ -107,13 +105,11 @@ public class ActivateVnfOperationalEnvironment {
* @param operationalEnvironmentId - String
* @param serviceModelVersionIdList - List<ServiceModelList> list
* @param workloadContext - String
- * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
- * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
* @return jsonResponse - JSONObject object
*/
- public void processActivateSDCRequest(String requestId, String operationalEnvironmentId, List<ServiceModelList> serviceModelVersionIdList,
- String workloadContext, OperationalEnvDistributionStatusRepository distributionStatusRepository,
- OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+ public void processActivateSDCRequest(String requestId, String operationalEnvironmentId,
+ List<ServiceModelList> serviceModelVersionIdList,
+ String workloadContext) throws ApiException {
JSONObject jsonResponse = null;
int retryCount = 0;
@@ -137,7 +133,7 @@ public class ActivateVnfOperationalEnvironment {
recoveryAction,
retryCount,
workloadContext);
- modelStatusRepository.save(serviceModelStatus);
+ client.save(serviceModelStatus);
String distributionId = "";
@@ -154,7 +150,7 @@ public class ActivateVnfOperationalEnvironment {
requestId,
DISTRIBUTION_STATUS_SENT,
"");
- distributionStatusRepository.save(distStatus);
+ client.save(distStatus);
} else {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_GENERAL_EXCEPTION, MsoLogger.ErrorCode.BusinessProcesssError).build();
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
index 6a9bec5abb..6eb5157568 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
@@ -28,6 +28,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.onap.so.apihandler.common.ErrorNumbers;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
@@ -38,8 +39,6 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDBHelper;
@@ -72,17 +71,16 @@ public class ActivateVnfStatusOperationalEnvironment {
private RequestsDBHelper requestDb;
@Autowired
private SDCClientHelper sdcClientHelper;
+ @Autowired
+ private RequestsDbClient client;
/**
* The Point-Of-Entry from APIH with activate status from SDC
* @param requestId - String
* @param request - CloudOrchestrationRequest - object
- * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository - object
- * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository - object
* @return void - nothing
*/
- public void execute(String requestId, CloudOrchestrationRequest request, OperationalEnvDistributionStatusRepository distributionStatusRepository,
- OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+ public void execute(String requestId, CloudOrchestrationRequest request) throws ApiException {
String operationalEnvironmentId = "";
@@ -91,18 +89,18 @@ public class ActivateVnfStatusOperationalEnvironment {
Distribution sdcStatus = request.getDistribution();
// Distribution, Query for operationalEnvironmentId, serviceModelVersionId
- this.queryDistributionDbResponse = distributionStatusRepository.findOne(sdcDistributionId);
+ this.queryDistributionDbResponse = client.getDistributionStatusById(sdcDistributionId);
operationalEnvironmentId = this.queryDistributionDbResponse.getOperationalEnvId();
// ServiceModel, Query for dbRequestId, recoveryAction, retryCountString
- this.queryServiceModelResponse = modelStatusRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId());
+ this.queryServiceModelResponse = client.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, queryDistributionDbResponse.getServiceModelVersionId());
this.origRequestId = this.queryServiceModelResponse.getRequestId();
- processActivateSDCStatus(sdcDistributionId, sdcStatus, this.queryDistributionDbResponse, this.queryServiceModelResponse, distributionStatusRepository, modelStatusRepository);
+ processActivateSDCStatus(sdcDistributionId, sdcStatus, this.queryDistributionDbResponse, this.queryServiceModelResponse);
// After EVERY status processed, need to query the status of all service modelId
// to determine the OVERALL status if "COMPLETE" or "FAILURE":
- checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId, modelStatusRepository);
+ checkOrUpdateOverallStatus(operationalEnvironmentId, this.origRequestId);
}
@@ -112,13 +110,10 @@ public class ActivateVnfStatusOperationalEnvironment {
* @param sdcStatus - Distribution object
* @param queryDistributionDbResponse - OperationalEnvDistributionStatus object
* @param queryServiceModelResponse - OperationalEnvServiceModelStatus object
- * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
- * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
* @return void - nothing
*/
public void processActivateSDCStatus(String sdcDistributionId, Distribution sdcStatus, OperationalEnvDistributionStatus queryDistributionDbResponse,
- OperationalEnvServiceModelStatus queryServiceModelResponse, OperationalEnvDistributionStatusRepository distributionStatusRepository,
- OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+ OperationalEnvServiceModelStatus queryServiceModelResponse) throws ApiException {
String sdcStatusValue = sdcStatus.getStatus().toString();
String recoveryAction = queryServiceModelResponse.getRecoveryAction();
@@ -131,13 +126,13 @@ public class ActivateVnfStatusOperationalEnvironment {
dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
sdcStatusValue,
"");
- distributionStatusRepository.save(updateDistStatusOk);
+ client.save(updateDistStatusOk);
// should update 1 row, update status and retryCount = 0 (ie, serviceModelVersionId is DONE!)
OperationalEnvServiceModelStatus updateRetryCountZeroAndStatusOk =
dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
sdcStatusValue,
RETRY_COUNT_ZERO);
- modelStatusRepository.save(updateRetryCountZeroAndStatusOk);
+ client.save(updateRetryCountZeroAndStatusOk);
} else {
// "DISTRIBUTION_COMPLETE_ERROR", Check if recoveryAction is "RETRY"
@@ -145,8 +140,7 @@ public class ActivateVnfStatusOperationalEnvironment {
// RESEND / RETRY serviceModelVersionId to SDC
- JSONObject jsonResponse = callSDClientForRetry(queryDistributionDbResponse, queryServiceModelResponse, sdcStatus,
- distributionStatusRepository, modelStatusRepository);
+ JSONObject jsonResponse = callSDClientForRetry(queryDistributionDbResponse, queryServiceModelResponse, sdcStatus);
} else { // either RETRY & Count = 0, or 'ABORT', or 'SKIP'
@@ -168,13 +162,13 @@ public class ActivateVnfStatusOperationalEnvironment {
dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
modifiedStatus,
RETRY_COUNT_ZERO);
- modelStatusRepository.save(updateRetryCountZeroAndStatus);
+ client.save(updateRetryCountZeroAndStatus);
// should update 1 row, modified status
OperationalEnvDistributionStatus updateDistStatus =
dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
modifiedStatus,
errorReason);
- distributionStatusRepository.save(updateDistStatus);
+ client.save(updateDistStatus);
} else {
// RETRY & Count = 0 (do nothing!)
}
@@ -187,15 +181,11 @@ public class ActivateVnfStatusOperationalEnvironment {
* @param queryDistributionDbResponse - OperationalEnvDistributionStatus object
* @param queryServiceModelResponse - OperationalEnvServiceModelStatus object
* @param sdcStatus - Distribution object
- * @param distributionStatusRepository - OperationalEnvDistributionStatusRepository object
- * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
* @return JSONObject object
*/
public JSONObject callSDClientForRetry(OperationalEnvDistributionStatus queryDistributionDbResponse,
OperationalEnvServiceModelStatus queryServiceModelResponse,
- Distribution sdcStatus,
- OperationalEnvDistributionStatusRepository distributionStatusRepository,
- OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException {
+ Distribution sdcStatus) throws ApiException {
JSONObject jsonResponse = null;
@@ -218,7 +208,7 @@ public class ActivateVnfStatusOperationalEnvironment {
originalRequestId,
DISTRIBUTION_STATUS_SENT,
"");
- distributionStatusRepository.save(insertNewDistributionId);
+ client.save(insertNewDistributionId);
// update retryCount (less 1) for the serviceModelServiceId
retryCount = retryCount - 1;
@@ -227,14 +217,14 @@ public class ActivateVnfStatusOperationalEnvironment {
dbHelper.updateRetryCountAndStatusInOperationalEnvServiceModelStatus(queryServiceModelResponse,
DISTRIBUTION_STATUS_SENT,
retryCount);
- modelStatusRepository.save(updateRetryCountAndStatus);
+ client.save(updateRetryCountAndStatus);
// should update 1 row, OLD distributionId set to status error (ie, old distributionId is DONE!).
OperationalEnvDistributionStatus updateStatus =
dbHelper.updateStatusInOperationalEnvDistributionStatus(queryDistributionDbResponse,
DISTRIBUTION_STATUS_ERROR,
sdcStatus.getErrorReason());
- distributionStatusRepository.save(updateStatus);
+ client.save(updateStatus);
} else {
String dbErrorMessage = "Failure calling SDC: statusCode: " + statusCode +
"; messageId: " + jsonResponse.get("messageId") +
@@ -255,12 +245,11 @@ public class ActivateVnfStatusOperationalEnvironment {
* The Method to check the overall status of the Activation for an operationalEnvironmentId
* @param operationalEnvironmentId - string
* @param origRequestId - string
- * @param modelStatusRepository - OperationalEnvServiceModelStatusRepository object
* @return void - nothing
*/
- public void checkOrUpdateOverallStatus(String operationalEnvironmentId, String origRequestId, OperationalEnvServiceModelStatusRepository modelStatusRepository) throws ApiException{
+ public void checkOrUpdateOverallStatus(String operationalEnvironmentId, String origRequestId) throws ApiException{
- List<OperationalEnvServiceModelStatus> queryServiceModelResponseList = modelStatusRepository.findAllByOperationalEnvIdAndRequestId(operationalEnvironmentId, origRequestId);
+ List<OperationalEnvServiceModelStatus> queryServiceModelResponseList = client.getAllByOperationalEnvIdAndRequestId(operationalEnvironmentId, origRequestId);
String status = "Waiting";
int count = 0;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java
index edd1b1a10e..8fdb43f20c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/validation/ConfigurationParametersValidation.java
@@ -41,7 +41,7 @@ public class ConfigurationParametersValidation implements ValidationRule{
String requestScope = info.getRequestScope();
Actions action = info.getAction();
- if(requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut && configParams.isEmpty()){
+ if(configParams.isEmpty() && requestScope.equalsIgnoreCase(ModelType.vfModule.name()) && action == Action.scaleOut){
throw new ValidationException("configuration parameters");
}
return info;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java
index a63b778a1f..5932f6d206 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/E2EServiceInstancesTest.java
@@ -187,7 +187,7 @@ private final ObjectMapper mapper = new ObjectMapper();
OperationStatus status = new OperationStatus();
status.setOperationId("operationId");
status.setServiceId("9b9f02c0-298b-458a-bc9c-be3692e4f35e");
- stubFor(get(urlPathEqualTo("/operationStatusRepository/search/findOneByServiceIdAndOperationId"))
+ stubFor(get(urlPathEqualTo("/operationStatus/search/findOneByServiceIdAndOperationId"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(mapper.writeValueAsString(status))
.withStatus(HttpStatus.SC_OK)));
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 de7f560020..582bc12077 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
@@ -31,6 +31,7 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.exceptions.ValidationException;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
index 3c991ef0c5..c36eb2b063 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironmentTest.java
@@ -25,70 +25,81 @@ import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
-import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
import org.junit.Test;
+import org.junit.rules.ExpectedException;
import org.onap.so.apihandlerinfra.BaseTest;
+import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
import org.onap.so.apihandlerinfra.tenantisolation.helpers.AAIClientHelper;
-import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest;
-import org.onap.so.apihandlerinfra.tenantisolationbeans.RecoveryAction;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.RecoveryAction;
+import org.onap.so.apihandlerinfra.tenantisolationbeans.Manifest;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
-import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRepository;
-import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
- @Autowired
- private OperationalEnvDistributionStatusRepository distributionDbRepository;
- @Autowired
- private OperationalEnvServiceModelStatusRepository serviceModelDbRepository;
+ @Rule
+ public ExpectedException thrown = ExpectedException.none();
+
@Autowired
private ActivateVnfOperationalEnvironment activateVnf;
@Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
- @Autowired
private AAIClientHelper clientHelper;
- String requestId = "TEST_requestId";
- String operationalEnvironmentId = "EMOE-001";
- CloudOrchestrationRequest request = new CloudOrchestrationRequest();
- String workloadContext = "PVT";
+ private final String requestId = "TEST_requestId";
+ private final String operationalEnvironmentId = "1dfe7154-eae0-44f2-8e7a-8e5e7882e55d";
+ private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
+ private final String workloadContext = "PVT";
String recoveryActionRetry = "RETRY";
- String serviceModelVersionId = "TEST_serviceModelVersionId";
+ private final String serviceModelVersionId = "TEST_serviceModelVersionId";
int retryCount = 3;
- String sdcDistributionId = "TEST_distributionId";
- String statusSent = "SENT";
-
- @After
- public void after() throws Exception {
- distributionDbRepository.deleteAll();
- serviceModelDbRepository.deleteAll();
+ private final String sdcDistributionId = "TEST_distributionId";
+ private final String statusSent = "SENT";
+ private final ObjectMapper mapper = new ObjectMapper();
+
+ @Before
+ public void init(){
+ stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":3,\"workloadContext\":\"PVT\",\"createTime\":null,\"modifyTime\":null}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
+ .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestId\",\"distributionIdStatus\":\"SENT\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
}
+
@Test
- public void getAAIOperationalEnvironmentTest() throws Exception {
+ public void getAAIOperationalEnvironmentTest() {
- AAIOperationalEnvironment aaiOpEnv = null;
+ AAIOperationalEnvironment aaiOpEnv;
stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED)));
@@ -104,7 +115,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
@Test
public void executionTest() throws Exception {
- List<ServiceModelList> serviceModelVersionIdList = new ArrayList<ServiceModelList>();
+ List<ServiceModelList> serviceModelVersionIdList = new ArrayList<>();
ServiceModelList serviceModelList1 = new ServiceModelList();
serviceModelList1.setRecoveryAction(RecoveryAction.retry);
serviceModelList1.setServiceModelVersionId(serviceModelVersionId);
@@ -130,22 +141,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
-
-
- activateVnf.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
-
- // insert record, status sent
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusSent, distStatus.getDistributionIdStatus());
-
- // insert record, status sent
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(statusSent, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
-
+ activateVnf.execute(requestId, request);
}
@Test
@@ -159,7 +155,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
jsonObject.put("distributionId", distributionId);
// prepare request detail
- List<ServiceModelList> serviceModelVersionIdList = new ArrayList<ServiceModelList>();
+ List<ServiceModelList> serviceModelVersionIdList = new ArrayList<>();
ServiceModelList serviceModelList1 = new ServiceModelList();
serviceModelList1.setRecoveryAction(RecoveryAction.retry);
serviceModelList1.setServiceModelVersionId(serviceModelVersionId);
@@ -168,25 +164,11 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext,
- distributionDbRepository, serviceModelDbRepository);
-
- // insert record, status sent
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusSent, distStatus.getDistributionIdStatus());
-
- // insert record, status sent
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(statusSent, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
-
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
}
- @Test
- public void processActivateSDCRequestTest_409() throws Exception {
+ @Test
+ public void processActivateSDCRequestTest_409() throws ApiException, JsonProcessingException {
// ERROR in asdc
JSONObject jsonMessages = new JSONObject();
@@ -200,7 +182,7 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
jsonErrorResponse.put("requestError", jsonServException);
// prepare request detail
- List<ServiceModelList> serviceModelVersionIdList = new ArrayList<ServiceModelList>();
+ List<ServiceModelList> serviceModelVersionIdList = new ArrayList<>();
ServiceModelList serviceModelList1 = new ServiceModelList();
serviceModelList1.setRecoveryAction(RecoveryAction.retry);
serviceModelList1.setServiceModelVersionId(serviceModelVersionId);
@@ -209,30 +191,20 @@ public class ActivateVnfOperationalEnvironmentTest extends BaseTest{
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestId);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
-
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonErrorResponse.toString()).withStatus(HttpStatus.SC_CONFLICT)));
-
- try {
- activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext,
- distributionDbRepository, serviceModelDbRepository);
-
- } catch (Exception ex) {
-
- // insert record, status sent
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(statusSent, servStatus.getServiceModelVersionDistrStatus());
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestId);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("FAILURE"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("FAILED"));
-
- }
-
- infraActiveRequestsRepository.delete(requestId);
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("operationalEnvId\":\"1dfe7154-eae0-44f2-8e7a-8e5e7882e55d\""))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ thrown.expect(ValidateException.class);
+
+ activateVnf.processActivateSDCRequest(requestId, operationalEnvironmentId, serviceModelVersionIdList, workloadContext);
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
index 3dcac0da18..eba90496ba 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
@@ -21,22 +21,27 @@
package org.onap.so.apihandlerinfra.tenantisolation.process;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.get;
import static com.github.tomakehurst.wiremock.client.WireMock.post;
import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.containing;
import static org.hamcrest.Matchers.startsWith;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
-import org.junit.After;
-import org.junit.Ignore;
import org.junit.Rule;
+import org.junit.After;
import org.junit.Test;
+import org.junit.Ignore;
import org.junit.rules.ExpectedException;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.BaseTest;
@@ -54,13 +59,12 @@ import org.onap.so.db.request.data.repository.OperationalEnvDistributionStatusRe
import org.onap.so.db.request.data.repository.OperationalEnvServiceModelStatusRepository;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
@Autowired
- private OperationalEnvDistributionStatusRepository distributionDbRepository;
- @Autowired
- private OperationalEnvServiceModelStatusRepository serviceModelDbRepository;
- @Autowired
private ActivateVnfStatusOperationalEnvironment activateVnfStatus;
@Autowired
private InfraActiveRequestsRepository infraActiveRequestsRepository;
@@ -69,30 +73,26 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
@Rule
public ExpectedException thrown = ExpectedException.none();
- private String requestId = "TEST_requestId";
- private String requestIdOrig = "TEST_requestIdOrig";
- private String operationalEnvironmentId = "TEST_operationalEnvironmentId";
- private CloudOrchestrationRequest request = new CloudOrchestrationRequest();
- private String workloadContext = "TEST_workloadContext";
- private String recoveryActionRetry = "RETRY";
- private String recoveryActionAbort = "ABORT";
- private String recoveryActionSkip = "SKIP";
- private String serviceModelVersionId = "TEST_serviceModelVersionId";
- private String serviceModelVersionId1 = "TEST_serviceModelVersionId1";
- private int retryCountThree = 3;
- private int retryCountTwo = 2;
- private int retryCountZero = 0;
- private String sdcDistributionId = "TEST_distributionId";
- private String sdcDistributionId1 = "TEST_distributionId1";
- private String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString();
- private String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
- private String statusSent = "SENT";
-
- @After
- public void after() throws Exception {
- distributionDbRepository.deleteAll();
- serviceModelDbRepository.deleteAll();
- }
+ private final String requestId = "TEST_requestId";
+ private final String requestIdOrig = "TEST_requestIdOrig";
+ private final String operationalEnvironmentId = "TEST_operationalEnvironmentId";
+ private final CloudOrchestrationRequest request = new CloudOrchestrationRequest();
+ private final String workloadContext = "TEST_workloadContext";
+ private final String recoveryActionRetry = "RETRY";
+ private final String recoveryActionAbort = "ABORT";
+ private final String recoveryActionSkip = "SKIP";
+ private final String serviceModelVersionId = "TEST_serviceModelVersionId";
+ private final String serviceModelVersionId1 = "TEST_serviceModelVersionId1";
+ private final int retryCountThree = 3;
+ private final int retryCountTwo = 2;
+ private final int retryCountZero = 0;
+ private final String sdcDistributionId = "TEST_distributionId";
+ private final String sdcDistributionId1 = "TEST_distributionId1";
+ private final String statusOk = Status.DISTRIBUTION_COMPLETE_OK.toString();
+ private final String statusError = DistributionStatus.DISTRIBUTION_COMPLETE_ERROR.toString();
+ private final String statusSent = "SENT";
+
+ private final ObjectMapper mapper = new ObjectMapper();
@Test
public void checkOrUpdateOverallStatusTest_Ok() throws Exception {
@@ -106,7 +106,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
serviceModelDb.setRequestId(requestIdOrig);
serviceModelDb.setServiceModelVersionId(serviceModelVersionId1);
@@ -115,27 +114,27 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusOk);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
-
+
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
+
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
- activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig, serviceModelDbRepository);
+ activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig);
// overall is success
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESSFUL"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("COMPLETE"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
}
@Test
- public void checkOrUpdateOverallStatusTest_Error() throws Exception {
+ public void checkOrUpdateOverallStatusTest_Error() throws JsonProcessingException {
OperationalEnvServiceModelStatus serviceModelDb = new OperationalEnvServiceModelStatus();
serviceModelDb.setRequestId(requestIdOrig);
@@ -145,29 +144,28 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
+
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
try {
- activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig, serviceModelDbRepository);
+ activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig);
}catch(ApiException e){
assertThat(e.getMessage(), startsWith("Overall Activation process is a Failure. "));
assertEquals(e.getHttpResponseCode(), HttpStatus.SC_BAD_REQUEST);
assertEquals(e.getMessageID(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
}
- // overall is failure
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("FAILURE"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("FAILED"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
}
@Test
@@ -181,9 +179,12 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountTwo);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
- activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig, serviceModelDbRepository);
+ activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig);
// do nothing, waiting for more
assertNull(infraActiveRequestsRepository.findOne(requestIdOrig));
@@ -200,7 +201,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusSent);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -209,9 +209,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setDistributionIdStatus(statusSent);
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
- distributionDbRepository.saveAndFlush(distributionDb);
-
-
// prepare distribution obj
Distribution distribution = new Distribution();
@@ -223,32 +220,30 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
-
- activateVnfStatus.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
-
- // status ok
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusOk, distStatus.getDistributionIdStatus());
- assertEquals("", distStatus.getDistributionIdErrorReason());
-
- // status ok
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
- assertEquals(statusOk, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(new Integer(retryCountZero), servStatus.getRetryCount());
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESSFUL"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("COMPLETE"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(distributionDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"RETRY\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
+ .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ activateVnfStatus.execute(requestId, request);
}
@Test
@@ -262,7 +257,10 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -271,7 +269,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setDistributionIdStatus(statusError);
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
- distributionDbRepository.saveAndFlush(distributionDb);
+
@@ -291,37 +289,34 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(distributionDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
+ .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_ERROR\",\"distributionIdErrorReason\":\"Unable to process.\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
+ .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId1\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"SENT\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
- activateVnfStatus.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
-
- // old distributionId, status error
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusError, distStatus.getDistributionIdStatus());
- assertEquals("Unable to process.", distStatus.getDistributionIdErrorReason());
-
- // new distributionId, status sent
- OperationalEnvDistributionStatus newDistStatus = distributionDbRepository.findOne(sdcDistributionId1);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, newDistStatus.getOperationalEnvId());
- assertEquals(statusSent, newDistStatus.getDistributionIdStatus());
- assertEquals("", newDistStatus.getDistributionIdErrorReason());
-
- // count is less 1, status sent
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
- assertEquals(statusSent, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(new Integer(retryCountTwo), servStatus.getRetryCount());
-
- // no update
- assertNull(infraActiveRequestsRepository.findOne(requestIdOrig));
-
+ activateVnfStatus.execute(requestId, request);
}
@Test
- public void executionTest_ERROR_Status_And_RETRY_And_RetryZero() throws Exception {
+ public void executionTest_ERROR_Status_And_RETRY_And_RetryZero() throws JsonProcessingException {
OperationalEnvServiceModelStatus serviceModelDb = new OperationalEnvServiceModelStatus();
serviceModelDb.setRequestId(requestIdOrig);
@@ -331,7 +326,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountZero);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -340,7 +334,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setDistributionIdStatus(statusError);
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
- distributionDbRepository.saveAndFlush(distributionDb);
@@ -359,44 +352,41 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
+
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(distributionDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
+ stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"SENT\",\"recoveryAction\":\"RETRY\",\"retryCount\":2,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
try {
- activateVnfStatus.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
+ activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
assertThat(e.getMessage(), startsWith("Overall Activation process is a Failure. "));
assertEquals(e.getHttpResponseCode(), HttpStatus.SC_BAD_REQUEST);
assertEquals(e.getMessageID(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
}
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusError, distStatus.getDistributionIdStatus());
- assertEquals(null, distStatus.getDistributionIdErrorReason());
-
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
- assertEquals(statusError, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(new Integer(retryCountZero), servStatus.getRetryCount());
-
- // Retry count is zero, no more retry. all retry failed.
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("FAILURE"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("FAILED"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
}
@Test
- public void executionTest_ERROR_Status_And_RETRY_And_ErrorSdc() throws Exception {
+ public void executionTest_ERROR_Status_And_RETRY_And_ErrorSdc() throws JsonProcessingException {
OperationalEnvServiceModelStatus serviceModelDb = new OperationalEnvServiceModelStatus();
serviceModelDb.setRequestId(requestIdOrig);
@@ -406,7 +396,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -415,7 +404,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setDistributionIdStatus(statusError);
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
- distributionDbRepository.saveAndFlush(distributionDb);
@@ -441,41 +429,33 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(distributionDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("operationalEnvId\":\"TEST_operationalEnvironmentId\""))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonMessages.toString()).withStatus(HttpStatus.SC_CONFLICT)));
try {
- activateVnfStatus.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
+ activateVnfStatus.execute(requestId, request);
}catch(ApiException e){
assertThat(e.getMessage(), startsWith("Failure calling SDC: statusCode: "));
assertEquals(e.getHttpResponseCode(), HttpStatus.SC_BAD_REQUEST);
assertEquals(e.getMessageID(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
}
- // status as-is / no changes
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusError, distStatus.getDistributionIdStatus());
- assertEquals(null, distStatus.getDistributionIdErrorReason());
-
- // status as-is / no changes
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
- assertEquals(statusError, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(new Integer(retryCountThree), servStatus.getRetryCount());
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("FAILURE"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("FAILED"));
- assertTrue(infraActiveRequest.getStatusMessage().contains("Undefined Error Message!"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
-
}
@Test
@@ -489,8 +469,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
-
+
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
distributionDb.setRequestId(requestIdOrig);
@@ -498,36 +477,48 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setDistributionIdStatus(statusError);
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
- distributionDbRepository.saveAndFlush(distributionDb);
-
-
// prepare distribution obj
+ OperationalEnvDistributionStatus distributionStatus = new OperationalEnvDistributionStatus(sdcDistributionId,operationalEnvironmentId,serviceModelVersionId);
+ distributionStatus.setDistributionIdStatus(Status.DISTRIBUTION_COMPLETE_ERROR.name());
+
Distribution distribution = new Distribution();
distribution.setStatus(Status.DISTRIBUTION_COMPLETE_ERROR);
request.setDistribution(distribution);
request.setDistributionId(sdcDistributionId);
request.setOperationalEnvironmentId(operationalEnvironmentId);
-
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
- activateVnfStatus.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(distributionDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
+ .withRequestBody(equalTo("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"recoveryAction\":\"SKIP\",\"retryCount\":0,\"workloadContext\":\"TEST_workloadContext\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
+ .withRequestBody(equalTo("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_OK\",\"distributionIdErrorReason\":\"\",\"createTime\":null,\"modifyTime\":null,\"handler\":{}}"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ activateVnfStatus.execute(requestId, request);
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESSFUL"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("COMPLETE"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
-
}
@Test
- public void executionTest_ERROR_Status_And_ABORT() throws Exception {
+ public void executionTest_ERROR_Status_And_ABORT() throws JsonProcessingException {
OperationalEnvServiceModelStatus serviceModelDb = new OperationalEnvServiceModelStatus();
serviceModelDb.setRequestId(requestIdOrig);
@@ -537,7 +528,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
serviceModelDb.setOperationalEnvId(operationalEnvironmentId);
serviceModelDb.setRetryCount(retryCountThree);
serviceModelDb.setServiceModelVersionDistrStatus(statusError);
- serviceModelDbRepository.saveAndFlush(serviceModelDb);
OperationalEnvDistributionStatus distributionDb = new OperationalEnvDistributionStatus();
distributionDb.setDistributionId(sdcDistributionId);
@@ -546,7 +536,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
distributionDb.setDistributionIdStatus(statusError);
distributionDb.setServiceModelVersionId(serviceModelVersionId);
distributionDb.setDistributionIdErrorReason(null);
- distributionDbRepository.saveAndFlush(distributionDb);
@@ -560,23 +549,36 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
InfraActiveRequests iar = new InfraActiveRequests();
iar.setRequestId(requestIdOrig);
iar.setRequestStatus("PENDING");
- infraActiveRequestsRepository.saveAndFlush(iar);
+ stubFor(get(urlPathEqualTo("/operationalEnvServiceModelStatus/search/findOneByOperationalEnvIdAndServiceModelVersionId"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(serviceModelDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/operationalEnvDistributionStatus/"+sdcDistributionId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(distributionDb))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestIdOrig))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/operationalEnvDistributionStatus/"))
+ .withRequestBody(containing("{\"distributionId\":\"TEST_distributionId\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"requestId\":\"TEST_requestIdOrig\",\"distributionIdStatus\":\"DISTRIBUTION_COMPLETE_ERROR\""))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(post(urlPathEqualTo("/operationalEnvServiceModelStatus/"))
+ .withRequestBody(containing("{\"requestId\":\"TEST_requestIdOrig\",\"operationalEnvId\":\"TEST_operationalEnvironmentId\",\"serviceModelVersionId\":\"TEST_serviceModelVersionId\",\"serviceModelVersionDistrStatus\":\"DISTRIBUTION_COMPLETE_ERROR\""))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
try {
- activateVnfStatus.execute(requestId, request, distributionDbRepository, serviceModelDbRepository);
- }catch(ApiException e){
- assertThat(e.getMessage(), startsWith("Overall Activation process is a Failure. "));
- assertEquals(e.getHttpResponseCode(), HttpStatus.SC_BAD_REQUEST);
- assertEquals(e.getMessageID(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
- }
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestIdOrig);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("FAILURE"));
- assertTrue(infraActiveRequest.getRequestStatus().contains("FAILED"));
-
- // cleanup
- infraActiveRequestsRepository.delete(requestIdOrig);
+ activateVnfStatus.execute(requestId, request);
+ }catch(ApiException e) {
+ assertThat(e.getMessage(), startsWith("Overall Activation process is a Failure. "));
+ assertEquals(e.getHttpResponseCode(), HttpStatus.SC_BAD_REQUEST);
+ assertEquals(e.getMessageID(), ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
+ }
}
@@ -617,24 +619,11 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
stubFor(post(urlPathMatching("/sdc/v1/catalog/services/TEST_serviceModelVersionId/distr.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBody(jsonObject.toString()).withStatus(HttpStatus.SC_ACCEPTED)));
- JSONObject jsonResponse = activateVnfStatus.callSDClientForRetry(distributionDb, serviceModelDb, distribution,
- distributionDbRepository, serviceModelDbRepository);
+ JSONObject jsonResponse = activateVnfStatus.callSDClientForRetry(distributionDb, serviceModelDb, distribution);
assertEquals("TEST_distributionId1", jsonResponse.get("distributionId"));
assertEquals("Success", jsonResponse.get("message"));
assertEquals("202", jsonResponse.get("statusCode"));
- // insert new record, status sent
- OperationalEnvDistributionStatus distStatus = distributionDbRepository.findOne(sdcDistributionId1);
- assertNotNull(distStatus);
- assertEquals(operationalEnvironmentId, distStatus.getOperationalEnvId());
- assertEquals(statusSent, distStatus.getDistributionIdStatus());
-
- // insert new record, status sent
- OperationalEnvServiceModelStatus servStatus = serviceModelDbRepository.findOneByOperationalEnvIdAndServiceModelVersionId(operationalEnvironmentId, serviceModelVersionId);
- assertNotNull(servStatus);
- assertEquals(statusSent, servStatus.getServiceModelVersionDistrStatus());
- assertEquals(operationalEnvironmentId, servStatus.getOperationalEnvId());
-
- }
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
index d64cf6106a..0ace9d5445 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateEcompOperationalEnvironmentTest.java
@@ -20,16 +20,12 @@
package org.onap.so.apihandlerinfra.tenantisolation.process;
-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.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertThat;
-import static org.junit.Assert.assertTrue;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
import org.junit.Test;
import org.onap.so.apihandler.common.ErrorNumbers;
@@ -44,19 +40,20 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestParameters;
import org.onap.so.client.aai.AAIVersion;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
public class CreateEcompOperationalEnvironmentTest extends BaseTest{
@Autowired
private CreateEcompOperationalEnvironment createEcompOpEn;
- @Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
-
+ private final ObjectMapper mapper = new ObjectMapper();
+
public CloudOrchestrationRequest getCloudOrchestrationRequest() {
CloudOrchestrationRequest request = new CloudOrchestrationRequest();
RequestDetails reqDetails = new RequestDetails();
@@ -75,7 +72,7 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{
}
@Test
- public void testProcess() throws ApiException {
+ public void testProcess() throws ApiException, JsonProcessingException {
stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/events/.*"))
@@ -87,18 +84,20 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{
iar.setRequestScope("create");
iar.setRequestStatus("PENDING");
iar.setRequestAction("UNKNOWN");
- infraActiveRequestsRepository.saveAndFlush(iar);
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/123"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL, operationalEnvironmentId - operationalEnvId; Success Message: SUCCESSFULLY Created ECOMP OperationalEnvironment.\",\"progress\":100"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
createEcompOpEn.execute("123", getCloudOrchestrationRequest());
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOneByRequestId("123");
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESS"));
- assertTrue(infraActiveRequest.getRequestStatus().equals("COMPLETE"));
}
@Test
- public void testProcessException() {
+ public void testProcessException() throws JsonProcessingException {
stubFor(put(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/events/.*"))
@@ -113,18 +112,20 @@ public class CreateEcompOperationalEnvironmentTest extends BaseTest{
iar.setRequestScope("create");
iar.setRequestStatus("PENDING");
iar.setRequestAction("UNKNOWN");
- infraActiveRequestsRepository.saveAndFlush(iar);
-
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/123"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("{\"requestId\":\"123\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE, operationalEnvironmentId - operationalEnvId; Error message: empty"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
try {
createEcompOpEn.execute("123", getCloudOrchestrationRequest());
}catch(ApiException e){
assertThat(e, sameBeanAs((ApiException) expectedException).ignoring("cause"));
}
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOneByRequestId("123");
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("FAILURE"));
- assertTrue(infraActiveRequest.getRequestStatus().equals("FAILED"));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
index 8fe40f31a4..1dfafce40c 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
@@ -20,21 +20,15 @@
package org.onap.so.apihandlerinfra.tenantisolation.process;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
import java.io.File;
import java.nio.file.Files;
import java.util.List;
import java.util.UUID;
+import com.fasterxml.jackson.core.JsonProcessingException;
import org.apache.http.HttpStatus;
import org.junit.Before;
import org.junit.Test;
@@ -51,6 +45,9 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.fasterxml.jackson.databind.ObjectMapper;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
public class CreateVnfOperationalEnvironmentTest extends BaseTest{
@@ -59,9 +56,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
@Autowired
private CreateVnfOperationalEnvironment createVnfOpEnv;
- @Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
-
+
@Before
public void testSetUp() throws Exception {
ObjectMapper mapper = new ObjectMapper();
@@ -70,7 +65,6 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
String jsonServiceEndpoints = getFileContentsAsString("__files/vnfoperenv/endpoints.json");
serviceEndpoints = mapper.readValue(jsonServiceEndpoints, ServiceEndPointList.class);
}
-
@Test
public void testGetEcompManagingEnvironmentId() throws Exception {
createVnfOpEnv.setRequest(request);
@@ -84,7 +78,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
}
@Test
- public void testGetEnvironmentName() throws Exception {
+ public void testGetEnvironmentName() {
createVnfOpEnv.setRequest(request);
List<Property> props = serviceEndpoints.getServiceEndPointList().get(0).getProperties();
assertEquals("DEV", createVnfOpEnv.getEnvironmentName(props));
@@ -120,7 +114,7 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
}
@Test
- public void testExecute() throws ApiException{
+ public void testExecute() throws ApiException, JsonProcessingException {
stubFor(get(urlPathMatching("/aai/" + AAIVersion.LATEST + "/cloud-infrastructure/operational-environments/.*"))
.willReturn(aResponse().withHeader("Content-Type", "application/json").withBodyFile("vnfoperenv/ecompOperationalEnvironment.json").withStatus(HttpStatus.SC_ACCEPTED)));
stubFor(post(urlPathMatching("/GRMLWPService/v1/serviceEndPoint/findRunning"))
@@ -136,11 +130,16 @@ public class CreateVnfOperationalEnvironmentTest extends BaseTest{
iar.setRequestScope("create");
iar.setRequestStatus("PENDING");
iar.setRequestAction("UNKNOWN");
- infraActiveRequestsRepository.saveAndFlush(iar);
+ ObjectMapper mapper = new ObjectMapper();
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
createVnfOpEnv.execute(requestId, request);
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestId);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESS"));
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
index a9be10c3f4..5b0e1f6bfd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
@@ -20,19 +20,14 @@
package org.onap.so.apihandlerinfra.tenantisolation.process;
-import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
-import static com.github.tomakehurst.wiremock.client.WireMock.get;
-import static com.github.tomakehurst.wiremock.client.WireMock.post;
-import static com.github.tomakehurst.wiremock.client.WireMock.put;
-import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
-import static com.github.tomakehurst.wiremock.client.WireMock.urlPathMatching;
+import static com.github.tomakehurst.wiremock.client.WireMock.*;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.startsWith;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
@@ -45,6 +40,9 @@ import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.springframework.beans.factory.annotation.Autowired;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+
public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{
@Rule
@@ -52,13 +50,20 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{
@Autowired
private DeactivateVnfOperationalEnvironment deactivate;
- @Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
-
+
private CloudOrchestrationRequest request = new CloudOrchestrationRequest();
private String operationalEnvironmentId = "ff3514e3-5a33-55df-13ab-12abad84e7ff";
private String requestId = "ff3514e3-5a33-55df-13ab-12abad84e7fe";
+ private ObjectMapper mapper = new ObjectMapper();
+
+ @Before
+ public void init(){
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"COMPLETE\",\"statusMessage\":\"SUCCESSFUL"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+ }
@Test
public void testDeactivateOperationalEnvironment() throws Exception {
request.setOperationalEnvironmentId(operationalEnvironmentId);
@@ -79,14 +84,11 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{
iar.setRequestScope("create");
iar.setRequestStatus("PENDING");
iar.setRequestAction("UNKNOWN");
- infraActiveRequestsRepository.saveAndFlush(iar);
-
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
deactivate.execute(requestId, request);
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestId);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESSFUL"));
-
}
@Test
@@ -110,8 +112,15 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{
iar.setRequestScope("create");
iar.setRequestStatus("PENDING");
iar.setRequestAction("UNKNOWN");
- infraActiveRequestsRepository.saveAndFlush(iar);
-
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
+ stubFor(post(urlPathEqualTo("/infraActiveRequests/"))
+ .withRequestBody(containing("{\"requestId\":\""+ requestId+"\",\"clientRequestId\":null,\"action\":null,\"requestStatus\":\"FAILED\",\"statusMessage\":\"FAILURE"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withStatus(HttpStatus.SC_OK)));
+
deactivate.execute(requestId, request);
}
@@ -131,13 +140,12 @@ public class DeactivateVnfOperationalEnvironmentTest extends BaseTest{
iar.setRequestScope("create");
iar.setRequestStatus("PENDING");
iar.setRequestAction("UNKNOWN");
- infraActiveRequestsRepository.saveAndFlush(iar);
+ stubFor(get(urlPathEqualTo("/infraActiveRequests/"+requestId))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(mapper.writeValueAsString(iar))
+ .withStatus(HttpStatus.SC_OK)));
deactivate.execute(requestId, request);
-
- InfraActiveRequests infraActiveRequest = infraActiveRequestsRepository.findOne(requestId);
- assertNotNull(infraActiveRequest);
- assertTrue(infraActiveRequest.getStatusMessage().contains("SUCCESS"));
}
@Test
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
index f3e92ed16a..603f9bb494 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ArchivedInfraRequestsRepository.java
@@ -22,9 +22,10 @@ package org.onap.so.db.request.data.repository;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "archivedInfraRequests", path = "archivedInfraRequests")
public interface ArchivedInfraRequestsRepository extends JpaRepository<ArchivedInfraRequests, String> {
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
index 22a1604bdd..16e10e3d5b 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationStatusRepository.java
@@ -26,7 +26,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
-@RepositoryRestResource(collectionResourceRel = "operationStatusRepository", path = "operationStatusRepository")
+@RepositoryRestResource(collectionResourceRel = "operationStatus", path = "operationStatus")
public interface OperationStatusRepository extends JpaRepository<OperationStatus, OperationStatusId> {
OperationStatus findOneByServiceIdAndOperationId(@Param("SERVICE_ID") String serviceId, @Param("OPERATION_ID") String operationId);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
index 799e5ad147..e89755d565 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvDistributionStatusRepository.java
@@ -25,10 +25,10 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.transaction.annotation.Transactional;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "operationalEnvDistributionStatus", path = "operationalEnvDistributionStatus")
public interface OperationalEnvDistributionStatusRepository extends JpaRepository<OperationalEnvDistributionStatus, String> {
@Modifying
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
index ee2baedf61..bcad9ce6d5 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/OperationalEnvServiceModelStatusRepository.java
@@ -28,32 +28,16 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;
-import org.springframework.stereotype.Repository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.transaction.annotation.Transactional;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "operationalEnvServiceModelStatus", path = "operationalEnvServiceModelStatus")
public interface OperationalEnvServiceModelStatusRepository extends JpaRepository<OperationalEnvServiceModelStatus, OperationalEnvServiceModelStatusId>{
public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
- public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(String operationalEnvId, String requestId);
- public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvId, String serviceModelVersionId);
+ public List<OperationalEnvServiceModelStatus> findAllByOperationalEnvIdAndRequestId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
+ @Param("REQUEST_ID") String requestId);
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(@Param("OPERATIONAL_ENV_ID") String operationalEnvId,
+ @Param("SERVICE_MODEL_VERSION_ID") String serviceModelVersionId);
- @Modifying
- @Transactional
- @Query("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount where "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId")
- public int setServiceModelVersionDistrStatusAndRetryCountFor(@Param("asdcStatus") String serviceModelVersionDistrStatus,
- @Param("retryCount") int retryCount,
- @Param("operationalEnvId") String operationalEnvId,
- @Param("serviceModelVersionId") String serviceModelVersionId);
-
- @Modifying
- @Transactional
- @Query("update OperationalEnvServiceModelStatus set serviceModelVersionDistrStatus = :asdcStatus, retryCount = :retryCount where "
- + "operationalEnvId = :operationalEnvId and serviceModelVersionId = :serviceModelVersionId and requestId = :requestId")
- public int setServiceModelVersionDistrStatusAndRetryCountFor(@Param("asdcStatus") String serviceModelVersionDistrStatus,
- @Param("retryCount") int retryCount,
- @Param("operationalEnvId") String operationalEnvId,
- @Param("serviceModelVersionId") String serviceModelVersionId,
- @Param("requestId") String requestId);
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
index 2d77f7589e..b93bf7840b 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/ResourceOperationStatusRepository.java
@@ -25,9 +25,10 @@ import java.util.List;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatusId;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "resourceOperationStatus", path = "resourceOperationStatus")
public interface ResourceOperationStatusRepository extends JpaRepository<ResourceOperationStatus, ResourceOperationStatusId> {
List<ResourceOperationStatus> findByServiceIdAndOperationId(String serviceId, String operationId);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
index 11923512a5..179d40ad23 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/SiteStatusRepository.java
@@ -22,9 +22,10 @@ package org.onap.so.db.request.data.repository;
import org.onap.so.db.request.beans.SiteStatus;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "siteStatus", path = "siteStatus")
public interface SiteStatusRepository extends JpaRepository<SiteStatus, String> {
SiteStatus findOneBySiteName(String siteName);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
index 8310d79a5b..138ec0fb4d 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogComponentDistributionStatusRepository.java
@@ -25,9 +25,10 @@ import java.util.List;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatusId;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "watchdogComponentDistributionStatus", path = "watchdogComponentDistributionStatus")
public interface WatchdogComponentDistributionStatusRepository extends JpaRepository<WatchdogComponentDistributionStatus, WatchdogComponentDistributionStatusId> {
public List<WatchdogComponentDistributionStatus> findByDistributionId(String distributionId);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
index 6e37181380..fde8485e6d 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogDistributionStatusRepository.java
@@ -22,9 +22,10 @@ package org.onap.so.db.request.data.repository;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "watchdogDistributionStatus", path = "watchdogDistributionStatus")
public interface WatchdogDistributionStatusRepository extends JpaRepository<WatchdogDistributionStatus, String> {
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
index b83481b88b..b9585d495e 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/WatchdogServiceModVerIdLookupRepository.java
@@ -23,9 +23,10 @@ package org.onap.so.db.request.data.repository;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookupId;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import org.springframework.stereotype.Repository;
-@Repository
+@RepositoryRestResource(collectionResourceRel = "watchdogServiceModVerIdLookup", path = "watchdogServiceModVerIdLookup")
public interface WatchdogServiceModVerIdLookupRepository extends JpaRepository<WatchdogServiceModVerIdLookup, WatchdogServiceModVerIdLookupId> {
public WatchdogServiceModVerIdLookup findOneByDistributionId(String distributionId);
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java
index 6eb00ea1e9..562e54ca6e 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java
@@ -23,8 +23,8 @@ package org.onap.so.requestsdb;
import java.sql.Timestamp;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.logger.MsoLogger;
+import org.onap.so.requestsdb.client.RequestsDbClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -37,7 +37,7 @@ public class RequestsDBHelper {
private String methodName = "";
private String classMethodMessage = "";
@Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
+ private RequestsDbClient requestsDbClient;
/**
* This util method is to update the InfraRequest table to Complete
* @param msg - string, unique message for each caller
@@ -51,7 +51,7 @@ public class RequestsDBHelper {
classMethodMessage = className + " " + methodName;
msoLogger.debug("Begin of " + classMethodMessage);
- InfraActiveRequests request = infraActiveRequestsRepository.findOneByRequestId(requestId);
+ InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
request.setRequestStatus("COMPLETE");
request.setStatusMessage("SUCCESSFUL, operationalEnvironmentId - " + operationalEnvironmentId + "; Success Message: " + msg);
@@ -66,7 +66,7 @@ public class RequestsDBHelper {
}
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
request.setEndTime(endTimeStamp);
- infraActiveRequestsRepository.save(request);
+ requestsDbClient.save(request);
msoLogger.debug("End of " + classMethodMessage);
@@ -85,7 +85,7 @@ public class RequestsDBHelper {
classMethodMessage = className + " " + methodName;
msoLogger.debug("Begin of " + classMethodMessage);
- InfraActiveRequests request = infraActiveRequestsRepository.findOneByRequestId(requestId);
+ InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
request.setRequestStatus("FAILED");
request.setStatusMessage("FAILURE, operationalEnvironmentId - " + operationalEnvironmentId + "; Error message: " + msg);
request.setProgress(100L);
@@ -99,7 +99,7 @@ public class RequestsDBHelper {
}
Timestamp endTimeStamp = new Timestamp(System.currentTimeMillis());
request.setEndTime(endTimeStamp);
- infraActiveRequestsRepository.save(request);
+ requestsDbClient.save(request);
msoLogger.debug("End of " + classMethodMessage);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java
index 380ee2c6ad..8e291aa15b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java
@@ -18,11 +18,19 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.apihandlerinfra;
+package org.onap.so.requestsdb.client;
import org.apache.http.HttpStatus;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.beans.OperationalEnvDistributionStatus;
import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.beans.OperationalEnvServiceModelStatus;
+import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
+import org.onap.so.db.request.beans.ArchivedInfraRequests;
+import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
+import org.onap.so.db.request.beans.WatchdogDistributionStatus;
+import org.onap.so.db.request.beans.SiteStatus;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
@@ -42,18 +50,25 @@ import uk.co.blackpepper.bowman.Configuration;
import javax.annotation.PostConstruct;
import javax.ws.rs.core.UriBuilder;
import java.net.URI;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
-@Component("RequestDbClient")
+@Component
public class RequestsDbClient {
private static final String SERVICE_ID = "SERVICE_ID";
private static final String OPERATION_ID = "OPERATION_ID";
-
- private Client<InfraActiveRequests> infraActiveRequestClient;
- private Client<OperationStatus> operationStatusClient;
+ private static final String OPERATIONAL_ENVIRONMENT_ID = "OPERATIONAL_ENVIRONMENT_ID";
+ private static final String SERVICE_MODEL_VERSION_ID = "SERVICE_MODEL_VERSION_ID";
+ private static final String REQUEST_ID = "REQUEST_ID";
+
+ private final Client<InfraActiveRequests> infraActiveRequestClient;
+ private final Client<OperationStatus> operationStatusClient;
+ private final Client<OperationalEnvDistributionStatus> distributionStatusClient;
+ private final Client<OperationalEnvServiceModelStatus> serviceModelStatusClient;
@Value("${mso.adapters.requestDb.endpoint}")
private String endpoint;
@@ -62,7 +77,8 @@ public class RequestsDbClient {
private String msoAdaptersAuth;
private String getOrchestrationFilterURI = "/infraActiveRequests/getOrchestrationFiltersFromInfraActive/";
- private static final String OPERATION_STATUS_REPOSITORY_SEARCH = "/operationStatusRepository/search";
+ private static final String OPERATION_STATUS_SEARCH = "/operationStatus/search";
+ private static final String OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH = "/operationalEnvServiceModelStatus/search";
private String checkVnfIdStatus = "/infraActiveRequests/checkVnfIdStatus/";
@@ -71,13 +87,22 @@ public class RequestsDbClient {
private String checkInstanceNameDuplicate = "/infraActiveRequests/checkInstanceNameDuplicate";
private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId";
+
+ private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/";
private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive";
+ private String findOneByOperationalEnvIdAndServiceModelVersionIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionId";
+
+ private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId";
+
private HttpHeaders headers;
@Autowired
private RestTemplate restTemplate;
+ @Autowired
+ ClassURLMapper classURLMapper;
+
@PostConstruct
public void init() {
@@ -86,7 +111,10 @@ public class RequestsDbClient {
checkVnfIdStatus = endpoint + checkVnfIdStatus;
checkInstanceNameDuplicate = endpoint + checkInstanceNameDuplicate;
cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive;
- findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_REPOSITORY_SEARCH + findOneByServiceIdAndOperationIdURI;
+ findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI;
+ operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI;
+ findOneByOperationalEnvIdAndServiceModelVersionIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdURI;
+ findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
headers = new HttpHeaders();
headers.set("Authorization", msoAdaptersAuth);
}
@@ -98,7 +126,8 @@ public class RequestsDbClient {
})).build().buildClientFactory();
infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class);
operationStatusClient = clientFactory.create(OperationStatus.class);
-
+ distributionStatusClient = clientFactory.create(OperationalEnvDistributionStatus.class);
+ serviceModelStatusClient = clientFactory.create(OperationalEnvServiceModelStatus.class);
}
public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){
URI uri = getUri(cloudOrchestrationFiltersFromInfraActive);
@@ -147,13 +176,53 @@ public class RequestsDbClient {
.build());
}
+ public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvironmentId, String serviceModelVersionId) {
+ return this.getSingleOperationalEnvServiceModelStatus(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI)
+ .queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId)
+ .queryParam(SERVICE_MODEL_VERSION_ID,serviceModelVersionId)
+ .build());
+ }
+
+ public List<OperationalEnvServiceModelStatus> getAllByOperationalEnvIdAndRequestId(String operationalEnvironmentId, String requestId){
+ return this.getMultipleOperationalEnvServiceModelStatus(UriBuilder.fromUri(findAllByOperationalEnvIdAndRequestIdURI)
+ .queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId)
+ .queryParam(REQUEST_ID,requestId)
+ .build());
+ }
+
+ public OperationalEnvDistributionStatus getDistributionStatusById(String distributionId){
+ return this.getSingleOperationalEnvDistributionStatus(UriBuilder.fromUri(operationalEnvDistributionStatusURI+distributionId).build());
+ }
+
+ private OperationalEnvServiceModelStatus getSingleOperationalEnvServiceModelStatus(URI uri){
+ return serviceModelStatusClient.get(uri);
+ }
+
+ private List<OperationalEnvServiceModelStatus> getMultipleOperationalEnvServiceModelStatus(URI uri){
+ Iterable <OperationalEnvServiceModelStatus> iterable = serviceModelStatusClient.getAll(uri);
+ List<OperationalEnvServiceModelStatus> serviceModelStatuses = new ArrayList<>();
+ Iterator<OperationalEnvServiceModelStatus> statusIterator = iterable.iterator();
+ statusIterator.forEachRemaining(serviceModelStatuses::add);
+ return serviceModelStatuses;
+ }
+
public void save(InfraActiveRequests infraActiveRequests) {
URI uri = getUri(infraActiveRequestURI);
HttpEntity<InfraActiveRequests> entity = new HttpEntity<>(infraActiveRequests, headers);
restTemplate.postForLocation(uri, entity);
}
+
+ public <T> void save(T object){
+ URI uri = getUri(endpoint+classURLMapper.getURI(object.getClass()));
+ HttpEntity<T> entity = new HttpEntity<>(object, headers);
+ restTemplate.postForLocation(uri, entity);
+ }
+
+ private OperationalEnvDistributionStatus getSingleOperationalEnvDistributionStatus(URI uri){
+ return distributionStatusClient.get(uri);
+ }
- protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) {
+ private InfraActiveRequests getSingleInfraActiveRequests(URI uri) {
return infraActiveRequestClient.get(uri);
}
@@ -161,11 +230,11 @@ public class RequestsDbClient {
infraActiveRequestClient.put(request);
}
- public OperationStatus getSingleOperationStatus(URI uri){
+ private OperationStatus getSingleOperationStatus(URI uri){
return operationStatusClient.get(uri);
}
- protected URI getUri(String uri) {
+ private URI getUri(String uri) {
return URI.create(uri);
}
@@ -173,4 +242,31 @@ public class RequestsDbClient {
public RestTemplate restTemplate() {
return new RestTemplate( new HttpComponentsClientHttpRequestFactory());
}
+
+ @Component
+ static class ClassURLMapper {
+ private static final Map <Class,String> classURLMap = new HashMap<>();
+
+ ClassURLMapper() {
+ classURLMap.put(ArchivedInfraRequests.class,"/archivedInfraRequests/");
+ classURLMap.put(InfraActiveRequests.class,"/infraActiveRequests/");
+ classURLMap.put(OperationalEnvDistributionStatus.class,"/operationalEnvDistributionStatus/");
+ classURLMap.put(OperationalEnvServiceModelStatus.class,"/operationalEnvServiceModelStatus/");
+ classURLMap.put(OperationStatus.class,"/operationStatus/");
+ classURLMap.put(ResourceOperationStatus.class,"/resourceOperationStatus/");
+ classURLMap.put(SiteStatus.class,"/siteStatus/");
+ classURLMap.put(WatchdogComponentDistributionStatus.class,"/watchdogComponentDistributionStatus/");
+ classURLMap.put(WatchdogDistributionStatus.class,"/watchdogDistributionStatus/");
+ classURLMap.put(WatchdogServiceModVerIdLookup.class,"/watchdogServiceModVerIdLookup/");
+ }
+
+ <T> String getURI(Class<T> className) {
+ Class actualClass = classURLMap.keySet()
+ .stream()
+ .filter(requestdbClass -> requestdbClass.isAssignableFrom(className))
+ .findFirst()
+ .get();
+ return classURLMap.get(actualClass);
+ }
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml b/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml
index c8e90c3d8b..62ae4794f5 100644
--- a/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml
+++ b/mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml
@@ -6,6 +6,10 @@ server:
max-threads: 50
ssl-enable: false
mso:
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
site-name: localDevEnv
logPath: logs
# H2
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
new file mode 100644
index 0000000000..de0dd39edc
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReference.java
@@ -0,0 +1,106 @@
+package org.onap.so.db.catalog.beans;
+/*-
+ * ============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=========================================================
+ */
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.Table;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+@IdClass(ControllerSelectionReferenceId.class)
+@Entity
+@Table(name = "CONTROLLER_SELECTION_REFERENCE")
+public class ControllerSelectionReference implements Serializable {
+
+ private static final long serialVersionUID = -608098800737567188L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "VNF_TYPE")
+ private String vnfType;
+
+ @BusinessKey
+ @Id
+ @Column(name = "CONTROLLER_NAME")
+ private String controllerName;
+
+ @BusinessKey
+ @Id
+ @Column(name = "ACTION_CATEGORY")
+ private String actionCategory;
+
+
+ public String getVnfType() {
+ return vnfType;
+ }
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+ public String getControllerName() {
+ return controllerName;
+ }
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+ public String getActionCategory() {
+ return actionCategory;
+ }
+ public void setActionCategory(String actionCategory) {
+ this.actionCategory = actionCategory;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vnfType", vnfType).append("controllerName", controllerName)
+ .append("actionCategory", actionCategory).toString();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof ControllerSelectionReference)) {
+ return false;
+ }
+ ControllerSelectionReference castOther = (ControllerSelectionReference) other;
+ return new EqualsBuilder().append(vnfType, castOther.vnfType).append(controllerName, castOther.controllerName)
+ .append(actionCategory, castOther.actionCategory).isEquals();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfType).append(controllerName).append(actionCategory).toHashCode();
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java
new file mode 100644
index 0000000000..e6ee349be6
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ControllerSelectionReferenceId.java
@@ -0,0 +1,83 @@
+/*-
+ * ============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.db.catalog.beans;
+
+import java.io.Serializable;
+
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+
+
+public class ControllerSelectionReferenceId implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+ @BusinessKey
+ private String vnfType;
+ @BusinessKey
+ private String controllerName;
+ @BusinessKey
+ private String actionCategory;
+
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof ControllerSelectionReferenceId)) {
+ return false;
+ }
+ ControllerSelectionReferenceId castOther = (ControllerSelectionReferenceId) other;
+ return new EqualsBuilder().append(vnfType, castOther.vnfType).append(controllerName, castOther.controllerName)
+ .append(actionCategory, castOther.actionCategory).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(vnfType).append(controllerName).append(actionCategory).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("vnfType", vnfType).append("controllerName", controllerName)
+ .append("actionCategory", actionCategory).toString();
+ }
+
+ public String getVnfType() {
+ return vnfType;
+ }
+ public void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+ public String getControllerName() {
+ return controllerName;
+ }
+ public void setControllerName(String controllerName) {
+ this.controllerName = controllerName;
+ }
+ public String getActionCategory() {
+ return actionCategory;
+ }
+ public void setActionCategory(String actionCategory) {
+ this.actionCategory = actionCategory;
+ }
+
+
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 0caafc794b..e43fc1796d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -23,6 +23,7 @@ package org.onap.so.db.catalog.client;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationAction;
@@ -43,17 +44,14 @@ import org.onap.so.logging.jaxrs.filter.jersey.SpringClientFilter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
import org.springframework.http.client.ClientHttpRequestFactory;
-import org.springframework.http.client.SimpleClientHttpRequestFactory;
+import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
-import org.springframework.web.client.RestTemplate;
import uk.co.blackpepper.bowman.Client;
import uk.co.blackpepper.bowman.ClientFactory;
import uk.co.blackpepper.bowman.Configuration;
-import uk.co.blackpepper.bowman.RestTemplateConfigurer;
import javax.annotation.PostConstruct;
import javax.ws.rs.core.UriBuilder;
-import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Iterator;
@@ -105,6 +103,8 @@ public class CatalogDbClient {
private Client<CloudifyManager> cloudifyManagerClient;
+ protected Client<ControllerSelectionReference> controllerSelectionReferenceClient;
+
@Value("${mso.catalog.db.spring.endpoint}")
private String endpoint;
@@ -119,7 +119,7 @@ public class CatalogDbClient {
}
public CatalogDbClient() {
- ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new SimpleClientHttpRequestFactory());
+ ClientHttpRequestFactory factory = new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory());
ClientFactory clientFactory = Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
restTemplate.getInterceptors().add((new SpringClientFilter()));
@@ -148,6 +148,7 @@ public class CatalogDbClient {
cloudIdentityClient = clientFactory.create(CloudIdentity.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
+ controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
}
public NetworkCollectionResourceCustomization getNetworkCollectionResourceCustomizationByID(String modelCustomizationUUID) {
@@ -299,6 +300,18 @@ public class CatalogDbClient {
.build());
}
+ public ControllerSelectionReference getControllerSelectionReferenceByVnfType(String vnfType) {
+ return this.getSingleControllerSelectionReference(UriBuilder
+ .fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfType")
+ .queryParam("VNF_TYPE", vnfType).build());
+
+ }
+
+ public ControllerSelectionReference getControllerSelectionReferenceByVnfTypeAndActionCategory(String vnfType, String actionCategory) {
+ return this.getSingleControllerSelectionReference(UriBuilder
+ .fromUri(endpoint + "/controllerSelectionReference/search/findControllerSelectionReferenceByVnfTypeAndActionCategory")
+ .queryParam("VNF_TYPE", vnfType).queryParam("ACTION_CATEGORY", actionCategory).build());
+ }
private CollectionNetworkResourceCustomization getSingleCollectionNetworkResourceCustomization(URI uri) {
return collectionNetworkResourceCustomizationClient.get(uri);
@@ -316,9 +329,9 @@ public class CatalogDbClient {
return this.getSingleCloudIdentity(UriBuilder.fromUri(endpoint+"/cloudIdentity/"+id).build());
}
- public CloudSite getCloudSiteByClliAndAicVersion (String clli, String aicVersion){
- return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloud_sites/search/findByClliAndCloudVersion")
- .queryParam("CLLI",clli).queryParam("AIC_VERSION",aicVersion)
+ public CloudSite getCloudSiteByClliAndAicVersion (String clli, String cloudVersion){
+ return this.getSinglCloudSite(UriBuilder.fromUri(endpoint+"/cloudSite/search/findByClliAndCloudVersion")
+ .queryParam("CLLI",clli).queryParam("CLOUD_VERSION",cloudVersion)
.build());
}
@@ -358,6 +371,10 @@ public class CatalogDbClient {
return cloudifyManagerClient.get(uri);
}
+ private ControllerSelectionReference getSingleControllerSelectionReference(URI uri) {
+ return controllerSelectionReferenceClient.get(uri);
+ }
+
public Service getServiceByModelVersionAndModelInvariantUUID(String modelVersion, String modelInvariantUUID) {
return this.getSingleService(
UriBuilder.fromUri(findByModelVersionAndModelInvariantUUIDURI)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
index 78f117b3ae..65181ff070 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
@@ -2,6 +2,7 @@ package org.onap.so.db.catalog.data.repository;
import org.onap.so.db.catalog.beans.CloudSite;
import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import javax.transaction.Transactional;
@@ -10,5 +11,5 @@ import javax.transaction.Transactional;
@Transactional
public interface CloudSiteRepository extends JpaRepository<CloudSite, String> {
- CloudSite findByClliAndCloudVersion(String clli, String aicVersion);
+ CloudSite findByClliAndCloudVersion(@Param("CLLI") String clli,@Param("CLOUD_VERSION") String cloudVersion);
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java
new file mode 100644
index 0000000000..ad1bbc3f68
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ControllerSelectionReferenceRepository.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.db.catalog.data.repository;
+
+
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+ @RepositoryRestResource(collectionResourceRel = "controllerSelectionReference", path = "controllerSelectionReference")
+ public interface ControllerSelectionReferenceRepository extends JpaRepository<ControllerSelectionReference, String> {
+
+ public ControllerSelectionReference findControllerSelectionReferenceByVnfType(@Param("VNF_TYPE") String vnfType);
+
+ public ControllerSelectionReference findControllerSelectionReferenceByVnfTypeAndActionCategory(@Param("VNF_TYPE") String vnfType,
+ @Param("ACTION_CATEGORY") String actionCategory);
+
+ } \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java
new file mode 100644
index 0000000000..f793fd79e3
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java
@@ -0,0 +1,80 @@
+/*-
+ * ============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.db.catalog;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.TestApplication;
+import org.onap.so.db.catalog.beans.ControllerSelectionReference;
+import org.onap.so.db.catalog.data.repository.ControllerSelectionReferenceRepository;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+import org.springframework.test.context.ActiveProfiles;
+import org.springframework.test.context.junit4.SpringRunner;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class ControllerSelectionReferenceTest {
+
+ @Autowired
+ private ControllerSelectionReferenceRepository controllerSelectionReferenceRepository;
+
+
+ @Test
+ public void Find_ControllerNameByVnfType_Test() {
+ String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
+ String controllerName = "APPC";
+ ControllerSelectionReference controller = controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfType(vnfType);
+ assertEquals(vnfType, controller.getVnfType());
+ assertEquals(controllerName, controller.getControllerName());
+ }
+
+ @Test
+ public void Find_ControllerNameByVnfTypeAndAction_Test() {
+ String vnfType = "vLoadBalancerMS/vLoadBalancerMS 0";
+ String controllerName = "APPC";
+ String actionCategory = "ConfigScaleOut";
+ ControllerSelectionReference controller =
+ controllerSelectionReferenceRepository.findControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, actionCategory);
+ assertEquals(vnfType, controller.getVnfType());
+ assertEquals(controllerName, controller.getControllerName());
+ assertEquals(actionCategory, controller.getActionCategory());
+ }
+
+ @Test
+ public final void controllerDataTest() {
+ ControllerSelectionReference controller = new ControllerSelectionReference();
+
+ controller.setVnfType("vnfType");
+ assertTrue(controller.getVnfType().equalsIgnoreCase("vnfType"));
+
+ controller.setControllerName("controllerName");
+ assertTrue(controller.getControllerName().equalsIgnoreCase("controllerName"));
+
+ controller.setActionCategory("actionCategory");
+ assertTrue(controller.getActionCategory().equalsIgnoreCase("actionCategory"));
+ }
+}
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index e16ca0fe8f..58bde0e532 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -642,9 +642,11 @@ VALUES
('CUSTOM', 'PENDING_DELETE', 'CUSTOM', 'CONTINUE'),
('CUSTOM', 'PRECREATED', 'CUSTOM', 'CONTINUE');
-
INSERT INTO `cloudify_managers` (`ID`, `CLOUDIFY_URL`, `USERNAME`, `PASSWORD`, `VERSION`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', NULL, 'MSO_USER', '2018-07-17 14:05:08', '2018-07-17 14:05:08');
INSERT INTO `identity_services` (`ID`, `IDENTITY_URL`, `MSO_ID`, `MSO_PASS`, `ADMIN_TENANT`, `MEMBER_ROLE`, `TENANT_METADATA`, `IDENTITY_SERVER_TYPE`, `IDENTITY_AUTHENTICATION_TYPE`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('MTN13', 'http://localhost:28090/v2.0', 'm93945', '93937EA01B94A10A49279D4572B48369', 'admin', 'admin', 1, 'KEYSTONE', 'USERNAME_PASSWORD', 'MSO_USER', '2018-07-17 14:02:33', '2018-07-17 14:02:33');
-INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28'); \ No newline at end of file
+INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERSION`, `CLLI`, `CLOUDIFY_ID`, `PLATFORM`, `ORCHESTRATOR`, `LAST_UPDATED_BY`, `CREATION_TIMESTAMP`, `UPDATE_TIMESTAMP`) VALUES ('mtn13', 'mtn13', 'MTN13', '2.5', 'MDT13', 'mtn13', NULL, 'orchestrator', 'MSO_USER', '2018-07-17 14:06:28', '2018-07-17 14:06:28');
+
+INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES
+('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut');
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 8ff04ea038..8a4b1f2103 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -822,6 +822,13 @@ create table if not exists model (
FOREIGN KEY (`RECIPE`) REFERENCES `model_recipe` (`MODEL_ID`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
+CREATE TABLE IF NOT EXISTS `controller_selection_reference` (
+ `VNF_TYPE` VARCHAR(50) NOT NULL,
+ `CONTROLLER_NAME` VARCHAR(100) NOT NULL,
+ `ACTION_CATEGORY` VARCHAR(15) NOT NULL,
+ PRIMARY KEY (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`)
+) ;
+
ALTER TABLE `vnf_recipe`
CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
@@ -841,7 +848,6 @@ CREATE TABLE IF NOT EXISTS `identity_services` (
PRIMARY KEY (`ID`)
) ;
-
CREATE TABLE IF NOT EXISTS `cloudify_managers` (
`ID` varchar(50) NOT NULL,
`CLOUDIFY_URL` varchar(200) DEFAULT NULL,
@@ -854,9 +860,6 @@ CREATE TABLE IF NOT EXISTS `cloudify_managers` (
PRIMARY KEY (`ID`)
) ;
-
-
-
CREATE TABLE IF NOT EXISTS `cloud_sites` (
`ID` varchar(50) NOT NULL,
`REGION_ID` varchar(11) DEFAULT NULL,
@@ -872,4 +875,4 @@ CREATE TABLE IF NOT EXISTS `cloud_sites` (
PRIMARY KEY (`ID`),
KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
-) ; \ No newline at end of file
+) ;
diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml
index eed81b9ca9..a8f8ee5f5a 100644
--- a/packages/docker/pom.xml
+++ b/packages/docker/pom.xml
@@ -205,7 +205,7 @@
</build>
</image>
<image>
- <name>onap/so/asdc-controller</name>
+ <name>onap/so/sdc-controller</name>
<build>
<cleanup>try</cleanup>
<dockerFileDir>docker-files</dockerFileDir>
@@ -310,7 +310,7 @@
<goal>push</goal>
</goals>
<configuration>
- <image>onap/so/catalog-db-adapter,onap/so/request-db-adapter,onap/so/sdnc-adapter,onap/so/openstack-adapter,onap/so/vfc-adapter,onap/so/asdc-controller,onap/so/bpmn-infra,onap/so/api-handler-infra</image>
+ <image>onap/so/catalog-db-adapter,onap/so/request-db-adapter,onap/so/sdnc-adapter,onap/so/openstack-adapter,onap/so/vfc-adapter,onap/so/sdc-controller,onap/so/bpmn-infra,onap/so/api-handler-infra</image>
</configuration>
</execution>
</executions>
diff --git a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
index 84c2b48f12..7db4319195 100644
--- a/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
+++ b/packages/docker/src/main/docker/docker-files/scripts/start-app.sh
@@ -40,7 +40,7 @@ if [ -z "${LOG_PATH}" ]; then
export LOG_PATH="logs/${APP}"
fi
-if [ ${APP} = "asdc-controller" ]; then
+if [ ${APP} = "sdc-controller" ]; then
ln -s ${LOG_PATH} ASDC
fi