aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore2
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java22
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java22
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql4
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql101
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql5
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java10
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java20
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java20
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java8
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java12
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java20
-rw-r--r--adapters/mso-requests-db-adapter/pom.xml6
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java22
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql18
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java92
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java22
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java2
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java6
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml8
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java4
-rw-r--r--adapters/mso-vfc-adapter/.springBeans2
-rw-r--r--asdc-controller/pom.xml4
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java1
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java18
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java2
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java10
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java9
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java320
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java8
-rw-r--r--asdc-controller/src/test/resources/schema.sql74
-rw-r--r--bpmn/MSOCommonBPMN/pom.xml15
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java10
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java)2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java55
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java8
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java93
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java5
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java86
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java20
-rw-r--r--bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java23
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java35
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java6
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java)43
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java140
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java57
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java3
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java11
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml2
-rw-r--r--bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java3
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java6
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java2
-rw-r--r--bpmn/pom.xml5
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java12
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java20
-rw-r--r--bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java3
-rw-r--r--bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java21
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java123
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java1
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java162
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java22
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java96
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java9
-rw-r--r--cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java1
-rw-r--r--common/pom.xml4
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java2
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java3
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIObjectType.java121
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java20
-rw-r--r--common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java17
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java20
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java20
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClient.java3
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java48
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Config.java217
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java127
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/Content.java47
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java59
-rw-r--r--common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java166
-rw-r--r--common/src/main/java/org/onap/so/exceptions/MSOException.java20
-rw-r--r--common/src/main/java/org/onap/so/logger/LoggerStartupListener.java1
-rw-r--r--common/src/main/java/org/onap/so/logger/MsoLogger.java5
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java22
-rw-r--r--common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java22
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/Request.java19
-rw-r--r--common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java62
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java14
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java1
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java20
-rw-r--r--common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java71
-rw-r--r--common/src/test/resources/__files/Policy/configJson.json23
-rw-r--r--common/src/test/resources/__files/Policy/policyConfig.json20
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java20
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java20
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java22
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java5
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java68
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java18
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java115
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java10
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java1
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json189
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json299
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json24
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json59
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql71
-rw-r--r--mso-api-handlers/mso-requests-db/hibernate.properties2
-rw-r--r--mso-api-handlers/mso-requests-db/hibernate.reveng.xml11
-rw-r--r--mso-api-handlers/mso-requests-db/pom.xml9
-rw-r--r--mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml30
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java167
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java)170
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java37
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java4
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java (renamed from mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java)2
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java34
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/afterMigrate.sql35
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml1
-rw-r--r--mso-api-handlers/mso-requests-db/src/test/resources/schema.sql4
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java13
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java275
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java3
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java49
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java33
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java236
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java191
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java20
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java20
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java20
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java37
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java32
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java31
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java69
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java1
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java103
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java85
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java77
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java22
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java22
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java103
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java121
-rw-r--r--mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java62
-rw-r--r--mso-catalog-db/src/test/resources/data.sql95
-rw-r--r--mso-catalog-db/src/test/resources/schema.sql72
196 files changed, 5989 insertions, 780 deletions
diff --git a/.gitignore b/.gitignore
index 284ea22711..5817c6984f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -17,5 +17,5 @@ target
*.tmp
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Catalog-schema.sql
packages/root-pack-extras/config-resources/mariadb/db-sql-scripts/main-schemas/MySQL-Requests-schema.sql
-/bin/
+**/bin/
/tattletale/
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
index d7b30edbe5..d688960a1c 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so;
import ch.vorburger.exec.ManagedProcessException;
@@ -39,4 +59,4 @@ public class EmbeddedMariaDbConfig {
.driverClassName(datasourceDriver)
.build();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
index 823c807c8a..efe6010f23 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.adapters.catalogdb;
@@ -19,4 +39,4 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor);
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql
new file mode 100644
index 0000000000..985c7cd44d
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql
@@ -0,0 +1,4 @@
+use catalogdb;
+
+ALTER TABLE cvnfc_customization
+ MODIFY IF EXISTS VNFC_CUST_MODEL_CUSTOMIZATION_UUID varchar(200) NULL; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql
new file mode 100644
index 0000000000..f0b291ed6b
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql
@@ -0,0 +1,101 @@
+USE catalogdb;
+
+CREATE TABLE IF NOT EXISTS vnfc_customization (
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`))
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS cvnfc_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `MODEL_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_VERSION` VARCHAR(20) NOT NULL,
+ `MODEL_NAME` VARCHAR(200) NOT NULL,
+ `TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+ `DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+ `NFC_FUNCTION` VARCHAR(200) NULL,
+ `NFC_NAMING_CODE` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ UNIQUE INDEX `UK_cvnfc_customization` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (
+ `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (
+ `VNFC_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC,
+ `MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC
+ ),
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`) REFERENCES `configuration` (`MODEL_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (
+ `CVNFC_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`
+ ) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE = INNODB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = LATIN1; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql
new file mode 100644
index 0000000000..7fd222a027
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql
@@ -0,0 +1,5 @@
+use catalogdb;
+
+DELETE FROM catalogdb.service_recipe
+ where orchestration_uri = '/mso/async/services/CreateGenericMacroServiceNetworkVnf'
+ or orchestration_uri = '/mso/async/services/DeleteGenericMacroServiceNetworkVnf'; \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 687b2f65ef..8ccf40eff5 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -115,7 +115,7 @@ public class CatalogDBRestTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
@@ -789,8 +789,8 @@ public class CatalogDBRestTest {
logEvent.getMarker().getName().equals("ENTRY")
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
assertEquals("v2/vfModules",mdc.get(MsoLogger.SERVICE_NAME));
@@ -798,9 +798,9 @@ public class CatalogDBRestTest {
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(MsoLogger.ENDTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("500",mdc.get(MsoLogger.RESPONSECODE));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
index b52cf73fe5..bf69686a76 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.client;
import org.springframework.stereotype.Component;
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
index b1c3bdb29c..4ec5839cb6 100644
--- 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
@@ -1,3 +1,23 @@
+/*-
+ * ============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.client;
import org.junit.Assert;
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java
index 0309c88dac..82139f21af 100644
--- a/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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 db.migration;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
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 ee89edbda8..3ec02bfb0e 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
@@ -1,3 +1,23 @@
+/*-
+ * ============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 db.migration;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java
index 6398d413d0..6c6366904f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java
+++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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 db.migration;
import org.flywaydb.core.api.migration.jdbc.JdbcMigration;
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 de8aedcc47..2eeed777de 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
@@ -22,7 +22,7 @@
*/
package org.onap.so.adapters.network;
-
+
import java.net.MalformedURLException;
import java.net.URL;
@@ -196,9 +196,9 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync {
copyCreateSubnetIdMap (subnetIdMap),
copyNrb (networkRollback));
} catch (Exception e) {
- error = "Error sending createNetwork notification " + e.getMessage ();
- LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, "Exception sending createNetwork notification", e);
- alarmLogger.sendAlarm ("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
+ error = CREATE_NETWORK_ERROR_MSG + e.getMessage ();
+ LOGGER.error (MessageEnum.RA_CREATE_NETWORK_NOTIF_EXC, "", "", MsoLogger.ErrorCode.DataError, CREATE_NETWORK_EXCEPTON_MSG, e);
+ alarmLogger.sendAlarm (MSO_INTERNAL_ERROR_MSG, MsoAlarmLogger.CRITICAL, error);
}
return;
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index c8df1fdac2..ac33a5269e 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -21,7 +21,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.adapters.network;
+package org.onap.so.adapters.network;
import java.util.ArrayList;
import java.util.HashMap;
@@ -104,7 +104,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
@Autowired
private MsoCommonUtils commonUtils;
- @Autowired
+ @Autowired
private NetworkResourceCustomizationRepository networkCustomRepo;
@Autowired
@@ -259,7 +259,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("CreateNetwork");
+ MsoLogger.setServiceName (CREATE_NETWORK_CONTEXT);
LOGGER.debug ("*** CREATE Network: " + networkName
+ " of type "
@@ -766,7 +766,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
Holder <Map <String, String>> subnetIdMap,
Holder <NetworkRollback> rollback) throws NetworkException {
MsoLogger.setLogContext (msoRequest);
- MsoLogger.setServiceName ("UpdateNetwork");
+ MsoLogger.setServiceName (UPDATE_NETWORK_CONTEXT);
LOGGER.debug ("***UPDATE Network adapter with Network: " + networkName
+ " of type "
+ networkType
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java
index 067a6727c1..cc48e95c81 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/beans/ValetStatus.java
@@ -35,11 +35,7 @@ public class ValetStatus implements Serializable {
private String status;
@JsonProperty("message")
private String message;
-
- @Override
- public String toString() {
- return new ToStringBuilder(this).append("status", status).append("message", message).toString();
- }
+
public ValetStatus() {
super();
@@ -51,6 +47,12 @@ public class ValetStatus implements Serializable {
this.message = statusMessage;
}
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("status", status).append("message", message).toString();
+ }
+
public String getStatus() {
return this.status;
}
diff --git a/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java
index b29e1f57a7..d83e929d6e 100644
--- a/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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 db.migration;
import org.junit.Assert;
diff --git a/adapters/mso-requests-db-adapter/pom.xml b/adapters/mso-requests-db-adapter/pom.xml
index 955a4d81fa..6669895ef1 100644
--- a/adapters/mso-requests-db-adapter/pom.xml
+++ b/adapters/mso-requests-db-adapter/pom.xml
@@ -106,6 +106,10 @@
<version>1.0.5</version>
</dependency>
<dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-rest</artifactId>
+ </dependency>
+ <dependency>
<groupId>org.onap.so</groupId>
<artifactId>cxf-logging</artifactId>
<version>${project.version}</version>
@@ -230,4 +234,4 @@
</plugins>
</pluginManagement>
</build>
-</project> \ No newline at end of file
+</project>
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
index 92a9df1071..33b1028cbb 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
@@ -300,4 +300,4 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
resStatus.setStatusDescription(statusDescription);
resourceOperationStatusRepository.save(resStatus);
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
index 69cf6ccb3d..e932bb2cca 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.adapters.requestsdb.application;
@@ -19,4 +39,4 @@ public class WebMvcConfig extends WebMvcConfigurerAdapter {
return new MappedInterceptor(new String[]{"/**"}, loggingInterceptor);
}
-} \ No newline at end of file
+}
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 ade3daada3..414c552619 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
@@ -12,6 +12,10 @@ mso:
endpoint: http://localhost:8081
logPath: logs
site-name: localSite
+ adapters:
+ requestDb:
+ auth: Basic YnBlbDptc28tZGItMTUwNyE=
+ endpoint: http://localhost:8081
spring:
datasource:
url: jdbc:mariadb://localhost:3306/requestdb
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql
new file mode 100644
index 0000000000..394a3e5b12
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql
@@ -0,0 +1,18 @@
+use requestdb;
+
+CREATE TABLE IF NOT EXISTS request_processing_data (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `SO_REQUEST_ID` VARCHAR(50) NOT NULL,
+ `GROUPING_ID` VARCHAR(100) NULL,
+ `NAME` VARCHAR(200) NOT NULL,
+ `VALUE` LONGTEXT,
+ `TAG` VARCHAR(200) NOT NULL,
+ `CREATE_TIME` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ PRIMARY KEY (`ID`),
+ UNIQUE INDEX `UK_request_processing_data` (
+ `SO_REQUEST_ID` ASC,
+ `GROUPING_ID` ASC,
+ `TAG` ASC,
+ `NAME` ASC
+ )
+) ENGINE = InnoDB DEFAULT CHARSET = latin1;
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java
new file mode 100644
index 0000000000..c1e620ba74
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java
@@ -0,0 +1,92 @@
+/*-
+ * ============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.adapters.requestdb.rest;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.transaction.Transactional;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.onap.so.adapters.requestsdb.application.MSORequestDBApplication;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
+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;
+
+@RunWith(SpringRunner.class)
+@SpringBootTest(classes = MSORequestDBApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
+@ActiveProfiles("test")
+public class RequestProcessingDataRequestDbQueryTest {
+ @Autowired
+ private RequestsDbClient client;
+
+ @LocalServerPort
+ private int port;
+
+ @Before
+ public void setPort() {
+ client.removePortFromEndpoint();
+ client.setPortToEndpoint(Integer.toString(port));
+ }
+
+ @Test
+ @Transactional
+ public void RequestProcessingDataBySoRequestIdTest() {
+ String soRequestId = "00032ab7-na18-42e5-965d-8ea592502018";
+ String tag = "pincFabricConfigRequest";
+ RequestProcessingData firstEntry = new RequestProcessingData();
+ RequestProcessingData secondEntry = new RequestProcessingData();
+ List<RequestProcessingData> expectedList = new ArrayList<>();
+ firstEntry.setSoRequestId(soRequestId);
+ firstEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
+ firstEntry.setName("configurationId");
+ firstEntry.setValue("52234bc0-d6a6-41d4-a901-79015e4877e2");
+ firstEntry.setTag(tag);
+ secondEntry.setSoRequestId(soRequestId);
+ secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ secondEntry.setName("requestAction");
+ secondEntry.setValue("assign");
+ secondEntry.setTag(tag);
+ expectedList.add(firstEntry);
+ expectedList.add(secondEntry);
+
+ List<RequestProcessingData> dataFound = client.getRequestProcessingDataBySoRequestId(soRequestId);
+ //bean comparison with shazam fails serialization: Forgot to register a type adapter?
+ assertEquals(dataFound.get(0).getSoRequestId(), firstEntry.getSoRequestId());
+ assertEquals(dataFound.get(0).getGroupingId(), firstEntry.getGroupingId());
+ assertEquals(dataFound.get(0).getName(), firstEntry.getName());
+ assertEquals(dataFound.get(0).getValue(), firstEntry.getValue());
+ assertEquals(dataFound.get(0).getTag(), firstEntry.getTag());
+ assertEquals(dataFound.get(1).getSoRequestId(), secondEntry.getSoRequestId());
+ assertEquals(dataFound.get(1).getGroupingId(), secondEntry.getGroupingId());
+ assertEquals(dataFound.get(1).getName(), secondEntry.getName());
+ assertEquals(dataFound.get(1).getValue(), secondEntry.getValue());
+ assertEquals(dataFound.get(1).getTag(), secondEntry.getTag());
+ }
+}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
index 11f8ff0c36..58fd517c91 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.adapters.requestsdb;
@@ -247,4 +267,4 @@ public class InfraActiveRequestsRepositoryCustomControllerTest {
verifyInfraActiveRequests();
}
-} \ No newline at end of file
+}
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
index 4e00ced841..21ec8f7518 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
@@ -72,7 +72,7 @@ public class HealthCheckHandlerTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/manage/health",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index 9ac0cce841..03fd0622fa 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -376,7 +376,7 @@ public class MSORequestDBImplTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
@@ -499,7 +499,7 @@ public class MSORequestDBImplTest {
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("",mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter",mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
@@ -517,4 +517,4 @@ public class MSORequestDBImplTest {
}
-} \ No newline at end of file
+}
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 165b6675dc..812fd232b4 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
@@ -39,6 +39,14 @@ spring:
username: bpel
password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke'
role: BPEL-Client
+ -
+ username: bpel
+ password: '$2a$12$1xyutEZNfjGewIZRfKaE8eZE99f5sYFUmmM80BobI65KNjmcK0JuO'
+ role: BPEL-Client
+ -
+ username: mso_admin
+ password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa'
+ role: ACTUATOR
mariaDB4j:
dataDir:
port: 3307
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index ec02ac0734..ae5f5e9124 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -29,4 +29,10 @@ insert into watchdog_service_mod_ver_id_lookup(distribution_id, service_model_ve
insert into site_status(site_name, status, creation_timestamp) values
-('testsite', 0, '2017-11-30 15:48:09'); \ No newline at end of file
+('testsite', 0, '2017-11-30 15:48:09');
+
+INSERT INTO requestdb.request_processing_data (ID, SO_REQUEST_ID, GROUPING_ID, NAME, VALUE, TAG)
+VALUES
+(1, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca714', 'requestAction', 'assign', 'pincFabricConfigRequest'),
+(2, '00032ab7-na18-42e5-965d-8ea592502018', '7d2e8c07-4d10-456d-bddc-37abf38ca715', 'configurationId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfigRequest'),
+(3, '5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'configId', '52234bc0-d6a6-41d4-a901-79015e4877e2', 'pincFabricConfig');
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
index 8000e3ab8e..a0e3a17496 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -77,8 +77,6 @@ public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
sdncResp.setRespMsg(respMsg);
sdncClient.sendRespToBpel(callbackUrl, sdncResp);
}
-
- SDNCAdapterResponse wsResp = new SDNCAdapterResponse();
- return wsResp;
+ return (new SDNCAdapterResponse());
}
}
diff --git a/adapters/mso-vfc-adapter/.springBeans b/adapters/mso-vfc-adapter/.springBeans
index 1310366fc4..7f46cc45af 100644
--- a/adapters/mso-vfc-adapter/.springBeans
+++ b/adapters/mso-vfc-adapter/.springBeans
@@ -13,4 +13,4 @@
</autoconfigs>
<configSets>
</configSets>
-</beansProjectDescription>
+</beansProjectDescription> \ No newline at end of file
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml
index f9f7127d17..28fd24c0c8 100644
--- a/asdc-controller/pom.xml
+++ b/asdc-controller/pom.xml
@@ -196,12 +196,12 @@
<dependency>
<groupId>org.onap.sdc.sdc-tosca</groupId>
<artifactId>sdc-tosca</artifactId>
- <version>1.4.1</version>
+ <version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.onap.sdc.jtosca</groupId>
<artifactId>jtosca</artifactId>
- <version>1.4.1</version>
+ <version>1.3.5</version>
</dependency>
<dependency>
<groupId>org.onap.so</groupId>
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
index 471a08bf99..62971ecd2b 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
@@ -15,7 +15,6 @@
* 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.
- * Modifications Copyright (C) 2018 IBM.
* ============LICENSE_END=========================================================
*/
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 55a437f2c0..fae3a49910 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -268,7 +268,7 @@ public class ASDCController {
- private IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
+ protected IDistributionClientDownloadResult downloadTheArtifact (IArtifactInfo artifact,
String distributionId) throws ASDCDownloadException {
LOGGER.debug ("Trying to download the artifact : " + artifact.getArtifactURL ()
@@ -370,7 +370,7 @@ public class ASDCController {
}
- private void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) {
+ protected void sendDeployNotificationsForResource(VfResourceStructure vfResourceStructure,DistributionStatusEnum distribStatus, String errorReason) {
for (IArtifactInfo artifactInfo : vfResourceStructure.getResourceInstance().getArtifacts()) {
@@ -397,7 +397,7 @@ public class ASDCController {
}
}
- private void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) {
+ protected void sendCsarDeployNotification(INotificationData iNotif, VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure, boolean deploySuccessful, String errorReason) {
IArtifactInfo csarArtifact = toscaResourceStructure.getToscaArtifact();
@@ -424,7 +424,7 @@ public class ASDCController {
}
}
- private void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
+ protected void deployResourceStructure (VfResourceStructure resourceStructure, ToscaResourceStructure toscaResourceStructure) throws ArtifactInstallerException {
LOGGER.info (MessageEnum.ASDC_START_DEPLOY_ARTIFACT, resourceStructure.getResourceInstance().getResourceInstanceName(), resourceStructure.getResourceInstance().getResourceUUID(), "ASDC");
try {
@@ -459,7 +459,7 @@ public class ASDCController {
DOWNLOAD, DEPLOY
}
- private void sendASDCNotification (NotificationType notificationType,
+ protected void sendASDCNotification (NotificationType notificationType,
String artifactURL,
String consumerID,
String distributionID,
@@ -515,7 +515,7 @@ public class ASDCController {
LOGGER.recordMetricEvent (subStarttime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully sent notification to ASDC", "ASDC", action, null);
}
- private void sendFinalDistributionStatus (
+ protected void sendFinalDistributionStatus (
String distributionID,
DistributionStatusEnum status,
String errorReason) {
@@ -664,7 +664,7 @@ public class ASDCController {
}
}
- private void processResourceNotification (INotificationData iNotif) {
+ protected void processResourceNotification (INotificationData iNotif) {
// For each artifact, create a structure describing the VFModule in a ordered flat level
VfResourceStructure resourceStructure = null;
ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure();
@@ -735,7 +735,7 @@ public class ASDCController {
"Exception caught during Installation of artifact", "ASDC", "processResourceNotification", MsoLogger.ErrorCode.BusinessProcesssError, "Exception in processResourceNotification", e);
}
}
- private void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
+ protected void processCsarServiceArtifacts (INotificationData iNotif, ToscaResourceStructure toscaResourceStructure) {
List<IArtifactInfo> serviceArtifacts = iNotif.getServiceArtifacts();
@@ -768,7 +768,7 @@ public class ASDCController {
}
private static final String UNKNOWN="Unknown";
-
+
/**
* @return the address of the ASDC we are connected to.
*/
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java
index cfdff85bc3..9115ed3ef2 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java
@@ -24,7 +24,7 @@ import java.util.ArrayList;
import org.onap.sdc.api.notification.IResourceInstance;
-final class ResourceInstance implements IResourceInstance {
+public class ResourceInstance implements IResourceInstance {
@Override
public String getResourceInstanceName(){
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
index adc8071454..92fc598e7d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
@@ -44,7 +44,15 @@ public final class VfModuleArtifact {
public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
artifactInfo=artifactinfo;
result = new String(clientResult.getArtifactPayload(), "UTF-8");
-
+ }
+
+ public VfModuleArtifact(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) throws UnsupportedEncodingException {
+ artifactInfo=artifactinfo;
+ if(modifiedHeatTemplate != null){
+ result = modifiedHeatTemplate;
+ }else{
+ result = new String(clientResult.getArtifactPayload(), "UTF-8");
+ }
}
public HeatFiles getHeatFiles() {
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index a045c2bb3a..f5e45115fd 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -102,6 +102,15 @@ public class VfResourceStructure {
public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult) throws UnsupportedEncodingException {
VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult);
+ addArtifactByType(artifactinfo,clientResult,vfModuleArtifact);
+ }
+
+ public void addArtifactToStructure(IDistributionClient distributionClient,IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, String modifiedHeatTemplate) throws UnsupportedEncodingException {
+ VfModuleArtifact vfModuleArtifact = new VfModuleArtifact(artifactinfo,clientResult,modifiedHeatTemplate);
+ addArtifactByType(artifactinfo,clientResult,vfModuleArtifact);
+ }
+
+ protected void addArtifactByType(IArtifactInfo artifactinfo,IDistributionClientDownloadResult clientResult, VfModuleArtifact vfModuleArtifact) throws UnsupportedEncodingException {
switch(artifactinfo.getArtifactType()) {
case ASDCConfiguration.HEAT:
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index 7dfb1bae3e..f7b457c718 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -41,6 +41,7 @@ import org.onap.sdc.toscaparser.api.CapabilityAssignment;
import org.onap.sdc.toscaparser.api.CapabilityAssignments;
import org.onap.sdc.toscaparser.api.Group;
import org.onap.sdc.toscaparser.api.NodeTemplate;
+import org.onap.sdc.toscaparser.api.Policy;
import org.onap.sdc.toscaparser.api.RequirementAssignment;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.sdc.utils.DistributionStatusEnum;
@@ -62,6 +63,7 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.ExternalServiceToInternalService;
import org.onap.so.db.catalog.beans.HeatEnvironment;
import org.onap.so.db.catalog.beans.HeatFiles;
@@ -83,24 +85,30 @@ import org.onap.so.db.catalog.beans.VfModule;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.data.repository.AllottedResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.AllottedResourceRepository;
import org.onap.so.db.catalog.data.repository.CollectionResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.CollectionResourceRepository;
import org.onap.so.db.catalog.data.repository.ConfigurationResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.ConfigurationResourceRepository;
+import org.onap.so.db.catalog.data.repository.CvnfcCustomizationRepository;
import org.onap.so.db.catalog.data.repository.ExternalServiceToInternalServiceRepository;
import org.onap.so.db.catalog.data.repository.HeatTemplateRepository;
import org.onap.so.db.catalog.data.repository.InstanceGroupRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceCustomizationRepository;
import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceProxyResourceCustomizationRepository;
+import org.onap.so.db.catalog.data.repository.ServiceProxyResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.TempNetworkHeatTemplateRepository;
import org.onap.so.db.catalog.data.repository.VFModuleCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VFModuleRepository;
import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfResourceRepository;
+import org.onap.so.db.catalog.data.repository.VnfcCustomizationRepository;
import org.onap.so.db.catalog.data.repository.VnfcInstanceGroupCustomizationRepository;
import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
@@ -144,6 +152,9 @@ public class ToscaResourceInstaller {
protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
@Autowired
+ protected ServiceProxyResourceRepository serviceProxyRepo;
+
+ @Autowired
protected CollectionResourceRepository collectionRepo;
@Autowired
@@ -151,6 +162,9 @@ public class ToscaResourceInstaller {
@Autowired
protected ConfigurationResourceCustomizationRepository configCustomizationRepo;
+
+ @Autowired
+ protected ConfigurationResourceRepository configRepo;
@Autowired
protected VnfResourceRepository vnfRepo;
@@ -166,6 +180,12 @@ public class ToscaResourceInstaller {
@Autowired
protected VnfcInstanceGroupCustomizationRepository vnfcInstanceGroupCustomizationRepo;
+
+ @Autowired
+ protected VnfcCustomizationRepository vnfcCustomizationRepo;
+
+ @Autowired
+ protected CvnfcCustomizationRepository cvnfcCustomizationRepo;
@Autowired
protected AllottedResourceRepository allottedRepo;
@@ -370,32 +390,48 @@ public class ToscaResourceInstaller {
}
}
}
-
+
protected void processServiceProxyAndConfiguration(ToscaResourceStructure toscaResourceStruct, Service service) {
List<NodeTemplate> serviceProxyResourceList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
List<NodeTemplate> configurationNodeTemplatesList = toscaResourceStruct.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
+ List<ServiceProxyResourceCustomization> serviceProxyList = new ArrayList<ServiceProxyResourceCustomization>();
+ List<ConfigurationResourceCustomization> configurationResourceList = new ArrayList<ConfigurationResourceCustomization>();
+
+ ServiceProxyResourceCustomization serviceProxy = null;
+
if (serviceProxyResourceList != null) {
for (NodeTemplate spNode : serviceProxyResourceList) {
- createServiceProxy(spNode, service, toscaResourceStruct);
- serviceProxyCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogServiceProxyResourceCustomization());
+ serviceProxy = createServiceProxy(spNode, service, toscaResourceStruct);
+
+ ServiceProxyResource serviceProxyResource = findExistingServiceProxyResource(serviceProxyList, serviceProxy.getServiceProxyResource().getModelUUID());
+
+ if(serviceProxyResource == null){
+
+ serviceProxyList.add(serviceProxy);
for (NodeTemplate configNode : configurationNodeTemplatesList) {
-
+
List<RequirementAssignment> requirementsList = toscaResourceStruct.getSdcCsarHelper().getRequirementsOf(configNode).getAll();
for (RequirementAssignment requirement : requirementsList) {
if (requirement.getNodeTemplateName().equals(spNode.getName())) {
- createConfiguration(configNode, toscaResourceStruct, toscaResourceStruct.getCatalogServiceProxyResourceCustomization());
- configCustomizationRepo.saveAndFlush(toscaResourceStruct.getCatalogConfigurationResourceCustomization());
+ ConfigurationResourceCustomization configurationResource = createConfiguration(configNode, toscaResourceStruct, serviceProxy);
+
+ configurationResourceList.add(configurationResource);
break;
}
}
}
+
+ }
}
}
+
+ service.setConfigurationCustomizations(configurationResourceList);
+ service.setServiceProxyCustomizations(serviceProxyList);
}
protected void processNetworkCollections(ToscaResourceStructure toscaResourceStruct, Service service) {
@@ -420,40 +456,57 @@ public class ToscaResourceInstaller {
protected void processVfModules(ToscaResourceStructure toscaResourceStruct, VfResourceStructure vfResourceStructure,
Service service, NodeTemplate nodeTemplate, Metadata metadata, String vfCustomizationCategory) throws Exception {
- if (!vfCustomizationCategory.equalsIgnoreCase(ALLOTTED_RESOURCE))
+
+ logger.debug("VF Category is : " + vfCustomizationCategory);
+
+ //if (!vfCustomizationCategory.equalsIgnoreCase(ALLOTTED_RESOURCE))
+ if(vfResourceStructure.getVfModuleStructure() != null && !vfResourceStructure.getVfModuleStructure().isEmpty())
{
String vfCustomizationUUID = toscaResourceStruct.getSdcCsarHelper()
.getMetadataPropertyValue(metadata, SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID);
- logger.debug("vfCustomizationUUID=" + vfCustomizationUUID);
+ logger.debug("VFCustomizationUUID=" + vfCustomizationUUID);
- IResourceInstance vfMetaDataResource = vfResourceStructure.getResourceInstance();
+ IResourceInstance vfNotificationResource = vfResourceStructure.getResourceInstance();
- // Make sure the vfMetadata and tosca customizations match before comparing their VF Modules UUID's
- if(vfCustomizationUUID.equals(vfMetaDataResource.getResourceCustomizationUUID())){
-
- logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfMetaData CustomizationUUID");
+ // Make sure the VF ResourceCustomizationUUID from the notification and tosca customizations match before comparing their VF Modules UUID's
+ logger.debug("Checking if Notification VF ResourceCustomizationUUID: " + vfNotificationResource.getResourceCustomizationUUID() +
+ " matches Tosca VF Customization UUID: " + vfCustomizationUUID);
+
+ if(vfCustomizationUUID.equals(vfNotificationResource.getResourceCustomizationUUID())){
- VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+ logger.debug("vfCustomizationUUID: " + vfCustomizationUUID + " matches vfNotificationResource CustomizationUUID");
- for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
- logger.debug("vfModuleStructure ModelUUID: " + vfModuleStructure.toString());
+ VnfResourceCustomization vnfResource = createVnfResource(nodeTemplate, toscaResourceStruct, service);
+
+ Set<CvnfcCustomization> cvnfcCustomizations = new HashSet<CvnfcCustomization>();
+ Set<VnfcCustomization> vnfcCustomizations = new HashSet<VnfcCustomization>();
+
+ for (VfModuleStructure vfModuleStructure : vfResourceStructure.getVfModuleStructure()) {
+
+ logger.debug("vfModuleStructure:" + vfModuleStructure.toString());
List<org.onap.sdc.toscaparser.api.Group> vfGroups = toscaResourceStruct
.getSdcCsarHelper().getVfModulesByVf(vfCustomizationUUID);
- IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
+ IVfModuleData vfMetadata = vfModuleStructure.getVfModuleMetadata();
+
+ logger.debug("Comparing VFModule Metadata CustomizationUUID : " + vfMetadata.getVfModuleModelCustomizationUUID());
+ for(Group group : vfGroups){
+ logger.debug("To Group VFModuleModelCustomizationUUID " + group.getMetadata().getValue("vfModuleModelCustomizationUUID"));
+ }
Optional<org.onap.sdc.toscaparser.api.Group> matchingObject = vfGroups.stream().
filter(group -> group.getMetadata().getValue("vfModuleModelCustomizationUUID").equals(vfMetadata.getVfModuleModelCustomizationUUID())).
findFirst();
if(matchingObject.isPresent()){
- VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct, vfResourceStructure,vfMetadata, vnfResource);
+ VfModuleCustomization vfModuleCustomization = createVFModuleResource(matchingObject.get(), nodeTemplate, toscaResourceStruct,
+ vfResourceStructure,vfMetadata, vnfResource, service, cvnfcCustomizations, vnfcCustomizations);
vfModuleCustomization.getVfModule().setVnfResources(vnfResource.getVnfResources());
}else
throw new Exception("Cannot find matching VFModule Customization for VF Module Metadata: " + vfMetadata.getVfModuleModelCustomizationUUID());
}
service.getVnfCustomizations().add(vnfResource);
- }
+ }
}
}
@@ -698,9 +751,6 @@ public class ToscaResourceInstaller {
spCustomizationResource.setServiceProxyResource(spResource);
serviceProxyCustomizationSet.add(spCustomizationResource);
-
- spResource.setServiceProxyCustomization(serviceProxyCustomizationSet);
-
toscaResourceStructure.setCatalogServiceProxyResource(spResource);
toscaResourceStructure.setCatalogServiceProxyResourceCustomization(spCustomizationResource);
@@ -744,7 +794,38 @@ public class ToscaResourceInstaller {
return configCustomizationResource;
}
+
+ protected ConfigurationResourceCustomization createFabricConfiguration(NodeTemplate nodeTemplate, ToscaResourceStructure toscaResourceStructure) {
+
+ Metadata fabricMetadata = nodeTemplate.getMetaData();
+
+ ConfigurationResource configResource = new ConfigurationResource();
+
+ configResource.setModelName(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ configResource.setModelInvariantUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ configResource.setModelUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ configResource.setModelVersion(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ configResource.setDescription(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ configResource.setToscaNodeType(nodeTemplate.getType());
+
+ ConfigurationResourceCustomization configCustomizationResource = new ConfigurationResourceCustomization();
+
+ Set<ConfigurationResourceCustomization> configResourceCustomizationSet = new HashSet<>();
+
+ configCustomizationResource.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ configCustomizationResource.setModelInstanceName(nodeTemplate.getName());
+
+ configCustomizationResource.setNfFunction(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "function"));
+ configCustomizationResource.setNfRole(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "role"));
+ configCustomizationResource.setNfType(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(nodeTemplate, "type"));
+ configCustomizationResource.setConfigResourceCustomization(configCustomizationResource);
+ configCustomizationResource.setConfigurationResource(configResource);
+ configResourceCustomizationSet.add(configCustomizationResource);
+ configResource.setConfigurationResourceCustomization(configResourceCustomizationSet);
+
+ return configCustomizationResource;
+ }
protected void createToscaCsar(ToscaResourceStructure toscaResourceStructure) {
ToscaCsar toscaCsar = new ToscaCsar();
@@ -761,6 +842,34 @@ public class ToscaResourceInstaller {
toscaResourceStructure.setCatalogToscaCsar(toscaCsar);
}
+
+ protected VnfcCustomization findExistingVfc(Set<VnfcCustomization> vnfcCustomizations, String customizationUUID) {
+ VnfcCustomization vnfcCustomization = null;
+ for(VnfcCustomization vnfcCustom : vnfcCustomizations){
+ if (vnfcCustom != null && vnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) {
+ vnfcCustomization = vnfcCustom;
+ }
+ }
+
+ if(vnfcCustomization==null)
+ vnfcCustomization = vnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
+
+ return vnfcCustomization;
+ }
+
+ protected CvnfcCustomization findExistingCvfc(Set<CvnfcCustomization> cvnfcCustomizations, String customizationUUID) {
+ CvnfcCustomization cvnfcCustomization = null;
+ for(CvnfcCustomization cvnfcCustom : cvnfcCustomizations){
+ if (cvnfcCustom != null && cvnfcCustom.getModelCustomizationUUID().equals(customizationUUID)) {
+ cvnfcCustomization = cvnfcCustom;
+ }
+ }
+
+ if(cvnfcCustomization==null)
+ cvnfcCustomization = cvnfcCustomizationRepo.findOneByModelCustomizationUUID(customizationUUID);
+
+ return cvnfcCustomization;
+ }
protected NetworkResourceCustomization createNetwork(NodeTemplate networkNodeTemplate,
ToscaResourceStructure toscaResourceStructure, HeatTemplate heatTemplate, String aicMax, String aicMin,Service service) {
@@ -1084,7 +1193,7 @@ public class ToscaResourceInstaller {
protected VfModuleCustomization createVFModuleResource(Group group, NodeTemplate nodeTemplate,
ToscaResourceStructure toscaResourceStructure, VfResourceStructure vfResourceStructure,
- IVfModuleData vfModuleData, VnfResourceCustomization vnfResource) {
+ IVfModuleData vfModuleData, VnfResourceCustomization vnfResource, Service service, Set<CvnfcCustomization> cvnfcCustomizations, Set<VnfcCustomization> vnfcCustomizations) {
VfModuleCustomization vfModuleCustomization = findExistingVfModuleCustomization(vnfResource,
vfModuleData.getVfModuleModelCustomizationUUID());
if(vfModuleCustomization == null){
@@ -1104,9 +1213,173 @@ public class ToscaResourceInstaller {
vfResourceStructure.setAlreadyDeployed(true);
}
+ //******************************************************************************************************************
+ //* Extract VFC's and CVFC's then add them to VFModule
+ //******************************************************************************************************************
+
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizations = new HashSet<VnfVfmoduleCvnfcConfigurationCustomization>();
+
+ // Extract CVFC lists
+ List<NodeTemplate> cvfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CVFC);
+
+ for(NodeTemplate cvfcTemplate : cvfcList) {
+
+ CvnfcCustomization existingCvnfcCustomization = findExistingCvfc(cvnfcCustomizations, cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if(existingCvnfcCustomization == null){
+
+ //Extract associated VFC - Should always be just one
+ List<NodeTemplate> vfcList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
+
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ VnfcCustomization existingVnfcCustomization = null;
+
+ for(NodeTemplate vfcTemplate : vfcList) {
+
+ existingVnfcCustomization = findExistingVfc(vnfcCustomizations, vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+
+ if(existingVnfcCustomization == null){
+ vnfcCustomization.setModelCustomizationUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vnfcCustomization.setModelInstanceName(vfcTemplate.getName());
+ vnfcCustomization.setModelInvariantUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ vnfcCustomization.setModelName(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ vnfcCustomization.setModelUUID(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ vnfcCustomization.setModelVersion(
+ testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ vnfcCustomization.setDescription(
+ testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ vnfcCustomization.setToscaNodeType(testNull(vfcTemplate.getType()));
+
+ vnfcCustomizations.add(vnfcCustomization);
+ }
+
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ cvnfcCustomization.setModelInstanceName(cvfcTemplate.getName());
+ cvnfcCustomization.setModelInvariantUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ cvnfcCustomization.setModelName(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ cvnfcCustomization.setModelUUID(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ cvnfcCustomization.setModelVersion(
+ testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ cvnfcCustomization.setDescription(
+ testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ cvnfcCustomization.setToscaNodeType(testNull(cvfcTemplate.getType()));
+
+ if(existingVnfcCustomization != null){
+ cvnfcCustomization.setVnfcCustomization(existingVnfcCustomization);
+ }else{
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+ }
+
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+ cvnfcCustomization.setVnfResourceCustomization(vnfResource);
+
+ cvnfcCustomizations.add(cvnfcCustomization);
+
+ //*****************************************************************************************************************************************
+ //* Extract Fabric Configuration
+ //*****************************************************************************************************************************************
+
+ List<NodeTemplate> fabricConfigList = toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(nodeTemplate, SdcTypes.CONFIGURATION);
+
+ for(NodeTemplate fabricTemplate : fabricConfigList) {
+
+ ConfigurationResource fabricConfig = null;
+
+ ConfigurationResource existingConfig = findExistingConfiguration(service, fabricTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+
+ if(existingConfig == null){
+
+ ConfigurationResourceCustomization fabricConfigCustomization = createFabricConfiguration(fabricTemplate, toscaResourceStructure);
+
+ fabricConfig = fabricConfigCustomization.getConfigurationResource();
+
+ service.getConfigurationCustomizations().add(fabricConfigCustomization);
+ }else {
+ fabricConfig = existingConfig;
+ }
+
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = createVfCnvfConfigCustomization(fabricTemplate, toscaResourceStructure,
+ vnfResource, vfModuleCustomization, cvnfcCustomization, fabricConfig);
+
+ vnfVfmoduleCvnfcConfigurationCustomizations.add(vnfVfmoduleCvnfcConfigurationCustomization);
+ }
+
+ }
+
+ }
+
+ }
+
+ vfModuleCustomization.setCvnfcCustomization(cvnfcCustomizations);
+ vfModuleCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizations);
+
return vfModuleCustomization;
}
+ protected VnfVfmoduleCvnfcConfigurationCustomization createVfCnvfConfigCustomization(NodeTemplate fabricTemplate, ToscaResourceStructure toscaResourceStruct,
+ VnfResourceCustomization vnfResource, VfModuleCustomization vfModuleCustomization, CvnfcCustomization cvnfcCustomization,
+ ConfigurationResource configResource) {
+
+ Metadata fabricMetadata = fabricTemplate.getMetaData();
+
+
+ VnfVfmoduleCvnfcConfigurationCustomization vfModuleToCvnfc = new VnfVfmoduleCvnfcConfigurationCustomization();
+
+ vfModuleToCvnfc.setConfigurationResource(configResource);
+ vfModuleToCvnfc.setCvnfcCustomization(cvnfcCustomization);
+ vfModuleToCvnfc.setModelCustomizationUUID(fabricMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ vfModuleToCvnfc.setModelInstanceName(fabricTemplate.getName());
+ vfModuleToCvnfc.setVfModuleCustomization(vfModuleCustomization);
+ vfModuleToCvnfc.setVnfResourceCustomization(vnfResource);
+ vfModuleToCvnfc.setPolicyName(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, "name"));
+
+ List<Policy> policyList = toscaResourceStruct.getSdcCsarHelper().getPoliciesOfTarget(fabricTemplate);
+
+ if(policyList != null){
+ for(Policy policy : policyList){
+ vfModuleToCvnfc.setPolicyName(policy.getName());
+ }
+ }
+
+ vfModuleToCvnfc.setConfigurationFunction(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ vfModuleToCvnfc.setConfigurationRole(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ vfModuleToCvnfc.setConfigurationType(toscaResourceStruct.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(fabricTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+
+ return vfModuleToCvnfc;
+ }
+
+ protected ConfigurationResource findExistingConfiguration(Service service, String modelUUID) {
+ ConfigurationResource configResource = null;
+ for(ConfigurationResourceCustomization configurationResourceCustom : service.getConfigurationCustomizations()){
+ if (configurationResourceCustom.getConfigurationResource() != null
+ && configurationResourceCustom.getConfigurationResource().getModelUUID().equals(modelUUID)) {
+ configResource = configurationResourceCustom.getConfigurationResource();
+ }
+ }
+ if(configResource==null)
+ configResource = configRepo.findResourceByModelUUID(modelUUID);
+
+ return configResource;
+ }
+
+ protected ServiceProxyResource findExistingServiceProxyResource(List<ServiceProxyResourceCustomization> serviceProxyList, String modelUUID) {
+ ServiceProxyResource serviceProxyResource = null;
+ for(ServiceProxyResourceCustomization serviceProxyResourceCustom : serviceProxyList){
+ if (serviceProxyResourceCustom.getServiceProxyResource() != null
+ && serviceProxyResourceCustom.getServiceProxyResource().getModelUUID().equals(modelUUID)) {
+ serviceProxyResource = serviceProxyResourceCustom.getServiceProxyResource();
+ }
+ }
+ if(serviceProxyResource==null)
+ serviceProxyResource = serviceProxyRepo.findResourceByModelUUID(modelUUID);
+
+ return serviceProxyResource;
+ }
+
protected VfModuleCustomization findExistingVfModuleCustomization(VnfResourceCustomization vnfResource,
String vfModuleModelCustomizationUUID) {
VfModuleCustomization vfModuleCustomization = null;
@@ -1210,6 +1483,7 @@ public class ToscaResourceInstaller {
protected void setHeatInformationForVfModule(ToscaResourceStructure toscaResourceStructure,
VfResourceStructure vfResourceStructure, VfModule vfModule, VfModuleCustomization vfModuleCustomization,
Metadata vfMetadata) {
+
Optional<VfModuleStructure> matchingObject = vfResourceStructure.getVfModuleStructure().stream()
.filter(vfModuleStruct -> vfModuleStruct.getVfModuleMetadata().getVfModuleModelUUID()
.equalsIgnoreCase(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
index fdeddf1f68..32f512b0f0 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
@@ -39,9 +39,9 @@ import org.onap.so.db.catalog.beans.HeatTemplateParam;
public class YamlEditor {
- private static final String REFER_PATTERN = "file:///";
- private Map <String, Object> yml;
- private Yaml yaml = new Yaml ();
+ protected static final String REFER_PATTERN = "file:///";
+ protected Map <String, Object> yml;
+ protected Yaml yaml = new Yaml ();
public YamlEditor () {
@@ -52,7 +52,7 @@ public class YamlEditor {
}
@SuppressWarnings("unchecked")
- private synchronized void init (byte[] body) {
+ protected synchronized void init (byte[] body) {
InputStream input = new ByteArrayInputStream (body);
yml = (Map <String, Object>) yaml.load (input);
}
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index f8f32b7005..0372887f15 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -771,6 +771,78 @@ FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup`
ON DELETE CASCADE ON UPDATE CASCADE)
ENGINE = InnoDB DEFAULT CHARACTER SET = latin1;
+CREATE TABLE IF NOT EXISTS vnfc_customization (
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`))
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS cvnfc_customization (
+`ID` INT(11) NOT NULL AUTO_INCREMENT,
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`NFC_FUNCTION` VARCHAR(200) NULL,
+`NFC_NAMING_CODE` VARCHAR(200) NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
+
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
@@ -1036,4 +1108,4 @@ create table if not exists model (
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
ALTER TABLE `catalogdb`.`vnf_recipe`
-CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ; \ No newline at end of file
+CHANGE COLUMN `VNF_TYPE` `NF_ROLE` VARCHAR(200) NULL DEFAULT NULL ;
diff --git a/bpmn/MSOCommonBPMN/pom.xml b/bpmn/MSOCommonBPMN/pom.xml
index dfb6af793c..532c062ea7 100644
--- a/bpmn/MSOCommonBPMN/pom.xml
+++ b/bpmn/MSOCommonBPMN/pom.xml
@@ -134,6 +134,17 @@
</configuration>
</execution>
<execution>
+ <id>non-spring-tests</id>
+ <goals>
+ <goal>test</goal>
+ </goals>
+ <configuration>
+ <includes>
+ <include>**/NonSpringSuite.java</include>
+ </includes>
+ </configuration>
+ </execution>
+ <execution>
<id>groovy-tests</id>
<goals>
<goal>test</goal>
@@ -217,15 +228,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
-
-
<dependency>
<!-- Needed for InMemoryH2Test -->
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
-
<dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
@@ -247,6 +255,7 @@
<dependency>
<groupId>org.onap.so</groupId>
<artifactId>mso-requests-db</artifactId>
+ <classifier>client</classifier>
<version>${project.version}</version>
</dependency>
<dependency>
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
index f1c2c8dda6..deae46ce98 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
@@ -21,8 +21,10 @@
package org.onap.so.bpmn.common;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
+import org.onap.so.client.aai.AAIQueryClient;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.AAIResultWrapper;
+import org.onap.so.client.policy.PolicyClientImpl;
import org.onap.so.client.sdno.SDNOValidator;
import org.onap.so.client.sdno.SDNOValidatorImpl;
import org.springframework.stereotype.Component;
@@ -46,6 +48,10 @@ public class InjectionHelper {
return new AAIResourcesClient();
}
+ public AAIQueryClient getAaiQueryClient() {
+ return new AAIQueryClient();
+ }
+
public SDNOValidator getSdnoValidator() {
return new SDNOValidatorImpl();
}
@@ -57,4 +63,8 @@ public class InjectionHelper {
public AAIResultWrapper getAaiResultWrapper(String json) {
return new AAIResultWrapper(json);
}
+
+ public PolicyClientImpl getPolicyClient() {
+ return new PolicyClientImpl();
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
index 50137cf985..c3511e69a4 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.client.sdnc;
+package org.onap.so.bpmn.common.baseclient;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index ca2da772fb..fe6b0f8b4e 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -57,7 +57,7 @@ public class ResourceRequestBuilder {
public static String CUSTOMIZATION_UUID = "customizationUUID";
- public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar?serviceModelUuid=";
+ public static String SERVICE_URL_TOSCA_CSAR = "/v3/serviceToscaCsar";
private static MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, ResourceRequestBuilder.class);
@@ -184,7 +184,7 @@ public class ResourceRequestBuilder {
private static String getCsarFromUuid(String uuid) throws Exception {
String catalogEndPoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint");
- HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint + SERVICE_URL_TOSCA_CSAR + uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB);
+ HttpClient client = new HttpClient(UriBuilder.fromUri(catalogEndPoint).path(SERVICE_URL_TOSCA_CSAR).queryParam("serviceModelUuid", uuid).build().toURL(), "application/json", TargetEntity.CATALOG_DB);
Response response = client.get();
String value = response.readEntity(String.class);
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 17bd4f545b..ba3ab7f315 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
@@ -139,8 +139,28 @@ public class GenericVnf implements Serializable, ShallowCopy<GenericVnf> {
private List<InstanceGroup> instanceGroups = new ArrayList<InstanceGroup>();
@JsonProperty("call-homing")
private Boolean callHoming;
+ @JsonProperty("nf-function")
+ private String nfFunction;
+ @JsonProperty("nf-role")
+ private String nfRole;
+ public String getNfFunction() {
+ return nfFunction;
+ }
+
+ public void setNfFunction(String nfFunction) {
+ this.nfFunction = nfFunction;
+ }
+
+ public String getNfRole() {
+ return nfRole;
+ }
+
+ public void setNfRole(String nfRole) {
+ this.nfRole = nfRole;
+ }
+
public List<InstanceGroup> getInstanceGroups() {
return instanceGroups;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
new file mode 100644
index 0000000000..8f0ced955c
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java
@@ -0,0 +1,55 @@
+/*-
+ * ============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.servicedecomposition.entities;
+
+import java.io.Serializable;
+
+public class ConfigurationResourceKeys implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = 1L;
+ private String vfModuleCustomizationUUID;
+ private String vnfResourceCustomizationUUID;
+ private String cvnfcCustomizationUUID;
+
+ public String getVfModuleCustomizationUUID() {
+ return vfModuleCustomizationUUID;
+ }
+ public void setVfModuleCustomizationUUID(String vfModuleCustomizationUUID) {
+ this.vfModuleCustomizationUUID = vfModuleCustomizationUUID;
+ }
+ public String getVnfResourceCustomizationUUID() {
+ return vnfResourceCustomizationUUID;
+ }
+ public void setVnfResourceCustomizationUUID(String vnfResourceCustomizationUUID) {
+ this.vnfResourceCustomizationUUID = vnfResourceCustomizationUUID;
+ }
+ public String getCvnfcCustomizationUUID() {
+ return cvnfcCustomizationUUID;
+ }
+ public void setCvnfcCustomizationUUID(String cvnfcCustomizationUUID) {
+ this.cvnfcCustomizationUUID = cvnfcCustomizationUUID;
+ }
+
+
+}
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 0d04b5e7a1..be73b37f85 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
@@ -39,6 +39,7 @@ public class ExecuteBuildingBlock implements Serializable{
private Boolean homing;
private WorkflowResourceIds workflowResourceIds;
private RequestDetails requestDetails;
+ private ConfigurationResourceKeys configurationResourceKeys;
public BuildingBlock getBuildingBlock() {
return buildingBlock;
@@ -100,4 +101,10 @@ public class ExecuteBuildingBlock implements Serializable{
public void setRequestDetails(RequestDetails requestDetails) {
this.requestDetails = requestDetails;
}
+ public ConfigurationResourceKeys getConfigurationResourceKeys() {
+ return configurationResourceKeys;
+ }
+ public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ this.configurationResourceKeys = configurationResourceKeys;
+ }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
index 9d3aa5934b..87168107e1 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
@@ -34,6 +34,8 @@ public class ModelInfoConfiguration implements Serializable{
private String modelVersionId;
@JsonProperty("model-customization-id")
private String modelCustomizationId;
+ @JsonProperty("policy-name")
+ private String policyName;
public String getModelInvariantId() {
return modelInvariantId;
@@ -53,4 +55,10 @@ public class ModelInfoConfiguration implements Serializable{
public void setModelCustomizationId(String modelCustomizationId) {
this.modelCustomizationId = modelCustomizationId;
}
+ public String getPolicyName() {
+ return policyName;
+ }
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
}
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 e8e1982911..fc48996b9b 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
@@ -49,6 +49,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -71,6 +72,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.logger.MsoLogger;
@@ -267,32 +269,24 @@ public class BBInputSetup implements JavaDelegate {
}
protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName) {
- boolean foundByName = false;
- boolean foundById = false;
- for (Configuration configuration : serviceInstance.getConfigurations()) {
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys) {
+ Configuration configuration = null;
+ for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null
- && configuration.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
- foundById = true;
+ && configurationTemp.getConfigurationId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
+ configuration = configurationTemp;
org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
if(aaiConfiguration!=null){
modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
}
- this.mapCatalogConfiguration(configuration, modelInfo, service);
- } else if (instanceName != null && configuration.getConfigurationName().equalsIgnoreCase(instanceName)) {
- foundByName = true;
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configuration.getConfigurationId());
- org.onap.aai.domain.yang.Configuration aaiConfiguration = bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
- if(aaiConfiguration!=null){
- modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
- }
- this.mapCatalogConfiguration(configuration, modelInfo, service);
}
}
- if (!foundByName && !foundById && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
- Configuration configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
+ if (configuration == null && bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())) {
+ configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
serviceInstance.getConfigurations().add(configuration);
- this.mapCatalogConfiguration(configuration, modelInfo, service);
+ }
+ if(configuration != null) {
+ this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
}
}
@@ -306,11 +300,28 @@ public class BBInputSetup implements JavaDelegate {
return configuration;
}
- protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service) {
+ protected void mapCatalogConfiguration(Configuration configuration, ModelInfo modelInfo, Service service, ConfigurationResourceKeys configurationResourceKeys) {
ConfigurationResourceCustomization configurationResourceCustomization = findConfigurationResourceCustomization(modelInfo, service);
- if (configurationResourceCustomization != null) {
- configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization));
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization =
+ findVnfVfmoduleCvnfcConfigurationCustomization(configurationResourceKeys.getVfModuleCustomizationUUID(),
+ configurationResourceKeys.getVnfResourceCustomizationUUID(), configurationResourceKeys.getCvnfcCustomizationUUID(), configurationResourceCustomization);
+ if (configurationResourceCustomization != null && vnfVfmoduleCvnfcConfigurationCustomization != null) {
+ configuration.setModelInfoConfiguration(this.mapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization
+ , vnfVfmoduleCvnfcConfigurationCustomization));
+ }
+ }
+
+ protected VnfVfmoduleCvnfcConfigurationCustomization findVnfVfmoduleCvnfcConfigurationCustomization(String vfModuleCustomizationUUID,
+ String vnfResourceCustomizationUUID, String cvnfcCustomizationUUID, ConfigurationResourceCustomization configurationResourceCustomization) {
+ for(VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization :
+ configurationResourceCustomization.getConfigurationResource().getVnfVfmoduleCvnfcConfigurationCustomization()) {
+ if(vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equalsIgnoreCase(vfModuleCustomizationUUID)
+ && vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equalsIgnoreCase(vnfResourceCustomizationUUID)
+ && vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equalsIgnoreCase(cvnfcCustomizationUUID)) {
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
}
+ return null;
}
protected ConfigurationResourceCustomization findConfigurationResourceCustomization(ModelInfo modelInfo, Service service) {
@@ -879,7 +890,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(!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink())) {
+ if((!Boolean.TRUE.equals(executeBB.getBuildingBlock().getIsVirtualLink()))) {
NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
if (networkCust != null) {
networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
@@ -890,18 +901,19 @@ public class BBInputSetup implements JavaDelegate {
}
} else {
msoLogger.debug("Orchestrating on Collection Network Resource Customization");
- serviceInstance.getNetworks().add(getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId));
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
+ L3Network l3Network = getVirtualLinkL3Network(lookupKeyMap, bbName, key, networkId, collectionNetworkResourceCust, serviceInstance);
+ NetworkResourceCustomization networkResourceCustomization =
+ mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
+ if(l3Network != null) {
+ l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
+ }
}
} else if(bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(key);
- ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service);
- if(configurationCust != null) {
- this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null);
- } else {
- msoLogger.debug("Could not find a configuration customization with key: " + key);
- }
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys());
}
if (executeBB.getWorkflowResourceIds() != null) {
this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
@@ -911,15 +923,18 @@ public class BBInputSetup implements JavaDelegate {
}
protected L3Network getVirtualLinkL3Network(Map<ResourceKey, String> lookupKeyMap, String bbName, String key,
- String networkId) {
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = bbInputSetupUtils.getCatalogCollectionNetworkResourceCustByID(key);
- if(collectionNetworkResourceCust != null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
+ String networkId, CollectionNetworkResourceCustomization collectionNetworkResourceCust, ServiceInstance serviceInstance) {
+ if(collectionNetworkResourceCust != null) {
+ if((bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
|| bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
- NetworkResourceCustomization networkResourceCustomization =
- mapperLayer.mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
- L3Network l3Network = createNetwork(lookupKeyMap, null, networkId, null);
- l3Network.setModelInfoNetwork(mapperLayer.mapCatalogNetworkToNetwork(networkResourceCustomization));
- return l3Network;
+ serviceInstance.getNetworks().add(createNetwork(lookupKeyMap, null, networkId, null));
+ } else {
+ for (L3Network network : serviceInstance.getNetworks()) {
+ if (network.getNetworkId().equalsIgnoreCase(networkId)) {
+ return network;
+ }
+ }
+ }
}
return null;
}
@@ -1019,7 +1034,7 @@ public class BBInputSetup implements JavaDelegate {
.getModelCustomizationId();
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationUuid(configurationCustUUID);
- this.mapCatalogConfiguration(configuration, modelInfo, service);
+ this.mapCatalogConfiguration(configuration, modelInfo, service, executeBB.getConfigurationResourceKeys());
break;
}
}
@@ -1087,7 +1102,7 @@ public class BBInputSetup implements JavaDelegate {
configurationModelInfo.setModelCustomizationUuid(key);
ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service);
if(configurationCust != null) {
- this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null);
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys());
} else {
msoLogger.debug("Could not find a configuration customization with key: " + key);
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
index c2161a4fee..877d5bb88f 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
@@ -76,6 +76,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -454,11 +455,13 @@ public class BBInputSetupMapperLayer {
}
protected ModelInfoConfiguration mapCatalogConfigurationToConfiguration(
- ConfigurationResourceCustomization configurationResourceCustomization) {
+ ConfigurationResourceCustomization configurationResourceCustomization,
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization) {
ModelInfoConfiguration modelInfoConfiguration = new ModelInfoConfiguration();
modelInfoConfiguration.setModelVersionId(configurationResourceCustomization.getConfigurationResource().getModelUUID());
modelInfoConfiguration.setModelCustomizationId(configurationResourceCustomization.getModelCustomizationUUID());
modelInfoConfiguration.setModelInvariantId(configurationResourceCustomization.getConfigurationResource().getModelInvariantUUID());
+ modelInfoConfiguration.setPolicyName(vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName());
return modelInfoConfiguration;
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index 4b85538428..84ecfc7576 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -45,7 +45,7 @@ import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
-import org.onap.so.client.db.request.RequestsDbClient;
+
import org.onap.so.client.graphinventory.entities.uri.Depth;
import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
@@ -54,6 +54,7 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java
deleted file mode 100644
index 61869ca322..0000000000
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java
+++ /dev/null
@@ -1,86 +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.db.request;
-
-import java.io.IOException;
-import java.net.URI;
-
-import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpRequest;
-import org.springframework.http.client.ClientHttpRequestExecution;
-import org.springframework.http.client.ClientHttpRequestInterceptor;
-import org.springframework.http.client.ClientHttpResponse;
-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;
-
-@Component("RequestDbClient")
-public class RequestsDbClient {
-
- private Client<InfraActiveRequests> infraActiveRequestClient;
-
- @Value("${mso.adapters.db.spring.endpoint}")
- private String endpoint;
-
- @Value("${mso.db.auth}")
- private String msoAdaptersAuth;
-
- public RequestsDbClient() {
- ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() {
-
- public void configure(RestTemplate restTemplate) {
-
- restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
-
- public ClientHttpResponse intercept(HttpRequest request, byte[] body,
- ClientHttpRequestExecution execution) throws IOException {
-
- request.getHeaders().add("Authorization", msoAdaptersAuth);
- return execution.execute(request, body);
- }
- });
- }
- }).build().buildClientFactory();
- infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class);
-
- }
-
- public InfraActiveRequests getInfraActiveRequestbyRequestId(String requestId) {
- return this.getSingleInfraActiveRequests(this.getUri(endpoint + "/infraActiveRequests/" + requestId));
- }
-
- protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) {
- return infraActiveRequestClient.get(uri);
- }
-
- public void updateInfraActiveRequests(InfraActiveRequests request) {
- infraActiveRequestClient.put(request);
- }
-
- protected URI getUri(String uri) {
- return URI.create(uri);
- }
-}
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
index 768bee578c..64283d78ca 100644
--- 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
@@ -1,3 +1,23 @@
+/*-
+ * ============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.openecomp.mso.bpmn.common.workflow.service;
import org.onap.so.bpmn.common.workflow.context.WorkflowResponse;
diff --git a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
index 31a981729b..67bd961844 100644
--- a/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
+++ b/bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.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="_EsMs0HcuEeW2U_kkOHX1ZQ" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.7.1" 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="_EsMs0HcuEeW2U_kkOHX1ZQ" 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="CompleteMsoProcess" name="CompleteMsoProcess" isExecutable="true">
<bpmn2:scriptTask id="preProcessRequest" name="Pre-Process Request" scriptFormat="groovy">
<bpmn2:incoming>SequenceFlow_18</bpmn2:incoming>
@@ -101,6 +101,7 @@ buildDataErrorMessage.buildDataError(execution, "Complete MSO -- Update DB stat
<camunda:in source="mso-service-instance-id" target="mso-service-instance-id" />
<camunda:in variables="all" />
<camunda:out variables="all" />
+ <camunda:in businessKey="#{execution.processBusinessKey}" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_81</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_13qdn1s</bpmn2:outgoing>
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
index d2f1186ad0..119d3b1e2d 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
@@ -32,6 +32,7 @@ import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.model.bpmn.Bpmn;
import org.camunda.bpm.model.bpmn.BpmnModelInstance;
import org.junit.Before;
+import org.junit.experimental.categories.Category;
import org.junit.runner.RunWith;
import org.onap.so.bpmn.common.InjectionHelper;
import org.onap.so.bpmn.common.MockLoggerDelegate;
@@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupMapperLayer;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.test.categories.SpringAware;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.embedded.LocalServerPort;
@@ -62,6 +64,7 @@ import com.github.tomakehurst.wiremock.client.WireMock;
@ActiveProfiles("test")
@ContextConfiguration
@AutoConfigureWireMock(port = 0)
+@Category(SpringAware.class)
public abstract class BaseTest extends BuildingBlockTestDataSetup {
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
index a983193ca3..5be879560f 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
@@ -665,4 +665,27 @@ public class BuildingBlockTestDataSetup{
return ar;
}
+
+ public Configuration setConfiguration () {
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId");
+ ModelInfoConfiguration modelInfoConfig = new ModelInfoConfiguration();
+ modelInfoConfig.setModelCustomizationId("modelCustomizationId");
+ modelInfoConfig.setModelVersionId("modelVersionId");
+ modelInfoConfig.setModelInvariantId("modelInvariantId");
+ modelInfoConfig.setPolicyName("policyName");
+ config.setModelInfoConfiguration(modelInfoConfig);
+
+ List<Configuration> configurations = new ArrayList<>();
+ configurations.add(config);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
+ serviceInstance.setConfigurations(configurations);
+ return config;
+ }
} \ No newline at end of file
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
new file mode 100644
index 0000000000..ee2848cf3a
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java
@@ -0,0 +1,35 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so;
+
+import org.junit.runner.RunWith;
+import org.onap.so.test.categories.SpringAware;
+
+import com.googlecode.junittoolbox.ExcludeCategories;
+import com.googlecode.junittoolbox.SuiteClasses;
+import com.googlecode.junittoolbox.WildcardPatternSuite;
+
+@RunWith(WildcardPatternSuite.class)
+@ExcludeCategories({SpringAware.class})
+@SuiteClasses({"**/*Test.class", "!**/bpmn/common/scripts/**/*Test.class"})
+public class NonSpringSuite {
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
index ba8caee058..d1559c2ed1 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
@@ -22,8 +22,6 @@ package org.onap.so;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@@ -35,9 +33,7 @@ import org.springframework.context.annotation.Profile;
@Profile("test")
@EnableProcessApplication("MSO CommonBPMN Test Application")
@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class TestApplication {
public static void main(String... args) {
SpringApplication.run(TestApplication.class, args);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
index 514d93bdf8..45bbe9e5d8 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
@@ -29,9 +29,7 @@ import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -51,9 +49,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@EnableProcessApplication("MSO Common Application")
@EnableAsync
@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class MSOCommonApplication {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
index a564d8a21d..f84a76468f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java
@@ -1,9 +1,28 @@
-package org.onap.so.client.sdnc;
+/*-
+ * ============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.common.baseclient;
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.urlEqualTo;
-import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.options;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
@@ -11,25 +30,23 @@ import java.util.Map;
import javax.ws.rs.core.UriBuilder;
-import org.junit.Rule;
import org.junit.Test;
+import org.onap.so.BaseTest;
import org.springframework.core.ParameterizedTypeReference;
-import com.github.tomakehurst.wiremock.junit.WireMockRule;
+import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
import wiremock.org.apache.http.entity.ContentType;
-public class BaseClientTest {
-
- @Rule
- public WireMockRule wm = new WireMockRule(options().dynamicPort());
-
+
+public class BaseClientTest extends BaseTest {
+
@Test
public void verifyString() {
BaseClient<String, String> client = new BaseClient<>();
String response = "{\"hello\" : \"world\"}";
- client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString());
- wm.stubFor(get(urlEqualTo("/test"))
+ client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
+ stubFor(get(urlEqualTo("/test"))
.willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
String result = client.get("", new ParameterizedTypeReference<String>() {});
@@ -40,8 +57,8 @@ public class BaseClientTest {
public void verifyMap() {
BaseClient<String, Map<String, Object>> client = new BaseClient<>();
String response = "{\"hello\" : \"world\"}";
- client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(wm.port()).build().toString());
- wm.stubFor(get(urlEqualTo("/test"))
+ client.setTargetUrl(UriBuilder.fromUri("http://localhost/test").port(Integer.parseInt(wireMockPort)).build().toString());
+ stubFor(get(urlEqualTo("/test"))
.willReturn(aResponse().withStatus(200).withBody(response).withHeader("Content-Type", ContentType.APPLICATION_JSON.toString())));
Map<String, Object> result = client.get("", new ParameterizedTypeReference<Map<String, Object>>() {});
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java
index c7d1a7c81f..3b41ff8337 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -44,16 +44,6 @@ public class StubResponseAAI {
/**
- * Tunnel-XConnect Mock Stub Response
- */
- public static void MockPutTunnelXConnect(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String tunnelId){
- stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "/tunnel-xconnects/tunnel-xconnect/" + tunnelId))
- .willReturn(aResponse()
- .withStatus(200)));
- }
-
-
- /**
* Allotted Resource Mock StubResponses below
*/
public static void MockGetAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String responseFile) {
@@ -63,7 +53,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockPutAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
stubFor(put(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
.willReturn(aResponse()
@@ -75,13 +65,13 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(500)));
}
-
+
public static void MockDeleteAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId, String resourceVersion) {
stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId + "[?]resource-version=" + resourceVersion))
.willReturn(aResponse()
.withStatus(204)));
}
-
+
public static void MockPatchAllottedResource(String globalCustId, String subscriptionType, String serviceInstanceId, String allottedResourceId) {
stubFor(patch(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType + "/service-instances/service-instance/" + serviceInstanceId + "/allotted-resources/allotted-resource/" + allottedResourceId))
.willReturn(aResponse()
@@ -183,26 +173,26 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(204)));
}
-
+
public static void MockGetServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
.willReturn(aResponse()
.withStatus(statusCode)));
}
-
+
public static void MockGetServiceInstance(String customer, String serviceSubscription, int statusCode){
stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription))
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")));
}
-
+
public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String serviceInstanceId, String resourceVersion, int statusCode){
stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "/service-instances/service-instance/" + serviceInstanceId + "[?]resource-version=" + resourceVersion))
.willReturn(aResponse()
.withStatus(statusCode)));
}
-
+
public static void MockDeleteServiceInstance(String customer, String serviceSubscription, String resourceVersion, int statusCode){
stubFor(delete(urlMatching("/aai/v[0-9]+/business/customers/customer/" + customer + "/service-subscriptions/service-subscription/" + serviceSubscription + "[?]resource-version=" +1234))
.willReturn(aResponse()
@@ -263,7 +253,7 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(200)));
}
-
+
public static void MockGetServiceSubscription(String globalCustId, String subscriptionType, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/business/customers/customer/" + globalCustId + "/service-subscriptions/service-subscription/" + subscriptionType))
.willReturn(aResponse()
@@ -303,7 +293,7 @@ public class StubResponseAAI {
/**
* Generic-Vnf Mock StubResponses below
*/
-
+
public static void MockGetGenericVnfById(String vnfId, String responseFile){
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "[?]depth=1"))
.willReturn(aResponse()
@@ -311,7 +301,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetGenericVnfById(String vnfId, String responseFile, int statusCode){
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
.willReturn(aResponse()
@@ -319,23 +309,23 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetGenericVnfByIdWithPriority(String vnfId, int statusCode, String responseFile) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
.atPriority(1)
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
+ .withBodyFile(responseFile)));
}
-
+
public static void MockGetGenericVnfByIdWithPriority(String vnfId, String vfModuleId, int statusCode, String responseFile, int priority) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
.atPriority(priority)
.willReturn(aResponse()
.withStatus(statusCode)
.withHeader("Content-Type", "text/xml")
- .withBodyFile(responseFile)));
+ .withBodyFile(responseFile)));
}
public static void MockGetGenericVnfByIdWithDepth(String vnfId, int depth, String responseFile){
@@ -345,7 +335,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetGenericVnfById_404(String vnfId){
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
.willReturn(aResponse()
@@ -366,7 +356,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetGenericVnfByNameWithDepth(String vnfName, int depth, String responseFile){
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf[?]vnf-name=" + vnfName + "[&]depth=" + depth))
.willReturn(aResponse()
@@ -404,7 +394,7 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(200)));
}
-
+
public static void MockPutGenericVnf(String vnfId, String requestBodyContaining, int statusCode) {
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf" + vnfId))
.withRequestBody(containing(requestBodyContaining))
@@ -417,7 +407,7 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(statusCode)));
}
-
+
public static void MockPutGenericVnf_Bad(String vnfId, int statusCode){
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId))
.willReturn(aResponse()
@@ -459,7 +449,7 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(200)));
}
-
+
public static void MockGetGenericVceByNameWithDepth(String vnfName, int depth, String responseFile){
stubFor(get(urlMatching("/aai/v[0-9]+/network/vces/vce[?]vnf-name=" + vnfName + "[&]depth=" + depth))
.willReturn(aResponse()
@@ -505,7 +495,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkByIdWithDepth(String networkId, String responseFile, String depth) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/" + networkId + "[?]depth=" + depth))
.willReturn(aResponse()
@@ -513,7 +503,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkCloudRegion(String responseFile, String cloudRegion) {
stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
.willReturn(aResponse()
@@ -521,7 +511,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkByName(String networkName, String responseFile) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name="+networkName))
.willReturn(aResponse()
@@ -537,7 +527,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkCloudRegion_404(String cloudRegion) {
stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegion))
.willReturn(aResponse()
@@ -551,7 +541,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockPutNetwork(String networkPolicyId, String responseFile, int statusCode) {
stubFor(put(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicyId))
.willReturn(aResponse()
@@ -559,7 +549,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkName(String networkPolicyName, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network[?]network-name=" + networkPolicyName))
.willReturn(aResponse()
@@ -574,8 +564,8 @@ public class StubResponseAAI {
.withStatus(200)
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
- }
-
+ }
+
public static void MockGetNetworkPolicy(String responseFile, String policy) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/"+policy + "[?]depth=all"))
.willReturn(aResponse()
@@ -583,7 +573,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkVpnBinding(String networkBindingId, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/vpn-bindings/vpn-binding/" + networkBindingId))
.willReturn(aResponse()
@@ -591,7 +581,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkPolicy(String networkPolicy, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/" + networkPolicy))
.willReturn(aResponse()
@@ -599,7 +589,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkTableReference(String responseFile, String tableReference) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/"+tableReference + "[?]depth=all"))
.willReturn(aResponse()
@@ -607,7 +597,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockPutNetworkIdWithDepth(String responseFile, String networkId, String depth) {
stubFor(put(urlMatching("/aai/v[0-9]+/network/l3-networks/l3-network/"+networkId+"[?]depth="+depth ))
.willReturn(aResponse()
@@ -615,7 +605,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkPolicyfqdn(String networkPolicy, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy[?]network-policy-fqdn=" + networkPolicy))
.willReturn(aResponse()
@@ -623,7 +613,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetNetworkRouteTable(String networkRouteId, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/route-table-references/route-table-reference/" + networkRouteId))
.willReturn(aResponse()
@@ -631,15 +621,15 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockPatchVfModuleId(String vnfId, String vfModuleId) {
stubFor(patch(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
.willReturn(aResponse()
.withStatus(200)));
}
-
+
/////////////
-
+
public static void MockVNFAdapterRestVfModule() {
stubFor(put(urlEqualTo("/vnfs/v1/vnfs/skask/vf-modules/supercool"))
.willReturn(aResponse()
@@ -658,7 +648,7 @@ public class StubResponseAAI {
.withStatus(202)
.withHeader("Content-Type", "application/xml")));
}
-
+
public static void MockDBUpdateVfModule(){
stubFor(post(urlEqualTo("/dbadapters/RequestsDbAdapter"))
.willReturn(aResponse()
@@ -666,7 +656,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile("VfModularity/DBUpdateResponse.xml")));
}
-
+
// start of mocks used locally and by other VF Module unit tests
public static void MockSDNCAdapterVfModule() {
// simplified the implementation to return "success" for all requests
@@ -678,7 +668,7 @@ public class StubResponseAAI {
.withBodyFile("VfModularity/StandardSDNCSynchResponse.xml")));
}
-
+
// start of mocks used locally and by other VF Module unit tests
public static void MockAAIVfModule() {
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/supercool"))
@@ -686,7 +676,7 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(200)
.withHeader("Content-Type", "text/xml")
- .withBodyFile("VfModularity/VfModule-supercool.xml")));
+ .withBodyFile("VfModularity/VfModule-supercool.xml")));
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/skask/vf-modules/vf-module/lukewarm"))
.atPriority(2)
.willReturn(aResponse()
@@ -758,14 +748,14 @@ public class StubResponseAAI {
.withStatus(200)));
}
-
-
+
+
//////////////
/**
* Cloud infrastructure below
*/
-
+
public static void MockGetCloudRegion(String cloudRegionId, int statusCode, String responseFile) {
stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId))
.willReturn(aResponse()
@@ -773,14 +763,14 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
/**
* Volume Group StubResponse below
*/
public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile) {
MockGetVolumeGroupById(cloudRegionId, volumeGroupId, responseFile, 200);
}
-
+
public static void MockGetVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int responseCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
.willReturn(aResponse()
@@ -788,7 +778,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockPutVolumeGroupById(String cloudRegionId, String volumeGroupId, String responseFile, int statusCode) {
stubFor(put(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId))
.willReturn(aResponse()
@@ -796,7 +786,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetVolumeGroupByName(String cloudRegionId, String volumeGroupName, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups[?]volume-group-name=" + volumeGroupName))
.willReturn(aResponse()
@@ -804,7 +794,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockDeleteVolumeGroupById(String cloudRegionId, String volumeGroupId, String resourceVersion, int statusCode) {
stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
.willReturn(aResponse()
@@ -816,13 +806,13 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(404)));
}
-
+
public static void MockDeleteVolumeGroup(String cloudRegionId, String volumeGroupId, String resourceVersion) {
stubFor(delete(urlMatching("/aai/v[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/" + cloudRegionId + "/volume-groups/volume-group/" + volumeGroupId + "[?]resource-version=" + resourceVersion))
.willReturn(aResponse()
.withStatus(200)));
}
-
+
/**
* VF-Module StubResponse below
* @param statusCode TODO
@@ -834,7 +824,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetVfModuleByNameWithDepth(String vnfId, String vfModuleName, int depth, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName + "[?]depth=" + depth))
.willReturn(aResponse()
@@ -842,7 +832,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetVfModuleByName(String vnfId, String vfModuleName, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module[?]vf-module-name=" + vfModuleName))
.willReturn(aResponse()
@@ -850,7 +840,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "text/xml")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetVfModuleIdNoResponse(String vnfId, String requestContaining, String vfModuleId) {
stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
.withRequestBody(containing(requestContaining))
@@ -865,19 +855,19 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(200)));
}
-
+
public static void MockPutVfModuleId(String vnfId, String vfModuleId) {
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
.willReturn(aResponse()
.withStatus(200)));
}
-
+
public static void MockPutVfModuleId(String vnfId, String vfModuleId, int returnCode) {
stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId))
.willReturn(aResponse()
.withStatus(returnCode)));
}
-
+
public static void MockDeleteVfModuleId(String vnfId, String vfModuleId, String resourceVersion, int returnCode) {
stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/" + vnfId + "/vf-modules/vf-module/" + vfModuleId + "/[?]resource-version=" + resourceVersion))
.willReturn(aResponse()
@@ -889,7 +879,7 @@ public class StubResponseAAI {
.willReturn(aResponse()
.withStatus(statusCode)));
}
-
+
/* AAI Pserver Queries */
public static void MockGetPserverByVnfId(String vnfId, String responseFile, int statusCode) {
stubFor(put(urlMatching("/aai/v1[0-9]/query.*"))
@@ -898,7 +888,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "application/json")
.withBodyFile(responseFile)));
}
-
+
public static void MockGetGenericVnfsByVnfId(String vnfId, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
.willReturn(aResponse()
@@ -906,14 +896,14 @@ public class StubResponseAAI {
.withHeader("Content-Type", "application/json; charset=utf-8")
.withBodyFile(responseFile)));
}
-
+
public static void MockSetInMaintFlagByVnfId(String vnfId, int statusCode) {
stubFor(patch(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
.willReturn(aResponse()
- .withStatus(statusCode)
+ .withStatus(statusCode)
));
}
-
+
public static void MockSetInMaintFlagByVnfId(String vnfId, String responseFile, int statusCode) {
stubFor(post(urlMatching("/aai/v1[0-9]/network/generic-vnfs/.*"))
.willReturn(aResponse()
@@ -921,7 +911,7 @@ public class StubResponseAAI {
.withBodyFile(responseFile)
));
}
-
+
public static void MockGetDefaultCloudRegionByCloudRegionId(String cloudRegionId, String responseFile, int statusCode) {
stubFor(get(urlMatching("/aai/v1[0-9]+/cloud-infrastructure/cloud-regions/cloud-region/att-aic/"+cloudRegionId + ".*"))
.willReturn(aResponse()
@@ -929,7 +919,7 @@ public class StubResponseAAI {
.withHeader("Content-Type", "application/json; charset=utf-8")
.withBodyFile(responseFile)));
}
-
+
//// Deprecated Stubs below - to be deleted once unit test that reference them are refactored to use common ones above ////
@Deprecated
public static void MockGetVceById(){
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 c18dcf5cfa..33e1390b9c 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
@@ -65,12 +65,15 @@ import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
@@ -613,17 +616,23 @@ public class BBInputSetupMapperLayerTest {
String modelCustUUID = "modelCustomizationUUID";
String modelInvariantUUID = "modelInvariantUUID";
String modelVersionUUID = "modelUUID";
+ String policyName = "policyName";
ModelInfoConfiguration expected = new ModelInfoConfiguration();
expected.setModelCustomizationId(modelCustUUID);
expected.setModelInvariantId(modelInvariantUUID);
expected.setModelVersionId(modelVersionUUID);
+ expected.setPolicyName(policyName);
ConfigurationResourceCustomization configurationResourceCustomization = new ConfigurationResourceCustomization();
configurationResourceCustomization.setModelCustomizationUUID(modelCustUUID);
configurationResourceCustomization.setConfigurationResource(new ConfigurationResource());
configurationResourceCustomization.getConfigurationResource().setModelInvariantUUID(modelInvariantUUID);
configurationResourceCustomization.getConfigurationResource().setModelUUID(modelVersionUUID);
+ VnfVfmoduleCvnfcConfigurationCustomization policyNameTable = new VnfVfmoduleCvnfcConfigurationCustomization();
+ policyNameTable.setCvnfcCustomization(new CvnfcCustomization());
+ policyNameTable.getCvnfcCustomization().setVnfcCustomization(new VnfcCustomization());
+ policyNameTable.setPolicyName(policyName);
- ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization );
+ ModelInfoConfiguration actual = bbInputSetupMapperLayer.mapCatalogConfigurationToConfiguration(configurationResourceCustomization, policyNameTable);
assertThat(actual, sameBeanAs(expected));
}
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 489163b23a..9897c04ad8 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
@@ -66,6 +66,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceSubscription;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
@@ -1074,28 +1075,32 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
String bbName = AssignFlows.FABRIC_CONFIGURATION.toString();
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
- doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service);
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service);
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName);
- verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service);
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys);
instanceName = "configurationName2";
resourceId = "resourceId2";
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2");
Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId);
doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId);
- doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service);
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys);
SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- instanceName);
- verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service);
+ instanceName, configResourceKeys);
+ verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys);
}
@Test
@@ -1666,6 +1671,12 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId);
doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId());
@@ -1714,13 +1725,13 @@ public class BBInputSetupTest {
doReturn(configurationCustList).when(service).getConfigurationCustomizations();
configurationCustList.add(configurationCust);
doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class));
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class));
executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class));
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(String.class), isA(ConfigurationResourceKeys.class));
}
@Test
@@ -1793,6 +1804,7 @@ public class BBInputSetupTest {
doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class));
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
+ executeBB.getBuildingBlock().setIsVirtualLink(Boolean.FALSE);
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(any(ExecuteBuildingBlock.class), any(),
any(String.class), any(String.class), any(GeneralBuildingBlock.class), any(Service.class));
@@ -1998,6 +2010,13 @@ public class BBInputSetupTest {
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "serviceInstanceId");
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId");
+
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
String resourceId = "123";
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
@@ -2029,17 +2048,20 @@ public class BBInputSetupTest {
doReturn(networkResourceCustomization).when(bbInputSetupMapperLayer).mapCollectionNetworkResourceCustToNetworkResourceCust(collectionNetworkResourceCust);
ModelInfoNetwork modelInfoNetwork = Mockito.mock(ModelInfoNetwork.class);
doReturn(modelInfoNetwork ).when(bbInputSetupMapperLayer).mapCatalogNetworkToNetwork(networkResourceCustomization);
+
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
executeBB.getBuildingBlock().setIsVirtualLink(true);
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(2)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap,
executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service);
- executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.FABRIC_CONFIGURATION.toString());
- executeBB.getBuildingBlock().setKey("modelCustId");
+
+ executeBB.getBuildingBlock().setBpmnFlowName("CreateNetworkBB");
+ executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
+ executeBB.getBuildingBlock().setIsVirtualLink(true);
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), "modelCustId", gBB, service);
+ executeBB.getBuildingBlock().getBpmnFlowName(), "ab153b6e-c364-44c0-bef6-1f2982117f04", gBB, service);
}
@Test
@@ -2167,6 +2189,12 @@ public class BBInputSetupTest {
cloudConfiguration.setLcpCloudRegionId("cloudRegionId");
String requestAction = "unassignInstance";
+ ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
+ configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
+ configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
+ configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
+ executeBB.setConfigurationResourceKeys(configResourceKeys);
+
L3Network network = new L3Network();
network.setNetworkId("networkId");
gBB.getServiceInstance().getNetworks().add(network);
@@ -2241,13 +2269,14 @@ public class BBInputSetupTest {
org.onap.aai.domain.yang.Configuration aaiConfiguration = new org.onap.aai.domain.yang.Configuration();
aaiConfiguration.setModelCustomizationId("modelCustId");
doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId());
+ doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class), isA(Service.class), isA(ConfigurationResourceKeys.class));
executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class),
- any(Service.class));
+ any(Service.class), isA(ConfigurationResourceKeys.class));
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
index aa883b67a2..eb74ab804e 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
@@ -64,12 +64,13 @@ import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.graphinventory.entities.uri.Depth;
-import org.onap.so.client.db.request.RequestsDbClient;
+
import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
index 79cb33b7c4..2144f1c69a 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
@@ -20,12 +20,18 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
+import static org.hamcrest.CoreMatchers.any;
import static org.junit.Assert.assertEquals;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.eq;
import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import org.camunda.bpm.engine.delegate.BpmnError;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Before;
import org.junit.Test;
import org.onap.so.bpmn.core.WorkflowException;
@@ -76,8 +82,9 @@ public class ExecuteBuildlingBlockRainyDayTest extends BaseTest {
@Test
public void setRetryTimerExceptionTest() {
expectedException.expect(BpmnError.class);
-
- executeBuildingBlockRainyDay.setRetryTimer(null);
+ DelegateExecution execution = mock(DelegateExecution.class);
+ when(execution.getVariable(eq("retryCount"))).thenThrow(Exception.class);
+ executeBuildingBlockRainyDay.setRetryTimer(execution);
}
@Test
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
index 0992b59267..47e05831ad 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
@@ -34,7 +34,7 @@ public class GlobalDmaapPublisherTest extends BaseTest{
@Test
public void testGetters() {
assertEquals("dmaapUsername", globalDmaapPublisher.getUserName());
- assertEquals("dmaapPassword", globalDmaapPublisher.getPassword());
+ assertEquals("ZG1hYXBQYXNzd29yZA==", globalDmaapPublisher.getPassword());
assertEquals("com.att.mso.asyncStatusUpdate", globalDmaapPublisher.getTopic());
assertEquals("http://localhost:" + wireMockPort, globalDmaapPublisher.getHost().get());
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
new file mode 100644
index 0000000000..21035fcd4d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java
@@ -0,0 +1,25 @@
+/*-
+ * ============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.test.categories;
+
+public interface SpringAware {
+ /* category marker */
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
index f039441738..236d435cb7 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
@@ -162,7 +162,7 @@ mso:
global:
dmaap:
username: dmaapUsername
- password: dmaapPassword
+ password: ZG1hYXBQYXNzd29yZA==
host: http://localhost:${wiremock.server.port}
publisher:
topic: com.att.mso.asyncStatusUpdate
diff --git a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
index d8f6ba3930..9088d1a844 100644
--- a/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
+++ b/bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
@@ -25,6 +25,6 @@
<appender-ref ref="STDOUT" />
</root>
- <logger name="wiremock.org" level="DEBUG" />
+ <logger name="wiremock.org" level="ERROR" />
</configuration> \ 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 ef72149d10..9ed36e5ba9 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
@@ -36,6 +36,7 @@ import javax.ws.rs.ext.Provider;
import org.camunda.bpm.engine.ProcessEngineServices;
import org.camunda.bpm.engine.variable.impl.VariableMapImpl;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
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;
@@ -110,7 +111,7 @@ public class WorkflowAsyncResource extends ProcessEngineAwareService {
@PathParam("processKey") String processKey, VariableMapImpl variableMap){
Map<String, Object> inputVariables = getInputVariables(variableMap);
try {
- MDC.put(MsoLogger.REQUEST_ID, getRequestId(inputVariables));
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, getRequestId(inputVariables));
processor.startProcess(processKey, variableMap);
WorkflowResponse response = waitForResponse(getRequestId(inputVariables));
return Response.status(202).entity(response).build();
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index c263fe636c..db2304d6b7 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -29,9 +29,7 @@ import org.camunda.bpm.application.ProcessApplicationInfo;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@@ -52,9 +50,7 @@ import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
@EnableProcessApplication("MSO Infrastructure Application")
@EnableAsync
@ComponentScan(basePackages = { "org.onap" }, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) })
public class MSOInfrastructureApplication {
private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
index 8ebc80c4c2..9dadb8b623 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
@@ -1487,7 +1487,7 @@ public abstract class WorkflowTest {
for(Resource resource:resourceList){
resourceId = resource.getResourceId();
}
- String homingList = getJsonValue(content, "solutionInfo.placement");
+ String homingList = getJsonValue(content, "solutionInfo.placementInfo");
JSONArray placementArr = null;
try {
placementArr = new JSONArray(homingList);
diff --git a/bpmn/pom.xml b/bpmn/pom.xml
index 9f004afe89..9368be1575 100644
--- a/bpmn/pom.xml
+++ b/bpmn/pom.xml
@@ -90,6 +90,11 @@
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</dependency>
+ <dependency>
+ <groupId>org.springframework.boot</groupId>
+ <artifactId>spring-boot-starter-data-jpa</artifactId>
+ <optional>true</optional>
+ </dependency>
</dependencies>
</project>
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java
index 314cc0b2de..d1559c2ed1 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java
@@ -20,14 +20,8 @@
package org.onap.so;
-import java.io.IOException;
-
-import javax.annotation.PreDestroy;
-
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@@ -35,15 +29,11 @@ import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Profile;
-import ch.vorburger.mariadb4j.MariaDB4jService;
-
@SpringBootApplication
@Profile("test")
@EnableProcessApplication("MSO CommonBPMN Test Application")
@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class TestApplication {
public static void main(String... args) {
SpringApplication.run(TestApplication.class, args);
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
index edf131d538..b22b90b0b4 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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;
diff --git a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
index 1c882e85d1..9553f72644 100644
--- a/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
+++ b/bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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;
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
index f11022dc08..ec8df3daa1 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License")
+ * 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
*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
index 63fd20eb2d..37c7d4d29a 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License")
+ * 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
*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
index d571c00f47..3d8b2571aa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
@@ -4,7 +4,7 @@
* ================================================================================
* Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved.
* ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License")
+ * 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
*
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
index df4698de9d..1585a7bb74 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
@@ -260,7 +260,7 @@ class DoCreateVnf extends AbstractServiceTaskProcessor {
if(resourceClient.exists(uri)){
Map<String, String> keys = uri.getURIKeys()
- execution.setVariable("globalCustomer", keys.get("global-customer-id"))
+ execution.setVariable("globalCustomerId", keys.get("global-customer-id"))
execution.setVariable("serviceType", keys.get("service-type"))
execution.setVariable("GENGS_siResourceLink", uri.build().toString())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
index fd844648fa..b13d7fc419 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
@@ -29,13 +29,10 @@ import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.GenericResour
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.HeaderUtil;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.NetworkRpcInputEntityBuilder;
import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationInputEntity;
-import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.entity.RpcNetworkTopologyOperationOutputEntity;
import org.onap.so.db.request.beans.ResourceOperationStatus;
import org.onap.so.db.request.beans.ResourceOperationStatusId;
-import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
import org.onap.so.logger.MsoLogger;
import org.onap.so.requestsdb.RequestsDbConstant;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
index 5bd3297c20..8bc9dce966 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
@@ -24,9 +24,6 @@ import org.apache.commons.lang3.StringUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.core.BaseTask;
import org.onap.so.db.request.beans.ResourceOperationStatus;
-import org.onap.so.db.request.beans.ResourceOperationStatusId;
-import org.onap.so.db.request.data.repository.ResourceOperationStatusRepository;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
diff --git a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
index 314cc0b2de..f9962c2630 100644
--- a/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
@@ -20,14 +20,8 @@
package org.onap.so;
-import java.io.IOException;
-
-import javax.annotation.PreDestroy;
-
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@@ -35,15 +29,11 @@ import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;
import org.springframework.context.annotation.Profile;
-import ch.vorburger.mariadb4j.MariaDB4jService;
-
@SpringBootApplication
@Profile("test")
@EnableProcessApplication("MSO CommonBPMN Test Application")
@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class) })
public class TestApplication {
public static void main(String... args) {
SpringApplication.run(TestApplication.class, args);
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 e534142471..887c51e179 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
@@ -24,6 +24,7 @@ import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.InstanceGroup;
@@ -40,6 +41,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -74,6 +76,8 @@ public class AAICreateTasks {
private AAINetworkResources aaiNetworkResources;
@Autowired
private AAIVpnBindingResources aaiVpnBindingResources;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void createServiceInstance(BuildingBlockExecution execution) {
try {
@@ -376,4 +380,13 @@ public class AAICreateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+
+ public void createConfiguration(BuildingBlockExecution execution){
+ try{
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.createConfiguration(configuration);
+ } 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/AAIDeleteTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
index cb265b6e41..a00806a19c 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
@@ -23,6 +23,7 @@ package org.onap.so.bpmn.infrastructure.aai.tasks;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -31,6 +32,7 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -56,6 +58,8 @@ public class AAIDeleteTasks {
private AAINetworkResources aaiNetworkResources;
@Autowired
private AAIVolumeGroupResources aaiVolumeGroupResources;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void deleteVfModule(BuildingBlockExecution execution) throws Exception {
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
@@ -133,4 +137,12 @@ public class AAIDeleteTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ public void deleteConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.deleteConfiguration(configuration);
+ } 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/AAIUpdateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
index b059a77641..58c51f6223 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
@@ -24,6 +24,7 @@ import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -35,6 +36,7 @@ import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
import org.onap.so.client.orchestration.AAIVfModuleResources;
@@ -64,6 +66,8 @@ public class AAIUpdateTasks {
private AAINetworkResources aaiNetworkResources;
@Autowired
private AAICollectionResources aaiCollectionResources;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
try {
@@ -394,4 +398,21 @@ public class AAIUpdateTasks {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
+ public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
+ try {
+ Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
+ } catch (Exception ex) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
} \ No newline at end of file
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 b2b071e1ee..57d097e87a 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
@@ -27,6 +27,7 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -36,21 +37,26 @@ import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
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.CvnfcCustomization;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -103,6 +109,8 @@ public class WorkflowAction {
private ExceptionBuilder exceptionBuilder;
@Autowired
private CatalogDbClient catalogDbClient;
+ @Autowired
+ private AAIConfigurationResources aaiConfigurationResources;
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
@@ -125,7 +133,6 @@ public class WorkflowAction {
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
List<Resource> resourceCounter = new ArrayList<>();
-
execution.setVariable("sentSyncResponse", false);
execution.setVariable("homing", false);
execution.setVariable("calledHoming", false);
@@ -212,7 +219,8 @@ public class WorkflowAction {
} else if (resourceType == WorkflowType.SERVICE
&& (requestAction.equalsIgnoreCase("activateInstance")
|| requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("deleteInstance"))) {
+ || requestAction.equalsIgnoreCase("deleteInstance")
+ || requestAction.equalsIgnoreCase("activateFabricConfiguration"))) {
// SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
// SERVICE-MACRO-DELETE
// Will never get user params with service, macro will have
@@ -230,7 +238,7 @@ public class WorkflowAction {
foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
}
msoLogger.info("Found " + foundObjects);
-
+
if (orchFlows == null || orchFlows.isEmpty()) {
orchFlows = queryNorthBoundRequestCatalogDb(execution, requestAction, resourceType, aLaCarte);
}
@@ -267,7 +275,6 @@ public class WorkflowAction {
execution.setVariable("flowsToExecute", flowsToExecute);
} catch (Exception ex) {
- msoLogger.error(ex);
buildAndThrowException(execution, "Exception in create execution list " + ex.getMessage(), ex);
}
}
@@ -278,7 +285,7 @@ public class WorkflowAction {
if(resource.isBaseVfModule()){
Collections.swap(vfModuleResources, 0, count);
break;
- }
+ }
count++;
}
return vfModuleResources;
@@ -294,7 +301,7 @@ public class WorkflowAction {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null);
- }
+ }
});
}
@@ -317,7 +324,7 @@ public class WorkflowAction {
.collect(Collectors.toList()).get(i);
updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); }
});
- }
+ }
protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){
String resourceId = id;
@@ -337,6 +344,8 @@ public class WorkflowAction {
workflowResourceIds.setNetworkId(resourceId);
}else if(resource == WorkflowType.NETWORKCOLLECTION){
workflowResourceIds.setNetworkCollectionId(resourceId);
+ }else if(resource == WorkflowType.CONFIGURATION){
+ workflowResourceIds.setConfigurationId(resourceId);
}
ebb.setWorkflowResourceIds(workflowResourceIds);
}
@@ -389,7 +398,7 @@ public class WorkflowAction {
String toscaNodeType = collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
if (toscaNodeType != null && toscaNodeType.contains("NetworkCollection")) {
int minNetworks = 0;
- InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup = collectionResourceCustomization.getCollectionResource().getInstanceGroup();
CollectionResourceInstanceGroupCustomization collectionInstCust = null;
if(!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
for(CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup.getCollectionInstanceGroupCustomizations()) {
@@ -418,14 +427,14 @@ public class WorkflowAction {
}
}
} else {
- msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType);
+ msoLogger.debug("Instance Group tosca node type does not contain NetworkCollection: " + toscaNodeType);
+ }
+ }else{
+ msoLogger.debug("No Instance Group found for network collection.");
}
}else{
- msoLogger.debug("No Instance Group found for network collection.");
+ msoLogger.debug("No Network Collection found. collectionResource is null");
}
- }else{
- msoLogger.debug("No Network Collection found. collectionResource is null");
- }
} else {
msoLogger.debug("No Network Collection Customization found");
}
@@ -484,6 +493,20 @@ public class WorkflowAction {
aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
resourceCounter.add(new Resource(WorkflowType.NETWORKCOLLECTION,serviceInstanceMSO.getCollection().getId(),false));
}
+ if (serviceInstanceMSO.getConfigurations() !=null) {
+ for(Configuration config : serviceInstanceMSO.getConfigurations()){
+ Optional<org.onap.aai.domain.yang.Configuration> aaiConfig = aaiConfigurationResources.getConfiguration(config.getConfigurationId());
+ if(aaiConfig.isPresent() && aaiConfig.get().getRelationshipList()!=null){
+ for(Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()){
+ if(relationship.getRelatedTo().contains("vnfc")){
+ aaiResourceIds.add(new Pair<WorkflowType, String>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config.getConfigurationId(),false));
+ break;
+ }
+ }
+ }
+ }
+ }
} catch (Exception ex) {
buildAndThrowException(execution,
"Could not find existing Service Instance or related Instances to execute the request on.");
@@ -495,6 +518,8 @@ public class WorkflowAction {
throws IOException {
boolean foundRelated = false;
boolean foundVfModuleOrVG = false;
+ String vnfCustomizationUUID = "";
+ String vfModuleCustomizationUUID = "";
if (sIRequest.getRequestDetails().getRequestParameters().getUserParams() != null) {
List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
for (Map<String, Object> params : userParams) {
@@ -507,18 +532,23 @@ public class WorkflowAction {
for (Vnfs vnf : validate.getResources().getVnfs()) {
resourceCounter.add(new Resource(WorkflowType.VNF,vnf.getModelInfo().getModelCustomizationId(),false));
foundRelated = true;
+ if(vnf.getModelInfo()!=null && vnf.getModelInfo().getModelCustomizationUuid()!=null){
+ vnfCustomizationUUID = vnf.getModelInfo().getModelCustomizationUuid();
+ }
if (vnf.getVfModules() != null) {
for (VfModules vfModule : vnf.getVfModules()) {
VfModuleCustomization vfModuleCustomization = catalogDbClient
.getVfModuleCustomizationByModelCuztomizationUUID(
vfModule.getModelInfo().getModelCustomizationUuid());
if (vfModuleCustomization != null) {
- if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate()!=null &&vfModuleCustomization.getVolumeHeatEnv() != null) {
+
+ if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getVolumeHeatTemplate() != null && vfModuleCustomization.getVolumeHeatEnv() != null) {
resourceCounter.add(new Resource(WorkflowType.VOLUMEGROUP,vfModuleCustomization.getModelCustomizationUUID(),false));
foundRelated = true;
foundVfModuleOrVG = true;
}
- if(vfModuleCustomization.getVfModule()!=null && vfModuleCustomization.getVfModule().getModuleHeatTemplate()!=null && vfModuleCustomization.getHeatEnvironment()!=null){
+
+ if(vfModuleCustomization.getVfModule() != null && vfModuleCustomization.getVfModule().getModuleHeatTemplate() != null && vfModuleCustomization.getHeatEnvironment() != null){
foundRelated = true;
foundVfModuleOrVG = true;
Resource resource = new Resource(WorkflowType.VFMODULE,vfModuleCustomization.getModelCustomizationUUID(),false);
@@ -528,6 +558,15 @@ public class WorkflowAction {
resource.setBaseVfModule(false);
}
resourceCounter.add(resource);
+ if(vfModule.getModelInfo()!=null && vfModule.getModelInfo().getModelCustomizationUuid()!=null){
+ vfModuleCustomizationUUID = vfModule.getModelInfo().getModelCustomizationUuid();
+ }
+ if(!vnfCustomizationUUID.equals("")&&!vfModuleCustomizationUUID.equals("")){
+ List<String> configs = traverseCatalogDbForConfiguration(vnfCustomizationUUID,vfModuleCustomizationUUID);
+ for(String config : configs){
+ resourceCounter.add(new Resource(WorkflowType.CONFIGURATION,config,false));
+ }
+ }
}
if(!foundVfModuleOrVG){
buildAndThrowException(execution, "Could not determine if vfModule was a vfModule or volume group. Heat template and Heat env are null");
@@ -556,6 +595,25 @@ public class WorkflowAction {
}
return foundRelated;
}
+
+
+ private List<String> traverseCatalogDbForConfiguration(String vnfCustomizationUUID, String vfModuleCustomizationUUID) {
+ List<String> configurations = new ArrayList<>();
+ try{
+ List<CvnfcCustomization> cvnfcCustomizations = catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(vnfCustomizationUUID, vfModuleCustomizationUUID);
+ for(CvnfcCustomization cvnfc : cvnfcCustomizations){
+ for(VnfVfmoduleCvnfcConfigurationCustomization customization : cvnfc.getVnfVfmoduleCvnfcConfigurationCustomization()){
+ if(customization.getConfigurationResource().getToscaNodeType().contains("FabricConfiguration")){
+ configurations.add(customization.getConfigurationResource().getModelUUID());
+ }
+ }
+ }
+ msoLogger.debug("found " + configurations.size() + " configurations");
+ return configurations;
+ } catch (Exception ex){
+ return configurations;
+ }
+ }
protected String queryCatalogDBforNetworkCollection(DelegateExecution execution, ServiceInstancesRequest sIRequest) {
org.onap.so.db.catalog.beans.Service service = catalogDbClient
@@ -664,7 +722,6 @@ public class WorkflowAction {
}
return generatedResourceId;
} catch (Exception ex) {
- msoLogger.error(ex);
throw new IllegalStateException(
"WorkflowAction was unable to verify if the instance name already exist in AAI.");
}
@@ -810,7 +867,7 @@ public class WorkflowAction {
.collect(Collectors.toList()).get(i).getResourceId(), apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
- } else {
+ }else {
flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, "", apiVersion, resourceId,
requestAction, aLaCarte, vnfType, workflowResourceIds, requestDetails, false, null));
}
@@ -852,24 +909,24 @@ public class WorkflowAction {
buildAndThrowException(execution,"The request: Macro " + resourceName + " " + requestAction + " is not supported by GR_API.");
}
} else {
- if(northBoundRequest.getIsToplevelflow()!=null){
- execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
- }
- List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
- if (flows == null)
- flows = new ArrayList<>();
- for (OrchestrationFlow flow : flows) {
- if (!flow.getFlowName().contains("BB")) {
- List<OrchestrationFlow> macroQueryFlows = catalogDbClient
- .getOrchestrationFlowByAction(flow.getFlowName());
- for (OrchestrationFlow macroFlow : macroQueryFlows) {
- listToExecute.add(macroFlow);
- }
- } else {
- listToExecute.add(flow);
+ if(northBoundRequest.getIsToplevelflow()!=null){
+ execution.setVariable(G_ISTOPLEVELFLOW, northBoundRequest.getIsToplevelflow());
+ }
+ List<OrchestrationFlow> flows = northBoundRequest.getOrchestrationFlowList();
+ if (flows == null)
+ flows = new ArrayList<>();
+ for (OrchestrationFlow flow : flows) {
+ if (!flow.getFlowName().contains("BB")) {
+ List<OrchestrationFlow> macroQueryFlows = catalogDbClient
+ .getOrchestrationFlowByAction(flow.getFlowName());
+ for (OrchestrationFlow macroFlow : macroQueryFlows) {
+ listToExecute.add(macroFlow);
}
+ } else {
+ listToExecute.add(flow);
}
}
+ }
return listToExecute;
}
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 101a355c2f..ab29e21dea 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
@@ -30,9 +30,10 @@ import org.onap.so.bpmn.common.workflow.context.WorkflowContextHolder;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.onap.so.client.db.request.RequestsDbClient;
+
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.logger.MsoLogger;
import org.onap.so.serviceinstancebeans.RequestReferences;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
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 be19f25cca..4a1c3f512c 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
@@ -7,15 +7,14 @@
* 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.
- * Modifications Copyright (C) 2018 IBM
* ============LICENSE_END=========================================================
*/
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
index b84f8b6459..e9dc3742f5 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
@@ -157,6 +157,15 @@ public class AAIConfigurationResources {
AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configurationId);
injectionHelper.getAaiClient().delete(aaiResourceUri);
}
+ /**
+ * method to delete Configuration details in A&AI
+ *
+ * @param configuration
+ */
+ public void deleteConfiguration(Configuration configuration) {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ injectionHelper.getAaiClient().delete(aaiResourceUri);
+ }
/**
* Get Configuration from AAI using related Link
@@ -167,4 +176,11 @@ public class AAIConfigurationResources {
return injectionHelper.getAaiClient()
.get(org.onap.aai.domain.yang.Configuration.class, AAIUriFactory.createResourceFromExistingURI(AAIObjectType.CONFIGURATION, UriBuilder.fromPath(relatedLink).build()));
}
+
+ public void updateOrchestrationStatusConfiguration(Configuration configuration, OrchestrationStatus orchestrationStatus) {
+ AAIResourceUri aaiResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.CONFIGURATION, configuration.getConfigurationId());
+ configuration.setOrchestrationStatus(orchestrationStatus);
+ org.onap.aai.domain.yang.Configuration aaiConfiguration = aaiObjectMapper.mapConfiguration(configuration);
+ injectionHelper.getAaiClient().update(aaiResourceUri, aaiConfiguration);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
index 9e60196426..0061f50ba8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
@@ -24,6 +24,7 @@ import java.util.LinkedHashMap;
import javax.ws.rs.core.UriBuilder;
+import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.beans.SDNCProperties;
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
index cee94e28bd..eb12278528 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
@@ -23,9 +23,9 @@ package org.onap.so.client.sniro;
import java.util.LinkedHashMap;
import org.camunda.bpm.engine.delegate.BpmnError;
+import org.onap.so.bpmn.common.baseclient.BaseClient;
import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.client.sdnc.BaseClient;
import org.onap.so.client.sniro.beans.ManagerProperties;
import org.onap.so.client.sniro.beans.SniroConductorRequest;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
index 6401d5516d..9244f7ee1f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
@@ -21,14 +21,8 @@ package org.onap.so;
-import java.io.IOException;
-
-import javax.annotation.PreDestroy;
-
import org.camunda.bpm.spring.boot.starter.annotation.EnableProcessApplication;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepositoryImpl;
-import org.onap.so.requestsdb.RequestsDBHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.ComponentScan;
@@ -40,9 +34,7 @@ import org.springframework.context.annotation.Profile;
@Profile("test")
@EnableProcessApplication("MSO CommonBPMN Test Application")
@ComponentScan(basePackages = {"org.onap.so"}, nameGenerator = DefaultToShortClassNameBeanNameGenerator.class, excludeFilters = {
- @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = RequestsDBHelper.class),
- @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = InfraActiveRequestsRepositoryImpl.class) })
+ @Filter(type = FilterType.ANNOTATION, classes = SpringBootApplication.class)})
public class TestApplication {
public static void main(String... args) {
SpringApplication.run(TestApplication.class, args);
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 3fce15a6c4..2b25dfd9f1 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
@@ -28,8 +28,8 @@ 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.appc.ApplicationControllerAction;
-import org.onap.so.client.db.request.RequestsDbClient;
import org.onap.so.client.orchestration.AAICollectionResources;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAIInstanceGroupResources;
import org.onap.so.client.orchestration.AAINetworkResources;
import org.onap.so.client.orchestration.AAIServiceInstanceResources;
@@ -46,6 +46,8 @@ import org.onap.so.client.orchestration.VnfAdapterVfModuleResources;
import org.onap.so.client.orchestration.VnfAdapterVolumeGroupResources;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.db.request.client.RequestsDbClient;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.boot.test.mock.mockito.SpyBean;
@@ -111,6 +113,7 @@ public abstract class BaseTaskTest extends TestDataSetup {
protected CatalogDbClient catalogDbClient;
@MockBean
+ @Qualifier("RequestsDbClient")
protected RequestsDbClient requestsDbClient;
@Mock
@@ -118,10 +121,13 @@ public abstract class BaseTaskTest extends TestDataSetup {
@Mock
protected BBInputSetup bbInputSetup;
-
+
@SpyBean
protected SDNCClient SPY_sdncClient;
@MockBean
protected ApplicationControllerAction appCClient;
+
+ @MockBean
+ protected AAIConfigurationResources aaiConfigurationResources;
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
index 675e8a1d95..fb9533091b 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
@@ -663,4 +663,20 @@ public class TestDataSetup{
return ar;
}
+
+ public Configuration setConfiguration () {
+ Configuration config = new Configuration();
+ config.setConfigurationId("testConfigurationId");
+ List<Configuration> configurations = new ArrayList<>();
+ configurations.add(config);
+ ServiceInstance serviceInstance = new ServiceInstance();
+ try {
+ serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
+ } catch(BBObjectNotFoundException e) {
+ serviceInstance = setServiceInstance();
+ }
+ lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "testConfigurationId");
+ serviceInstance.setConfigurations(configurations);
+ return config;
+ }
} \ No newline at end of file
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
index 51a7f1ab04..0b802a3385 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
@@ -26,6 +26,9 @@ import static org.mockito.Mockito.never;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
+import java.util.ArrayList;
+import java.util.List;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.junit.Before;
import org.junit.Rule;
@@ -33,6 +36,7 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
@@ -54,6 +58,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
private CloudRegion cloudRegion;
private VfModule vfModule;
private Customer customer;
+ private Configuration configuration;
@Rule
public final ExpectedException exception = ExpectedException.none();
@@ -67,6 +72,7 @@ public class AAICreateTasksTest extends BaseTaskTest{
volumeGroup = setVolumeGroup();
cloudRegion = setCloudRegion();
vfModule = setVfModule();
+ configuration = setConfiguration();
}
@@ -384,4 +390,12 @@ public class AAICreateTasksTest extends BaseTaskTest{
aaiCreateTasks.connectNetworkToTenant(execution);
verify(aaiNetworkResources, times(1)).connectNetworkToTenant(network, gBBInput.getCloudRegion());
}
+
+ @Test
+ public void createConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).createConfiguration(configuration);
+ aaiCreateTasks.createConfiguration(execution);
+ verify(aaiConfigurationResources, times(1)).createConfiguration(configuration);
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
new file mode 100644
index 0000000000..efe5b5d971
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java
@@ -0,0 +1,162 @@
+/*-
+ * ============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.infrastructure.aai.tasks;
+
+import static org.mockito.Mockito.doNothing;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public class AAIDeleteTasksTest extends BaseTaskTest {
+ @Autowired
+ private AAIDeleteTasks aaiDeleteTasks;
+
+ private L3Network network;
+ private ServiceInstance serviceInstance;
+ private GenericVnf genericVnf;
+ private VfModule vfModule;
+ private VolumeGroup volumeGroup;
+ private CloudRegion cloudRegion;
+ private Configuration configuration;
+
+ @Before
+ public void before() {
+ serviceInstance = setServiceInstance();
+ genericVnf = setGenericVnf();
+ vfModule = setVfModule();
+ network = setL3Network();
+ volumeGroup = setVolumeGroup();
+ cloudRegion = setCloudRegion();
+ configuration = setConfiguration();
+ }
+
+ @Test
+ public void deleteVfModuleTest() throws Exception {
+ doNothing().when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
+ aaiDeleteTasks.deleteVfModule(execution);
+ verify(aaiVfModuleResources, times(1)).deleteVfModule(vfModule, genericVnf);
+ }
+
+ @Test
+ public void deleteVfModuleExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVfModuleResources).deleteVfModule(vfModule, genericVnf);
+ aaiDeleteTasks.deleteVfModule(execution);
+ }
+
+ @Test
+ public void deleteServiceInstanceTest() throws Exception {
+ doNothing().when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
+
+ aaiDeleteTasks.deleteServiceInstance(execution);
+
+ verify(aaiServiceInstanceResources, times(1)).deleteServiceInstance(serviceInstance);
+ }
+
+ @Test
+ public void deleteServiceInstanceExceptionTest() throws Exception {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiServiceInstanceResources).deleteServiceInstance(serviceInstance);
+
+ aaiDeleteTasks.deleteServiceInstance(execution);
+ }
+
+ @Test
+ public void deleteVnfTest() throws Exception {
+ doNothing().when(aaiVnfResources).deleteVnf(genericVnf);
+ aaiDeleteTasks.deleteVnf(execution);
+ verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
+ }
+
+ @Test
+ public void deleteVnfTestException() throws Exception {
+ expectedException.expect(BpmnError.class);
+ doThrow(Exception.class).when(aaiVnfResources).deleteVnf(genericVnf);
+
+ aaiDeleteTasks.deleteVnf(execution);
+ verify(aaiVnfResources, times(1)).deleteVnf(genericVnf);
+ }
+
+ @Test
+ public void deleteNetworkTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteNetwork(network);
+ aaiDeleteTasks.deleteNetwork(execution);
+ verify(aaiNetworkResources, times(1)).deleteNetwork(network);
+ }
+
+ @Test
+ public void deleteCollectionTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteCollection(serviceInstance.getCollection());
+ aaiDeleteTasks.deleteCollection(execution);
+ verify(aaiNetworkResources, times(1)).deleteCollection(serviceInstance.getCollection());
+ }
+
+ @Test
+ public void deleteInstanceGroupTest() throws Exception {
+ doNothing().when(aaiNetworkResources).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ aaiDeleteTasks.deleteInstanceGroup(execution);
+ verify(aaiNetworkResources, times(1)).deleteNetworkInstanceGroup(serviceInstance.getCollection().getInstanceGroup());
+ }
+
+ @Test
+ public void deleteVolumeGroupTest() {
+ doNothing().when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiDeleteTasks.deleteVolumeGroup(execution);
+
+ verify(aaiVolumeGroupResources, times(1)).deleteVolumeGroup(volumeGroup, cloudRegion);
+ }
+
+ @Test
+ public void deleteVolumeGroupExceptionTest() {
+ expectedException.expect(BpmnError.class);
+
+ doThrow(Exception.class).when(aaiVolumeGroupResources).deleteVolumeGroup(volumeGroup, cloudRegion);
+
+ aaiDeleteTasks.deleteVolumeGroup(execution);
+ }
+
+ @Test
+ public void deleteConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).deleteConfiguration(configuration);
+ aaiDeleteTasks.deleteConfiguration(execution);
+ verify(aaiConfigurationResources, times(1)).deleteConfiguration(configuration);
+ }
+}
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 b45752957e..d800ae9618 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
@@ -32,6 +32,7 @@ import org.junit.Test;
import org.onap.so.adapters.nwrest.CreateNetworkResponse;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
@@ -50,6 +51,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
private GenericVnf genericVnf;
private VolumeGroup volumeGroup;
private CloudRegion cloudRegion;
+ private Configuration configuration;
@Before
public void before() {
@@ -59,6 +61,7 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
volumeGroup = setVolumeGroup();
cloudRegion = setCloudRegion();
network = setL3Network();
+ configuration = setConfiguration();
}
@Test
@@ -462,4 +465,23 @@ public class AAIUpdateTasksTest extends BaseTaskTest{
doThrow(Exception.class).when(aaiVfModuleResources).changeAssignVfModule(vfModule, genericVnf);
aaiUpdateTasks.updateModelVfModule(execution);
}
+
+ @Test
+ public void updateOrchestrationStatusDeactivateFabricConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
+
+ aaiUpdateTasks.updateOrchestrationStatusDeactivateFabricConfiguration(execution);
+
+ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
+ }
+ @Test
+ public void updateOrchestrationStatusActivateFabricConfigurationTest() throws Exception {
+ gBBInput = execution.getGeneralBuildingBlock();
+ doNothing().when(aaiConfigurationResources).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+
+ aaiUpdateTasks.updateOrchestrationStatusActivateFabricConfiguration(execution);
+
+ verify(aaiConfigurationResources, times(1)).updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
+ }
}
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 3869988c40..65d16adb40 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
@@ -36,7 +36,6 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Optional;
@@ -74,7 +73,6 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
-import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
@@ -304,7 +302,7 @@ public class WorkflowActionTest extends BaseTaskTest {
orchFlows.add(orch7);
OrchestrationFlow orch8 = new OrchestrationFlow();
orch8.setFlowName("ActivateServiceInstanceBB");
- orchFlows.add(orch8);
+ orchFlows.add(orch8);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("si0");
@@ -718,6 +716,9 @@ public class WorkflowActionTest extends BaseTaskTest {
orch15.setFlowName("ActivateServiceInstanceBB");
orchFlows.add(orch15);
+ Service service = new Service();
+ service.setModelUUID("3c40d244-808e-42ca-b09a-256d83d19d0a");
+
VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
vfModuleCustomization.setModelCustomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
HeatEnvironment volumeHeatEnv = new HeatEnvironment();
@@ -743,6 +744,7 @@ public class WorkflowActionTest extends BaseTaskTest {
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f")).thenReturn(vfModuleCustomization);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa8")).thenReturn(vfModuleCustomization2);
when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")).thenReturn(vfModuleCustomization3);
+ when(catalogDbClient.getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a")).thenReturn(service);
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
@@ -796,48 +798,48 @@ public class WorkflowActionTest extends BaseTaskTest {
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = new LinkedList<>();
northBoundRequest.setOrchestrationFlowList(orchFlows);
- OrchestrationFlow orch1 = new OrchestrationFlow();
- orch1.setFlowName("DeactivateVfModuleBB");
- orchFlows.add(orch1);
- OrchestrationFlow orch2 = new OrchestrationFlow();
- orch2.setFlowName("DeleteVfModuleBB");
- orchFlows.add(orch2);
OrchestrationFlow orch3 = new OrchestrationFlow();
- orch3.setFlowName("DeactivateVolumeGroupBB");
+ orch3.setFlowName("DeactivateVfModuleBB");
orchFlows.add(orch3);
OrchestrationFlow orch4 = new OrchestrationFlow();
- orch4.setFlowName("DeleteVolumeGroupBB");
+ orch4.setFlowName("DeleteVfModuleBB");
orchFlows.add(orch4);
OrchestrationFlow orch5 = new OrchestrationFlow();
- orch5.setFlowName("DeactivateVnfBB");
+ orch5.setFlowName("DeactivateVolumeGroupBB");
orchFlows.add(orch5);
OrchestrationFlow orch6 = new OrchestrationFlow();
- orch6.setFlowName("DeactivateNetworkBB");
+ orch6.setFlowName("DeleteVolumeGroupBB");
orchFlows.add(orch6);
OrchestrationFlow orch7 = new OrchestrationFlow();
- orch7.setFlowName("DeleteNetworkBB");
+ orch7.setFlowName("DeactivateVnfBB");
orchFlows.add(orch7);
OrchestrationFlow orch8 = new OrchestrationFlow();
- orch8.setFlowName("DeleteNetworkCollectionBB");
+ orch8.setFlowName("DeactivateNetworkBB");
orchFlows.add(orch8);
OrchestrationFlow orch9 = new OrchestrationFlow();
- orch9.setFlowName("DeactivateServiceInstanceBB");
+ orch9.setFlowName("DeleteNetworkBB");
orchFlows.add(orch9);
OrchestrationFlow orch10 = new OrchestrationFlow();
- orch10.setFlowName("UnassignVfModuleBB");
+ orch10.setFlowName("DeleteNetworkCollectionBB");
orchFlows.add(orch10);
OrchestrationFlow orch11 = new OrchestrationFlow();
- orch11.setFlowName("UnassignVolumeGroupBB");
+ orch11.setFlowName("DeactivateServiceInstanceBB");
orchFlows.add(orch11);
OrchestrationFlow orch12 = new OrchestrationFlow();
- orch12.setFlowName("UnassignVnfBB");
+ orch12.setFlowName("UnassignVfModuleBB");
orchFlows.add(orch12);
OrchestrationFlow orch13 = new OrchestrationFlow();
- orch13.setFlowName("UnassignNetworkBB");
+ orch13.setFlowName("UnassignVolumeGroupBB");
orchFlows.add(orch13);
OrchestrationFlow orch14 = new OrchestrationFlow();
- orch14.setFlowName("UnassignServiceInstanceBB");
+ orch14.setFlowName("UnassignVnfBB");
orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch15);
+ OrchestrationFlow orch16 = new OrchestrationFlow();
+ orch16.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch16);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("aaisi123");
@@ -954,49 +956,49 @@ public class WorkflowActionTest extends BaseTaskTest {
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = new LinkedList<>();
- northBoundRequest.setOrchestrationFlowList(orchFlows);
- OrchestrationFlow orch1 = new OrchestrationFlow();
- orch1.setFlowName("DeactivateVfModuleBB");
- orchFlows.add(orch1);
- OrchestrationFlow orch2 = new OrchestrationFlow();
- orch2.setFlowName("DeleteVfModuleBB");
- orchFlows.add(orch2);
+ northBoundRequest.setOrchestrationFlowList(orchFlows);
OrchestrationFlow orch3 = new OrchestrationFlow();
- orch3.setFlowName("DeactivateVolumeGroupBB");
+ orch3.setFlowName("DeactivateVfModuleBB");
orchFlows.add(orch3);
OrchestrationFlow orch4 = new OrchestrationFlow();
- orch4.setFlowName("DeleteVolumeGroupBB");
+ orch4.setFlowName("DeleteVfModuleBB");
orchFlows.add(orch4);
OrchestrationFlow orch5 = new OrchestrationFlow();
- orch5.setFlowName("DeactivateVnfBB");
+ orch5.setFlowName("DeactivateVolumeGroupBB");
orchFlows.add(orch5);
OrchestrationFlow orch6 = new OrchestrationFlow();
- orch6.setFlowName("DeactivateNetworkBB");
+ orch6.setFlowName("DeleteVolumeGroupBB");
orchFlows.add(orch6);
OrchestrationFlow orch7 = new OrchestrationFlow();
- orch7.setFlowName("DeleteNetworkBB");
+ orch7.setFlowName("DeactivateVnfBB");
orchFlows.add(orch7);
OrchestrationFlow orch8 = new OrchestrationFlow();
- orch8.setFlowName("DeleteNetworkCollectionBB");
- orchFlows.add(orch8);
+ orch8.setFlowName("DeactivateNetworkBB");
+ orchFlows.add(orch8);
OrchestrationFlow orch9 = new OrchestrationFlow();
- orch9.setFlowName("DeactivateServiceInstanceBB");
- orchFlows.add(orch9);
+ orch9.setFlowName("DeleteNetworkBB");
+ orchFlows.add(orch9);
OrchestrationFlow orch10 = new OrchestrationFlow();
- orch10.setFlowName("UnassignVfModuleBB");
- orchFlows.add(orch10);
+ orch10.setFlowName("DeleteNetworkCollectionBB");
+ orchFlows.add(orch10);
OrchestrationFlow orch11 = new OrchestrationFlow();
- orch11.setFlowName("UnassignVolumeGroupBB");
- orchFlows.add(orch11);
+ orch11.setFlowName("DeactivateServiceInstanceBB");
+ orchFlows.add(orch11);
OrchestrationFlow orch12 = new OrchestrationFlow();
- orch12.setFlowName("UnassignVnfBB");
- orchFlows.add(orch12);
+ orch12.setFlowName("UnassignVfModuleBB");
+ orchFlows.add(orch12);
OrchestrationFlow orch13 = new OrchestrationFlow();
- orch13.setFlowName("UnassignNetworkBB");
- orchFlows.add(orch13);
+ orch13.setFlowName("UnassignVolumeGroupBB");
+ orchFlows.add(orch13);
OrchestrationFlow orch14 = new OrchestrationFlow();
- orch14.setFlowName("UnassignServiceInstanceBB");
- orchFlows.add(orch14);
+ orch14.setFlowName("UnassignVnfBB");
+ orchFlows.add(orch14);
+ OrchestrationFlow orch15 = new OrchestrationFlow();
+ orch15.setFlowName("UnassignNetworkBB");
+ orchFlows.add(orch15);
+ OrchestrationFlow orch16 = new OrchestrationFlow();
+ orch16.setFlowName("UnassignServiceInstanceBB");
+ orchFlows.add(orch16);
ServiceInstance serviceInstanceAAI = new ServiceInstance();
serviceInstanceAAI.setServiceInstanceId("aaisi123");
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 0355006d15..99f1b188c9 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
@@ -562,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().longValue(), v12CtagAssingments.getCtagAssignment().get(0).getVlanIdInner());
+ assertEquals(new Long(ctagAssignments.get(0).getVlanIdInner().longValue()), new Long(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/orchestration/AAIConfigurationResourcesTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
index cc48c46508..5948c66baa 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
@@ -177,4 +177,13 @@ public class AAIConfigurationResourcesTest extends TestDataSetup{
aaiConfigurationResources.deleteConfiguration("configurationId");
verify(MOCK_aaiResourcesClient, times(1)).delete(aaiResourceUri);
}
+
+ @Test
+ public void updateOrchestrationStatusConfigurationTest() throws Exception {
+ configuration.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
+ doNothing().when(MOCK_aaiResourcesClient).update(isA(AAIResourceUri.class), isA(org.onap.aai.domain.yang.Configuration.class));
+ aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration,OrchestrationStatus.ACTIVE);
+ verify(MOCK_aaiResourcesClient, times(1)).update(any(AAIResourceUri.class), any(org.onap.aai.domain.yang.Configuration.class));
+ assertEquals(OrchestrationStatus.ACTIVE, configuration.getOrchestrationStatus());
+ }
} \ No newline at end of file
diff --git a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
index 6214cc5ef6..2595ddcbcd 100644
--- a/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
+++ b/cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
@@ -15,7 +15,6 @@
* 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.
- * Modifications Copyright (C) 2018 IBM.
* ============LICENSE_END=========================================================
*/
diff --git a/common/pom.xml b/common/pom.xml
index d3f460e563..a3084e8174 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -55,7 +55,6 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.onap.appc.client</groupId>
@@ -78,9 +77,6 @@
<dependency>
<groupId>org.onap.aai.aai-common</groupId>
<artifactId>aai-schema</artifactId>
- <!-- TODO: replace with release a version when -->
- <!-- org.onap.aai.domain.yang.Collection has -->
- <!-- been released -->
<version>1.3.0-SNAPSHOT</version>
</dependency>
<dependency>
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 007c666ac2..631850a01f 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -71,7 +71,7 @@ public abstract class RestClient {
protected Optional<URI> path;
protected String accept;
protected String contentType;
- protected String requestId;
+ protected String requestId = "";
protected JaxRsClientLogging jaxRsClientLogging;
protected RestProperties props;
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
index 514eab6fc4..ffc474a55a 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
@@ -29,6 +29,7 @@ import javax.ws.rs.ext.Provider;
import javax.annotation.Priority;
import javax.ws.rs.ext.Provider;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.aai.entities.AAIError;
import org.onap.so.logger.MsoLogger;
@@ -42,7 +43,7 @@ public class AAIClientResponseExceptionMapper extends ResponseExceptionMapper {
private final String requestId;
public AAIClientResponseExceptionMapper() {
- this.requestId = MDC.get(MsoLogger.REQUEST_ID);
+ this.requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
}
@Override
public Optional<String> extractMessage(String entity) {
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
index ce75b1716a..a5d8f12e83 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
@@ -20,6 +20,40 @@
package org.onap.so.client.aai;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.onap.aai.annotations.Metadata;
+import org.onap.aai.domain.yang.AllottedResource;
+import org.onap.aai.domain.yang.CloudRegion;
+import org.onap.aai.domain.yang.Collection;
+import org.onap.aai.domain.yang.Configuration;
+import org.onap.aai.domain.yang.Customer;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.LineOfBusiness;
+import org.onap.aai.domain.yang.ModelVer;
+import org.onap.aai.domain.yang.NetworkPolicy;
+import org.onap.aai.domain.yang.OperationalEnvironment;
+import org.onap.aai.domain.yang.OwningEntity;
+import org.onap.aai.domain.yang.PInterface;
+import org.onap.aai.domain.yang.PhysicalLink;
+import org.onap.aai.domain.yang.Platform;
+import org.onap.aai.domain.yang.Project;
+import org.onap.aai.domain.yang.Pserver;
+import org.onap.aai.domain.yang.RouteTableReferences;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.ServiceSubscription;
+import org.onap.aai.domain.yang.Tenant;
+import org.onap.aai.domain.yang.TunnelXconnect;
+import org.onap.aai.domain.yang.Vce;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VlanTag;
+import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.VolumeGroup;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aai.domain.yang.Vserver;
import org.onap.so.client.graphinventory.GraphInventoryObjectType;
import com.google.common.base.CaseFormat;
@@ -27,57 +61,82 @@ import com.google.common.base.CaseFormat;
public enum AAIObjectType implements GraphInventoryObjectType {
DEFAULT_CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/att-aic/{cloud-region-id}"),
- CUSTOMER(AAINamespaceConstants.BUSINESS, "/customers/customer/{global-customer-id}"),
+ CUSTOMER(AAINamespaceConstants.BUSINESS, Customer.class),
GENERIC_QUERY("/search", "/generic-query"),
BULK_PROCESS("/bulkprocess", ""),
- GENERIC_VNF(AAINamespaceConstants.NETWORK, "/generic-vnfs/generic-vnf/{vnf-id}"),
- VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), "/vf-modules/vf-module/{vf-module-id}"),
- L3_NETWORK(AAINamespaceConstants.NETWORK, "/l3-networks/l3-network/{network-id}"),
- NETWORK_POLICY(AAINamespaceConstants.NETWORK, "/network-policies/network-policy/{network-policy-id}"),
+ GENERIC_VNF(AAINamespaceConstants.NETWORK, GenericVnf.class),
+ VF_MODULE(AAIObjectType.GENERIC_VNF.uriTemplate(), VfModule.class),
+ L3_NETWORK(AAINamespaceConstants.NETWORK, L3Network.class),
+ NETWORK_POLICY(AAINamespaceConstants.NETWORK, NetworkPolicy.class),
NODES_QUERY("/search", "/nodes-query"),
CUSTOM_QUERY("/query", ""),
- ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, "/route-table-references/route-table-reference/{route-table-reference-id}"),
+ ROUTE_TABLE_REFERENCE(AAINamespaceConstants.NETWORK, RouteTableReferences.class),
DEFAULT_TENANT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE + "/cloud-regions/cloud-region/att-aic/AAIAIC25", "/tenants/tenant/{tenant-id}"),
- VCE(AAINamespaceConstants.NETWORK, "/vces/vce/{vnf-id}"),
- VPN_BINDING(AAINamespaceConstants.NETWORK, "/vpn-bindings/vpn-binding/{vpn-id}"),
+ VCE(AAINamespaceConstants.NETWORK, Vce.class),
+ VPN_BINDING(AAINamespaceConstants.NETWORK, VpnBinding.class),
VPN_BINDINGS(AAINamespaceConstants.NETWORK, "/vpn-bindings"),
- CONFIGURATION(AAINamespaceConstants.NETWORK, "/configurations/configuration/{configuration-id}"),
- PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/pservers/pserver/{hostname}"),
- SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), "/service-subscriptions/service-subscription/{service-type}"),
- SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), "/service-instances/service-instance/{service-instance-id}"),
- PROJECT(AAINamespaceConstants.BUSINESS, "/projects/project/{id}"),
- LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, "/lines-of-business/line-of-business/{id}"),
- PLATFORM(AAINamespaceConstants.BUSINESS, "/platforms/platform/{id}"),
- OWNING_ENTITY(AAINamespaceConstants.BUSINESS, "/owning-entities/owning-entity/{id}"),
- ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), "/allotted-resources/allotted-resource/{id}"),
+ CONFIGURATION(AAINamespaceConstants.NETWORK, Configuration.class),
+ PSERVER(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, Pserver.class),
+ SERVICE_SUBSCRIPTION(AAIObjectType.CUSTOMER.uriTemplate(), ServiceSubscription.class),
+ SERVICE_INSTANCE(AAIObjectType.SERVICE_SUBSCRIPTION.uriTemplate(), ServiceInstance.class),
+ PROJECT(AAINamespaceConstants.BUSINESS, Project.class),
+ LINE_OF_BUSINESS(AAINamespaceConstants.BUSINESS, LineOfBusiness.class),
+ PLATFORM(AAINamespaceConstants.BUSINESS, Platform.class),
+ OWNING_ENTITY(AAINamespaceConstants.BUSINESS, OwningEntity.class),
+ ALLOTTED_RESOURCE(AAIObjectType.SERVICE_INSTANCE.uriTemplate(), AllottedResource.class),
PNF(AAINamespaceConstants.NETWORK, "/pnfs/pnf/{pnf-name}"),
- OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/operational-environments/operational-environment/{operational-environment-id}"),
- CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, "/cloud-regions/cloud-region/{cloud-owner-id}/{cloud-region-id}"),
- TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), "/tenants/tenant/{tenant-id}"),
- VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), "/volume-groups/volume-group/{volume-group-id}"),
- VSERVER(AAIObjectType.TENANT.uriTemplate(), "/vservers/vserver/{vserver-id}"),
- MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", "/model-vers/model-ver/{model-version-id}"),
- TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), "/tunnel-xconnects/tunnel-xconnect/{tunnel-id}"),
- P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), "/p-interfaces/p-interface/{interface-name}"),
- PHYSICAL_LINK(AAINamespaceConstants.NETWORK, "/physical-links/physical-link/{link-name}"),
- INSTANCE_GROUP(AAINamespaceConstants.NETWORK, "/instance-groups/instance-group/{id}"),
- COLLECTION(AAINamespaceConstants.NETWORK, "/collections/collection/{collection-id}"),
+ OPERATIONAL_ENVIRONMENT(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, OperationalEnvironment.class),
+ CLOUD_REGION(AAINamespaceConstants.CLOUD_INFRASTRUCTURE, CloudRegion.class),
+ TENANT(AAIObjectType.CLOUD_REGION.uriTemplate(), Tenant.class),
+ VOLUME_GROUP(AAIObjectType.CLOUD_REGION.uriTemplate(), VolumeGroup.class),
+ VSERVER(AAIObjectType.TENANT.uriTemplate(), Vserver.class),
+ MODEL_VER(AAINamespaceConstants.SERVICE_DESIGN_AND_CREATION + "/models/model/{model-invariant-id}", ModelVer.class),
+ TUNNEL_XCONNECT(AAIObjectType.ALLOTTED_RESOURCE.uriTemplate(), TunnelXconnect.class),
+ P_INTERFACE(AAIObjectType.PSERVER.uriTemplate(), PInterface.class),
+ PHYSICAL_LINK(AAINamespaceConstants.NETWORK, PhysicalLink.class),
+ INSTANCE_GROUP(AAINamespaceConstants.NETWORK, InstanceGroup.class),
+ COLLECTION(AAINamespaceConstants.NETWORK, Collection.class),
+ VNFC(AAINamespaceConstants.NETWORK, Vnfc.class),
+ VLAN_TAG(AAINamespaceConstants.NETWORK, VlanTag.class),
UNKNOWN("", "");
private final String uriTemplate;
private final String parentUri;
private final String partialUri;
+ private final Class<?> aaiObjectClass;
+ private static Map<String, AAIObjectType> map = new HashMap<>();
private AAIObjectType(String parentUri, String partialUri) {
this.parentUri = parentUri;
this.partialUri = partialUri;
this.uriTemplate = parentUri + partialUri;
+ this.aaiObjectClass = null;
+ }
+
+ private AAIObjectType(String parentUri, Class<?> aaiObjectClass) {
+ this.parentUri = parentUri;
+ this.partialUri = removeParentUri(aaiObjectClass, parentUri);
+ this.uriTemplate = parentUri + partialUri;
+ this.aaiObjectClass = aaiObjectClass;
}
@Override
public String toString() {
return this.uriTemplate();
}
-
+
+ public static AAIObjectType fromTypeName(String name) {
+ if (map.isEmpty()) {
+ for (AAIObjectType type : AAIObjectType.values()) {
+ map.put(type.typeName(), type);
+ }
+ }
+
+ if (map.containsKey(name)) {
+ return map.get(name);
+ } else {
+ return AAIObjectType.UNKNOWN;
+ }
+ }
@Override
public String typeName() {
return this.typeName(CaseFormat.LOWER_HYPHEN);
@@ -101,4 +160,8 @@ public enum AAIObjectType implements GraphInventoryObjectType {
public String partialUri() {
return this.partialUri;
}
+
+ protected String removeParentUri(Class<?> aaiObjectClass, String parentUri) {
+ return aaiObjectClass.getAnnotation(Metadata.class).uriTemplate().replace(parentUri, "");
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
index 0356e86861..434dbf946b 100644
--- a/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
+++ b/common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.aai.entities;
import org.onap.so.client.graphinventory.entities.GraphInventoryEdgeLabel;
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 36e67e2e09..45621f09a6 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
@@ -26,9 +26,11 @@ import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
+import org.apache.log4j.Logger;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
import org.onap.so.jsonpath.JsonPathUtil;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -37,11 +39,26 @@ public class AAIResultWrapper implements Serializable {
private static final long serialVersionUID = 5895841925807816737L;
private final String jsonBody;
private final ObjectMapper mapper;
+ private final transient Logger logger = Logger.getLogger(AAIResultWrapper.class);
+
public AAIResultWrapper(String json) {
this.jsonBody = json;
this.mapper = new AAICommonObjectMapperProvider().getMapper();
}
+ public AAIResultWrapper(Object aaiObject) {
+ this.mapper = new AAICommonObjectMapperProvider().getMapper();
+ this.jsonBody = mapObjectToString(aaiObject);
+ }
+
+ protected String mapObjectToString(Object aaiObject) {
+ try {
+ return mapper.writeValueAsString(aaiObject);
+ } catch (JsonProcessingException e) {
+ logger.warn("could not parse object into json - defaulting to {}");
+ return "{}";
+ }
+ }
public Optional<Relationships> getRelationships() {
final String path = "$.relationship-list";
if (isEmpty()) {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java
index 1ede2f9e1b..461920fe7f 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.graphinventory.entities;
public interface GraphInventoryEdgeLabel {
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
index 145959dc73..3d08c8d40c 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.graphinventory.entities.uri;
import java.net.URI;
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
index 74c1e398db..6743bc2c34 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClient.java
@@ -20,6 +20,7 @@
package org.onap.so.client.policy;
+import org.onap.so.client.policy.entities.Config;
import org.onap.so.client.policy.entities.DictionaryData;
import org.onap.so.client.policy.entities.PolicyDecision;
@@ -29,4 +30,6 @@ public interface PolicyClient {
String errorCode);
public DictionaryData getAllowedTreatments(String bbID, String workStep);
+
+ public Config getConfigWithPolicyName(String policyName);
}
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
index 1fd01e65ed..71a3227c56 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
@@ -20,6 +20,7 @@
package org.onap.so.client.policy;
+import java.io.IOException;
import java.util.List;
import org.onap.so.client.RestClient;
@@ -27,10 +28,13 @@ import org.onap.so.client.RestPropertiesLoader;
import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl;
import org.onap.so.client.policy.entities.AllowedTreatments;
import org.onap.so.client.policy.entities.Bbid;
+import org.onap.so.client.policy.entities.Config;
+import org.onap.so.client.policy.entities.ConfigRequestParameters;
import org.onap.so.client.policy.entities.DecisionAttributes;
import org.onap.so.client.policy.entities.DictionaryData;
import org.onap.so.client.policy.entities.DictionaryItemsRequest;
import org.onap.so.client.policy.entities.DictionaryJson;
+import org.onap.so.client.policy.entities.PolicyConfig;
import org.onap.so.client.policy.entities.PolicyDecision;
import org.onap.so.client.policy.entities.PolicyDecisionRequest;
import org.onap.so.client.policy.entities.PolicyServiceType;
@@ -38,11 +42,19 @@ import org.onap.so.client.policy.entities.Workstep;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
public class PolicyClientImpl implements PolicyClient {
private static Logger logger = LoggerFactory.getLogger(PolicyClientImpl.class);
private PolicyRestProperties props;
+ private ObjectMapper mapper = new ObjectMapper();
+
public PolicyClientImpl() {
props = RestPropertiesLoader.getInstance().getNewImpl(PolicyRestProperties.class);
if (props == null) {
@@ -63,7 +75,7 @@ public class PolicyClientImpl implements PolicyClient {
}
protected PolicyDecision getDecision(DecisionAttributes decisionAttributes) {
- PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DECISION);
+ PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DECISION);
PolicyDecisionRequest decisionRequest = new PolicyDecisionRequest();
decisionRequest.setDecisionAttributes(decisionAttributes);
decisionRequest.setEcompcomponentName(RestClient.ECOMP_COMPONENT_NAME);
@@ -73,7 +85,7 @@ public class PolicyClientImpl implements PolicyClient {
public DictionaryData getAllowedTreatments(String bbID, String workStep)
{
- PolicyRestClient client = new PolicyRestClient(this.props, PolicyServiceType.GET_DICTIONARY_ITEMS);
+ PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_DICTIONARY_ITEMS);
DictionaryItemsRequest dictionaryItemsRequest = new DictionaryItemsRequest();
dictionaryItemsRequest.setDictionaryType("Decision");
dictionaryItemsRequest.setDictionary("RainyDayTreatments");
@@ -92,5 +104,35 @@ public class PolicyClientImpl implements PolicyClient {
logger.error("There is no AllowedTreatments with that specified parameter set");
return null;
}
-
+
+ @Override
+ public Config getConfigWithPolicyName(String policyName) {
+ PolicyRestClient client = this.getPolicyRestClient(PolicyServiceType.GET_CONFIG);
+ ConfigRequestParameters configReqParameters = new ConfigRequestParameters();
+ configReqParameters.setPolicyName(policyName);
+ PolicyConfig[] policyConfigList = client.post(configReqParameters, PolicyConfig[].class);
+ PolicyConfig policyConfig = null;
+ if(policyConfigList.length > 1) {
+ logger.debug("Too many configs for policyName: " + policyName);
+ return null;
+ }
+ try {
+ policyConfig = policyConfigList[0];
+ return this.getConfigFromStringJson(policyConfig.getConfig());
+ } catch (IOException e) {
+ logger.error(e.getMessage());
+ return null;
+ }
+ }
+
+ protected Config getConfigFromStringJson(String configJson) throws JsonParseException, JsonMappingException, IOException {
+ String unescapedJson = configJson.replaceAll("\\\\", "");
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ return mapper.readValue(unescapedJson, Config.class);
+ }
+
+ protected PolicyRestClient getPolicyRestClient(PolicyServiceType policyServiceType) {
+ return new PolicyRestClient(this.props, policyServiceType);
+ }
}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Config.java b/common/src/main/java/org/onap/so/client/policy/entities/Config.java
new file mode 100644
index 0000000000..6c9c0759d6
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Config.java
@@ -0,0 +1,217 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "configName",
+ "riskLevel",
+ "policyName",
+ "policyScope",
+ "guard",
+ "description",
+ "priority",
+ "uuid",
+ "version",
+ "content",
+ "riskType",
+ "service",
+ "location",
+ "templateVersion"
+})
+@JsonRootName(value = "config")
+public class Config {
+
+ @JsonProperty("configName")
+ private String configName;
+ @JsonProperty("riskLevel")
+ private String riskLevel;
+ @JsonProperty("policyName")
+ private String policyName;
+ @JsonProperty("policyScope")
+ private String policyScope;
+ @JsonProperty("guard")
+ private String guard;
+ @JsonProperty("description")
+ private String description;
+ @JsonProperty("priority")
+ private String priority;
+ @JsonProperty("uuid")
+ private String uuid;
+ @JsonProperty("version")
+ private String version;
+ @JsonProperty("content")
+ private Content content;
+ @JsonProperty("riskType")
+ private String riskType;
+ @JsonProperty("service")
+ private String service;
+ @JsonProperty("location")
+ private String location;
+ @JsonProperty("templateVersion")
+ private String templateVersion;
+
+ @JsonProperty("configName")
+ public String getConfigName() {
+ return configName;
+ }
+
+ @JsonProperty("configName")
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+
+ @JsonProperty("riskLevel")
+ public String getRiskLevel() {
+ return riskLevel;
+ }
+
+ @JsonProperty("riskLevel")
+ public void setRiskLevel(String riskLevel) {
+ this.riskLevel = riskLevel;
+ }
+
+ @JsonProperty("policyName")
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ @JsonProperty("policyName")
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ @JsonProperty("policyScope")
+ public String getPolicyScope() {
+ return policyScope;
+ }
+
+ @JsonProperty("policyScope")
+ public void setPolicyScope(String policyScope) {
+ this.policyScope = policyScope;
+ }
+
+ @JsonProperty("guard")
+ public String getGuard() {
+ return guard;
+ }
+
+ @JsonProperty("guard")
+ public void setGuard(String guard) {
+ this.guard = guard;
+ }
+
+ @JsonProperty("description")
+ public String getDescription() {
+ return description;
+ }
+
+ @JsonProperty("description")
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ @JsonProperty("priority")
+ public String getPriority() {
+ return priority;
+ }
+
+ @JsonProperty("priority")
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
+
+ @JsonProperty("uuid")
+ public String getUuid() {
+ return uuid;
+ }
+
+ @JsonProperty("uuid")
+ public void setUuid(String uuid) {
+ this.uuid = uuid;
+ }
+
+ @JsonProperty("version")
+ public String getVersion() {
+ return version;
+ }
+
+ @JsonProperty("version")
+ public void setVersion(String version) {
+ this.version = version;
+ }
+
+ @JsonProperty("content")
+ public Content getContent() {
+ return content;
+ }
+
+ @JsonProperty("content")
+ public void setContent(Content content) {
+ this.content = content;
+ }
+
+ @JsonProperty("riskType")
+ public String getRiskType() {
+ return riskType;
+ }
+
+ @JsonProperty("riskType")
+ public void setRiskType(String riskType) {
+ this.riskType = riskType;
+ }
+
+ @JsonProperty("service")
+ public String getService() {
+ return service;
+ }
+
+ @JsonProperty("service")
+ public void setService(String service) {
+ this.service = service;
+ }
+
+ @JsonProperty("location")
+ public String getLocation() {
+ return location;
+ }
+
+ @JsonProperty("location")
+ public void setLocation(String location) {
+ this.location = location;
+ }
+
+ @JsonProperty("templateVersion")
+ public String getTemplateVersion() {
+ return templateVersion;
+ }
+
+ @JsonProperty("templateVersion")
+ public void setTemplateVersion(String templateVersion) {
+ this.templateVersion = templateVersion;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java b/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java
new file mode 100644
index 0000000000..8cd5b93a36
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java
@@ -0,0 +1,127 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.policy.entities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "configAttributes",
+ "configName",
+ "ecompName",
+ "onapName",
+ "policyName",
+ "requestID",
+ "unique"
+})
+public class ConfigRequestParameters {
+
+ @JsonProperty("configAttributes")
+ private Map<String, String> configAttributes = new HashMap<>();
+ @JsonProperty("configName")
+ private String configName;
+ @JsonProperty("ecompName")
+ private String ecompName;
+ @JsonProperty("onapName")
+ private String onapName;
+ @JsonProperty("policyName")
+ private String policyName;
+ @JsonProperty("requestID")
+ private String requestID;
+ @JsonProperty("unique")
+ private Boolean unique;
+
+ @JsonProperty("configAttributes")
+ public Map<String, String> getConfigAttributes() {
+ return configAttributes;
+ }
+
+ @JsonProperty("configAttributes")
+ public void setConfigAttributes(Map<String, String> configAttributes) {
+ this.configAttributes = configAttributes;
+ }
+
+ @JsonProperty("configName")
+ public String getConfigName() {
+ return configName;
+ }
+
+ @JsonProperty("configName")
+ public void setConfigName(String configName) {
+ this.configName = configName;
+ }
+
+ @JsonProperty("ecompName")
+ public String getEcompName() {
+ return ecompName;
+ }
+
+ @JsonProperty("ecompName")
+ public void setEcompName(String ecompName) {
+ this.ecompName = ecompName;
+ }
+
+ @JsonProperty("onapName")
+ public String getOnapName() {
+ return onapName;
+ }
+
+ @JsonProperty("onapName")
+ public void setOnapName(String onapName) {
+ this.onapName = onapName;
+ }
+
+ @JsonProperty("policyName")
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ @JsonProperty("policyName")
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ @JsonProperty("requestID")
+ public String getRequestID() {
+ return requestID;
+ }
+
+ @JsonProperty("requestID")
+ public void setRequestID(String requestID) {
+ this.requestID = requestID;
+ }
+
+ @JsonProperty("unique")
+ public Boolean getUnique() {
+ return unique;
+ }
+
+ @JsonProperty("unique")
+ public void setUnique(Boolean unique) {
+ this.unique = unique;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/Content.java b/common/src/main/java/org/onap/so/client/policy/entities/Content.java
new file mode 100644
index 0000000000..a473f6c566
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/policy/entities/Content.java
@@ -0,0 +1,47 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.policy.entities;
+
+import java.util.List;
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "fabric-config-models"
+})
+public class Content {
+
+ @JsonProperty("fabric-config-models")
+ private List<FabricConfigModel> fabricConfigModels = null;
+
+ @JsonProperty("fabric-config-models")
+ public List<FabricConfigModel> getFabricConfigModels() {
+ return fabricConfigModels;
+ }
+
+ @JsonProperty("fabric-config-models")
+ public void setFabricConfigModels(List<FabricConfigModel> fabricConfigModels) {
+ this.fabricConfigModels = fabricConfigModels;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java b/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java
new file mode 100644
index 0000000000..d1a924cb7d
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java
@@ -0,0 +1,59 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.policy.entities;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "vnfProfile",
+ "lagProfile"
+})
+public class FabricConfigModel {
+
+ @JsonProperty("vnfProfile")
+ private String vnfProfile;
+ @JsonProperty("lagProfile")
+ private String lagProfile;
+
+ @JsonProperty("vnfProfile")
+ public String getVnfProfile() {
+ return vnfProfile;
+ }
+
+ @JsonProperty("vnfProfile")
+ public void setVnfProfile(String vnfProfile) {
+ this.vnfProfile = vnfProfile;
+ }
+
+ @JsonProperty("lagProfile")
+ public String getLagProfile() {
+ return lagProfile;
+ }
+
+ @JsonProperty("lagProfile")
+ public void setLagProfile(String lagProfile) {
+ this.lagProfile = lagProfile;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java b/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java
new file mode 100644
index 0000000000..807829e323
--- /dev/null
+++ b/common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java
@@ -0,0 +1,166 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.client.policy.entities;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonPropertyOrder;
+
+@JsonInclude(JsonInclude.Include.NON_NULL)
+@JsonPropertyOrder({
+ "policyConfigMessage",
+ "policyConfigStatus",
+ "type",
+ "config",
+ "policyName",
+ "policyType",
+ "policyVersion",
+ "matchingConditions",
+ "responseAttributes",
+ "property"
+})
+public class PolicyConfig {
+
+ @JsonProperty("policyConfigMessage")
+ private String policyConfigMessage;
+ @JsonProperty("policyConfigStatus")
+ private String policyConfigStatus;
+ @JsonProperty("type")
+ private String type;
+ @JsonProperty("config")
+ private String config;
+ @JsonProperty("policyName")
+ private String policyName;
+ @JsonProperty("policyType")
+ private String policyType;
+ @JsonProperty("policyVersion")
+ private String policyVersion;
+ @JsonProperty("matchingConditions")
+ private Map<String, String> matchingConditions = new HashMap<>();
+ @JsonProperty("responseAttributes")
+ private Map<String, String> responseAttributes = new HashMap<>();
+ @JsonProperty("property")
+ private Object property;
+
+ @JsonProperty("policyConfigMessage")
+ public String getPolicyConfigMessage() {
+ return policyConfigMessage;
+ }
+
+ @JsonProperty("policyConfigMessage")
+ public void setPolicyConfigMessage(String policyConfigMessage) {
+ this.policyConfigMessage = policyConfigMessage;
+ }
+
+ @JsonProperty("policyConfigStatus")
+ public String getPolicyConfigStatus() {
+ return policyConfigStatus;
+ }
+
+ @JsonProperty("policyConfigStatus")
+ public void setPolicyConfigStatus(String policyConfigStatus) {
+ this.policyConfigStatus = policyConfigStatus;
+ }
+
+ @JsonProperty("type")
+ public String getType() {
+ return type;
+ }
+
+ @JsonProperty("type")
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ @JsonProperty("config")
+ public String getConfig() {
+ return config;
+ }
+
+ @JsonProperty("config")
+ public void setConfig(String config) {
+ this.config = config;
+ }
+
+ @JsonProperty("policyName")
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ @JsonProperty("policyName")
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ @JsonProperty("policyType")
+ public String getPolicyType() {
+ return policyType;
+ }
+
+ @JsonProperty("policyType")
+ public void setPolicyType(String policyType) {
+ this.policyType = policyType;
+ }
+
+ @JsonProperty("policyVersion")
+ public String getPolicyVersion() {
+ return policyVersion;
+ }
+
+ @JsonProperty("policyVersion")
+ public void setPolicyVersion(String policyVersion) {
+ this.policyVersion = policyVersion;
+ }
+
+ @JsonProperty("matchingConditions")
+ public Map<String, String> getMatchingConditions() {
+ return matchingConditions;
+ }
+
+ @JsonProperty("matchingConditions")
+ public void setMatchingConditions(Map<String, String> matchingConditions) {
+ this.matchingConditions = matchingConditions;
+ }
+
+ @JsonProperty("responseAttributes")
+ public Map<String, String> getResponseAttributes() {
+ return responseAttributes;
+ }
+
+ @JsonProperty("responseAttributes")
+ public void setResponseAttributes(Map<String, String> responseAttributes) {
+ this.responseAttributes = responseAttributes;
+ }
+
+ @JsonProperty("property")
+ public Object getProperty() {
+ return property;
+ }
+
+ @JsonProperty("property")
+ public void setProperty(Object property) {
+ this.property = property;
+ }
+
+}
diff --git a/common/src/main/java/org/onap/so/exceptions/MSOException.java b/common/src/main/java/org/onap/so/exceptions/MSOException.java
index c4be075cf0..f49cd8d8f8 100644
--- a/common/src/main/java/org/onap/so/exceptions/MSOException.java
+++ b/common/src/main/java/org/onap/so/exceptions/MSOException.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.exceptions;
diff --git a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
index 1ed18eae0f..794d02a240 100644
--- a/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
+++ b/common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
@@ -15,7 +15,6 @@
* 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.
- * Modifications Copyright (C) 2018 IBM.
* ============LICENSE_END=========================================================
*/
diff --git a/common/src/main/java/org/onap/so/logger/MsoLogger.java b/common/src/main/java/org/onap/so/logger/MsoLogger.java
index 3ef01f5216..94ffa71169 100644
--- a/common/src/main/java/org/onap/so/logger/MsoLogger.java
+++ b/common/src/main/java/org/onap/so/logger/MsoLogger.java
@@ -31,6 +31,7 @@ import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
+import org.apache.commons.lang3.StringUtils;
import org.onap.so.entity.MsoRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -291,7 +292,9 @@ public class MsoLogger {
public void recordAuditEvent(Long startTime, StatusCode statusCode, ResponseCode responseCode,
String responseDesc) {
- MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN");
+ if (StringUtils.isEmpty(MDC.get(MsoLogger.PARTNERNAME))) {
+ MDC.put(MsoLogger.PARTNERNAME, "UNKNOWN");
+ }
prepareAuditMsg(startTime, statusCode, responseCode.getValue(), responseDesc);
auditLogger.info("");
MDC.remove(TIMER);
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
index efc0aa84ef..f0a16561aa 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.logging.jaxrs.filter;
import java.net.InetAddress;
@@ -87,4 +107,4 @@ public class MDCSetup {
}
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
index 755d18b5ee..194a445ce2 100644
--- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
+++ b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.logging.spring.interceptor;
import java.util.Collections;
@@ -96,4 +116,4 @@ public class LoggingInterceptor extends HandlerInterceptorAdapter {
}
-} \ No newline at end of file
+}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
index bda3096f05..8e7e5e945e 100644
--- a/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
@@ -20,9 +20,10 @@
package org.onap.so.serviceinstancebeans;
+import java.util.List;
+
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
-import org.apache.commons.lang3.builder.ToStringBuilder;
@JsonInclude(Include.NON_DEFAULT)
@@ -35,6 +36,7 @@ public class Request {
protected RequestDetails requestDetails;
protected InstanceReferences instanceReferences;
protected RequestStatus requestStatus;
+ protected List<RequestProcessingData> requestProcessingData;
public String getRequestId() {
@@ -79,12 +81,19 @@ public class Request {
public void setRequestDetails(RequestDetails requestDetails) {
this.requestDetails = requestDetails;
}
+ public List<RequestProcessingData> getRequestProcessingData() {
+ return requestProcessingData;
+ }
+ public void setRequestProcessingData(List<RequestProcessingData> requestProcessingData) {
+ this.requestProcessingData = requestProcessingData;
+ }
@Override
public String toString() {
- return new ToStringBuilder(this).append("requestId", requestId).append("startTime", startTime)
- .append("requestScope", requestScope).append("requestType", requestType)
- .append("requestDetails", requestDetails).append("instanceReferences", instanceReferences)
- .append("requestStatus", requestStatus).toString();
+ return "Request [requestId=" + requestId + ", startTime=" + startTime
+ + ", requestScope=" + requestScope + ", requestType=" + requestType
+ + ", requestDetails=" + requestDetails + ", instanceReferences=" + instanceReferences
+ + ", requestStatus=" + requestStatus + ", requestProcessingData=" + requestProcessingData + "]";
}
+
}
diff --git a/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java
new file mode 100644
index 0000000000..3373f78335
--- /dev/null
+++ b/common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java
@@ -0,0 +1,62 @@
+/* ============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.serviceinstancebeans;
+
+import java.util.HashMap;
+import java.util.List;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonInclude.Include;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+
+@JsonInclude(Include.NON_DEFAULT)
+public class RequestProcessingData {
+
+ protected String groupingId;
+ protected String tag;
+ protected List<HashMap<String, String>> dataPairs;
+
+ public String getGroupingId() {
+ return groupingId;
+ }
+ public void setGroupingId(String groupingId) {
+ this.groupingId = groupingId;
+ }
+ public String getTag() {
+ return tag;
+ }
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+ public List<HashMap<String, String>> getDataPairs() {
+ return dataPairs;
+ }
+ public void setDataPairs(List<HashMap<String, String>> dataPairs) {
+ this.dataPairs = dataPairs;
+ }
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("groupingId", groupingId).append("tag", tag)
+ .append("dataPairs", dataPairs).toString();
+ }
+
+
+}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
index ce90ccdc0e..ea842719e8 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
@@ -52,4 +52,18 @@ public class AAIObjectTypeTest {
AAIUri aaiUri = AAIUriFactory.createResourceUri(AAIObjectType.COLLECTION, id);
assertEquals("/network/collections/collection/test1", aaiUri.build().toString());
}
+
+ @Test
+ public void genericVnfTest() {
+ AAIObjectType type = AAIObjectType.GENERIC_VNF;
+ assertEquals("/network/generic-vnfs/generic-vnf/{vnf-id}", type.uriTemplate());
+ assertEquals("/generic-vnfs/generic-vnf/{vnf-id}", type.partialUri());
+ }
+
+ @Test
+ public void pInterfaceTest() {
+ AAIObjectType type = AAIObjectType.P_INTERFACE;
+ assertEquals("/cloud-infrastructure/pservers/pserver/{hostname}/p-interfaces/p-interface/{interface-name}", type.uriTemplate());
+ assertEquals("/p-interfaces/p-interface/{interface-name}", type.partialUri());
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
index 1e2e7471f1..37188bc4bc 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
@@ -44,6 +44,7 @@ public class AAIPServerTest {
List<Pserver> list = client.getListOfPservers(json);
assertEquals("", list.get(0).getHostname(), "test");
+ assertEquals("", list.size(), 2);
}
@Test
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
index efd60a36a8..3d23213ff0 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.client.aai;
import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
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 e40c25a2e2..d4bf1b0224 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
@@ -102,8 +102,12 @@ public class AAIResultWrapperTest {
assertEquals(Optional.empty(), wrapper.asBean(GenericVnf.class));
assertEquals(true, wrapper.asMap().isEmpty());
assertEquals("{}", wrapper.toString());
-
-
}
+
+ @Test
+ public void objectConstructor() {
+ AAIResultWrapper wrapper = new AAIResultWrapper(new GenericVnf());
+ assertEquals("{}", wrapper.getJson());
+ }
}
diff --git a/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
index 104d40f76e..4cb9bd0e16 100644
--- a/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
+++ b/common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
@@ -23,8 +23,12 @@ package org.onap.so.client.policy;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
+import static org.mockito.Matchers.isA;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Matchers.any;
+import java.io.File;
+import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
@@ -33,16 +37,28 @@ import org.junit.Ignore;
import org.junit.Test;
import org.mockito.Mockito;
import org.onap.so.client.defaultproperties.PolicyRestPropertiesImpl;
+import org.onap.so.client.policy.entities.Config;
+import org.onap.so.client.policy.entities.ConfigRequestParameters;
import org.onap.so.client.policy.entities.DictionaryData;
+import org.onap.so.client.policy.entities.PolicyConfig;
import org.onap.so.client.policy.entities.PolicyDecision;
import org.onap.so.client.policy.entities.PolicyServiceType;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.SerializationFeature;
+
public class PolicyClientImplTest {
-
+
@BeforeClass
public static void setUp() {
System.setProperty("mso.config.path", "src/test/resources");
}
+
+ private static String RESOURCE_PATH = "src/test/resources/__files/Policy/";
+
@Test
public void successReadProperties() {
PolicyRestClient client = new PolicyRestClient(new PolicyRestPropertiesImpl(), PolicyServiceType.GET_DECISION);
@@ -52,7 +68,7 @@ public class PolicyClientImplTest {
assertEquals("Found expected Authorization", "Basic dGVzdHBkcDphbHBoYTEyMw==", map.get("Authorization"));
assertEquals("Found expected Environment", "TEST", map.get("Environment"));
}
-
+
@Test
@Ignore
public void getDecisionTest() {
@@ -61,10 +77,10 @@ public class PolicyClientImplTest {
assertEquals("Decision is correct", decision.getDecision(), "PERMIT");
assertEquals("Decision details is correct", decision.getDetails(), "Retry");
}
-
+
@Test
@Ignore
- public void getAllowedTreatmentsTest(){
+ public void getAllowedTreatmentsTest() {
PolicyClient client = new PolicyClientImpl();
DictionaryData dictClient = client.getAllowedTreatments("BB1", "1");
final String dictBbidString = dictClient.getBbid().getString();
@@ -72,7 +88,7 @@ public class PolicyClientImplTest {
assertEquals("DictionaryData matches a response Bbid", dictBbidString, "BB1");
assertEquals("DicitonaryData matches a response WorkStep", dictWorkStepString, "1");
}
-
+
@Test
public void getDecisionMockTest() {
String serviceType = "S";
@@ -80,11 +96,11 @@ public class PolicyClientImplTest {
String bbID = "BB1";
String workStep = "1";
String errorCode = "123";
-
+
PolicyDecision expected = new PolicyDecision();
expected.setDecision("PERMIT");
expected.setDetails("Retry");
-
+
DecisionAttributes decisionAttributes = new DecisionAttributes();
decisionAttributes.setServiceType(serviceType);
decisionAttributes.setVNFType(vnfType);
@@ -92,20 +108,43 @@ public class PolicyClientImplTest {
decisionAttributes.setWorkStep(workStep);
decisionAttributes.setErrorCode(errorCode);
PolicyClient client = Mockito.spy(PolicyClientImpl.class);
-
+
doReturn(expected).when(client).getDecision(serviceType, vnfType, bbID, workStep, errorCode);
PolicyDecision actual = client.getDecision(serviceType, vnfType, bbID, workStep, errorCode);
assertThat(actual, sameBeanAs(expected));
}
+
+ @Test
+ public void getConfigFromStringJsonTest() throws JsonParseException, JsonMappingException, IOException {
+ PolicyClientImpl client = new PolicyClientImpl();
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ Config expected = mapper.readValue(new File(RESOURCE_PATH + "configJson.json"), Config.class);
+ PolicyConfig[] returnedPolicyConfigList = mapper.readValue(new File(RESOURCE_PATH + "policyConfig.json"), PolicyConfig[].class);
+ String configJson = returnedPolicyConfigList[0].getConfig();
+ Config actual = client.getConfigFromStringJson(configJson);
+
+ assertThat(actual, sameBeanAs(expected));
+ }
- /*
@Test
- public void getAllowedTreatmentsTest() {
- PolicyClient client = new PolicyClientImpl();
- AllowedTreatments allowedTreatments = client.getAllowedTreatments("BB1", "1");
- int expectedSizeOfList = 4;
- int sizeOfList = allowedTreatments.getAllowedTreatments().size();
- assertEquals("Decision is correct", sizeOfList, expectedSizeOfList);
- }*/
+ public void getConfigWithPolicyNameTest() throws JsonParseException, JsonMappingException, IOException {
+ PolicyClientImpl client = Mockito.spy(PolicyClientImpl.class);
+ ObjectMapper mapper = new ObjectMapper();
+ mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, false);
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, false);
+ PolicyConfig[] returnedPolicyConfigList = mapper.readValue(new File(RESOURCE_PATH + "policyConfig.json"), PolicyConfig[].class);
+ Config expected = mapper.readValue(new File(RESOURCE_PATH + "configJson.json"), Config.class);
+
+ PolicyRestClient mockedClient = Mockito.mock(PolicyRestClient.class);
+ doReturn(mockedClient).when(client).getPolicyRestClient(PolicyServiceType.GET_CONFIG);
+ doReturn(returnedPolicyConfigList).when(mockedClient).post(isA(ConfigRequestParameters.class), any());
+
+ Config actual = client.getConfigWithPolicyName("policyName");
+
+ assertThat(actual, sameBeanAs(expected));
+
+ }
}
diff --git a/common/src/test/resources/__files/Policy/configJson.json b/common/src/test/resources/__files/Policy/configJson.json
new file mode 100644
index 0000000000..b206998b41
--- /dev/null
+++ b/common/src/test/resources/__files/Policy/configJson.json
@@ -0,0 +1,23 @@
+{
+ "configName": "Testing",
+ "riskLevel": "1",
+ "policyName": "fabric_configuration",
+ "policyScope": "resource=Test1,service=vSCP,type=configuration,closedLoopControlName=Firewall",
+ "guard": "False",
+ "description": "null",
+ "priority": "9",
+ "uuid": "1234",
+ "version": "1.0",
+ "content": {
+ "fabric-config-models": [
+ {
+ "vnfProfile": "v5",
+ "lagProfile": "N1"
+ }
+ ]
+ },
+ "riskType": "test",
+ "service": "mso-fabric-configuration-model",
+ "location": " Edge",
+ "templateVersion": "1607"
+} \ No newline at end of file
diff --git a/common/src/test/resources/__files/Policy/policyConfig.json b/common/src/test/resources/__files/Policy/policyConfig.json
new file mode 100644
index 0000000000..b67c9c0e48
--- /dev/null
+++ b/common/src/test/resources/__files/Policy/policyConfig.json
@@ -0,0 +1,20 @@
+[
+ {
+ "policyConfigMessage": "Config Retrieved! ",
+ "policyConfigStatus": "CONFIG_RETRIEVED",
+ "type": "JSON",
+ "config": "{\"configName\":\"Testing\",\"riskLevel\":\"1\",\"policyName\":\"fabric_configuration\",\"policyScope\":\"resource=Test1,service=vSCP,type=configuration,closedLoopControlName=Firewall\",\"guard\":\"False\",\"description\":\"null\",\"priority\":\"9\",\"uuid\":\"1234\",\"version\":\"1.0\",\"content\":{\"fabric-config-models\":[{\"vnfProfile\":\"v5\",\"lagProfile\":\"N1\"}]},\"riskType\":\"test\",\"service\":\"mso-fabric-configuration-model\",\"location\":\" Edge\",\"templateVersion\":\"1607\"}",
+ "policyName": "MSO_Policy.Config_MS_fabric_configuration_vPE.2.xml",
+ "policyType": "MicroService",
+ "policyVersion": "2",
+ "matchingConditions": {
+ "ECOMPName": "MSO",
+ "ONAPName": "MSO",
+ "service": "mso-fabric-configuration-model"
+ },
+ "responseAttributes": {
+
+ },
+ "property": null
+ }
+] \ No newline at end of file
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index 52d26fb09a..08499cfd22 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.logging.cxf.interceptor;
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
index 1ddf268ea8..ed4ba76268 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.logging.cxf.interceptor;
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
index 6991949dd0..ef47106fa1 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.logging.cxf.interceptor;
import java.net.InetAddress;
@@ -50,4 +70,4 @@ public class SOAPMDCSetup {
}
-} \ No newline at end of file
+}
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 8f8cf0898d..1a95aa0e09 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
@@ -58,10 +58,10 @@ import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.OperationStatus;
+import org.onap.so.db.request.client.RequestsDbClient;
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 1a1b45ac8e..753e712d71 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,11 @@ 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.client.RequestsDbClient;
+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;
@@ -741,4 +742,4 @@ public class MsoRequest {
return vnfType;
}
-} \ No newline at end of file
+}
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 753b4c48d4..50d2639b2d 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
@@ -23,6 +23,7 @@ package org.onap.so.apihandlerinfra;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -48,11 +49,12 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.onap.so.db.request.client.RequestsDbClient;
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;
@@ -97,10 +99,11 @@ public class OrchestrationRequests {
GetOrchestrationResponse orchestrationResponse = new GetOrchestrationResponse();
- InfraActiveRequests requestDB = null;
-
+ InfraActiveRequests infraActiveRequest = null;
+ List<org.onap.so.db.request.beans.RequestProcessingData> requestProcessingData = null;
try {
- requestDB = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
+ infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
+ requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId);
} catch (Exception e) {
msoLogger.error(e);
@@ -115,8 +118,8 @@ public class OrchestrationRequests {
throw validateException;
}
-
- if(requestDB == null) {
+
+ if(infraActiveRequest == null) {
ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, MsoLogger.ErrorCode.BusinessProcesssError).build();
@@ -126,8 +129,11 @@ public class OrchestrationRequests {
throw validateException;
}
-
- Request request = mapInfraActiveRequestToRequest(requestDB);
+
+ Request request = mapInfraActiveRequestToRequest(infraActiveRequest);
+ if(!requestProcessingData.isEmpty()){
+ request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
+ }
request.setRequestId(requestId);
orchestrationResponse.setRequest(request);
@@ -171,8 +177,12 @@ public class OrchestrationRequests {
List<RequestList> requestLists = new ArrayList<>();
for(InfraActiveRequests infraActive : activeRequests){
+ List<RequestProcessingData> requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(infraActive.getRequestId());
RequestList requestList = new RequestList();
Request request = mapInfraActiveRequestToRequest(infraActive);
+ if(!requestProcessingData.isEmpty()){
+ request.setRequestProcessingData(mapRequestProcessingData(requestProcessingData));
+ }
requestList.setRequest(request);
requestLists.add(requestList);
}
@@ -337,4 +347,46 @@ public class OrchestrationRequests {
return request;
}
+
+ public List<org.onap.so.serviceinstancebeans.RequestProcessingData> mapRequestProcessingData(List<org.onap.so.db.request.beans.RequestProcessingData> processingData){
+ List<org.onap.so.serviceinstancebeans.RequestProcessingData> addedRequestProcessingData = new ArrayList<>();
+ org.onap.so.serviceinstancebeans.RequestProcessingData finalProcessingData = new org.onap.so.serviceinstancebeans.RequestProcessingData();
+ String currentGroupingId = null;
+ HashMap<String, String> tempMap = new HashMap<>();
+ List<HashMap<String, String>> tempList = new ArrayList<>();
+ for(RequestProcessingData data : processingData){
+ String groupingId = data.getGroupingId();
+ String tag = data.getTag();
+ if(currentGroupingId == null || !currentGroupingId.equals(groupingId)){
+ if(!tempMap.isEmpty()){
+ tempList.add(tempMap);
+ finalProcessingData.setDataPairs(tempList);
+ addedRequestProcessingData.add(finalProcessingData);
+ }
+ finalProcessingData = new org.onap.so.serviceinstancebeans.RequestProcessingData();
+ if(groupingId != null){
+ finalProcessingData.setGroupingId(groupingId);
+ }
+ if(tag != null){
+ finalProcessingData.setTag(tag);
+ }
+ currentGroupingId = groupingId;
+ tempMap = new HashMap<>();
+ tempList = new ArrayList<>();
+ if(data.getName() != null && data.getValue() != null){
+ tempMap.put(data.getName(), data.getValue());
+ }
+ }else{
+ if(data.getName() != null && data.getValue() != null){
+ tempMap.put(data.getName(), data.getValue());
+ }
+ }
+ }
+ if(tempMap.size() > 0){
+ tempList.add(tempMap);
+ finalProcessingData.setDataPairs(tempList);
+ }
+ addedRequestProcessingData.add(finalProcessingData);
+ return addedRequestProcessingData;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index a7dac34aa0..60b07fdeab 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -58,10 +58,10 @@ import org.onap.so.db.catalog.beans.VnfResource;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
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.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -1511,7 +1511,9 @@ public class ServiceInstances {
}
}else{
//ok for version < 3 and action delete
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
+ if(modelName != null){
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
+ }
}
if(recipe == null){
@@ -1656,4 +1658,4 @@ public class ServiceInstances {
infraActiveRequestsClient.save(aq);
}
}
-} \ No newline at end of file
+}
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 cfe32a3833..d743c440e7 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,6 @@ 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.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
@@ -51,6 +50,7 @@ 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.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
@@ -237,4 +237,4 @@ public class CloudOrchestration {
private String getRequestId(ContainerRequestContext requestContext) {
return requestContext.getProperty("requestId").toString();
}
-} \ No newline at end of file
+}
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 3b7a326f3e..a35f40baf6 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,6 @@ 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.requestsdb.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.AlarmLoggerInfo;
@@ -56,6 +55,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.Request;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestDetails;
import org.onap.so.apihandlerinfra.tenantisolationbeans.RequestStatus;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoAlarmLogger;
@@ -294,4 +294,4 @@ public class CloudResourcesOrchestration {
return request;
}
-} \ No newline at end of file
+}
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 b13008b3d3..855a5433f3 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,6 @@ import javax.ws.rs.core.MultivaluedMap;
import org.apache.commons.lang3.StringUtils;
import org.onap.so.apihandlerinfra.Constants;
-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;
@@ -44,6 +43,7 @@ import org.onap.so.apihandlerinfra.tenantisolationbeans.ResourceType;
import org.onap.so.apihandlerinfra.tenantisolationbeans.ServiceModelList;
import org.onap.so.apihandlerinfra.vnfbeans.RequestStatusType;
import org.onap.so.db.request.beans.InfraActiveRequests;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
@@ -384,4 +384,4 @@ public class TenantIsolationRequest {
public void setOperationalEnvironmentId(String operationalEnvironmentId) {
this.operationalEnvironmentId = operationalEnvironmentId;
}
-} \ No newline at end of file
+}
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 e89b5c8d42..ac9a000d3b 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
@@ -27,7 +27,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.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
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 6eb5157568..66cfd349df 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,7 +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.db.request.client.RequestsDbClient;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
index d2730406e6..52ed34ac3f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
@@ -28,7 +28,6 @@ import com.github.tomakehurst.wiremock.client.WireMock;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.runner.RunWith;
-import org.onap.so.db.request.data.repository.InfraActiveRequestsRepository;
import org.onap.so.logger.MsoLogger;
import org.onap.so.logger.MsoLogger.Catalog;
import org.springframework.beans.factory.annotation.Autowired;
@@ -45,8 +44,7 @@ import org.springframework.test.context.jdbc.Sql.ExecutionPhase;
import org.springframework.test.context.junit4.SpringRunner;
import javax.transaction.Transactional;
-import java.io.File;
-import java.io.IOException;
+
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -55,7 +53,7 @@ import java.nio.file.Paths;
@ActiveProfiles("test")
@ContextConfiguration
@Transactional
-@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql")
+//@Sql(executionPhase=ExecutionPhase.AFTER_TEST_METHOD,scripts="classpath:InfraActiveRequestsReset.sql")
@AutoConfigureWireMock(port = 0)
public abstract class BaseTest {
protected MsoLogger logger = MsoLogger.getMsoLogger(Catalog.GENERAL, BaseTest.class);
@@ -65,26 +63,16 @@ public abstract class BaseTest {
@Autowired
protected Environment env;
-
- @Autowired
- protected InfraActiveRequestsRepository iar;
-
+
@LocalServerPort
private int port;
- protected String readJsonFileAsString(String fileLocation) throws JsonParseException, JsonMappingException, IOException{
- ObjectMapper mapper = new ObjectMapper();
- JsonNode jsonNode = mapper.readTree(new File(fileLocation));
- return jsonNode.asText();
- }
-
protected String createURLWithPort(String uri) {
return "http://localhost:" + port + uri;
}
@After
public void tearDown(){
- iar.deleteAll();
WireMock.reset();
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index 5d6aa43a9b..76d4b48a36 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
@@ -39,6 +39,7 @@ import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.apache.log4j.MDC;
import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.apihandlerinfra.tasksbeans.RequestDetails;
import org.onap.so.apihandlerinfra.tasksbeans.RequestInfo;
import org.onap.so.apihandlerinfra.tasksbeans.TaskRequestReference;
@@ -110,8 +111,8 @@ public class ManualTasksTest extends BaseTest{
logEvent.getMarker().getName().equals("ENTRY")
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
assertEquals("tasks/v1/55/complete",mdc.get(MsoLogger.SERVICE_NAME));
@@ -119,9 +120,9 @@ public class ManualTasksTest extends BaseTest{
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(MsoLogger.ENDTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
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 582bc12077..0af9826020 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
@@ -20,50 +20,63 @@
package org.onap.so.apihandlerinfra;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
+import static com.github.tomakehurst.wiremock.client.WireMock.any;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.equalToJson;
+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.urlPathEqualTo;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+
import org.apache.http.HttpStatus;
import org.junit.Ignore;
import org.junit.Test;
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.db.request.client.RequestsDbClient;
import org.onap.so.exceptions.ValidationException;
-import org.onap.so.requestsdb.client.RequestsDbClient;
-import org.onap.so.serviceinstancebeans.*;
+import org.onap.so.serviceinstancebeans.GetOrchestrationListResponse;
+import org.onap.so.serviceinstancebeans.GetOrchestrationResponse;
+import org.onap.so.serviceinstancebeans.Request;
+import org.onap.so.serviceinstancebeans.RequestError;
+import org.onap.so.serviceinstancebeans.RequestProcessingData;
+import org.onap.so.serviceinstancebeans.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.web.util.UriComponentsBuilder;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.io.File;
-import java.io.IOException;
-import java.nio.file.Files;
-import java.nio.file.Paths;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static com.github.tomakehurst.wiremock.client.WireMock.*;
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.type.TypeReference;
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
public class OrchestrationRequestsTest extends BaseTest {
@Autowired
- private InfraActiveRequestsRepository iar;
-
- @Autowired
private RequestsDbClient requestsDbClient;
+
+ @Autowired
+ private OrchestrationRequests orchReq;
- private static final String CHECK_HTML = "<!DOCTYPE html><html><head><meta charset=\"ISO-8859-1\"><title></title></head><body></body></html>";
private static final GetOrchestrationListResponse ORCHESTRATION_LIST = generateOrchestrationList();
private static final String INVALID_REQUEST_ID = "invalid-request-id";
@@ -162,9 +175,14 @@ public class OrchestrationRequestsTest extends BaseTest {
List<String> values = new ArrayList<>();
values.add("EQUALS");
values.add("vfModule");
+
+ ObjectMapper mapper = new ObjectMapper();
+ GetOrchestrationListResponse testResponse = mapper.readValue(new File("src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json"),
+ GetOrchestrationListResponse.class);
Map<String, List<String>> orchestrationMap = new HashMap<>();
orchestrationMap.put("modelType", values);
+ List<GetOrchestrationResponse> testResponses = new ArrayList<>();
List<InfraActiveRequests> requests = requestsDbClient.getOrchestrationFiltersFromInfraActive(orchestrationMap);
HttpEntity<Request> entity = new HttpEntity<Request>(null, headers);
@@ -175,8 +193,11 @@ public class OrchestrationRequestsTest extends BaseTest {
ResponseEntity<GetOrchestrationListResponse> response = restTemplate.exchange(builder.toUriString(),
HttpMethod.GET, entity, GetOrchestrationListResponse.class);
+ assertThat(response.getBody(),
+ sameBeanAs(testResponse).ignoring("requestList.request.startTime").ignoring("requestList.request.requestStatus.finishTime"));
assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value());
assertEquals(requests.size(), response.getBody().getRequestList().size());
+
}
@Test
@@ -315,7 +336,7 @@ public class OrchestrationRequestsTest extends BaseTest {
requests.setRequestId("requestId");
requests.setRequestScope("service");
requests.setRequestType("createInstance");
- iar.save(requests);
+// iar.save(requests);
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
@@ -334,12 +355,48 @@ public class OrchestrationRequestsTest extends BaseTest {
assertEquals("7.0.0", response.getHeaders().get("X-LatestVersion").get(0));
assertEquals("requestId", response.getHeaders().get("X-TransactionID").get(0));
}
+ @Test
+ public void mapRequestProcessingDataTest() throws JsonParseException, JsonMappingException, IOException{
+ RequestProcessingData entry = new RequestProcessingData();
+ RequestProcessingData secondEntry = new RequestProcessingData();
+ List<HashMap<String, String>> expectedList = new ArrayList<>();
+ HashMap<String, String> expectedMap = new HashMap<>();
+ List<HashMap<String, String>> secondExpectedList = new ArrayList<>();
+ HashMap<String, String> secondExpectedMap = new HashMap<>();
+ List<RequestProcessingData> expectedDataList = new ArrayList<>();
+ entry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca714");
+ entry.setTag("pincFabricConfigRequest");
+ expectedMap.put("requestAction", "assign");
+ expectedMap.put("pincFabricId", "testId");
+ expectedList.add(expectedMap);
+ entry.setDataPairs(expectedList);
+ secondEntry.setGroupingId("7d2e8c07-4d10-456d-bddc-37abf38ca715");
+ secondEntry.setTag("pincFabricConfig");
+ secondExpectedMap.put("requestAction", "unassign");
+ secondExpectedList.add(secondExpectedMap);
+ secondEntry.setDataPairs(secondExpectedList);
+ expectedDataList.add(entry);
+ expectedDataList.add(secondEntry);
+
+ List<org.onap.so.db.request.beans.RequestProcessingData> processingData = new ArrayList<>();
+ List<RequestProcessingData> actualProcessingData = new ArrayList<>();
+ ObjectMapper mapper = new ObjectMapper();
+ processingData = mapper.readValue(new File("src/test/resources/OrchestrationRequest/RequestProcessingData.json"),
+ new TypeReference<List<org.onap.so.db.request.beans.RequestProcessingData>>(){});
+ actualProcessingData = orchReq.mapRequestProcessingData(processingData);
+ assertThat(actualProcessingData,sameBeanAs(expectedDataList));
+ }
public void setupTestGetOrchestrationRequest() throws Exception{
//For testGetOrchestrationRequest
stubFor(any(urlPathEqualTo("/infraActiveRequests/00032ab7-na18-42e5-965d-8ea592502018")).willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getOrchestrationRequest.json"))))
.withStatus(HttpStatus.SC_OK)));
+ stubFor(get(urlPathEqualTo("/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/"))
+ .withQueryParam("SO_REQUEST_ID", equalTo("00032ab7-na18-42e5-965d-8ea592502018"))
+ .willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
+ .withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestProcessingData.json"))))
+ .withStatus(HttpStatus.SC_OK)));
}
private void setupTestGetOrchestrationRequestRequestDetails(String requestId, String status) throws Exception{
@@ -379,4 +436,4 @@ public class OrchestrationRequestsTest extends BaseTest {
.withBody(new String(Files.readAllBytes(Paths.get("src/test/resources/OrchestrationRequest/getRequestDetailsFilter.json"))))
.withStatus(HttpStatus.SC_OK)));
}
-} \ No newline at end of file
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 76f4bb08a2..e4ec850c4e 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -189,8 +189,8 @@ public class ServiceInstancesTest extends BaseTest{
logEvent.getMarker().getName().equals("ENTRY")
){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",mdc.get(MsoLogger.SERVICE_NAME));
@@ -198,9 +198,9 @@ public class ServiceInstancesTest extends BaseTest{
}else if(logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging") &&
logEvent.getMarker().getName().equals("EXIT")){
Map<String,String> mdc = logEvent.getMDCPropertyMap();
- assertNotNull(mdc.get(MsoLogger.BEGINTIME));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(MsoLogger.ENDTIME));
- assertNotNull(mdc.get(MsoLogger.REQUEST_ID));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(MsoLogger.INVOCATION_ID));
assertEquals("202",mdc.get(MsoLogger.RESPONSECODE));
assertEquals("UNKNOWN",mdc.get(MsoLogger.PARTNERNAME));
@@ -1633,7 +1633,7 @@ public class ServiceInstancesTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
stubFor(get(urlMatching(".*/networkRecipe/search/findFirstByModelNameAndAction[?]" +
- "modelName=GR-API-DEFAULT&action=deleteInstance"))
+ "modelName=VNF-API-DEFAULT&action=deleteInstance"))
.willReturn(aResponse().withHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON)
.withBody(getWiremockResponseForCatalogdb("networkRecipe_Response.json"))
.withStatus(org.apache.http.HttpStatus.SC_OK)));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
index e759752c33..1e11b74215 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
@@ -30,7 +30,6 @@ import org.onap.so.apihandlerinfra.Status;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Action;
import org.onap.so.apihandlerinfra.tenantisolationbeans.TenantIsolationRequest;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
index 5f18e28ba6..8ac84d6598 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
@@ -25,9 +25,6 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.so.apihandlerinfra.BaseTest;
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 org.springframework.boot.context.embedded.LocalServerPort;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
@@ -44,15 +41,8 @@ import static org.junit.Assert.assertTrue;
public class CloudResourcesOrchestrationTest extends BaseTest{
- @Autowired
- private InfraActiveRequestsRepository iarRepo;
private String requestJSON = "{\"requestDetails\":{\"requestInfo\":{\"source\":\"VID\",\"requestorId\":\"xxxxxx\" } } }";
private static final String path = "/onap/so/infra/cloudResourcesRequests";
-
- @LocalServerPort
- private int port;
-
-
HttpHeaders headers = new HttpHeaders();
@Before
@@ -275,8 +265,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest{
iar.setRequestStatus("COMPLETE");
iar.setRequestAction("TEST");
- iarRepo.saveAndFlush(iar);
-
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>("", headers);
@@ -303,8 +291,6 @@ public class CloudResourcesOrchestrationTest extends BaseTest{
iar.setRequestStatus("COMPLETE");
iar.setRequestAction("TEST");
- iarRepo.saveAndFlush(iar);
-
headers.set("Accept", MediaType.APPLICATION_JSON);
headers.set("Content-Type", MediaType.APPLICATION_JSON);
HttpEntity<String> entity = new HttpEntity<>(null, headers);
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 eba90496ba..9a5334081f 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
@@ -30,8 +30,7 @@ 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 com.fasterxml.jackson.core.JsonProcessingException;
@@ -39,7 +38,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import org.apache.http.HttpStatus;
import org.json.JSONObject;
import org.junit.Rule;
-import org.junit.After;
import org.junit.Test;
import org.junit.Ignore;
import org.junit.rules.ExpectedException;
@@ -47,16 +45,12 @@ import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandlerinfra.BaseTest;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
-import org.onap.so.apihandlerinfra.tenantisolation.helpers.ActivateVnfDBHelper;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Distribution;
import org.onap.so.apihandlerinfra.tenantisolationbeans.DistributionStatus;
import org.onap.so.apihandlerinfra.tenantisolationbeans.Status;
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;
@@ -66,10 +60,6 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
@Autowired
private ActivateVnfStatusOperationalEnvironment activateVnfStatus;
- @Autowired
- private InfraActiveRequestsRepository infraActiveRequestsRepository;
- @Autowired
- private ActivateVnfDBHelper dbHelper;
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -185,10 +175,7 @@ public class ActivateVnfStatusOperationalEnvironmentTest extends BaseTest{
.withStatus(HttpStatus.SC_OK)));
activateVnfStatus.checkOrUpdateOverallStatus(operationalEnvironmentId, requestIdOrig);
-
- // do nothing, waiting for more
- assertNull(infraActiveRequestsRepository.findOne(requestIdOrig));
- }
+ }
@Test
public void executionTest_Ok() throws Exception {
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 1dfafce40c..809e39c772 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
@@ -40,7 +40,6 @@ import org.onap.so.client.aai.objects.AAIOperationalEnvironment;
import org.onap.so.client.grm.beans.Property;
import org.onap.so.client.grm.beans.ServiceEndPointList;
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 com.fasterxml.jackson.databind.ObjectMapper;
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 5b0e1f6bfd..7c24050775 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
@@ -37,7 +37,6 @@ import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestrationRequest;
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.springframework.beans.factory.annotation.Autowired;
import javax.ws.rs.core.HttpHeaders;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
new file mode 100644
index 0000000000..561ed0d31f
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json
@@ -0,0 +1,189 @@
+{
+ "requestList": [
+ {
+ "request": {
+ "requestId": "001619d2-a297-4a4b-a9f5-e2823c88458f",
+ "startTime": "Fri, 01 Jul 2016 04:41:42 GMT",
+ "requestScope": "vfModule",
+ "requestType": "createInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "test::base::module-0"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "cloudConfiguration": {
+ "tenantId": "6accefef3cb442ff9e644d589fb04107",
+ "lcpCloudRegionId": "n6"
+ },
+ "instanceName": []
+ },
+ "instanceReferences": {
+ "vnfInstanceName": "test-vscp",
+ "vfModuleInstanceName": "MODULENAME1"
+ },
+ "requestStatus": {
+ "requestState": "COMPLETE",
+ "statusMessage": "COMPLETED",
+ "percentProgress": 100,
+ "finishTime": "Tue, 02 May 2017 06:33:34 GMT"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "00032ab7-3fb3-42e5-965d-8ea592502017",
+ "startTime": "Thu, 22 Dec 2016 08:29:54 GMT",
+ "requestScope": "vfModule",
+ "requestType": "deleteInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "test::base::module-0"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "cloudConfiguration": {
+ "tenantId": "6accefef3cb442ff9e644d589fb04107",
+ "lcpCloudRegionId": "n6"
+ },
+ "instanceName": []
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc",
+ "vnfInstanceId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005",
+ "vfModuleInstanceId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"
+ },
+ "requestStatus": {
+ "requestState": "COMPLETE",
+ "statusMessage": "Vf Module has been deleted successfully.",
+ "percentProgress": 100,
+ "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "startTime": "Thu, 22 Dec 2016 08:29:54 GMT",
+ "requestScope": "vfModule",
+ "requestType": "deleteInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vfModule",
+ "modelName": "test::base::module-0"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "suppressRollback": false
+ },
+ "cloudConfiguration": {
+ "tenantId": "6accefef3cb442ff9e644d589fb04107",
+ "lcpCloudRegionId": "n6"
+ },
+ "instanceName": []
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc",
+ "vnfInstanceId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005",
+ "vfModuleInstanceId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"
+ },
+ "requestStatus": {
+ "requestState": "PENDING",
+ "statusMessage": "Vf Module deletion pending.",
+ "percentProgress": 0,
+ "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "5ffbabd6-b793-4377-a1ab-082670fbc7ac",
+ "startTime": "Thu, 22 Dec 2016 08:29:54 GMT",
+ "requestScope": "vfModule",
+ "requestType": "deleteInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671",
+ "modelType": "vfModule",
+ "modelId": "20c4431c-246d-11e7-93ae-92361f002671",
+ "modelName": "test::base::module-0",
+ "modelVersion": "2",
+ "modelCustomizationUuid": "cb82ffd8-252a-11e7-93ae-92361f002671",
+ "modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671",
+ "modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671",
+ "modelUuid": "20c4431c-246d-11e7-93ae-92361f002671",
+ "modelInvariantUuid": "78ca26d0-246d-11e7-93ae-92361f002671"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1",
+ "suppressRollback": false,
+ "requestorId": "xxxxxx"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "76fa8849-4c98-473f-b431-2590b192a653",
+ "modelInfo": {
+ "modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671",
+ "modelType": "service",
+ "modelId": "5df8b6de-2083-11e7-93ae-92361f002671",
+ "modelName": "Infra_v10_Service",
+ "modelVersion": "1.0",
+ "modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671",
+ "modelUuid": "5df8b6de-2083-11e7-93ae-92361f002671",
+ "modelInvariantUuid": "9647dfc4-2083-11e7-93ae-92361f002671"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c",
+ "modelInfo": {
+ "modelCustomizationName": "v10 1",
+ "modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "modelType": "vnf",
+ "modelId": "ff2ae348-214a-11e7-93ae-92361f002671",
+ "modelName": "v10",
+ "modelVersion": "1.0",
+ "modelCustomizationUuid": "68dc9a92-214c-11e7-93ae-92361f002671",
+ "modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671",
+ "modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671",
+ "modelUuid": "ff2ae348-214a-11e7-93ae-92361f002671",
+ "modelInvariantUuid": "2fff5b20-214b-11e7-93ae-92361f002671",
+ "modelInstanceName": "v10 1"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration": {
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "lcpCloudRegionId": "n6"
+ },
+ "requestParameters": {
+ "userParams": [],
+ "usePreload": true
+ },
+ "instanceName": []
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "e3b5744d-2ad1-4cdd-8390-c999a38829bc",
+ "vnfInstanceId": "b92f60c8-8de3-46c1-8dc1-e4390ac2b005",
+ "vfModuleInstanceId": "c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"
+ },
+ "requestStatus": {
+ "requestState": "UNLOCKED",
+ "statusMessage": "Vf Module deletion pending.",
+ "percentProgress": 0,
+ "finishTime": "Thu, 22 Dec 2016 08:30:28 GMT"
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
index 124513de0d..1b1530d3a6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
@@ -1 +1,298 @@
-{"requestList":[{"request":{"requestId":"00032ab7-3fb3-42e5-965d-8ea592502017","requestScope":"vfModule","requestType":"deleteInstance","requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID","suppressRollback":false},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}},"instanceReferences":{"serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc","vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005","vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"},"requestStatus":{"requestState":"COMPLETE","statusMessage":"Vf Module has been deleted successfully.","percentProgress":100}}},{"request":{"requestId":"00032ab7-na18-42e5-965d-8ea592502018","requestScope":"vfModule","requestType":"deleteInstance","requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID","suppressRollback":false},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}},"instanceReferences":{"serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc","vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005","vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"},"requestStatus":{"requestState":"PENDING","statusMessage":"Vf Module deletion pending.","percentProgress":0}}},{"request":{"requestId":"00093944-bf16-4373-ab9a-3adfe730ff2d","requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_v10_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_v10_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}},"instanceReferences":{},"requestStatus":{"requestState":"FAILED","statusMessage":"Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.","percentProgress":100}}},{"request":{"requestId":"001619d2-a297-4a4b-a9f5-e2823c88458f","requestScope":"vfModule","requestType":"createInstance","instanceReferences":{},"requestStatus":{"requestState":"COMPLETE","statusMessage":"COMPLETED","percentProgress":100}}},{"request":{"requestId":"00164b9e-784d-48a8-8973-bbad6ef818ed","requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelName":"MSO Test Network","modelVersion":"1.0","modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e"},"requestInfo":{"source":"VID","instanceName":"DEV-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}},"instanceReferences":{"serviceInstanceId":"b2f59173-b7e5-4e0f-8440-232fd601b865"},"requestStatus":{"requestState":"COMPLETE","statusMessage":"Service Instance was created successfully.","percentProgress":100}}},{"request":{"requestId":"00173cc9-5ce2-4673-a810-f87fefb2829e","requestScope":"service","requestType":"createInstance","requestDetails":{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}},"instanceReferences":{},"requestStatus":{"requestState":"FAILED","statusMessage":"Error parsing request. No valid instanceName is specified","percentProgress":100}}},{"request":{"requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc349","requestScope":"configuration","requestType":"activateInstance","requestDetails":{"modelInfo":{"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a"}}}],"cloudConfiguration":{"lcpCloudRegionId":"n6"},"requestParameters":{"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true}},"instanceReferences":{"serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d"},"requestStatus":{"requestState":"UNLOCKED","percentProgress":20}}},{"request": {"requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc350","requestScope":"service","requestType":"createInstance","requestStatus": {"requestState": "IN_PROGRESS", "statusMessage": "Error parsing request.\n\tNo valid instanceName is specified"}}}]} \ No newline at end of file
+{
+ "requestList":[
+ {
+ "request":{
+ "requestId":"00032ab7-3fb3-42e5-965d-8ea592502017",
+ "requestScope":"vfModule",
+ "requestType":"deleteInstance",
+ "requestDetails":{
+ "modelInfo":{
+ "modelType":"vfModule",
+ "modelName":"test::base::module-0"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false
+ },
+ "cloudConfiguration":{
+ "tenantId":"6accefef3cb442ff9e644d589fb04107",
+ "lcpCloudRegionId":"n6"
+ }
+ },
+ "instanceReferences":{
+ "serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc",
+ "vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005",
+ "vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"
+ },
+ "requestStatus":{
+ "requestState":"COMPLETE",
+ "statusMessage":"Vf Module has been deleted successfully.",
+ "percentProgress":100
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"00032ab7-na18-42e5-965d-8ea592502018",
+ "requestScope":"vfModule",
+ "requestType":"deleteInstance",
+ "requestDetails":{
+ "modelInfo":{
+ "modelType":"vfModule",
+ "modelName":"test::base::module-0"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false
+ },
+ "cloudConfiguration":{
+ "tenantId":"6accefef3cb442ff9e644d589fb04107",
+ "lcpCloudRegionId":"n6"
+ }
+ },
+ "instanceReferences":{
+ "serviceInstanceId":"e3b5744d-2ad1-4cdd-8390-c999a38829bc",
+ "vnfInstanceId":"b92f60c8-8de3-46c1-8dc1-e4390ac2b005",
+ "vfModuleInstanceId":"c7d527b1-7a91-49fd-b97d-1c8c0f4a7992"
+ },
+ "requestStatus":{
+ "requestState":"PENDING",
+ "statusMessage":"Vf Module deletion pending.",
+ "percentProgress":0
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"00093944-bf16-4373-ab9a-3adfe730ff2d",
+ "requestScope":"service",
+ "requestType":"createInstance",
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671",
+ "modelType":"service",
+ "modelName":"MSOTADevInfra_v10_Service",
+ "modelVersion":"1.0",
+ "modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "instanceName":"MSODEV_1707_SI_v10_011-4",
+ "suppressRollback":false,
+ "requestorId":"xxxxxx"
+ },
+ "subscriberInfo":{
+ "globalSubscriberId":"MSO_1610_dev",
+ "subscriberName":"MSO_1610_dev"
+ },
+ "cloudConfiguration":{
+ "tenantId":"19123c2924c648eb8e42a3c1f14b7682",
+ "lcpCloudRegionId":"n6"
+ },
+ "requestParameters":{
+ "subscriptionServiceType":"MSO-dev-service-type",
+ "userParams":[
+ {
+ "name":"someUserParam",
+ "value":"someValue"
+ }
+ ],
+ "aLaCarte":true,
+ "autoBuildVfModules":false,
+ "cascadeDelete":false,
+ "usePreload":true
+ }
+ },
+ "instanceReferences":{
+
+ },
+ "requestStatus":{
+ "requestState":"FAILED",
+ "statusMessage":"Error: Locked instance - This service (MSODEV_1707_SI_v10_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.",
+ "percentProgress":100
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"001619d2-a297-4a4b-a9f5-e2823c88458f",
+ "requestScope":"vfModule",
+ "requestType":"createInstance",
+ "instanceReferences":{
+
+ },
+ "requestStatus":{
+ "requestState":"COMPLETE",
+ "statusMessage":"COMPLETED",
+ "percentProgress":100
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"00164b9e-784d-48a8-8973-bbad6ef818ed",
+ "requestScope":"service",
+ "requestType":"createInstance",
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f",
+ "modelType":"service",
+ "modelName":"MSO Test Network",
+ "modelVersion":"1.0",
+ "modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "instanceName":"DEV-n6-3100-0927-1",
+ "suppressRollback":false,
+ "requestorId":"xxxxxx"
+ },
+ "subscriberInfo":{
+ "globalSubscriberId":"MSO_1610_dev",
+ "subscriberName":"MSO_1610_dev"
+ },
+ "cloudConfiguration":{
+ "tenantId":"19123c2924c648eb8e42a3c1f14b7682",
+ "lcpCloudRegionId":"n6"
+ },
+ "requestParameters":{
+ "subscriptionServiceType":"MSO-dev-service-type",
+ "userParams":[
+ {
+ "name":"someUserParam",
+ "value":"someValue"
+ }
+ ],
+ "aLaCarte":true,
+ "autoBuildVfModules":false,
+ "cascadeDelete":false,
+ "usePreload":true
+ }
+ },
+ "instanceReferences":{
+ "serviceInstanceId":"b2f59173-b7e5-4e0f-8440-232fd601b865"
+ },
+ "requestStatus":{
+ "requestState":"COMPLETE",
+ "statusMessage":"Service Instance was created successfully.",
+ "percentProgress":100
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"00173cc9-5ce2-4673-a810-f87fefb2829e",
+ "requestScope":"service",
+ "requestType":"createInstance",
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51",
+ "modelType":"service",
+ "modelName":"ConstraintsSrvcVID",
+ "modelVersion":"2.0",
+ "modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"
+ },
+ "requestInfo":{
+ "productFamilyId":"LRSI-OSPF",
+ "source":"VID",
+ "suppressRollback":false,
+ "requestorId":"xxxxxx"
+ },
+ "subscriberInfo":{
+ "globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ "cloudConfiguration":{
+ "tenantId":"a259ae7b7c3f493cb3d91f95a7c18149",
+ "lcpCloudRegionId":"mtn16"
+ },
+ "requestParameters":{
+ "subscriptionServiceType":"Mobility",
+ "userParams":[
+ {
+ "name":"neutronport6_name",
+ "value":"8"
+ },
+ {
+ "name":"neutronnet5_network_name",
+ "value":"8"
+ },
+ {
+ "name":"contrailv2vlansubinterface3_name",
+ "value":"false"
+ }
+ ]
+ }
+ },
+ "instanceReferences":{
+
+ },
+ "requestStatus":{
+ "requestState":"FAILED",
+ "statusMessage":"Error parsing request. No valid instanceName is specified",
+ "percentProgress":100
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc349",
+ "requestScope":"configuration",
+ "requestType":"activateInstance",
+ "requestDetails":{
+ "modelInfo":{
+ "modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39",
+ "modelType":"configuration",
+ "modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455",
+ "modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "suppressRollback":false,
+ "requestorId":"xxxxxx"
+ },
+ "relatedInstanceList":[
+ {
+ "relatedInstance":{
+ "instanceId":"9e15a443-af65-4f05-9000-47ae495e937d",
+ "modelInfo":{
+ "modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a",
+ "modelType":"service",
+ "modelName":"MSOTADevInfra_Configuration_Service",
+ "modelVersion":"1.0",
+ "modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration":{
+ "lcpCloudRegionId":"n6"
+ },
+ "requestParameters":{
+ "aLaCarte":false,
+ "autoBuildVfModules":false,
+ "cascadeDelete":false,
+ "usePreload":true
+ }
+ },
+ "instanceReferences":{
+ "serviceInstanceId":"9e15a443-af65-4f05-9000-47ae495e937d"
+ },
+ "requestStatus":{
+ "requestState":"UNLOCKED",
+ "percentProgress":20
+ }
+ }
+ },
+ {
+ "request":{
+ "requestId":"0017f68c-eb2d-45bb-b7c7-ec31b37dc350",
+ "requestScope":"service",
+ "requestType":"createInstance",
+ "requestStatus":{
+ "requestState":"IN_PROGRESS",
+ "statusMessage":"Error parsing request.\n\tNo valid instanceName is specified"
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
new file mode 100644
index 0000000000..79caa33419
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json
@@ -0,0 +1,24 @@
+[
+ {
+ "id": 1,
+ "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+ "name": "requestAction",
+ "value": "assign",
+ "tag": "pincFabricConfigRequest"
+ },{
+ "id": 2,
+ "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+ "name": "pincFabricId",
+ "value": "testId",
+ "tag": "pincFabricConfigRequest"
+ },{
+ "id": 3,
+ "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca715",
+ "name": "requestAction",
+ "value": "unassign",
+ "tag": "pincFabricConfig"
+ }
+] \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
new file mode 100644
index 0000000000..af28007900
--- /dev/null
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json
@@ -0,0 +1,8 @@
+{
+ "id": 1,
+ "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+ "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+ "name": "requestAction",
+ "value": "assign",
+ "tag": "pincFabricConfigRequest"
+}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json
index 993310d48f..a37fe050eb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json
@@ -1,45 +1,18 @@
{
- "requestDetails": {
- "cloudConfiguration": {
- "lcpCloudRegionId": "mtn6",
- "tenantId": "19123c2924c648eb8e42a3c1f14b7682"
- },
- "modelInfo": {
- "modelInvariantId": "1710f6e8-1c29-4990-9aea-e943a2ec3d21",
- "modelName": "TestNetworkType",
- "modelType": "network",
- "modelVersion": "2.0",
- "modelVersionId": "1710966e-097c-4d63-afda-e0d3bb7015fb",
- "modelCustomizationId": "3bdbb104-476c-483e-9f8b-c095b3d308ac"
- },
- "requestInfo": {
- "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
- "requestorId": "xxxxxx",
- "source": "VID",
- "suppressRollback": false,
- "instanceName": "tested"
- },
- "requestParameters": {
- "aLaCarte" : true,
- "autoBuildVfModules": false,
- "subscriptionServiceType": "MSO-dev-service-type",
- "userParams": [
- {
- "name": "aic_zone",
- "value": "mtn6"
- }
- ]
- },
- "subscriberInfo": {
- "globalSubscriberId": "MSO_1610_dev",
- "subscriberName": "MSO_1610_dev"
- },
- "project": {
- "projectName": "projectName"
- },
- "owningEntity": {
- "owningEntityId": "oeId",
- "owningEntityName": "oeName"
- }
- }
+ "requestDetails":{
+ "modelInfo":{
+ "modelType":"network"
+ },
+ "requestInfo":{
+ "source":"VID",
+ "requestorId":"xxxxxx"
+ },
+ "requestParameters":{
+ "testApi":"VNF_API"
+ },
+ "cloudConfiguration":{
+ "lcpCloudRegionId":"cloudRegionId",
+ "tenantId":"821553e85fd2461ab205bcd45cc3eeda"
+ }
+ }
} \ No newline at end of file
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index 3540110351..381330b928 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -770,6 +770,77 @@ FOREIGN KEY (`NB_REQ_REF_LOOKUP_ID`) REFERENCES `northbound_request_ref_lookup`
ON DELETE CASCADE ON UPDATE CASCADE)
ENGINE = InnoDB DEFAULT CHARACTER SET = latin1;
+CREATE TABLE IF NOT EXISTS vnfc_customization (
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`))
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS cvnfc_customization (
+`ID` INT(11) NOT NULL AUTO_INCREMENT,
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`NFC_FUNCTION` VARCHAR(200) NULL,
+`NFC_NAMING_CODE` VARCHAR(200) NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;
+
--------START Request DB SCHEMA --------
CREATE DATABASE requestdb;
USE requestdb;
diff --git a/mso-api-handlers/mso-requests-db/hibernate.properties b/mso-api-handlers/mso-requests-db/hibernate.properties
deleted file mode 100644
index cf56960f4b..0000000000
--- a/mso-api-handlers/mso-requests-db/hibernate.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-hibernate.show_sql=true
-hibernate.format_sql=true
diff --git a/mso-api-handlers/mso-requests-db/hibernate.reveng.xml b/mso-api-handlers/mso-requests-db/hibernate.reveng.xml
deleted file mode 100644
index cb1e8c6669..0000000000
--- a/mso-api-handlers/mso-requests-db/hibernate.reveng.xml
+++ /dev/null
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://www.hibernate.org/dtd/hibernate-reverse-engineering-3.0.dtd" >
-
-<hibernate-reverse-engineering>
-
- <schema-selection match-schema="MSO"/>
- <type-mapping>
- <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" />
- </type-mapping>
- <table-filter match-schema="MSO" match-name=".*"/>
-</hibernate-reverse-engineering> \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/pom.xml b/mso-api-handlers/mso-requests-db/pom.xml
index 006058e98d..a3b0ec1258 100644
--- a/mso-api-handlers/mso-requests-db/pom.xml
+++ b/mso-api-handlers/mso-requests-db/pom.xml
@@ -74,6 +74,7 @@
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
+ <optional>true</optional>
</dependency>
</dependencies>
<packaging>jar</packaging>
@@ -90,10 +91,10 @@
<goal>jar</goal>
</goals>
<configuration>
- <classifier>beans</classifier>
- <includes>
- <include>**/beans/**</include>
- </includes>
+ <classifier>client</classifier>
+ <excludes>
+ <exclude>**/repository/**</exclude>
+ </excludes>
</configuration>
</execution>
</executions>
diff --git a/mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml b/mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml
deleted file mode 100644
index d62640525b..0000000000
--- a/mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- ============LICENSE_START=======================================================
- ECOMP MSO
- ================================================================================
- 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=========================================================
- -->
-
-<!DOCTYPE hibernate-reverse-engineering PUBLIC "-//Hibernate/Hibernate Reverse Engineering DTD 3.0//EN" "http://www.hibernate.org/dtd//hibernate-reverse-engineering-3.0.dtd" >
-
-<hibernate-reverse-engineering>
- <schema-selection match-schema="MSO" />
- <type-mapping>
- <sql-type jdbc-type="OTHER" hibernate-type="java.sql.Timestamp" />
- </type-mapping>
- <table-filter match-schema="MSO" match-name=".*" />
-</hibernate-reverse-engineering>
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 0833064f8a..4a46a0d00d 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -35,7 +35,7 @@ import javax.persistence.TemporalType;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.onap.so.requestsdb.adapter.TimestampXMLAdapter;
+import org.onap.so.requestsdb.TimestampXMLAdapter;
import uk.co.blackpepper.bowman.annotation.ResourceId;
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
new file mode 100644
index 0000000000..34832b9917
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java
@@ -0,0 +1,167 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 Huawei Technologies Co., Ltd. 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.request.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.openpojo.business.annotation.BusinessKey;
+
+/**
+ * persist the request identifiers created when MSO POSTs a request to PINC
+ * <br>
+ * <p>
+ * </p>
+ *
+ * @author
+ * @version
+ */
+
+@Entity
+@Table(name = "request_processing_data")
+public class RequestProcessingData implements Serializable{
+
+ /**
+ *
+ */
+ private static final long serialVersionUID = -3497593687393936143L;
+
+ @Id
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ @Column(name = "ID")
+ private Integer id;
+
+ @BusinessKey
+ @Column(name = "SO_REQUEST_ID", length=50, unique=true)
+ private String soRequestId;
+
+ @BusinessKey
+ @Column(name = "GROUPING_ID", length=100, unique=true)
+ private String groupingId;
+
+ @BusinessKey
+ @Column(name = "NAME", length=200)
+ private String name;
+
+ @Column(name = "VALUE", columnDefinition = "LONGTEXT")
+ private String value;
+
+ @BusinessKey
+ @Column(name = "TAG", length=200)
+ private String tag;
+
+ @Column(name = "CREATE_TIME", insertable = false, updatable = false)
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created = null;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof RequestProcessingData)) {
+ return false;
+ }
+ RequestProcessingData castOther = (RequestProcessingData) other;
+ return new EqualsBuilder().append(soRequestId, castOther.soRequestId).append(groupingId, castOther.groupingId)
+ .append(name, castOther.name).append(tag, castOther.tag).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(soRequestId).append(groupingId).append(name).append(tag).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("soRequestId", soRequestId)
+ .append("groupingId", groupingId).append("name", name).append("value", value).append("tag", tag)
+ .toString();
+ }
+
+ @PrePersist
+ protected void createdAt() {
+ this.created = new Date();
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getSoRequestId() {
+ return soRequestId;
+ }
+
+ public void setSoRequestId(String soRequestId) {
+ this.soRequestId = soRequestId;
+ }
+
+ public String getGroupingId() {
+ return groupingId;
+ }
+
+ public void setGroupingId(String groupingId) {
+ this.groupingId = groupingId;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getValue() {
+ return value;
+ }
+
+ public void setValue(String value) {
+ this.value = value;
+ }
+
+ public String getTag() {
+ return tag;
+ }
+
+ public void setTag(String tag) {
+ this.tag = tag;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+} \ No newline at end of file
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 8e291aa15b..54fec3ad4d 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -18,60 +18,77 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.requestsdb.client;
+package org.onap.so.db.request.client;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import javax.annotation.PostConstruct;
+import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.so.db.request.beans.ArchivedInfraRequests;
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.OperationalEnvDistributionStatus;
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.RequestProcessingData;
import org.onap.so.db.request.beans.ResourceOperationStatus;
+import org.onap.so.db.request.beans.SiteStatus;
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.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Primary;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
+import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpRequestExecution;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
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.net.URI;
-import java.util.List;
-import java.util.Map;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-
-@Component
+@Component("RequestsDbClient")
+@Primary
public class RequestsDbClient {
private static final String SERVICE_ID = "SERVICE_ID";
private static final String OPERATION_ID = "OPERATION_ID";
+ private static final String SO_REQUEST_ID = "SO_REQUEST_ID";
+ private static final String GROUPING_ID = "GROUPING_ID";
+ private static final String REQUEST_ID = "REQUEST_ID";
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 static final String NAME = "NAME";
+ private static final String VALUE = "VALUE";
+ private static final String TAG = "TAG";
+
+ private Client<InfraActiveRequests> infraActiveRequestClient;
+ private Client<OperationStatus> operationStatusClient;
+ private Client<RequestProcessingData> requestProcessingDataClient;
private final Client<OperationalEnvDistributionStatus> distributionStatusClient;
private final Client<OperationalEnvServiceModelStatus> serviceModelStatusClient;
@Value("${mso.adapters.requestDb.endpoint}")
- private String endpoint;
+ protected String endpoint;
@Value("${mso.adapters.requestDb.auth}")
private String msoAdaptersAuth;
@@ -80,29 +97,38 @@ public class RequestsDbClient {
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/";
private String infraActiveRequestURI = "/infraActiveRequests/";
private String checkInstanceNameDuplicate = "/infraActiveRequests/checkInstanceNameDuplicate";
+ private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/";
+
private String findOneByServiceIdAndOperationIdURI = "/findOneByServiceIdAndOperationId";
- private String operationalEnvDistributionStatusURI = "/operationalEnvDistributionStatus/";
-
- private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive";
-
private String findOneByOperationalEnvIdAndServiceModelVersionIdURI = "/findOneByOperationalEnvIdAndServiceModelVersionId";
private String findAllByOperationalEnvIdAndRequestIdURI = "/findAllByOperationalEnvIdAndRequestId";
- private HttpHeaders headers;
+ private String cloudOrchestrationFiltersFromInfraActive = "/infraActiveRequests/getCloudOrchestrationFiltersFromInfraActive";
+
+ private String requestProcessingDataURI = "/requestProcessingData";
+
+ private String findOneBySoRequestIdAndGroupingIdAndNameAndTagURI = "/requestProcessingData/search/findOneBySoRequestIdAndGroupingIdAndNameAndTag/";
+
+ private String findBySoRequestIdOrderByGroupingIdDesc = "/requestProcessingData/search/findBySoRequestIdOrderByGroupingIdDesc/";
+ protected HttpHeaders headers;
+
+ protected ClientFactory clientFactory;
+
@Autowired
- private RestTemplate restTemplate;
+ protected RestTemplate restTemplate;
+
@Autowired
ClassURLMapper classURLMapper;
-
@PostConstruct
public void init() {
@@ -112,6 +138,7 @@ public class RequestsDbClient {
checkInstanceNameDuplicate = endpoint + checkInstanceNameDuplicate;
cloudOrchestrationFiltersFromInfraActive = endpoint + cloudOrchestrationFiltersFromInfraActive;
findOneByServiceIdAndOperationIdURI = endpoint + OPERATION_STATUS_SEARCH + findOneByServiceIdAndOperationIdURI;
+ requestProcessingDataURI = endpoint + requestProcessingDataURI;
operationalEnvDistributionStatusURI = endpoint + operationalEnvDistributionStatusURI;
findOneByOperationalEnvIdAndServiceModelVersionIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findOneByOperationalEnvIdAndServiceModelVersionIdURI;
findAllByOperationalEnvIdAndRequestIdURI = endpoint + OPERATIONAL_ENV_SERVICE_MODEL_STATUS_SEARCH + findAllByOperationalEnvIdAndRequestIdURI;
@@ -120,15 +147,28 @@ public class RequestsDbClient {
}
public RequestsDbClient() {
- ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(restTemplate -> restTemplate.getInterceptors().add((request, body, execution) -> {
- request.getHeaders().add("Authorization", msoAdaptersAuth);
- return execution.execute(request, body);
- })).build().buildClientFactory();
+ ClientFactory clientFactory = Configuration.builder().setRestTemplateConfigurer(new RestTemplateConfigurer() {
+
+ public void configure(RestTemplate restTemplate) {
+
+ restTemplate.getInterceptors().add(new ClientHttpRequestInterceptor() {
+
+ public ClientHttpResponse intercept(HttpRequest request, byte[] body,
+ ClientHttpRequestExecution execution) throws IOException {
+
+ request.getHeaders().add("Authorization", msoAdaptersAuth);
+ return execution.execute(request, body);
+ }
+ });
+ }
+ }).build().buildClientFactory();
infraActiveRequestClient = clientFactory.create(InfraActiveRequests.class);
operationStatusClient = clientFactory.create(OperationStatus.class);
+ requestProcessingDataClient = clientFactory.create(RequestProcessingData.class);
distributionStatusClient = clientFactory.create(OperationalEnvDistributionStatus.class);
serviceModelStatusClient = clientFactory.create(OperationalEnvServiceModelStatus.class);
}
+
public List<InfraActiveRequests> getCloudOrchestrationFiltersFromInfraActive(Map<String, String> orchestrationMap){
URI uri = getUri(cloudOrchestrationFiltersFromInfraActive);
HttpEntity<Map> entity = new HttpEntity<>(orchestrationMap, headers);
@@ -175,7 +215,7 @@ public class RequestsDbClient {
.queryParam(OPERATION_ID,operationId)
.build());
}
-
+
public OperationalEnvServiceModelStatus findOneByOperationalEnvIdAndServiceModelVersionId(String operationalEnvironmentId, String serviceModelVersionId) {
return this.getSingleOperationalEnvServiceModelStatus(UriBuilder.fromUri(findOneByOperationalEnvIdAndServiceModelVersionIdURI)
.queryParam(OPERATIONAL_ENVIRONMENT_ID,operationalEnvironmentId)
@@ -211,7 +251,7 @@ public class RequestsDbClient {
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);
@@ -221,8 +261,8 @@ public class RequestsDbClient {
private OperationalEnvDistributionStatus getSingleOperationalEnvDistributionStatus(URI uri){
return distributionStatusClient.get(uri);
}
-
- private InfraActiveRequests getSingleInfraActiveRequests(URI uri) {
+
+ protected InfraActiveRequests getSingleInfraActiveRequests(URI uri) {
return infraActiveRequestClient.get(uri);
}
@@ -230,12 +270,56 @@ public class RequestsDbClient {
infraActiveRequestClient.put(request);
}
- private OperationStatus getSingleOperationStatus(URI uri){
+ protected URI getUri(String uri) {
+ return URI.create(uri);
+ }
+
+
+
+ public OperationStatus getSingleOperationStatus(URI uri){
return operationStatusClient.get(uri);
}
- private URI getUri(String uri) {
- return URI.create(uri);
+ public void saveRequestProcessingData(RequestProcessingData requestProcessingData) {
+ URI uri = getUri(endpoint + requestProcessingDataURI);
+ HttpEntity<RequestProcessingData> entity = new HttpEntity<>(requestProcessingData, headers);
+ restTemplate.postForLocation(uri, entity);
+ }
+
+ public RequestProcessingData getRequestProcessingDataBySoRequestIdAndGroupingIdAndNameAndTag(String soRequestId,
+ String groupingId, String name, String tag) {
+ return this.getSingleRequestProcessingData(UriBuilder.fromUri(endpoint + findOneBySoRequestIdAndGroupingIdAndNameAndTagURI)
+ .queryParam(SO_REQUEST_ID,soRequestId)
+ .queryParam(GROUPING_ID,groupingId)
+ .queryParam(NAME,name)
+ .queryParam(TAG,tag)
+ .build());
+ }
+ public List<RequestProcessingData> getRequestProcessingDataBySoRequestId(String soRequestId) {
+ return this.getRequestProcessingData(UriBuilder.fromUri(endpoint + findBySoRequestIdOrderByGroupingIdDesc)
+ .queryParam(SO_REQUEST_ID,soRequestId)
+ .build());
+ }
+
+ public RequestProcessingData getSingleRequestProcessingData(URI uri){
+ return requestProcessingDataClient.get(uri);
+ }
+
+ private List<RequestProcessingData> getRequestProcessingData(URI uri) {
+ Iterable<RequestProcessingData> requestProcessingDataIterator = requestProcessingDataClient.getAll(uri);
+ List<RequestProcessingData> requestProcessingDataList = new ArrayList<>();
+ Iterator<RequestProcessingData> it = requestProcessingDataIterator.iterator();
+ it.forEachRemaining(requestProcessingDataList::add);
+ return requestProcessingDataList;
+ }
+
+ public List<RequestProcessingData> getAllRequestProcessingData() {
+
+ return (List<RequestProcessingData>) this.getAllRequestProcessingData(UriBuilder.fromUri(endpoint + "/requestProcessingData").build());
+ }
+
+ private Iterable<RequestProcessingData> getAllRequestProcessingData(URI uri) {
+ return requestProcessingDataClient.getAll(uri);
}
@Bean
@@ -269,4 +353,14 @@ public class RequestsDbClient {
return classURLMap.get(actualClass);
}
}
+
+ //USED FOR TEST ONLY
+ public void setPortToEndpoint(String port) {
+ endpoint = endpoint + port;
+ }
+
+ //USED FOR TEST ONLY
+ public void removePortFromEndpoint() {
+ endpoint = endpoint.substring(0, endpoint.lastIndexOf(':') + 1);
+ }
}
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
new file mode 100644
index 0000000000..f80be0525c
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.request.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.request.beans.RequestProcessingData;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "requestProcessingData", path = "requestProcessingData")
+public interface RequestProcessingDataRepository extends JpaRepository<RequestProcessingData, Integer> {
+ RequestProcessingData findOneBySoRequestIdAndGroupingIdAndNameAndTag(
+ @Param("SO_REQUEST_ID") String soRequestId, @Param("GROUPING_ID") String groupingId,
+ @Param("NAME") String name, @Param("TAG") String tag);
+
+ List<RequestProcessingData> findBySoRequestIdOrderByGroupingIdDesc(@Param("SO_REQUEST_ID") String soRequestId);
+}
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 562e54ca6e..ea3ef30827 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
@@ -24,8 +24,9 @@ import java.sql.Timestamp;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.logger.MsoLogger;
-import org.onap.so.requestsdb.client.RequestsDbClient;
+import org.onap.so.db.request.client.RequestsDbClient;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Component;
@Component
@@ -37,6 +38,7 @@ public class RequestsDBHelper {
private String methodName = "";
private String classMethodMessage = "";
@Autowired
+ @Qualifier("RequestsDbClient")
private RequestsDbClient requestsDbClient;
/**
* This util method is to update the InfraRequest table to Complete
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java
index 1cde1aac51..3a326598a7 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.requestsdb.adapter;
+package org.onap.so.requestsdb;
import java.sql.Timestamp;
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java
new file mode 100644
index 0000000000..5a8df1d556
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java
@@ -0,0 +1,34 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+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 abstract class BaseTest {
+
+}
diff --git a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java
index ec2c41bf8c..00d212a23e 100644
--- a/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java
+++ b/mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java
@@ -24,7 +24,7 @@ import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Profile;
-@SpringBootApplication(scanBasePackages = { "org.onap" })
+@SpringBootApplication(scanBasePackages = { "org.onap.so.db" })
@Profile("test")
public class TestApplication {
public static void main(String... args) {
diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/afterMigrate.sql b/mso-api-handlers/mso-requests-db/src/test/resources/afterMigrate.sql
new file mode 100644
index 0000000000..897dd3faca
--- /dev/null
+++ b/mso-api-handlers/mso-requests-db/src/test/resources/afterMigrate.sql
@@ -0,0 +1,35 @@
+use requestdb;
+
+insert into operation_status(service_id, operation_id, service_name, user_id, result, operation_content, progress, reason, operate_at, finished_at) values
+('serviceid', 'operationid', 'servicename', 'userid', 'result', 'operationcontent', 'progress', 'reason', '2016-11-24 13:19:10', '2016-11-24 13:19:10');
+
+
+insert into infra_active_requests(request_id, client_request_id, action, request_status, status_message, progress, start_time, end_time, source, vnf_id, vnf_name, vnf_type, service_type, aic_node_clli, tenant_id, prov_status, vnf_params, vnf_outputs, request_body, response_body, last_modified_by, modify_time, request_type, volume_group_id, volume_group_name, vf_module_id, vf_module_name, vf_module_model_name, aai_service_id, aic_cloud_region, callback_url, correlator, network_id, network_name, network_type, request_scope, request_action, service_instance_id, service_instance_name, requestor_id, configuration_id, configuration_name, operational_env_id, operational_env_name) values
+('00032ab7-3fb3-42e5-965d-8ea592502017', '00032ab7-3fb3-42e5-965d-8ea592502016', 'deleteInstance', 'COMPLETE', 'Vf Module has been deleted successfully.', '100', '2016-12-22 18:59:54', '2016-12-22 19:00:28', 'VID', 'b92f60c8-8de3-46c1-8dc1-e4390ac2b005', null, null, null, null, '6accefef3cb442ff9e644d589fb04107', null, null, null, '{"requestDetails":{"modelInfo":{"modelType":"vfModule","modelName":"vSAMP10aDEV::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"mtn6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'vSAMP10aDEV::base::module-0', null, 'mtn6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null),
+('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', 'Error: Locked instance - This service (MSODEV_1707_SI_vSAMP10a_011-4) already has a request being worked with a status of IN_PROGRESS (RequestId - 278e83b1-4f9f-450e-9e7d-3700a6ed22f4). The existing request must finish or be cleaned up before proceeding.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"MSOTADevInfra_vSAMP10a_Service","modelVersion":"1.0","modelVersionId":"5df8b6de-2083-11e7-93ae-92361f002671"},"requestInfo":{"source":"VID","instanceName":"MSODEV_1707_SI_vSAMP10a_011-4","suppressRollback":false,"requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarteSet":true,"alaCarte":true}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_vSAMP10a_011-4', 'xxxxxx', null, null, null, null),
+('001619d2-a297-4a4b-a9f5-e2823c88458f', '001619d2-a297-4a4b-a9f5-e2823c88458f', 'CREATE_VF_MODULE', 'COMPLETE', 'COMPLETED', '100', '2016-07-01 14:11:42', '2017-05-02 16:03:34', 'PORTAL', null, 'test-vscp', 'elena_test21', null, null, '381b9ff6c75e4625b7a4182f90fc68d3', null, null, null, '<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<vnf-request xmlns=\"http://org.onap.so/mso/infra/vnf-request/v1\">\n <request-info>\n <request-id>001619d2-a297-4a4b-a9f5-e2823c88458f</request-id>\n <action>CREATE_VF_MODULE</action>\n <source>PORTAL</source>\n </request-info>\n <vnf-inputs>\n <vnf-name>test-vscp</vnf-name>\n <vf-module-name>moduleName</vf-module-name>\n <vnf-type>elena_test21</vnf-type>\n <vf-module-model-name>moduleModelName</vf-module-model-name>\n <asdc-service-model-version>1.0</asdc-service-model-version>\n <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>\n <aic-cloud-region>mtn9</aic-cloud-region>\n <tenant-id>381b9ff6c75e4625b7a4182f90fc68d3</tenant-id>\n <persona-model-id></persona-model-id>\n <persona-model-version></persona-model-version>\n <is-base-vf-module>false</is-base-vf-module>\n </vnf-inputs>\n <vnf-params xmlns:tns=\"http://org.onap.so/mso/infra/vnf-request/v1\"/>\n</vnf-request>\n', 'NONE', 'RDBTEST', '2016-07-01 14:11:42', 'VNF', null, null, null, 'MODULENAME1', 'moduleModelName', 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb', 'mtn9', null, null, null, null, null, 'vfModule', 'createInstance', null, null, null, null, null, null, null),
+('00164b9e-784d-48a8-8973-bbad6ef818ed', null, 'createInstance', 'COMPLETE', 'Service Instance was created successfully.', '100', '2017-09-28 12:45:51', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"requestDetails":{"requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"52b49b5d-3086-4ffd-b5e6-1b1e5e7e062f","modelType":"service","modelNameVersionId":null,"modelName":"MSO Test Network","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"aed5a5b7-20d3-44f7-90a3-ddbd16f14d1e","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":"DEV-MTN6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}}}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-MTN6-3100-0927-1', 'xxxxxx', null, null, null, null),
+('00173cc9-5ce2-4673-a810-f87fefb2829e', null, 'createInstance', 'FAILED', 'Error parsing request. No valid instanceName is specified', '100', '2017-04-14 21:08:46', '2017-04-14 21:08:46', 'VID', null, null, null, null, null, 'a259ae7b7c3f493cb3d91f95a7c18149', null, null, null, '{"requestDetails":{"modelInfo":{"modelInvariantId":"ff6163d4-7214-459e-9f76-507b4eb00f51","modelType":"service","modelName":"ConstraintsSrvcVID","modelVersion":"2.0","modelVersionId":"722d256c-a374-4fba-a14f-a59b76bb7656"},"requestInfo":{"productFamilyId":"LRSI-OSPF","source":"VID","requestorId":"xxxxxx"},"subscriberInfo":{"globalSubscriberId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"},"cloudConfiguration":{"tenantId":"a259ae7b7c3f493cb3d91f95a7c18149","lcpCloudRegionId":"mtn16"},"requestParameters":{"subscriptionServiceType":"Mobility","userParams":[{"name":"neutronport6_name","value":"8"},{"name":"neutronnet5_network_name","value":"8"},{"name":"contrailv2vlansubinterface3_name","value":"false"}]}}}', null, 'APIH', '2016-12-22 19:00:28', null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null),
+('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', '2017-09-28 12:45:53', 'VID', null, null, null, null, null, null, null, null, null, '{"requestDetails":{"modelInfo":{"modelCustomizationName":null,"modelInvariantId":"1587cf0e-f12f-478d-8530-5c55ac578c39","modelType":"configuration","modelNameVersionId":null,"modelName":null,"modelVersion":null,"modelCustomizationUuid":null,"modelVersionId":"36a3a8ea-49a6-4ac8-b06c-89a545444455","modelCustomizationId":"68dc9a92-214c-11e7-93ae-92361f002671","modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"requestInfo":{"billingAccountNumber":null,"callbackUrl":null,"correlator":null,"orderNumber":null,"productFamilyId":null,"orderVersion":null,"source":"VID","instanceName":null,"suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":[{"relatedInstance":{"instanceName":null,"instanceId":"9e15a443-af65-4f05-9000-47ae495e937d","modelInfo":{"modelCustomizationName":null,"modelInvariantId":"de19ae10-9a25-11e7-abc4-cec278b6b50a","modelType":"service","modelNameVersionId":null,"modelName":"MSOTADevInfra_Configuration_Service","modelVersion":"1.0","modelCustomizationUuid":null,"modelVersionId":"ee938612-9a25-11e7-abc4-cec278b6b50a","modelCustomizationId":null,"modelUuid":null,"modelInvariantUuid":null,"modelInstanceName":null},"instanceDirection":null}}],"subscriberInfo":null,"cloudConfiguration":{"aicNodeClli":null,"tenantId":null,"lcpCloudRegionId":"mtn6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true,"alaCarte":false},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'mtn6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null);
+
+insert into watchdog_distributionid_status(distribution_id, distribution_id_status, create_time, modify_time) values
+('1533c4bd-a3e3-493f-a16d-28c20614415e', '', '2017-11-30 15:48:09', '2017-11-30 15:48:09'),
+('55429711-809b-4a3b-9ee5-5120d46d9de0', '', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', '', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+
+insert into watchdog_per_component_distribution_status(distribution_id, component_name, component_distribution_status, create_time, modify_time) values
+('1533c4bd-a3e3-493f-a16d-28c20614415e', 'MSO', 'COMPONENT_DONE_OK', '2017-11-30 15:48:09', '2017-11-30 15:48:09'),
+('55429711-809b-4a3b-9ee5-5120d46d9de0', 'MSO', 'COMPONENT_DONE_ERROR', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'MSO', 'COMPONENT_DONE_OK', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+
+insert into watchdog_service_mod_ver_id_lookup(distribution_id, service_model_version_id, create_time, modify_time) values
+('1533c4bd-a3e3-493f-a16d-28c20614415e', '7e813ab5-88d3-4fcb-86c0-498c5d7eef9a', '2017-11-30 15:48:08', '2017-11-30 15:48:08'),
+('55429711-809b-4a3b-9ee5-5120d46d9de0', 'cc031e75-4442-4d1a-b774-8a2b434e0a50', '2017-11-30 16:35:36', '2017-11-30 16:35:36'),
+('67f0b2d1-9013-4b2b-9914-bbe2288284fb', 'eade1e9d-c1ec-4ef3-bc31-60570fba1573', '2017-11-30 15:54:39', '2017-11-30 15:54:39');
+
+
+insert into site_status(site_name, status, creation_timestamp) values
+('testsite', 0, '2017-11-30 15:48:09');
+
+INSERT INTO requestdb.request_processing_data (ID, SO_REQUEST_ID, GROUPING_ID, NAME, VALUE, TAG) VALUES
+(1, 'fbb8df64-9be5-11e8-98d0-529269fb1459', '12b84dc6-9be6-11e8-98d0-529269fb1459', 'test-name', 'test-value', 'test-tag'); \ No newline at end of file
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 62ae4794f5..c4dd60356b 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
@@ -12,6 +12,7 @@ mso:
endpoint: http://localhost:8081
site-name: localDevEnv
logPath: logs
+
# H2
spring:
datasource:
diff --git a/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql
index a01153a43c..ab554d440b 100644
--- a/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db/src/test/resources/schema.sql
@@ -207,6 +207,4 @@ ALTER TABLE PUBLIC.SITE_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_C PRIMARY KEY(SI
ALTER TABLE PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_7 PRIMARY KEY(DISTRIBUTION_ID);
ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_D PRIMARY KEY(DISTRIBUTION_ID, COMPONENT_NAME);
ALTER TABLE PUBLIC.WATCHDOG_SERVICE_MOD_VER_ID_LOOKUP ADD CONSTRAINT PUBLIC.CONSTRAINT_6 PRIMARY KEY(DISTRIBUTION_ID, SERVICE_MODEL_VERSION_ID);
-ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK;
-
-
+ALTER TABLE PUBLIC.WATCHDOG_PER_COMPONENT_DISTRIBUTION_STATUS ADD CONSTRAINT PUBLIC.CONSTRAINT_DE FOREIGN KEY(DISTRIBUTION_ID) REFERENCES PUBLIC.WATCHDOG_DISTRIBUTIONID_STATUS(DISTRIBUTION_ID) NOCHECK; \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java
index 173480172d..7c6fb04079 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java
@@ -79,6 +79,9 @@ public class ConfigurationResource implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource")
private Set<ConfigurationResourceCustomization> configurationResourceCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "configurationResource")
+ private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
@PrePersist
protected void onCreate() {
@@ -147,6 +150,16 @@ public class ConfigurationResource implements Serializable {
this.configurationResourceCustomization = configurationResourceCustomization;
}
+ @LinkedResource
+ public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public void setVnfVfmoduleCvnfcConfigurationCustomization(
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
+ this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
@Override
public String toString() {
return new ToStringBuilder(this).append("modelUUID", modelUUID).append("modelInvariantUUID", modelInvariantUUID)
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
new file mode 100644
index 0000000000..c02b1e3030
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java
@@ -0,0 +1,275 @@
+/*-
+ * ============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.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.Set;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+
+import uk.co.blackpepper.bowman.annotation.LinkedResource;
+
+@Entity
+@Table(name = "cvnfc_customization")
+public class CvnfcCustomization implements Serializable {
+
+ private static final long serialVersionUID = -3772469944364616486L;
+
+ @Id
+ @Column(name = "ID")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
+ @BusinessKey
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
+
+ @Column(name = "TOSCA_NODE_TYPE")
+ private String toscaNodeType;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "NFC_FUNCTION")
+ private String nfcFunction;
+
+ @Column(name = "NFC_NAMING_CODE")
+ private String nfcNamingCode;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID")
+ private VfModuleCustomization vfModuleCustomization;
+
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "VNFC_CUST_MODEL_CUSTOMIZATION_UUID")
+ private VnfcCustomization vnfcCustomization;
+
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID")
+ private VnfResourceCustomization vnfResourceCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof CvnfcCustomization)) {
+ return false;
+ }
+ CvnfcCustomization castOther = (CvnfcCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID)
+ .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion)
+ .append("modelName", modelName).append("toscaNodeType", toscaNodeType)
+ .append("description", description).append("nfcFunction", nfcFunction)
+ .append("nfcNamingCode", nfcNamingCode).append("created", created)
+ .append("vfModuleCustomization", vfModuleCustomization).append("vnfcCustomization", vnfcCustomization)
+ .append("vnfResourceCustomization", vnfResourceCustomization)
+ .append("vnfVfmoduleCvnfcConfigurationCustomization", vnfVfmoduleCvnfcConfigurationCustomization)
+ .toString();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ @LinkedResource
+ public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public void setVnfVfmoduleCvnfcConfigurationCustomization(
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
+ this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
+
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+
+ public String getModelInvariantUUID() {
+ return modelInvariantUUID;
+ }
+
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public String getNfcFunction() {
+ return nfcFunction;
+ }
+
+ public void setNfcFunction(String nfcFunction) {
+ this.nfcFunction = nfcFunction;
+ }
+
+ public String getNfcNamingCode() {
+ return nfcNamingCode;
+ }
+
+ public void setNfcNamingCode(String nfcNamingCode) {
+ this.nfcNamingCode = nfcNamingCode;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public VfModuleCustomization getVfModuleCustomization() {
+ return vfModuleCustomization;
+ }
+
+ public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
+ this.vfModuleCustomization = vfModuleCustomization;
+ }
+
+ public VnfcCustomization getVnfcCustomization() {
+ return vnfcCustomization;
+ }
+
+ public void setVnfcCustomization(VnfcCustomization vnfcCustomization) {
+ this.vnfcCustomization = vnfcCustomization;
+ }
+
+ public VnfResourceCustomization getVnfResourceCustomization() {
+ return vnfResourceCustomization;
+ }
+
+ public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) {
+ this.vnfResourceCustomization = vnfResourceCustomization;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java
index 47d82bff06..7d53a0b843 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java
@@ -28,6 +28,7 @@ import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
@@ -94,7 +95,7 @@ public class VfModule implements Serializable {
@OneToMany(mappedBy = "vfModule")
private List<VfModuleCustomization> vfModuleCustomization;
- @ManyToOne
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
@JoinColumn(name = "VNF_RESOURCE_MODEL_UUID")
private VnfResource vnfResources;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
index 4a9b3bbbb5..5a7d0d5425 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
@@ -22,6 +22,9 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.Date;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -29,6 +32,7 @@ import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
+import javax.persistence.OneToMany;
import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
@@ -37,6 +41,7 @@ import javax.persistence.TemporalType;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.openpojo.business.annotation.BusinessKey;
@@ -85,7 +90,16 @@ public class VfModuleCustomization implements Serializable {
@ManyToOne(cascade = CascadeType.ALL)
@JoinColumn(name = "VF_MODULE_MODEL_UUID")
private VfModule vfModule;
-
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<VnfcCustomization> vnfcCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<CvnfcCustomization> cvnfcCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
+
@PrePersist
protected void onCreate() {
this.created = new Date();
@@ -196,4 +210,37 @@ public class VfModuleCustomization implements Serializable {
public void setVfModule(VfModule vfModule) {
this.vfModule = vfModule;
}
+
+ @LinkedResource
+ public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
+ if (vnfVfmoduleCvnfcConfigurationCustomization == null)
+ vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>();
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public void setVnfVfmoduleCvnfcConfigurationCustomization(
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
+ this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ @LinkedResource
+ public Set<VnfcCustomization> getVnfcCustomization() {
+ return vnfcCustomization;
+ }
+
+ public void setVnfcCustomization(
+ Set<VnfcCustomization> vnfcCustomization) {
+ this.vnfcCustomization = vnfcCustomization;
+ }
+
+ @LinkedResource
+ public Set<CvnfcCustomization> getCvnfcCustomization() {
+ if (cvnfcCustomization == null)
+ cvnfcCustomization = new HashSet<>();
+ return cvnfcCustomization;
+ }
+
+ public void setCvnfcCustomization(Set<CvnfcCustomization> cvnfcCustomization) {
+ this.cvnfcCustomization = cvnfcCustomization;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
index fa0fe5636e..d286bc0727 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
@@ -23,7 +23,9 @@ package org.onap.so.db.catalog.beans;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashSet;
import java.util.List;
+import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
@@ -67,6 +69,10 @@ public class VnfResourceCustomization implements Serializable {
@Temporal(TemporalType.TIMESTAMP)
private Date created;
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
@Column(name = "MIN_INSTANCES")
private Integer minInstances;
@@ -101,6 +107,12 @@ public class VnfResourceCustomization implements Serializable {
@OneToMany(fetch = FetchType.LAZY, mappedBy = "vnfResourceCust")
private List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "modelCustomizationUUID")
+ private List<CvnfcCustomization> cvnfcCustomization;
@Override
public String toString() {
@@ -250,4 +262,25 @@ public class VnfResourceCustomization implements Serializable {
List<VnfcInstanceGroupCustomization> vnfcInstanceGroupCustomizations) {
this.vnfcInstanceGroupCustomizations = vnfcInstanceGroupCustomizations;
}
+
+ @LinkedResource
+ public Set<VnfVfmoduleCvnfcConfigurationCustomization> getVnfVfmoduleCvnfcConfigurationCustomization() {
+ if (vnfVfmoduleCvnfcConfigurationCustomization == null)
+ vnfVfmoduleCvnfcConfigurationCustomization = new HashSet<>();
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ public void setVnfVfmoduleCvnfcConfigurationCustomization(
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomization) {
+ this.vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+
+ @LinkedResource
+ public List<CvnfcCustomization> getCvnfcCustomization() {
+ return cvnfcCustomization;
+ }
+
+ public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
+ this.cvnfcCustomization = cvnfcCustomization;
+ }
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
new file mode 100644
index 0000000000..8ef797f8fa
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java
@@ -0,0 +1,236 @@
+/*-
+ * ============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.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+import javax.persistence.JoinColumn;
+import javax.persistence.ManyToOne;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+
+@Entity
+@Table(name = "vnf_vfmodule_cvnfc_configuration_customization")
+public class VnfVfmoduleCvnfcConfigurationCustomization implements Serializable {
+
+ private static final long serialVersionUID = -3153216266280581103L;
+
+ @Id
+ @Column(name = "ID")
+ @GeneratedValue(strategy = GenerationType.IDENTITY)
+ private Integer id;
+
+ @BusinessKey
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "CONFIGURATION_TYPE")
+ private String configurationType;
+
+ @Column(name = "CONFIGURATION_ROLE")
+ private String configurationRole;
+
+ @Column(name = "CONFIGURATION_FUNCTION")
+ private String configurationFunction;
+
+ @Column(name = "POLICY_NAME")
+ private String policyName;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "CONFIGURATION_MODEL_UUID")
+ private ConfigurationResource configurationResource;
+
+ @BusinessKey
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "CVNFC_MODEL_CUSTOMIZATION_UUID", referencedColumnName = "MODEL_CUSTOMIZATION_UUID")
+ private CvnfcCustomization cvnfcCustomization;
+
+ @BusinessKey
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "VF_MODULE_MODEL_CUSTOMIZATION_UUID")
+ private VfModuleCustomization vfModuleCustomization;
+
+ @BusinessKey
+ @ManyToOne(cascade = CascadeType.ALL, fetch = FetchType.LAZY)
+ @JoinColumn(name = "VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID")
+ private VnfResourceCustomization vnfResourceCustomization;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof VnfVfmoduleCvnfcConfigurationCustomization)) {
+ return false;
+ }
+ VnfVfmoduleCvnfcConfigurationCustomization castOther = (VnfVfmoduleCvnfcConfigurationCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID)
+ .append(cvnfcCustomization, castOther.cvnfcCustomization)
+ .append(vfModuleCustomization, castOther.vfModuleCustomization)
+ .append(vnfResourceCustomization, castOther.vnfResourceCustomization).isEquals();
+ }
+
+
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).append(cvnfcCustomization)
+ .append(vfModuleCustomization).append(vnfResourceCustomization).toHashCode();
+ }
+
+
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("id", id).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("configurationType", configurationType)
+ .append("configurationRole", configurationRole).append("configurationFunction", configurationFunction)
+ .append("policyName", policyName).append("created", created)
+ .append("configurationResource", configurationResource).append("cvnfcCustomization", cvnfcCustomization)
+ .append("vfModuleCustomization", vfModuleCustomization)
+ .append("vnfResourceCustomization", vnfResourceCustomization).toString();
+ }
+
+
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ public Integer getId() {
+ return id;
+ }
+
+ public void setId(Integer id) {
+ this.id = id;
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getConfigurationType() {
+ return configurationType;
+ }
+
+ public void setConfigurationType(String configurationType) {
+ this.configurationType = configurationType;
+ }
+
+ public String getConfigurationRole() {
+ return configurationRole;
+ }
+
+ public void setConfigurationRole(String configurationRole) {
+ this.configurationRole = configurationRole;
+ }
+
+ public String getConfigurationFunction() {
+ return configurationFunction;
+ }
+
+ public void setConfigurationFunction(String configurationFunction) {
+ this.configurationFunction = configurationFunction;
+ }
+
+ public String getPolicyName() {
+ return policyName;
+ }
+
+ public void setPolicyName(String policyName) {
+ this.policyName = policyName;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public ConfigurationResource getConfigurationResource() {
+ return configurationResource;
+ }
+
+ public void setConfigurationResource(ConfigurationResource configurationResource) {
+ this.configurationResource = configurationResource;
+ }
+
+ public CvnfcCustomization getCvnfcCustomization() {
+ return cvnfcCustomization;
+ }
+
+ public void setCvnfcCustomization(CvnfcCustomization cvnfcCustomization) {
+ this.cvnfcCustomization = cvnfcCustomization;
+ }
+
+ public VfModuleCustomization getVfModuleCustomization() {
+ return vfModuleCustomization;
+ }
+
+ public void setVfModuleCustomization(VfModuleCustomization vfModuleCustomization) {
+ this.vfModuleCustomization = vfModuleCustomization;
+ }
+
+ public VnfResourceCustomization getVnfResourceCustomization() {
+ return vnfResourceCustomization;
+ }
+
+ public void setVnfResourceCustomization(VnfResourceCustomization vnfResourceCustomization) {
+ this.vnfResourceCustomization = vnfResourceCustomization;
+ }
+}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
new file mode 100644
index 0000000000..8534242a58
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java
@@ -0,0 +1,191 @@
+/*-
+ * ============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.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.PrePersist;
+import javax.persistence.Table;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import com.openpojo.business.annotation.BusinessKey;
+import org.apache.commons.lang3.builder.HashCodeBuilder;
+import org.apache.commons.lang3.builder.EqualsBuilder;
+import org.apache.commons.lang3.builder.ToStringBuilder;
+
+@Entity
+@Table(name = "vnfc_customization")
+public class VnfcCustomization implements Serializable {
+
+ private static final long serialVersionUID = -3772469944364616486L;
+
+ @BusinessKey
+ @Id
+ @Column(name = "MODEL_CUSTOMIZATION_UUID")
+ private String modelCustomizationUUID;
+
+ @Column(name = "MODEL_INSTANCE_NAME")
+ private String modelInstanceName;
+
+ @Column(name = "MODEL_UUID")
+ private String modelUUID;
+
+ @Column(name = "MODEL_INVARIANT_UUID")
+ private String modelInvariantUUID;
+
+ @Column(name = "MODEL_VERSION")
+ private String modelVersion;
+
+ @Column(name = "MODEL_NAME")
+ private String modelName;
+
+ @Column(name = "TOSCA_NODE_TYPE")
+ private String toscaNodeType;
+
+ @Column(name = "DESCRIPTION")
+ private String description;
+
+ @Column(name = "CREATION_TIMESTAMP", updatable = false)
+ @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
+ @Temporal(TemporalType.TIMESTAMP)
+ private Date created;
+
+ @OneToMany(cascade = CascadeType.ALL, mappedBy = "vnfcCustomization")
+ private List<CvnfcCustomization> cvnfcCustomization;
+
+ @Override
+ public boolean equals(final Object other) {
+ if (!(other instanceof VnfcCustomization)) {
+ return false;
+ }
+ VnfcCustomization castOther = (VnfcCustomization) other;
+ return new EqualsBuilder().append(modelCustomizationUUID, castOther.modelCustomizationUUID).isEquals();
+ }
+
+ @Override
+ public int hashCode() {
+ return new HashCodeBuilder().append(modelCustomizationUUID).toHashCode();
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("modelCustomizationUUID", modelCustomizationUUID)
+ .append("modelInstanceName", modelInstanceName).append("modelUUID", modelUUID)
+ .append("modelInvariantUUID", modelInvariantUUID).append("modelVersion", modelVersion)
+ .append("modelName", modelName).append("toscaNodeType", toscaNodeType)
+ .append("description", description).append("created", created)
+ .append("cvnfcCustomization", cvnfcCustomization).toString();
+ }
+
+ @PrePersist
+ protected void onCreate() {
+ this.created = new Date();
+ }
+
+ public String getModelCustomizationUUID() {
+ return modelCustomizationUUID;
+ }
+
+ public void setModelCustomizationUUID(String modelCustomizationUUID) {
+ this.modelCustomizationUUID = modelCustomizationUUID;
+ }
+
+ public String getModelInstanceName() {
+ return modelInstanceName;
+ }
+
+ public void setModelInstanceName(String modelInstanceName) {
+ this.modelInstanceName = modelInstanceName;
+ }
+
+ public String getModelUUID() {
+ return modelUUID;
+ }
+
+ public void setModelUUID(String modelUUID) {
+ this.modelUUID = modelUUID;
+ }
+
+ public String getModelInvariantUUID() {
+ return modelInvariantUUID;
+ }
+
+ public void setModelInvariantUUID(String modelInvariantUUID) {
+ this.modelInvariantUUID = modelInvariantUUID;
+ }
+
+ public String getModelVersion() {
+ return modelVersion;
+ }
+
+ public void setModelVersion(String modelVersion) {
+ this.modelVersion = modelVersion;
+ }
+
+ public String getModelName() {
+ return modelName;
+ }
+
+ public void setModelName(String modelName) {
+ this.modelName = modelName;
+ }
+
+ public String getToscaNodeType() {
+ return toscaNodeType;
+ }
+
+ public void setToscaNodeType(String toscaNodeType) {
+ this.toscaNodeType = toscaNodeType;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Date getCreated() {
+ return created;
+ }
+
+ public void setCreated(Date created) {
+ this.created = created;
+ }
+
+ public List<CvnfcCustomization> getCvnfcCustomization() {
+ return cvnfcCustomization;
+ }
+
+ public void setCvnfcCustomization(List<CvnfcCustomization> cvnfcCustomization) {
+ this.cvnfcCustomization = cvnfcCustomization;
+ }
+}
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 8da24c928d..e29d88cb89 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
@@ -26,6 +26,7 @@ import org.onap.so.db.catalog.beans.CloudifyManager;
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.CvnfcCustomization;
import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.NetworkCollectionResourceCustomization;
import org.onap.so.db.catalog.beans.NetworkRecipe;
@@ -195,6 +196,8 @@ public class CatalogDbClient {
private final Client<CloudSite> cloudSiteClient;
private final Client<CloudifyManager> cloudifyManagerClient;
+
+ private Client<CvnfcCustomization> cvnfcCustomizationClient;
private final Client<ControllerSelectionReference> controllerSelectionReferenceClient;
@@ -240,6 +243,7 @@ public class CatalogDbClient {
instanceGroupURI = endpoint + INSTANCE_GROUP + URI_SEPARATOR;
cloudifyManagerURI = endpoint + CLOUDIFY_MANAGER + URI_SEPARATOR;
cloudSiteURI = endpoint + CLOUD_SITE + URI_SEPARATOR;
+
}
public CatalogDbClient() {
@@ -278,6 +282,7 @@ public class CatalogDbClient {
cloudSiteClient = clientFactory.create(CloudSite.class);
cloudifyManagerClient = clientFactory.create(CloudifyManager.class);
serviceRecipeClient = clientFactory.create(ServiceRecipe.class);
+ cvnfcCustomizationClient = clientFactory.create(CvnfcCustomization.class);
controllerSelectionReferenceClient = clientFactory.create(ControllerSelectionReference.class);
}
@@ -537,5 +542,20 @@ public class CatalogDbClient {
it.forEachRemaining(list::add);
return list;
}
+
+ public List<CvnfcCustomization> getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID(String vnfCustomizationUUID, String vfModuleCustomizationUUID){
+ return this.getMultipleVnfcCustomizations(
+ UriBuilder.fromUri(endpoint + "/vnfcCustomization/search/findByVnfCustomizationUUIDAndVfModuleCustomizationUUID")
+ .queryParam("VNF_CUSTOMIZATION_UUID", vnfCustomizationUUID)
+ .queryParam("VFMODULE_CUSTOMIZATION_UUID", vfModuleCustomizationUUID).build());
+ }
+
+ private List<CvnfcCustomization> getMultipleVnfcCustomizations(URI uri) {
+ Iterable<CvnfcCustomization> vnfcIterator = cvnfcCustomizationClient.getAll(uri);
+ List<CvnfcCustomization> vnfcList = new ArrayList<>();
+ Iterator<CvnfcCustomization> it = vnfcIterator.iterator();
+ it.forEachRemaining(vnfcList::add);
+ return vnfcList;
+ }
}
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 ba40a9c506..fc5a95769d 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
@@ -1,3 +1,23 @@
+/*-
+ * ============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.CloudSite;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
index dfa677b402..3d2ecea2d6 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.CloudifyManager;
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
new file mode 100644
index 0000000000..3eeef07c97
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java
@@ -0,0 +1,37 @@
+/*-
+ * ============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.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.data.projections.InlineVnf;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.repository.query.Param;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "cvnfcCustomization", path = "cvnfcCustomization", excerptProjection = InlineVnf.class)
+public interface CvnfcCustomizationRepository extends JpaRepository<CvnfcCustomization, String> {
+ CvnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
+ List<CvnfcCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
+ List<CvnfcCustomization> findByVnfResourceCustomizationAndVfModuleCustomization (@Param("VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID") String vnfResourceCustomization,
+ @Param("VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID") String vfModuleCustomization);
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
new file mode 100644
index 0000000000..f936933485
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java
@@ -0,0 +1,32 @@
+/*-
+ * ============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.data.repository;
+
+import java.util.List;
+
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "vnfVfmoduleCvnfcConfigurationCustomization", path = "vnfVfmoduleCvnfcConfigurationCustomization")
+public interface VnfVfmoduleCvnfcConfigurationCustomizationRepository extends JpaRepository<VnfVfmoduleCvnfcConfigurationCustomization, Integer> {
+ List<VnfVfmoduleCvnfcConfigurationCustomization> findByModelCustomizationUUID(String modelCustomizationUUID);
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java
new file mode 100644
index 0000000000..4ccbf5831f
--- /dev/null
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java
@@ -0,0 +1,31 @@
+/*-
+ * ============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.data.repository;
+
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.onap.so.db.catalog.data.projections.InlineVnf;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.rest.core.annotation.RepositoryRestResource;
+
+@RepositoryRestResource(collectionResourceRel = "vnfcCustomization", path = "vnfcCustomization")
+public interface VnfcCustomizationRepository extends JpaRepository<VnfcCustomization, String> {
+ VnfcCustomization findOneByModelCustomizationUUID(String modelCustomizationUuid);
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java
index 5a5dc70029..5bfa300a03 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java
@@ -1,7 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
package org.onap.so.db.catalog;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.context.junit4.SpringRunner;
@@ -10,6 +34,51 @@ import org.springframework.test.context.junit4.SpringRunner;
@SpringBootTest(classes = TestApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
@ActiveProfiles("test")
public class BaseTest {
+
+ protected VnfcCustomization setUpVnfcCustomization(){
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelInstanceName("testVnfcCustomizationModelInstanceName");
+ vnfcCustomization.setModelUUID("321228a4-9f15-11e8-98d0-529269fb1459");
+ vnfcCustomization.setModelInvariantUUID("c0659136-9f15-11e8-98d0-529269fb1459");
+ vnfcCustomization.setModelVersion("testModelVersion");
+ vnfcCustomization.setModelName("testModelName");
+ vnfcCustomization.setToscaNodeType("testToscaModelType");
+ vnfcCustomization.setDescription("testVnfcCustomizationDescription");
+ return vnfcCustomization;
+ }
+
+ protected CvnfcCustomization setUpCvnfcCustomization(){
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelInstanceName("cvfncCustomizationTestModelInstanceName");
+ cvnfcCustomization.setModelUUID("321228a4-9f15-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelInvariantUUID("c0659136-9f15-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setModelVersion("testModelVersion");
+ cvnfcCustomization.setModelName("testModelName");
+ cvnfcCustomization.setToscaNodeType("testToscaNodeType");
+ cvnfcCustomization.setDescription("description");
+ cvnfcCustomization.setNfcFunction("testNfcFunction");
+ cvnfcCustomization.setNfcNamingCode("testNfcNamingCode");
+ return cvnfcCustomization;
+ }
+
+ protected VfModule setUpVfModule(){
+ VfModule vFModule = new VfModule();
+ vFModule.setModelUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
+ vFModule.setModelVersion("testModelVersion");
+ vFModule.setModelName("testModelName");
+ vFModule.setIsBase(false);
+ return vFModule;
+ }
+
+ protected VnfResource setUpVnfResource(){
+ VnfResource vnfResource = new VnfResource();
+ vnfResource.setModelUUID("cb82ffd8-252a-11e7-93ae-92361f002671");
+ vnfResource.setModelInvariantUUID("az82ffd8-252a-11e7-93ae-92361f002677");
+ vnfResource.setModelVersion("testModelVersion");
+ vnfResource.setOrchestrationMode("HEAT");
+ return vnfResource;
+ }
+
@Test
public void testNothing(){}
}
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
index 016d1d61d6..489f8a0a3d 100644
--- 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
@@ -23,7 +23,6 @@ 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.db.catalog.beans.ControllerSelectionReference;
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
new file mode 100644
index 0000000000..7ec28205d6
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============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.beans;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.junit.Test;
+
+public class CvnfcCustomizationTest {
+
+ private static final Integer ID = new Integer(1);
+ private static final String DESCRIPTION = "testDescription";
+ private static final String MODEL_CUSTOMIZATION_UUID = "testModelCustomizationUUID";
+ private static final String MODEL_INSTANCE_NAME = "testModelInstanceName";
+ private static final String MODEL_INVARIANT_UUID = "testModelInvariantUUID";
+ private static final String MODEL_NAME = "testModelName";
+ private static final String MODEL_UUID = "testModelUUID";
+ private static final String MODEL_VERSION = "testModelVersion";
+ private static final String TOSCA_NODE_TYPE = "testToscaNodeType";
+ private static final String NFC_FUNCTION = "testNfcFunction";
+ private static final String NFC_NAMING_CODE = "testNfcNamingCode";
+
+ @Test
+ public final void testCvnfcCustomization () {
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setDescription(DESCRIPTION);
+ cvnfcCustomization.setId(ID);
+ cvnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ cvnfcCustomization.setModelInstanceName(MODEL_INSTANCE_NAME);
+ cvnfcCustomization.setModelInvariantUUID(MODEL_INVARIANT_UUID);
+ cvnfcCustomization.setModelName(MODEL_NAME);
+ cvnfcCustomization.setModelUUID(MODEL_UUID);
+ cvnfcCustomization.setModelVersion(MODEL_VERSION);
+ cvnfcCustomization.setNfcFunction(NFC_FUNCTION);
+ cvnfcCustomization.setNfcNamingCode(NFC_NAMING_CODE);
+ cvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE);
+ cvnfcCustomization.setVfModuleCustomization(setupVfModuleCustomization());
+ cvnfcCustomization.setVnfcCustomization(setupVnfcCustomization());
+ cvnfcCustomization.setVnfResourceCustomization(setupVnfResourceCustomization());
+ Set<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationSet = new HashSet();
+ vnfVfmoduleCvnfcConfigurationCustomizationSet.add(setupVnfVfmoduleCvnfcConfigurationCustomization());
+ cvnfcCustomization.setVnfVfmoduleCvnfcConfigurationCustomization(vnfVfmoduleCvnfcConfigurationCustomizationSet);
+
+ assertTrue (cvnfcCustomization.getId().equals (new Integer(1)));
+ assertTrue (cvnfcCustomization.getDescription().equals (DESCRIPTION));
+ assertTrue (cvnfcCustomization.getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ assertTrue (cvnfcCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME));
+ assertTrue (cvnfcCustomization.getModelInvariantUUID().equals (MODEL_INVARIANT_UUID));
+ assertTrue (cvnfcCustomization.getModelName().equals (MODEL_NAME));
+ assertTrue (cvnfcCustomization.getModelUUID().equals (MODEL_UUID));
+ assertTrue (cvnfcCustomization.getModelVersion().equals (MODEL_VERSION));
+ assertTrue (cvnfcCustomization.getNfcFunction().equals (NFC_FUNCTION));
+ assertTrue (cvnfcCustomization.getNfcNamingCode().equals (NFC_NAMING_CODE));
+ assertTrue (cvnfcCustomization.getToscaNodeType().equals (TOSCA_NODE_TYPE));
+ assertTrue (cvnfcCustomization.getVnfcCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ assertTrue (cvnfcCustomization.getVfModuleCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ }
+
+ private VfModuleCustomization setupVfModuleCustomization(){
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ return vfModuleCustomization;
+ }
+
+ private VnfcCustomization setupVnfcCustomization(){
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ return vnfcCustomization;
+ }
+
+ private VnfResourceCustomization setupVnfResourceCustomization(){
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ return vnfResourceCustomization;
+ }
+
+ private VnfVfmoduleCvnfcConfigurationCustomization setupVnfVfmoduleCvnfcConfigurationCustomization(){
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ return vnfVfmoduleCvnfcConfigurationCustomization;
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java
new file mode 100644
index 0000000000..b3ad06cca4
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java
@@ -0,0 +1,85 @@
+/*-
+ * ============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.beans;
+
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Test;
+
+public class VnfVfmoduleCvnfcConfigurationCustomizationTest {
+
+ private static final String CONFIGURATION_FUNCTION = "testconfigurationFunction";
+ private static final String CONFIGURATION_ROLE = "testconfigurationRole";
+ private static final String CONFIGURATION_TYPE = "testconfigurationType";
+ private static final Integer ID = new Integer(1);
+ private static final String MODEL_CUSTOMIZATION_UUID = "testModelCustomizationUUID";
+ private static final String MODEL_INSTANCE_NAME = "testModelInstanceName";
+ private static final String MODEL_UUID = "testModelUUID";
+ private static final String POLICY_NAME = "testPolicyName";
+
+ @Test
+ public final void testVnfVfmoduleCvnfcConfigurationCustomization () {
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction(CONFIGURATION_FUNCTION);
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(setupConfigurationResource());
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole(CONFIGURATION_ROLE);
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationType(CONFIGURATION_TYPE);
+ CvnfcCustomization cvnfcCustomization = new CvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setId(ID);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName(MODEL_INSTANCE_NAME);
+ vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName(POLICY_NAME);
+
+ vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(setupVfModuleCustomization());
+ vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(setupVnfResourceCustomization());
+
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getId().equals (new Integer(1)));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equals (CONFIGURATION_FUNCTION));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationRole().equals (CONFIGURATION_ROLE));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationType().equals (CONFIGURATION_TYPE));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getPolicyName().equals (POLICY_NAME));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getCvnfcCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getVnfResourceCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ assertTrue (vnfVfmoduleCvnfcConfigurationCustomization.getVfModuleCustomization().getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ }
+
+ private VfModuleCustomization setupVfModuleCustomization(){
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ return vfModuleCustomization;
+ }
+
+ private VnfResourceCustomization setupVnfResourceCustomization(){
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ return vnfResourceCustomization;
+ }
+
+ private ConfigurationResource setupConfigurationResource(){
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setModelUUID(MODEL_UUID);
+ return configurationResource;
+ }
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java
new file mode 100644
index 0000000000..2a315d83b6
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java
@@ -0,0 +1,77 @@
+/*-
+ * ============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.beans;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Test;
+
+public class VnfcCustomizationTest {
+
+ private static final String DESCRIPTION = "testDescription";
+ private static final String MODEL_CUSTOMIZATION_UUID = "testModelCustomizationUUID";
+ private static final String MODEL_INSTANCE_NAME = "testModelInstanceName";
+ private static final String MODEL_INVARIANT_UUID = "testModelInvariantUUID";
+ private static final String MODEL_NAME = "testModelName";
+ private static final String MODEL_UUID = "testModelUUID";
+ private static final String MODEL_VERSION = "testModelVersion";
+ private static final String TOSCA_NODE_TYPE = "testToscaNodeType";
+
+ @Test
+ public final void testVnfcCustomization () {
+ VnfcCustomization vnfcCustomization = new VnfcCustomization();
+ vnfcCustomization.setCvnfcCustomization(setupCvnfcCustomizationList());
+ vnfcCustomization.setDescription(DESCRIPTION);
+ vnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ vnfcCustomization.setModelInstanceName(MODEL_INSTANCE_NAME);
+ vnfcCustomization.setModelInvariantUUID(MODEL_INVARIANT_UUID);
+ vnfcCustomization.setModelName(MODEL_NAME);
+ vnfcCustomization.setModelUUID(MODEL_UUID);
+ vnfcCustomization.setModelVersion(MODEL_VERSION);
+ vnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE);
+
+ assertTrue (vnfcCustomization.getDescription().equals (DESCRIPTION));
+ assertTrue (vnfcCustomization.getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ assertTrue (vnfcCustomization.getModelInstanceName().equals (MODEL_INSTANCE_NAME));
+ assertTrue (vnfcCustomization.getModelInvariantUUID().equals (MODEL_INVARIANT_UUID));
+ assertTrue (vnfcCustomization.getModelName().equals (MODEL_NAME));
+ assertTrue (vnfcCustomization.getModelUUID().equals (MODEL_UUID));
+ assertTrue (vnfcCustomization.getModelVersion().equals (MODEL_VERSION));
+ assertTrue (vnfcCustomization.getToscaNodeType().equals (TOSCA_NODE_TYPE));
+ assertTrue (vnfcCustomization.getCvnfcCustomization().get(0).getModelCustomizationUUID().equals (MODEL_CUSTOMIZATION_UUID));
+ }
+
+ private List<CvnfcCustomization> setupCvnfcCustomizationList(){
+ CvnfcCustomization testCvnfcCustomization = new CvnfcCustomization();
+ testCvnfcCustomization.setModelCustomizationUUID(MODEL_CUSTOMIZATION_UUID);
+ testCvnfcCustomization.setDescription(DESCRIPTION);
+ testCvnfcCustomization.setModelVersion(MODEL_VERSION);
+ testCvnfcCustomization.setModelInstanceName(MODEL_INSTANCE_NAME);
+ testCvnfcCustomization.setToscaNodeType(TOSCA_NODE_TYPE);
+ List<CvnfcCustomization> testCvnfcCustomizationList = new ArrayList();
+ testCvnfcCustomizationList.add(testCvnfcCustomization);
+ return testCvnfcCustomizationList;
+ }
+
+} \ No newline at end of file
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
index 37a43aa529..c5ae3cc83c 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.junit.Assert;
@@ -34,4 +54,4 @@ public class CloudSiteRepositoryTest extends BaseTest {
Assert.assertFalse(CollectionUtils.isEmpty(cloudSiteList));
}
-} \ No newline at end of file
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
index db62759406..34c22b07b2 100644
--- a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
@@ -1,3 +1,23 @@
+/*-
+ * ============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.junit.Assert;
@@ -18,4 +38,4 @@ public class CloudifyManagerRepositoryTest extends BaseTest {
Assert.assertEquals("mtn13", cloudifyManager.getId());
}
-} \ No newline at end of file
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..ae3c49ec7d
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============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 static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+public class CvnfcCustomizationRepositoryTest extends BaseTest {
+ @Autowired
+ private CvnfcCustomizationRepository cvnfcCustomizationRepository;
+
+ @Test
+ public void findAllTest() throws Exception {
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll();
+ Assert.assertFalse(CollectionUtils.isEmpty(cvnfcCustomizationList));
+ }
+
+ @Test
+ @Transactional
+ public void createAndGetTest() throws Exception {
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("d95d704a-9ff2-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ List<CvnfcCustomization> cvnfcCustomizationList = cvnfcCustomizationRepository.findAll();
+ boolean matchFound = false;
+ for (CvnfcCustomization foundCvnfcCustomization : cvnfcCustomizationList) {
+ if (foundCvnfcCustomization.getDescription().equalsIgnoreCase(cvnfcCustomization.getDescription())) {
+
+ assertThat(cvnfcCustomization, sameBeanAs(foundCvnfcCustomization)
+ .ignoring("id")
+ .ignoring("created")
+ .ignoring("vnfVfmoduleCvnfcConfigurationCustomization")
+ .ignoring("vnfResourceCusteModelCustomizationUUID"));
+
+ matchFound = true;
+ break;
+ }
+ }
+ Assert.assertTrue(matchFound);
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..52cb46f391
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java
@@ -0,0 +1,121 @@
+/*-
+ * ============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 static org.junit.Assert.fail;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.ConfigurationResource;
+import org.onap.so.db.catalog.beans.CvnfcCustomization;
+import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
+import org.onap.so.db.catalog.beans.VnfVfmoduleCvnfcConfigurationCustomization;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+public class VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest extends BaseTest {
+ @Autowired
+ private VnfVfmoduleCvnfcConfigurationCustomizationRepository vnfVfmoduleCvnfcConfigurationCustomizationRepository;
+ @Autowired
+ private CvnfcCustomizationRepository cvnfcCustomizationRepository;
+
+ @Test
+ public void findAllTest() throws Exception {
+ List<VnfVfmoduleCvnfcConfigurationCustomization> vnfVfmoduleCvnfcConfigurationCustomizationList = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findAll();
+ Assert.assertFalse(CollectionUtils.isEmpty(vnfVfmoduleCvnfcConfigurationCustomizationList));
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOne(1);
+ Assert.assertTrue(vnfVfmoduleCvnfcConfigurationCustomization.getConfigurationFunction().equalsIgnoreCase("testConfigurationFunction"));
+ }
+
+ @Test
+ @Transactional
+ public void createAndGetTest() throws Exception {
+
+ VnfVfmoduleCvnfcConfigurationCustomization vnfVfmoduleCvnfcConfigurationCustomization = new VnfVfmoduleCvnfcConfigurationCustomization();
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfVfmoduleCvnfcConfigurationCustomization.setModelInstanceName("testModelInstanceName");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationType("testConfigurationType");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationRole("testConfigurationRole");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationFunction("testConfigurationFunction");
+ vnfVfmoduleCvnfcConfigurationCustomization.setPolicyName("testPolicyName");
+
+ ConfigurationResource configurationResource = new ConfigurationResource();
+ configurationResource.setModelUUID("98b42780-9f13-11e8-98d0-529269fb1459");
+ configurationResource.setModelInvariantUUID("c9338d1a-9f13-11e8-98d0-529269fb1459");
+ configurationResource.setModelVersion("testModelVertsion");
+ configurationResource.setModelName("testModelName");
+ configurationResource.setToscaNodeType("testToscaNodeType");
+ configurationResource.setDescription("testConfigurationDescription");
+ vnfVfmoduleCvnfcConfigurationCustomization.setConfigurationResource(configurationResource);
+
+ CvnfcCustomization cvnfcCustomization = setUpCvnfcCustomization();
+ cvnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModuleCustomization vfModuleCustomization = new VfModuleCustomization();
+ vfModuleCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ VfModule vFModule = setUpVfModule();
+ VnfResource vnfResource = setUpVnfResource();
+
+ vFModule.setVnfResources(vnfResource);
+ vfModuleCustomization.setVfModule(vFModule);
+ cvnfcCustomization.setVfModuleCustomization(vfModuleCustomization);
+
+ VnfResourceCustomization vnfResourceCustomization = new VnfResourceCustomization();
+ vnfResourceCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfResourceCustomization.setModelInstanceName("testModelInstanceName");
+
+ List<VnfResourceCustomization> vnfResourceCustomizations = new ArrayList();
+ vnfResourceCustomizations.add(vnfResourceCustomization);
+ vnfResource.setVnfResourceCustomizations(vnfResourceCustomizations);
+ vnfResourceCustomization.setVnfResources(vnfResource);
+
+ cvnfcCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("0aa015ea-9ff3-11e8-98d0-529269fb1459");
+ cvnfcCustomization.setVnfcCustomization(vnfcCustomization);
+
+ cvnfcCustomizationRepository.save(cvnfcCustomization);
+
+ vnfVfmoduleCvnfcConfigurationCustomization.setCvnfcCustomization(cvnfcCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setVfModuleCustomization(vfModuleCustomization);
+ vnfVfmoduleCvnfcConfigurationCustomization.setVnfResourceCustomization(vnfResourceCustomization);
+
+ vnfVfmoduleCvnfcConfigurationCustomizationRepository.save(vnfVfmoduleCvnfcConfigurationCustomization);
+
+ VnfVfmoduleCvnfcConfigurationCustomization foundVnfVfmoduleCvnfcConfigurationCustomization = vnfVfmoduleCvnfcConfigurationCustomizationRepository.findOne(1);
+
+
+ if(foundVnfVfmoduleCvnfcConfigurationCustomization == null)
+ fail("should not be null");
+ }
+}
diff --git a/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
new file mode 100644
index 0000000000..0f82c8abf0
--- /dev/null
+++ b/mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java
@@ -0,0 +1,62 @@
+/*-
+ * ============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 static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+
+import java.util.List;
+
+import org.junit.Assert;
+import org.junit.Test;
+import org.onap.so.db.catalog.BaseTest;
+import org.onap.so.db.catalog.beans.VnfcCustomization;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.CollectionUtils;
+
+public class VnfcCustomizationRepositoryTest extends BaseTest {
+ @Autowired
+ private VnfcCustomizationRepository vnfcCustomizationRepository;
+
+ @Test
+ public void findAllTest() throws Exception {
+ List<VnfcCustomization> vnfcCustomizationList = vnfcCustomizationRepository.findAll();
+ Assert.assertFalse(CollectionUtils.isEmpty(vnfcCustomizationList));
+
+ VnfcCustomization vnfcCustomization = vnfcCustomizationRepository.findOne("9bcce658-9b37-11e8-98d0-529269fb1459");
+ Assert.assertTrue(vnfcCustomization.getDescription().equalsIgnoreCase("testVnfcCustomizationDescription"));
+ }
+
+ @Test
+ @Transactional
+ public void createAndGetTest() throws Exception {
+
+ VnfcCustomization vnfcCustomization = setUpVnfcCustomization();
+ vnfcCustomization.setModelCustomizationUUID("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+ vnfcCustomizationRepository.save(vnfcCustomization);
+
+ VnfcCustomization foundVnfcCustomization = vnfcCustomizationRepository.findOne("cf9f6efc-9f14-11e8-98d0-529269fb1459");
+
+ assertThat(vnfcCustomization, sameBeanAs(foundVnfcCustomization)
+ .ignoring("created"));
+ }
+}
diff --git a/mso-catalog-db/src/test/resources/data.sql b/mso-catalog-db/src/test/resources/data.sql
index 9da6d13e49..097cd1ecd0 100644
--- a/mso-catalog-db/src/test/resources/data.sql
+++ b/mso-catalog-db/src/test/resources/data.sql
@@ -651,3 +651,98 @@ INSERT INTO `cloud_sites` (`ID`, `REGION_ID`, `IDENTITY_SERVICE_ID`, `CLOUD_VERS
INSERT INTO `controller_selection_reference` (`VNF_TYPE`, `CONTROLLER_NAME`, `ACTION_CATEGORY`) VALUES
('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'ConfigScaleOut'),
('vLoadBalancerMS/vLoadBalancerMS 0', 'APPC', 'HealthCheck');
+
+INSERT INTO `configuration`
+ (`model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `creation_timestamp`)
+VALUES ( 'c59a41ca-9b3b-11e8-98d0-529269fb1459',
+ '15881e64-9b3c-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaModelType',
+ 'testConfigurationDescription',
+ '2018-07-17 14:05:08' );
+
+
+INSERT INTO `vnfc_customization`
+ (`model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `creation_timestamp`)
+VALUES ( '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'toscaNodeType',
+ 'testVnfcCustomizationDescription',
+ '2018-07-17 14:05:08');
+
+INSERT INTO `cvnfc_customization`
+ (`id`,
+ `model_customization_uuid`,
+ `model_instance_name`,
+ `model_uuid`,
+ `model_invariant_uuid`,
+ `model_version`,
+ `model_name`,
+ `tosca_node_type`,
+ `description`,
+ `nfc_function`,
+ `nfc_naming_code`,
+ `creation_timestamp`,
+ `vnf_resource_cust_model_customization_uuid`,
+ `vf_module_cust_model_customization_uuid`,
+ `vnfc_cust_model_customization_uuid`)
+VALUES ( '1',
+ '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'b25735fe-9b37-11e8-98d0-529269fb1459',
+ 'ba7e6ef0-9b37-11e8-98d0-529269fb1459',
+ 'testModelVersion',
+ 'testModelName',
+ 'testToscaNodeType',
+ 'testCvnfcCustomzationDescription',
+ 'testNfcFunction',
+ 'testNfcNamingCode',
+ '2018-07-17 14:05:08',
+ '68dc9a92-214c-11e7-93ae-92361f002671',
+ 'cb82ffd8-252a-11e7-93ae-92361f002671',
+ '9bcce658-9b37-11e8-98d0-529269fb1459');
+
+INSERT INTO vnf_vfmodule_cvnfc_configuration_customization
+ (id,
+ model_customization_uuid,
+ vnf_resource_cust_model_customization_uuid,
+ vf_module_model_customization_uuid,
+ cvnfc_model_customization_uuid,
+ model_instance_name,
+ configuration_type,
+ configuration_role,
+ configuration_function,
+ policy_name,
+ creation_timestamp,
+ configuration_model_uuid)
+VALUES ( '1',
+ '7bcce658-9b37-11e8-98d0-529269fb1450',
+ '68dc9a92-214c-11e7-93ae-92361f002671',
+ 'cb82ffd8-252a-11e7-93ae-92361f002671',
+ '9bcce658-9b37-11e8-98d0-529269fb1459',
+ 'testModelInstanceName',
+ 'testConfigurationType',
+ 'testConfigurationRole',
+ 'testConfigurationFunction',
+ 'testPolicyName',
+ '2018-07-17 14:05:08',
+ 'c59a41ca-9b3b-11e8-98d0-529269fb1459');
diff --git a/mso-catalog-db/src/test/resources/schema.sql b/mso-catalog-db/src/test/resources/schema.sql
index 8a4b1f2103..6eaad260ea 100644
--- a/mso-catalog-db/src/test/resources/schema.sql
+++ b/mso-catalog-db/src/test/resources/schema.sql
@@ -876,3 +876,75 @@ CREATE TABLE IF NOT EXISTS `cloud_sites` (
KEY `FK_cloud_sites_identity_services` (`IDENTITY_SERVICE_ID`),
CONSTRAINT `FK_cloud_sites_identity_services` FOREIGN KEY (`IDENTITY_SERVICE_ID`) REFERENCES `identity_services` (`ID`)
) ;
+
+CREATE TABLE IF NOT EXISTS vnfc_customization (
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+PRIMARY KEY (`MODEL_CUSTOMIZATION_UUID`))
+ENGINE = InnoDB
+AUTO_INCREMENT = 20654
+DEFAULT CHARACTER SET = latin1;
+
+CREATE TABLE IF NOT EXISTS cvnfc_customization (
+`ID` INT(11) NOT NULL AUTO_INCREMENT,
+`MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+`MODEL_UUID` VARCHAR(200) NOT NULL,
+`MODEL_INVARIANT_UUID` VARCHAR(200) NOT NULL,
+`MODEL_VERSION` VARCHAR(20) NOT NULL,
+`MODEL_NAME` VARCHAR(200) NOT NULL,
+`TOSCA_NODE_TYPE` VARCHAR(200) NOT NULL,
+`DESCRIPTION` VARCHAR(1200) NULL DEFAULT NULL,
+`NFC_FUNCTION` VARCHAR(200) NULL,
+`NFC_NAMING_CODE` VARCHAR(200) NULL,
+`CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL, PRIMARY KEY (`ID`), INDEX `fk_cvnfc_customization__vf_module_customization1_idx` (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnfc_customization1_idx` (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_resource_customization1_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC), UNIQUE INDEX `UK_cvnfc_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID` ASC, `MODEL_CUSTOMIZATION_UUID` ASC), INDEX `fk_cvnfc_customization__vnf_vfmod_cvnfc_config_cust1_idx` (`MODEL_CUSTOMIZATION_UUID` ASC), CONSTRAINT `fk_cvnfc_customization__vf_module_customization1` FOREIGN KEY (`VF_MODULE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnfc_customization1` FOREIGN KEY (`VNFC_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnfc_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE, CONSTRAINT `fk_cvnfc_customization__vnf_resource_customization1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`) REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`) ON
+DELETE CASCADE ON
+UPDATE CASCADE) ENGINE = InnoDB AUTO_INCREMENT = 20654 DEFAULT CHARACTER SET = latin1;
+
+
+CREATE TABLE IF NOT EXISTS vnf_vfmodule_cvnfc_configuration_customization (
+ `ID` INT(11) NOT NULL AUTO_INCREMENT,
+ `MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `VF_MODULE_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `CVNFC_MODEL_CUSTOMIZATION_UUID` VARCHAR(200) NOT NULL,
+ `MODEL_INSTANCE_NAME` VARCHAR(200) NOT NULL,
+ `CONFIGURATION_TYPE` VARCHAR(200) NULL,
+ `CONFIGURATION_ROLE` VARCHAR(200) NULL,
+ `CONFIGURATION_FUNCTION` VARCHAR(200) NULL,
+ `POLICY_NAME` VARCHAR(200) NULL,
+ `CREATION_TIMESTAMP` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
+ `CONFIGURATION_MODEL_UUID` VARCHAR(200) NOT NULL,
+ PRIMARY KEY (`ID`),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__configuration_idx` (`CONFIGURATION_MODEL_UUID` ASC),
+ UNIQUE INDEX `UK_vnf_vfmodule_cvnfc_configuration_customization` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC , `VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC , `CVNFC_MODEL_CUSTOMIZATION_UUID` ASC , `MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__cvnfc_cust1_idx` (`CVNFC_MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vf_module_cust_idx` (`VF_MODULE_MODEL_CUSTOMIZATION_UUID` ASC),
+ INDEX `fk_vnf_vfmodule_cvnfc_config_cust__vnf_res_cust_idx` (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID` ASC),
+ CONSTRAINT `fk_vnf_vfmod_cvnfc_config_cust__configuration_resource` FOREIGN KEY (`CONFIGURATION_MODEL_UUID`)
+ REFERENCES `configuration` (`MODEL_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_cvnfc_configuration_customization__cvnfc_customization1` FOREIGN KEY (`CVNFC_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `cvnfc_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vnf_configuration_cvnfc_customization__vf_module_customiza1` FOREIGN KEY (`VF_MODULE_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `vf_module_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE,
+ CONSTRAINT `fk_vfmodule_cvnfc_configuration_customization__vnf_resource_c1` FOREIGN KEY (`VNF_RESOURCE_CUST_MODEL_CUSTOMIZATION_UUID`)
+ REFERENCES `vnf_resource_customization` (`MODEL_CUSTOMIZATION_UUID`)
+ ON DELETE CASCADE ON UPDATE CASCADE
+) ENGINE=INNODB AUTO_INCREMENT=20654 DEFAULT CHARACTER SET=LATIN1;