Merge "ValetStatus.jsvs: Fixed sonar issue"
authorByung-Woo Jun <byung-woo.jun@ericsson.com>
Mon, 10 Sep 2018 12:48:23 +0000 (12:48 +0000)
committerGerrit Code Review <gerrit@onap.org>
Mon, 10 Sep 2018 12:48:23 +0000 (12:48 +0000)
195 files changed:
.gitignore
adapters/mso-adapter-utils/src/test/java/org/onap/so/EmbeddedMariaDbConfig.java
adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.10__CvnfcCustomizationNullableColumn.sql [new file with mode: 0644]
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.4__AddVnfcTables.sql [new file with mode: 0644]
adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V4.9__DeleteServiceRecipeOldMacro.sql [new file with mode: 0644]
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientPortChanger.java
adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
adapters/mso-openstack-adapters/src/main/java/db/migration/CloudConfig.java
adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java
adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java
adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/valet/GenericValetResponse.java
adapters/mso-openstack-adapters/src/test/java/db/migration/CloudConfigMigrationTest.java
adapters/mso-requests-db-adapter/pom.xml
adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/MsoRequestsDbAdapterImpl.java
adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
adapters/mso-requests-db-adapter/src/main/resources/application-local.yaml
adapters/mso-requests-db-adapter/src/main/resources/db/migration/V4.2__Add_Request_Processing_Data.sql [new file with mode: 0644]
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestdb/rest/RequestProcessingDataRequestDbQueryTest.java [new file with mode: 0644]
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/InfraActiveRequestsRepositoryCustomControllerTest.java
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/HealthCheckHandlerTest.java
adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
adapters/mso-requests-db-adapter/src/test/resources/application-test.yaml
adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
adapters/mso-vfc-adapter/.springBeans
asdc-controller/pom.xml
asdc-controller/src/main/java/org/onap/so/asdc/ASDCControllerSingleton.java
asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
asdc-controller/src/main/java/org/onap/so/asdc/client/ResourceInstance.java
asdc-controller/src/main/java/org/onap/so/asdc/installer/VfModuleArtifact.java
asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
asdc-controller/src/main/java/org/onap/so/asdc/util/YamlEditor.java
asdc-controller/src/test/resources/schema.sql
bpmn/MSOCommonBPMN/pom.xml
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/InjectionHelper.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/baseclient/BaseClient.java [moved from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/BaseClient.java with 98% similarity]
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/bbobjects/GenericVnf.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ConfigurationResourceKeys.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ExecuteBuildingBlock.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/modelinfo/ModelInfoConfiguration.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayer.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/db/request/RequestsDbClient.java [deleted file]
bpmn/MSOCommonBPMN/src/main/java/org/openecomp/mso/bpmn/common/workflow/service/WorkflowProcessorException.java
bpmn/MSOCommonBPMN/src/main/resources/subprocess/CompleteMsoProcess.bpmn
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BaseTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/BuildingBlockTestDataSetup.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/NonSpringSuite.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/TestApplication.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/MSOCommonApplication.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/common/baseclient/BaseClientTest.java [moved from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/sdnc/BaseClientTest.java with 52% similarity]
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/mock/StubResponseAAI.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupMapperLayerTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtilsTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildlingBlockRainyDayTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/dmaapproperties/GlobalDmaapPublisherTest.java
bpmn/MSOCommonBPMN/src/test/java/org/onap/so/test/categories/SpringAware.java [new file with mode: 0644]
bpmn/MSOCommonBPMN/src/test/resources/application-test.yaml
bpmn/MSOCommonBPMN/src/test/resources/logback-test.xml
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowAsyncResource.java
bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/WorkflowTest.java
bpmn/pom.xml
bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/TestApplication.java
bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/ConfigurationScaleOutBBTest.java
bpmn/so-bpmn-building-blocks/src/test/java/org/onap/so/bpmn/infrastructure/bpmn/subprocess/GenericVnfHealthCheckBBTest.java
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Create3rdONAPE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/Delete3rdONAPE2EServiceInstance.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateResources.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVnf.groovy
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnOperationClient.java
bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/workflow/serviceTask/SdncUnderlayVpnPreprocessTask.java
bpmn/so-bpmn-infrastructure-flows/src/test/java/org/onap/so/TestApplication.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/aai/mapper/AAIObjectMapper.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/orchestration/AAIConfigurationResources.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sdnc/SDNCClient.java
bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/sniro/SniroClient.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/TestApplication.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/BaseTaskTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/common/data/TestDataSetup.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIDeleteTasksTest.java [new file with mode: 0644]
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAIUpdateTasksTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/aai/mapper/AAIObjectMapperTest.java
bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/orchestration/AAIConfigurationResourcesTest.java
cloudify-client/src/main/java/org/onap/so/cloudify/connector/http/HttpClientConnector.java
common/pom.xml
common/src/main/java/org/onap/so/client/RestClient.java
common/src/main/java/org/onap/so/client/aai/AAIClientResponseExceptionMapper.java
common/src/main/java/org/onap/so/client/aai/AAIObjectType.java
common/src/main/java/org/onap/so/client/aai/entities/AAIEdgeLabel.java
common/src/main/java/org/onap/so/client/aai/entities/AAIResultWrapper.java
common/src/main/java/org/onap/so/client/graphinventory/entities/GraphInventoryEdgeLabel.java
common/src/main/java/org/onap/so/client/graphinventory/entities/uri/HttpAwareUri.java
common/src/main/java/org/onap/so/client/policy/PolicyClient.java
common/src/main/java/org/onap/so/client/policy/PolicyClientImpl.java
common/src/main/java/org/onap/so/client/policy/entities/Config.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/policy/entities/ConfigRequestParameters.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/policy/entities/Content.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/policy/entities/FabricConfigModel.java [new file with mode: 0644]
common/src/main/java/org/onap/so/client/policy/entities/PolicyConfig.java [new file with mode: 0644]
common/src/main/java/org/onap/so/exceptions/MSOException.java
common/src/main/java/org/onap/so/logger/LoggerStartupListener.java
common/src/main/java/org/onap/so/logger/MsoLogger.java
common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
common/src/main/java/org/onap/so/serviceinstancebeans/Request.java
common/src/main/java/org/onap/so/serviceinstancebeans/RequestProcessingData.java [new file with mode: 0644]
common/src/test/java/org/onap/so/client/aai/AAIObjectTypeTest.java
common/src/test/java/org/onap/so/client/aai/AAIPServerTest.java
common/src/test/java/org/onap/so/client/aai/AAIResourcesClientWithServiceInstanceUriTest.java
common/src/test/java/org/onap/so/client/aai/entities/AAIResultWrapperTest.java
common/src/test/java/org/onap/so/client/policy/PolicyClientImplTest.java
common/src/test/resources/__files/Policy/configJson.json [new file with mode: 0644]
common/src/test/resources/__files/Policy/policyConfig.json [new file with mode: 0644]
cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPMDCSetup.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/MsoRequest.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/TenantIsolationRequest.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfOperationalEnvironment.java
mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironment.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/BaseTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestrationTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestrationTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/ActivateVnfStatusOperationalEnvironmentTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/CreateVnfOperationalEnvironmentTest.java
mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/tenantisolation/process/DeactivateVnfOperationalEnvironmentTest.java
mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationFilterResponse.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/OrchestrationList.json
mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/RequestProcessingData.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/OrchestrationRequest/getRequestProcessingData.json [new file with mode: 0644]
mso-api-handlers/mso-api-handler-infra/src/test/resources/ServiceInstanceTest/NetworkInstance.json
mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
mso-api-handlers/mso-requests-db/hibernate.properties [deleted file]
mso-api-handlers/mso-requests-db/hibernate.reveng.xml [deleted file]
mso-api-handlers/mso-requests-db/pom.xml
mso-api-handlers/mso-requests-db/src/hibernate.reveng.xml [deleted file]
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/RequestProcessingData.java [new file with mode: 0644]
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java [moved from mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/client/RequestsDbClient.java with 72% similarity]
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/data/repository/RequestProcessingDataRepository.java [new file with mode: 0644]
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/RequestsDBHelper.java
mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/TimestampXMLAdapter.java [moved from mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/requestsdb/adapter/TimestampXMLAdapter.java with 97% similarity]
mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/BaseTest.java [new file with mode: 0644]
mso-api-handlers/mso-requests-db/src/test/java/org/onap/so/TestApplication.java
mso-api-handlers/mso-requests-db/src/test/resources/afterMigrate.sql [new file with mode: 0644]
mso-api-handlers/mso-requests-db/src/test/resources/application-test.yaml
mso-api-handlers/mso-requests-db/src/test/resources/schema.sql
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/ConfigurationResource.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/CvnfcCustomization.java [new file with mode: 0644]
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModule.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VfModuleCustomization.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfResourceCustomization.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomization.java [new file with mode: 0644]
mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/VnfcCustomization.java [new file with mode: 0644]
mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudSiteRepository.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepository.java
mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepository.java [new file with mode: 0644]
mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepository.java [new file with mode: 0644]
mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepository.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/onap/so/db/catalog/BaseTest.java
mso-catalog-db/src/test/java/org/onap/so/db/catalog/ControllerSelectionReferenceTest.java
mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/CvnfcCustomizationTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfVfmoduleCvnfcConfigurationCustomizationTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/onap/so/db/catalog/beans/VnfcCustomizationTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudSiteRepositoryTest.java
mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CloudifyManagerRepositoryTest.java
mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/CvnfcCustomizationRepositoryTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfVfmoduleCvnfcConfigurationCustomizationRepositoryTest.java [new file with mode: 0644]
mso-catalog-db/src/test/java/org/onap/so/db/catalog/data/repository/VnfcCustomizationRepositoryTest.java [new file with mode: 0644]
mso-catalog-db/src/test/resources/data.sql
mso-catalog-db/src/test/resources/schema.sql

index 284ea22..5817c69 100644 (file)
@@ -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/
index d7b30ed..d688960 100644 (file)
@@ -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
+}
index 823c807..efe6010 100644 (file)
@@ -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 (file)
index 0000000..985c7cd
--- /dev/null
@@ -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 (file)
index 0000000..f0b291e
--- /dev/null
@@ -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 (file)
index 0000000..7fd222a
--- /dev/null
@@ -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
index 687b2f6..8ccf40e 100644 (file)
@@ -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));
index b52cf73..bf69686 100644 (file)
@@ -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;
index b1c3bdb..4ec5839 100644 (file)
@@ -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;
index 0309c88..82139f2 100644 (file)
@@ -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;
index ee89edb..3ec02bf 100644 (file)
@@ -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;
index 6398d41..6c63669 100644 (file)
@@ -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;
index de8aedc..2eeed77 100644 (file)
@@ -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;
     }
index 344895f..30062a0 100644 (file)
@@ -34,11 +34,7 @@ public class GenericValetResponse<T> {
        private String errorMessage;
        private T returnObject;
        
-       @Override
-       public String toString() {
-               return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
-                               .append("returnObject", returnObject).toString();
-       }
+
        public GenericValetResponse(int statusCode, String errorMessage, T obj) {
                super();
                this.statusCode = statusCode;
@@ -48,6 +44,11 @@ public class GenericValetResponse<T> {
        public GenericValetResponse() {
                this(-1, "not set", null);
        }
+       @Override
+       public String toString() {
+               return new ToStringBuilder(this).append("statusCode", statusCode).append("errorMessage", errorMessage)
+                               .append("returnObject", returnObject).toString();
+       }
        public void setErrorMessage(String errorMessage) {
                this.errorMessage = errorMessage;
        }
index b29e1f5..d83e929 100644 (file)
@@ -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;
index 955a4d8..6669895 100644 (file)
                        <artifactId>micrometer-registry-prometheus</artifactId>
                        <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>
                        </plugins>
                </pluginManagement>
        </build>
-</project>
\ No newline at end of file
+</project>
index 92a9df1..33b1028 100644 (file)
@@ -300,4 +300,4 @@ public class MsoRequestsDbAdapterImpl implements MsoRequestsDbAdapter {
                resStatus.setStatusDescription(statusDescription);
                resourceOperationStatusRepository.save(resStatus);
        }
-}
\ No newline at end of file
+}
index 69cf6cc..e932bb2 100644 (file)
@@ -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
+}
index ade3daa..414c552 100644 (file)
@@ -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 (file)
index 0000000..394a3e5
--- /dev/null
@@ -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 (file)
index 0000000..c1e620b
--- /dev/null
@@ -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());
+       }
+}
index 11f8ff0..58fd517 100644 (file)
@@ -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
+}
index 4e00ced..21ec8f7 100644 (file)
@@ -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));
index 9ac0cce..03fd062 100644 (file)
@@ -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
+}
index 165b667..812fd23 100644 (file)
@@ -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
index ec02ac0..ae5f5e9 100644 (file)
@@ -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');
index 766a48a..543c8e4 100644 (file)
@@ -48,8 +48,6 @@ import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 
 @Configuration("CXFConfiguration")
 public class CXFConfiguration {
-    
-       private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class);
        
        JAXRSServerFactoryBean endpoint;
        
index 1310366..7f46cc4 100644 (file)
@@ -13,4 +13,4 @@
        </autoconfigs>
        <configSets>
        </configSets>
-</beansProjectDescription>
+</beansProjectDescription>
\ No newline at end of file
index f9f7127..28fd24c 100644 (file)
                <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>
index 471a08b..62971ec 100644 (file)
@@ -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=========================================================
  */
 
index 55a437f..fae3a49 100644 (file)
@@ -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.
      */
index cfdff85..9115ed3 100644 (file)
@@ -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(){
index adc8071..92fc598 100644 (file)
@@ -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() {
index a045c2b..f5e4511 100644 (file)
@@ -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:
index 7dfb1ba..f7b457c 100644 (file)
@@ -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;
@@ -143,6 +151,9 @@ public class ToscaResourceInstaller {
        @Autowired
        protected ServiceProxyResourceCustomizationRepository serviceProxyCustomizationRepo;
        
+       @Autowired
+       protected ServiceProxyResourceRepository serviceProxyRepo;
+       
        @Autowired
        protected CollectionResourceRepository collectionRepo;
        
@@ -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,
index fdeddf1..32f512b 100644 (file)
@@ -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);
     }
index f8f32b7..0372887 100644 (file)
@@ -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 ;
index dfb6af7..532c062 100644 (file)
                                                        </includes>     
                                                </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>
                        <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>
                <dependency>
                        <groupId>org.onap.so</groupId>
                        <artifactId>mso-requests-db</artifactId>
+                       <classifier>client</classifier>
                        <version>${project.version}</version>
                </dependency>
                <dependency>
index f1c2c8d..deae46c 100644 (file)
 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();
+       }
 }
@@ -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;
index ca2da77..fe6b0f8 100644 (file)
@@ -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);
index 17bd4f5..ba3ab7f 100644 (file)
@@ -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 (file)
index 0000000..8f0ced9
--- /dev/null
@@ -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;
+       }
+       
+       
+}
index 0d04b5e..be73b37 100644 (file)
@@ -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;
+       }
 }
index 9d3aa59..8716810 100644 (file)
@@ -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;
+       }
 }
index e8e1982..fc48996 100644 (file)
@@ -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);
                        }
index c2161a4..877d5bb 100644 (file)
@@ -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;
        }
 
index 4b85538..84ecfc7 100644 (file)
@@ -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 (file)
index 61869ca..0000000
+++ /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);
-       }
-}
index 768bee5..64283d7 100644 (file)
@@ -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;
index 31a9817..67bd961 100644 (file)
@@ -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>
index d2f1186..119d3b1 100644 (file)
@@ -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 {
        
 
index a983193..5be8795 100644 (file)
@@ -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 (file)
index 0000000..ee2848c
--- /dev/null
@@ -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 {
+
+}
index ba8caee..d1559c2 100644 (file)
@@ -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);
index 514d93b..45bbe9e 100644 (file)
@@ -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,
@@ -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>>() {});
index c7d1a7c..3b41ff8 100644 (file)
@@ -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.
@@ -43,16 +43,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
         */
@@ -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(){
index c18dcf5..33e1390 100644 (file)
@@ -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));
        }
index 489163b..9897c04 100644 (file)
@@ -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
index aa883b6..eb74ab8 100644 (file)
@@ -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;
index 79cb33b..2144f1c 100644 (file)
 
 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
index 0992b59..47e0583 100644 (file)
@@ -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 (file)
index 0000000..21035fc
--- /dev/null
@@ -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 */
+}
index f039441..236d435 100644 (file)
@@ -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
index d8f6ba3..9088d1a 100644 (file)
@@ -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
index ef72149..9ed36e5 100644 (file)
@@ -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();   
index c263fe6..db2304d 100644 (file)
@@ -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,
index 8ebc80c..9dadb8b 100644 (file)
@@ -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);
index 9f004af..9368be1 100644 (file)
                        <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>
index 314cc0b..d1559c2 100644 (file)
 
 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);
index edf131d..b22b90b 100644 (file)
@@ -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;
index 1c882e8..9553f72 100644 (file)
@@ -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;
index f11022d..ec8df3d 100644 (file)
@@ -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
  * 
index 63fd20e..37c7d4d 100644 (file)
@@ -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
  * 
index d571c00..3d8b257 100644 (file)
@@ -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
  * 
index df4698d..1585a7b 100644 (file)
@@ -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())
 
index fd84464..b13d7fc 100644 (file)
@@ -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
index 5bd3297..8bc9dce 100644 (file)
@@ -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
index 314cc0b..f9962c2 100644 (file)
 
 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);
index e534142..887c51e 100644 (file)
@@ -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);
+               }
+       }
 }
index cb265b6..a00806a 100644 (file)
@@ -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);
+               }
+       }
 }
index b059a77..58c51f6 100644 (file)
@@ -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
index b2b071e..57d097e 100644 (file)
@@ -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;
        }
 
index 101a355..ab29e21 100644 (file)
@@ -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;
index be19f25..4a1c3f5 100644 (file)
@@ -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=========================================================
  */
 
index b84f8b6..e9dc374 100644 (file)
@@ -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);
+       }
 }
index 9e60196..0061f50 100644 (file)
@@ -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;
index cee94e2..eb12278 100644 (file)
@@ -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;
index 6401d55..9244f7e 100644 (file)
@@ -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);
index 3fce15a..2b25dfd 100644 (file)
@@ -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;
 }
index 675e8a1..fb95330 100644 (file)
@@ -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
index 51a7f1a..0b802a3 100644 (file)
@@ -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 (file)
index 0000000..efe5b5d
--- /dev/null
@@ -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);
+       }
+}
index b457529..d800ae9 100644 (file)
@@ -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);
+       }
 }
index 3869988..65d16ad 100644 (file)
@@ -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");
index 0355006..99f1b18 100644 (file)
@@ -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();
index cc48c46..5948c66 100644 (file)
@@ -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
index 6214cc5..2595ddc 100644 (file)
@@ -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=========================================================
  */
 
index d3f460e..a3084e8 100644 (file)
@@ -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>
index 007c666..631850a 100644 (file)
@@ -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;
 
index 514eab6..ffc474a 100644 (file)
@@ -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) {
index ce75b17..a5d8f12 100644 (file)
 
 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, "");
+       }
 }
index 0356e86..434dbf9 100644 (file)
@@ -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;
index 36e67e2..45621f0 100644 (file)
@@ -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()) {
index 1ede2f9..461920f 100644 (file)
@@ -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 {
index 145959d..3d08c8d 100644 (file)
@@ -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;
index 74c1e39..6743bc2 100644 (file)
@@ -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);
 }
index 1fd01e6..71a3227 100644 (file)
@@ -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 (file)
index 0000000..6c9c075
--- /dev/null
@@ -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 (file)
index 0000000..8cd5b93
--- /dev/null
@@ -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 (file)
index 0000000..a473f6c
--- /dev/null
@@ -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 (file)
index 0000000..d1a924c
--- /dev/null
@@ -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 (file)
index 0000000..807829e
--- /dev/null
@@ -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;
+    }
+
+}
index c4be075..f49cd8d 100644 (file)
@@ -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;
 
 
index 1ed18ea..794d02a 100644 (file)
@@ -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=========================================================
  */
 
index 3ef01f5..94ffa71 100644 (file)
@@ -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);
index efc0aa8..f0a1656 100644 (file)
@@ -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
+}
index 755d18b..194a445 100644 (file)
@@ -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
+}
index bda3096..8e7e5e9 100644 (file)
 
 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 (file)
index 0000000..3373f78
--- /dev/null
@@ -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();
+       }
+       
+       
+}
index ce90ccd..ea84271 100644 (file)
@@ -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());
+       }
 }
index 1e2e747..37188bc 100644 (file)
@@ -44,6 +44,7 @@ public class AAIPServerTest {
                List<Pserver> list = client.getListOfPservers(json);
                
                assertEquals("", list.get(0).getHostname(), "test");
+               assertEquals("", list.size(), 2);
        }
        
        @Test
index efd60a3..3d23213 100644 (file)
@@ -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;
index e40c25a..d4bf1b0 100644 (file)
@@ -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());
+       }
 }
index 104d40f..4cb9bd0 100644 (file)
@@ -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 (file)
index 0000000..b206998
--- /dev/null
@@ -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 (file)
index 0000000..b67c9c0
--- /dev/null
@@ -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
index 52d26fb..08499cf 100644 (file)
@@ -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;
 
 
index 1ddf268..ed4ba76 100644 (file)
@@ -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;
 
 
index 6991949..ef47106 100644 (file)
@@ -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
+}
index 8f8cf08..1a95aa0 100644 (file)
@@ -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;
index 1a1b45a..753e712 100644 (file)
@@ -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
+}
index 753b4c4..50d2639 100644 (file)
@@ -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;
+   }
  }
index a7dac34..60b07fd 100644 (file)
@@ -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
+}
index cfe32a3..d743c44 100644 (file)
@@ -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
+}
index 3b7a326..a35f40b 100644 (file)
@@ -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
+}
index b13008b..855a543 100644 (file)
@@ -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
+}
index e89b5c8..ac9a000 100644 (file)
@@ -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;
index 6eb5157..66cfd34 100644 (file)
@@ -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;
index d273040..52ed34a 100644 (file)
@@ -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();
        }
 
index 5d6aa43..76d4b48 100644 (file)
@@ -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));
index 582bc12..0af9826 100644 (file)
 
 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
+}
index 76f4bb0..e4ec850 100644 (file)
@@ -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)));
index e759752..1e11b74 100644 (file)
@@ -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;
index 5f18e28..8ac84d6 100644 (file)
@@ -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);
index eba9049..9a53340 100644 (file)
@@ -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 {
index 1dfafce..809e39c 100644 (file)
@@ -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;
index 5b0e1f6..7c24050 100644 (file)
@@ -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 (file)
index 0000000..561ed0d
--- /dev/null
@@ -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
index 124513d..1b1530d 100644 (file)
@@ -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 (file)
index 0000000..79caa33
--- /dev/null
@@ -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 (file)
index 0000000..af28007
--- /dev/null
@@ -0,0 +1,8 @@
+{
+       "id": 1,
+       "soRequestId": "00032ab7-na18-42e5-965d-8ea592502018",
+       "groupingId": "7d2e8c07-4d10-456d-bddc-37abf38ca714",
+       "name": "requestAction",
+       "value": "assign",
+       "tag": "pincFabricConfigRequest"
+}
index 993310d..a37fe05 100644 (file)
@@ -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
index 3540110..381330b 100644 (file)
@@ -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 (file)
index cf56960..0000000
+++ /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 (file)
index cb1e8c6..0000000
+++ /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
index 006058e..a3b0ec1 100644 (file)
@@ -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>
                                                        <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 (file)
index d626405..0000000
+++ /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>
index 0833064..4a46a0d 100644 (file)
@@ -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 (file)
index 0000000..34832b9
--- /dev/null
@@ -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
  * ============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 (file)
index 0000000..f80be05
--- /dev/null
@@ -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);
+}
index 562e54c..ea3ef30 100644 (file)
@@ -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/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 (file)
index 0000000..5a8df1d
--- /dev/null
@@ -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 {
+
+}
index ec2c41b..00d212a 100644 (file)
@@ -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 (file)
index 0000000..897dd3f
--- /dev/null
@@ -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
index 62ae479..c4dd603 100644 (file)
@@ -12,6 +12,7 @@ mso:
       endpoint: http://localhost:8081
   site-name: localDevEnv
   logPath: logs
+        
 # H2
 spring:
   datasource:
index a01153a..ab554d4 100644 (file)
@@ -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
index 1734801..7c6fb04 100644 (file)
@@ -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 (file)
index 0000000..c02b1e3
--- /dev/null
@@ -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;
+       }
+}
index 47d82bf..7d53a0b 100644 (file)
@@ -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;
 
index 4a9b3bb..5a7d0d5 100644 (file)
@@ -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;
+       }
 }
index fa0fe56..d286bc0 100644 (file)
@@ -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 (file)
index 0000000..8ef797f
--- /dev/null
@@ -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 (file)
index 0000000..8534242
--- /dev/null
@@ -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;
+       }
+}
index 8da24c9..e29d88c 100644 (file)
@@ -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;
+       }
 
 }
index ba40a9c..fc5a957 100644 (file)
@@ -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;
index dfa677b..3d2ecea 100644 (file)
@@ -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 (file)
index 0000000..3eeef07
--- /dev/null
@@ -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 (file)
index 0000000..f936933
--- /dev/null
@@ -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 (file)
index 0000000..4ccbf58
--- /dev/null
@@ -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
index 5a5dc70..5bfa300 100644 (file)
@@ -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(){}
 }
index 016d1d6..489f8a0 100644 (file)
@@ -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 (file)
index 0000000..7ec2820
--- /dev/null
@@ -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 (file)
index 0000000..b3ad06c
--- /dev/null
@@ -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 (file)
index 0000000..2a315d8
--- /dev/null
@@ -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
index 37a43aa..c5ae3cc 100644 (file)
@@ -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
+}
index db62759..34c22b0 100644 (file)
@@ -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 (file)
index 0000000..ae3c49e
--- /dev/null
@@ -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 (file)
index 0000000..52cb46f
--- /dev/null
@@ -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 (file)
index 0000000..0f82c8a
--- /dev/null
@@ -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"));
+    }
+}
index 9da6d13..097cd1e 100644 (file)
@@ -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'); 
index 8a4b1f2..6eaad26 100644 (file)
@@ -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;