summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java8
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java325
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java17
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java14
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java6
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java24
-rw-r--r--adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java20
-rw-r--r--adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json2
-rw-r--r--adapters/mso-catalog-db-adapter/pom.xml53
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java2
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java44
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java14
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java23
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java22
-rw-r--r--adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql47
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java32
-rw-r--r--adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java9
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java26
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java36
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java35
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java34
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java49
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java24
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java65
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java64
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java2
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java162
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java1
-rw-r--r--adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java12
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java45
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java91
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java4
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java2
-rw-r--r--adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java99
-rw-r--r--adapters/mso-openstack-adapters/src/test/resources/application-test.yaml4
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java6
-rw-r--r--adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java14
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql12
-rw-r--r--adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.5__Drop_Table_Active_Requests.sql4
-rw-r--r--adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java6
-rw-r--r--adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java2
-rw-r--r--adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java6
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt12
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java88
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java27
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java18
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java14
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java12
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java22
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml13
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java16
-rw-r--r--adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java21
-rw-r--r--adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java42
-rw-r--r--adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java45
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java7
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java13
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java3
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java24
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java1
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java5
-rw-r--r--asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java553
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java10
-rw-r--r--asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java2
-rw-r--r--asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java19
-rw-r--r--asdc-controller/src/test/resources/schema.sql4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy6
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy2
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy47
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java (renamed from common/src/main/java/org/onap/so/utils/TargetEntities.java)12
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java (renamed from common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java)41
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java64
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java4
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java7
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java28
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java27
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java24
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy4
-rw-r--r--bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy10
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java21
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java16
-rw-r--r--bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java10
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java14
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java21
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java42
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java51
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java8
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java2
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java13
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java118
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java6
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn258
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy2
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy6
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java48
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java4
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java54
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy20
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java7
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java9
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java46
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java4
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java36
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java94
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java8
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java20
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java15
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java29
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java12
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java3
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java14
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java149
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java13
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java7
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java155
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java11
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java18
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java95
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java27
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java63
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java16
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java5
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json2
-rw-r--r--bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json2
-rw-r--r--common/pom.xml11
-rw-r--r--common/src/main/java/org/onap/so/client/BaseClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClient.java8
-rw-r--r--common/src/main/java/org/onap/so/client/HttpClientFactory.java8
-rw-r--r--common/src/main/java/org/onap/so/client/RestClient.java20
-rw-r--r--common/src/main/java/org/onap/so/client/RestTemplateConfig.java9
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java4
-rw-r--r--common/src/main/java/org/onap/so/client/aai/AAIRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java16
-rw-r--r--common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java5
-rw-r--r--common/src/main/java/org/onap/so/client/grm/GRMRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java6
-rw-r--r--common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java56
-rw-r--r--common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java8
-rw-r--r--common/src/main/java/org/onap/so/logger/LogConstants.java2
-rw-r--r--common/src/main/java/org/onap/so/logger/MdcConstants.java10
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java136
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java173
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java111
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java158
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java34
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java61
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java68
-rw-r--r--common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java156
-rw-r--r--common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java132
-rw-r--r--common/src/main/java/org/onap/so/utils/Components.java7
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java46
-rw-r--r--common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java36
-rw-r--r--common/src/main/java/org/onap/so/utils/TargetEntity.java59
-rw-r--r--common/src/test/java/org/onap/so/client/HttpClientTest.java8
-rw-r--r--common/src/test/java/org/onap/so/client/RestClientTest.java4
-rw-r--r--common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java16
-rw-r--r--common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java6
-rw-r--r--common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java96
-rw-r--r--common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java93
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java61
-rw-r--r--common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java65
-rw-r--r--cxf-logging/pom.xml5
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java2
-rw-r--r--cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java2
-rw-r--r--deployment-configs/src/main/resources/logger/logback-spring.xml231
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java9
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java1
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java17
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json103
-rw-r--r--mso-api-handlers/mso-api-handler-infra/pom.xml14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java41
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java45
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java12
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java28
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java130
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java594
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java17
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java739
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java14
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java9
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java21
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java20
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java15
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java36
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java2
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java11
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java7
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java8
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java63
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java6
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql4
-rw-r--r--mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql4
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql2
-rw-r--r--mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql8
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java2
-rw-r--r--mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java6
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java1
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java21
-rw-r--r--mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java2
-rw-r--r--packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml35
-rw-r--r--pom.xml15
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts9
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html15
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss24
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts82
-rw-r--r--so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts8
-rw-r--r--version.properties2
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java108
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java12
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java127
-rw-r--r--vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/TerminateOperationProgressorTest.java157
269 files changed, 5239 insertions, 3980 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
index f1c42bb4a5..d7bc22aa7c 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/cloudify/utils/MsoCloudifyUtils.java
@@ -419,7 +419,11 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
logger.debug("pollTimeout remaining: " + pollTimeout);
execution = queryExecution.execute();
- status = execution.getStatus();
+ if (execution != null) {
+ status = execution.getStatus();
+ } else {
+ status = TERMINATED;
+ }
}
// Broke the loop. Check again for a terminal state
@@ -562,7 +566,7 @@ public class MsoCloudifyUtils extends MsoCommonUtils implements VduPlugin {
Executions executions = listExecutions.execute();
// If no executions, does this give NOT_FOUND or empty set?
- if (executions.getItems().isEmpty()) {
+ if (executions == null || executions.getItems().isEmpty()) {
return new DeploymentInfoBuilder().withId(deployment.getId())
.withDeploymentInputs(deployment.getInputs()).build();
} else {
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index b5a97f7559..75a8ca0593 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -89,6 +89,10 @@ import com.woorea.openstack.heat.model.Stacks;
@Component
public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
+ private static final String CREATE_FAILED = "CREATE_FAILED";
+
+ private static final String DELETE_FAILED = "DELETE_FAILED";
+
private static final String CREATE_COMPLETE = "CREATE_COMPLETE";
private static final String DELETE_COMPLETE = "DELETE_COMPLETE";
@@ -133,42 +137,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
- /**
- * keep this old method signature here to maintain backwards compatibility. keep others as well. this method does
- * not include environment, files, or heatFiles
- */
- public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
- String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes)
- throws MsoException {
- // Just call the new method with the environment & files variable set to null
- return this.createStack(cloudSiteId, cloudOwner, tenantId, stackName, null, heatTemplate, stackInputs,
- pollForCompletion, timeoutMinutes, null, null, null, true);
- }
-
- // This method has environment, but not files or heatFiles
- public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
- String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes,
- String environment) throws MsoException {
- // Just call the new method with the files/heatFiles variables set to null
- return this.createStack(cloudSiteId, cloudOwner, tenantId, stackName, null, heatTemplate, stackInputs,
- pollForCompletion, timeoutMinutes, environment, null, null, true);
- }
-
- // This method has environment and files, but not heatFiles.
- public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
- String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes,
- String environment, Map<String, Object> files) throws MsoException {
- return this.createStack(cloudSiteId, cloudOwner, tenantId, stackName, null, heatTemplate, stackInputs,
- pollForCompletion, timeoutMinutes, environment, files, null, true);
- }
- // This method has environment, files, heatfiles
- public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
- String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion, int timeoutMinutes,
- String environment, Map<String, Object> files, Map<String, Object> heatFiles) throws MsoException {
- return this.createStack(cloudSiteId, cloudOwner, tenantId, stackName, null, heatTemplate, stackInputs,
- pollForCompletion, timeoutMinutes, environment, files, heatFiles, true);
- }
/**
* Create a new Stack in the specified cloud location and tenant. The Heat template and parameter map are passed in
@@ -211,20 +180,50 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
@SuppressWarnings("unchecked")
public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
VduModelInfo vduModel, String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion,
- int timeoutMinutes, String environment, Map<String, Object> files, Map<String, Object> heatFiles,
- boolean backout) throws MsoException {
-
+ int timeoutMinutes, String environment, Map<String, Object> nestedTemplates, Map<String, Object> heatFiles,
+ boolean backout, boolean failIfExists) throws MsoException {
stripMultiCloudInputs(stackInputs);
- CreateStackParam createStack =
- createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes, environment, files, heatFiles);
- Stack currentStack = createStack(createStack, cloudSiteId, tenantId);
- currentStack.setStackName(stackName);
- if (pollForCompletion) {
- currentStack =
+ CreateStackParam createStack = createStackParam(stackName, heatTemplate, stackInputs, timeoutMinutes,
+ environment, nestedTemplates, heatFiles);
+ Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
+ if (currentStack != null) {
+ logger.debug("Existing Stack found with Status: {} ", currentStack.getStackStatus());
+ if (CREATE_COMPLETE.equals(currentStack.getStackStatus())) {
+ new StackInfoMapper(currentStack).map();
+ } else if (CREATE_IN_PROGRESS.equals(currentStack.getStackStatus())) {
+ currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack,
+ createStack, true);
+ } else if (CREATE_FAILED.equals(currentStack.getStackStatus())
+ || DELETE_FAILED.equals(currentStack.getStackStatus())) {
+ try {
processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack, createStack, true);
+ } catch (MsoException e) {
+ if (e instanceof StackCreationException) {
+ logger.warn("Error during Stack will attempt to recreate stack");
+ currentStack = createStack(createStack, cloudSiteId, tenantId);
+ currentStack.setStackName(stackName);
+ if (pollForCompletion) {
+ currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout,
+ currentStack, createStack, true);
+ } else {
+ currentStack = queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(),
+ cloudSiteId, tenantId);
+ }
+ } else {
+ throw e;
+ }
+ }
+ }
} else {
- currentStack =
- queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
+ currentStack = createStack(createStack, cloudSiteId, tenantId);
+ currentStack.setStackName(stackName);
+ if (pollForCompletion) {
+ currentStack = processCreateStack(cloudSiteId, tenantId, timeoutMinutes, backout, currentStack,
+ createStack, true);
+ } else {
+ currentStack =
+ queryHeatStack(currentStack.getStackName() + "/" + currentStack.getId(), cloudSiteId, tenantId);
+ }
}
return new StackInfoMapper(currentStack).map();
}
@@ -270,7 +269,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
Stack heatStack, CreateStackParam stackCreate, boolean keyPairCleanUp) throws MsoException {
Stack latestStack = null;
try {
- latestStack = pollStackForStatus(timeoutMinutes, heatStack, CREATE_IN_PROGRESS, cloudSiteId, tenantId);
+ latestStack =
+ pollStackForStatus(timeoutMinutes, heatStack, CREATE_IN_PROGRESS, cloudSiteId, tenantId, false);
} catch (MsoException me) {
logger.error("Exception in Create Stack", me);
}
@@ -280,47 +280,54 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected Stack postProcessStackCreate(Stack stack, boolean backout, int timeoutMinutes, boolean cleanUpKeyPair,
String cloudSiteId, String tenantId, CreateStackParam stackCreate) throws MsoException {
+ boolean stackCreationFailed = false;
+ boolean stackRollbackFailed = false;
if (stack == null) {
throw new StackCreationException("Unknown Error in Stack Creation");
- }
-
- logger.info("Performing post processing backout: {} cleanUpKeyPair: {}, stack {}", backout, cleanUpKeyPair,
- stack);
- if (!CREATE_COMPLETE.equals(stack.getStackStatus())) {
- if (cleanUpKeyPair && !Strings.isNullOrEmpty(stack.getStackStatusReason())
- && isKeyPairFailure(stack.getStackStatusReason())) {
- return handleKeyPairConflict(cloudSiteId, tenantId, stackCreate, timeoutMinutes, backout, stack);
- }
- if (!backout) {
- logger.info("Status is not CREATE_COMPLETE, stack deletion suppressed");
- throw new StackCreationException("Stack rollback suppressed, stack not deleted");
- } else {
- logger.info("Status is not CREATE_COMPLETE, stack deletion will be executed");
- String errorMessage = "Stack Creation Failed Openstack Status: " + stack.getStackStatus()
- + " Status Reason: " + stack.getStackStatusReason();
- try {
- Stack deletedStack = handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
- errorMessage = errorMessage + " , Rollback of Stack Creation completed with status: "
- + deletedStack.getStackStatus() + " Status Reason: " + deletedStack.getStackStatusReason();
- } catch (StackRollbackException se) {
- logger.error("Sync Error Deleting Stack during rollback process", se);
- errorMessage = errorMessage + se.getMessage();
- } catch (MsoException e) {
- logger.error("Sync Error Deleting Stack during rollback", e);
-
- errorMessage =
- errorMessage + " , Rollback of Stack Creation failed with sync error: " + e.getMessage();
+ } else {
+ logger.info("Performing post processing backout: {} cleanUpKeyPair: {}, stack {}", backout, cleanUpKeyPair,
+ stack);
+ if (!CREATE_COMPLETE.equals(stack.getStackStatus())) {
+ if (cleanUpKeyPair && !Strings.isNullOrEmpty(stack.getStackStatusReason())
+ && isKeyPairFailure(stack.getStackStatusReason())) {
+ return handleKeyPairConflict(cloudSiteId, tenantId, stackCreate, timeoutMinutes, backout, stack);
+ }
+ if (!backout) {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion suppressed");
+ stackCreationFailed = true;
+ throw new StackCreationException("Stack rollback suppressed, stack not deleted",
+ stackCreationFailed, stackRollbackFailed);
+ } else {
+ logger.info("Status is not CREATE_COMPLETE, stack deletion will be executed");
+ stackCreationFailed = true;
+ String errorMessage = "Stack Creation Failed Openstack Status: " + stack.getStackStatus()
+ + " Status Reason: " + stack.getStackStatusReason();
+ try {
+ Stack deletedStack =
+ handleUnknownCreateStackFailure(stack, timeoutMinutes, cloudSiteId, tenantId);
+ errorMessage = errorMessage + " , Rollback of Stack Creation completed with status: "
+ + deletedStack.getStackStatus() + " Status Reason: "
+ + deletedStack.getStackStatusReason();
+ } catch (MsoException e) {
+ stackRollbackFailed = true;
+ logger.error("Sync Error Deleting Stack during rollback", e);
+ if (e instanceof StackRollbackException) {
+ errorMessage = errorMessage + e.getMessage();
+ } else {
+ errorMessage = errorMessage + " , Rollback of Stack Creation failed with sync error: "
+ + e.getMessage();
+ }
+ }
+ throw new StackCreationException(errorMessage, stackCreationFailed, stackRollbackFailed);
}
- throw new StackCreationException(errorMessage);
+ } else {
+ return stack;
}
- } else {
- return stack;
}
-
}
protected Stack pollStackForStatus(int timeoutMinutes, Stack stack, String stackStatus, String cloudSiteId,
- String tenantId) throws MsoException {
+ String tenantId, boolean notFoundIsSuccess) throws MsoException {
int pollingFrequency =
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
int pollingMultiplier =
@@ -329,9 +336,10 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
while (true) {
Stack latestStack = queryHeatStack(heatClient, stack.getStackName() + "/" + stack.getId());
- if (latestStack != null) {
+ if (latestStack == null && notFoundIsSuccess) {
+ return null;
+ } else if (latestStack != null) {
statusHandler.updateStackStatus(latestStack);
- logger.debug("Polling: {} ({})", latestStack.getStackStatus(), latestStack.getStackName());
if (stackStatus.equals(latestStack.getStackStatus())) {
if (numberOfPollingAttempts <= 0) {
logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
@@ -342,9 +350,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} else {
return latestStack;
}
- } else {
- logger.error("latestStack is null");
- return null;
}
}
}
@@ -381,17 +386,26 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
protected Stack handleUnknownCreateStackFailure(Stack stack, int timeoutMinutes, String cloudSiteId,
String tenantId) throws MsoException {
if (stack != null && !Strings.isNullOrEmpty(stack.getStackName()) && !Strings.isNullOrEmpty(stack.getId())) {
- OpenStackRequest<Void> request = getHeatClient(cloudSiteId, tenantId).getStacks()
- .deleteByName(stack.getStackName() + "/" + stack.getId());
- executeAndRecordOpenstackRequest(request);
- Stack currentStack = pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId);
- postProcessStackDelete(currentStack);
- return currentStack;
+ return deleteStack(stack, timeoutMinutes, cloudSiteId, tenantId);
} else {
throw new StackCreationException("Cannot Find Stack Name or Id");
}
}
+ private Stack deleteStack(Stack stack, int timeoutMinutes, String cloudSiteId, String tenantId)
+ throws MsoException {
+ OpenStackRequest<Void> request = getHeatClient(cloudSiteId, tenantId).getStacks()
+ .deleteByName(stack.getStackName() + "/" + stack.getId());
+ executeAndRecordOpenstackRequest(request);
+ Stack currentStack = pollStackForStatus(timeoutMinutes, stack, DELETE_IN_PROGRESS, cloudSiteId, tenantId, true);
+ if (currentStack == null) {
+ return currentStack;
+ } else {
+ postProcessStackDelete(currentStack);
+ }
+ return currentStack;
+ }
+
protected void postProcessStackDelete(Stack stack) throws MsoException {
logger.info("Performing post processing on delete stack {}", stack);
if (stack != null && !Strings.isNullOrEmpty(stack.getStackStatus())) {
@@ -453,7 +467,6 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Query the Stack.
// An MsoException will propagate transparently to the caller.
Stack heatStack = queryHeatStack(heatClient, stackName);
-
if (heatStack == null) {
// Stack does not exist. Return a StackInfo with status NOTFOUND
return new StackInfo(stackName, HeatStatus.NOTFOUND);
@@ -484,114 +497,16 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
* @throws MsoCloudSiteNotFound
*/
public StackInfo deleteStack(String tenantId, String cloudOwner, String cloudSiteId, String stackName,
- boolean pollForCompletion) throws MsoException {
- Heat heatClient = null;
- try {
- heatClient = getHeatClient(cloudSiteId, tenantId);
- } catch (MsoTenantNotFound e) {
- logger.debug("Tenant with id " + tenantId + "not found.", e);
- return new StackInfo(stackName, HeatStatus.NOTFOUND);
- } catch (MsoException me) {
- logger.error("{} {} Openstack Exception on Token request: ", MessageEnum.RA_CONNECTION_EXCEPTION,
- ErrorCode.AvailabilityError.getValue(), me);
- me.addContext(DELETE_STACK);
- throw me;
- }
-
- // OK if stack not found, perform a query first
- Stack heatStack = queryHeatStack(heatClient, stackName);
- if (heatStack == null || DELETE_COMPLETE.equals(heatStack.getStackStatus())) {
- // Not found. Return a StackInfo with status NOTFOUND
- return new StackInfo(stackName, HeatStatus.NOTFOUND);
- }
-
- // Use canonical name "<stack name>/<stack-id>" to delete.
- // Otherwise, deletion by name returns a 302 redirect.
- // NOTE: This is specific to the v1 Orchestration API.
- String canonicalName = heatStack.getStackName() + "/" + heatStack.getId();
-
- try {
- OpenStackRequest<Void> request = null;
- if (null != heatClient) {
- request = heatClient.getStacks().deleteByName(canonicalName);
- } else {
- logger.debug("Heat Client is NULL");
- }
- executeAndRecordOpenstackRequest(request);
- } catch (OpenStackResponseException e) {
- if (e.getStatus() == 404) {
- // Not found. We are OK with this. Return a StackInfo with status NOTFOUND
- return new StackInfo(stackName, HeatStatus.NOTFOUND);
- } else {
- // Convert the OpenStackResponseException to an MsoOpenstackException
- throw heatExceptionToMsoException(e, DELETE_STACK);
- }
- } catch (OpenStackConnectException e) {
- // Error connecting to Openstack instance. Convert to an MsoException
- throw heatExceptionToMsoException(e, DELETE_STACK);
- } catch (RuntimeException e) {
- // Catch-all
- throw runtimeExceptionToMsoException(e, DELETE_STACK);
- }
-
- // Requery the stack for current status.
- // It will probably still exist with "DELETE_IN_PROGRESS" status.
- heatStack = queryHeatStack(heatClient, canonicalName);
- statusHandler.updateStackStatus(heatStack);
- if (pollForCompletion) {
- int pollInterval = Integer
- .parseInt(this.environment.getProperty(deletePollIntervalProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
- int pollTimeout = Integer
- .parseInt(this.environment.getProperty(deletePollTimeoutProp, "" + DELETE_POLL_INTERVAL_DEFAULT));
- statusHandler.updateStackStatus(heatStack);
- // When querying by canonical name, Openstack returns DELETE_COMPLETE status
- // instead of "404" (which would result from query by stack name).
- while (heatStack != null && !DELETE_COMPLETE.equals(heatStack.getStackStatus())) {
- logger.debug("Stack status: {}", heatStack.getStackStatus());
-
- if ("DELETE_FAILED".equals(heatStack.getStackStatus())) {
- // Throw a 'special case' of MsoOpenstackException to report the Heat status
- String error = "Stack delete error (" + heatStack.getStackStatus() + "): "
- + heatStack.getStackStatusReason();
- MsoOpenstackException me = new MsoOpenstackException(0, "", error);
- me.addContext(DELETE_STACK);
-
- // Alarm this condition, stack deletion failed
-
-
- throw me;
- }
-
- if (pollTimeout <= 0) {
- logger.error("{} Cloud site: {} Tenant: {} Stack: {} Stack status: {} {} Delete Stack Timeout",
- MessageEnum.RA_DELETE_STACK_TIMEOUT, cloudSiteId, tenantId, stackName,
- heatStack.getStackStatus(), ErrorCode.AvailabilityError.getValue());
-
- // Throw a 'special case' of MsoOpenstackException to report the Heat status
- MsoOpenstackException me = new MsoOpenstackException(0, "", "Stack Deletion Timeout");
- me.addContext(DELETE_STACK);
-
- // Alarm this condition, stack deletion failed
-
-
- throw me;
- }
-
- sleep(pollInterval * 1000L);
-
- pollTimeout -= pollInterval;
- logger.debug("pollTimeout remaining: {}", pollTimeout);
-
- heatStack = queryHeatStack(heatClient, canonicalName);
- }
-
- // The stack is gone when this point is reached
+ boolean pollForCompletion, int timeoutMinutes) throws MsoException {
+ Stack currentStack = queryHeatStack(stackName, cloudSiteId, tenantId);
+ if (currentStack == null || DELETE_COMPLETE.equals(currentStack.getStackStatus())) {
return new StackInfo(stackName, HeatStatus.NOTFOUND);
+ } else {
+ currentStack = deleteStack(currentStack, timeoutMinutes, cloudSiteId, tenantId);
+ StackInfo stackInfo = new StackInfoMapper(currentStack).map();
+ stackInfo.setName(stackName);
+ return stackInfo;
}
- // Return the current status (if not polling, the delete may still be in progress)
- StackInfo stackInfo = new StackInfoMapper(heatStack).map();
- stackInfo.setName(stackName);
- return stackInfo;
}
/**
@@ -734,7 +649,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
if (!inputs.containsKey(key)) {
Object obj = otherStackOutputs.get(key);
if (obj instanceof String) {
- inputs.put(key, (String) otherStackOutputs.get(key));
+ inputs.put(key, otherStackOutputs.get(key));
} else if (obj instanceof JsonNode) {
// This is a bit of mess - but I think it's the least impacting
// let's convert it BACK to a string - then it will get converted back later
@@ -1115,11 +1030,11 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
}
try {
- StackInfo stackInfo =
- createStack(cloudSiteId, cloudOwner, tenantId, instanceName, vduModel, heatTemplate, inputs, true, // poll
- // for
- // completion
- vduModel.getTimeoutMinutes(), heatEnvironment, nestedTemplates, files, rollbackOnFailure);
+ StackInfo stackInfo = createStack(cloudSiteId, cloudOwner, tenantId, instanceName, vduModel, heatTemplate,
+ inputs, true, // poll
+ // for
+ // completion
+ vduModel.getTimeoutMinutes(), heatEnvironment, nestedTemplates, files, rollbackOnFailure, false);
// Populate a vduInstance from the StackInfo
return stackInfoToVduInstance(stackInfo);
@@ -1160,7 +1075,7 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
try {
// Delete the Heat stack
- StackInfo stackInfo = deleteStack(tenantId, cloudOwner, cloudSiteId, instanceId, true);
+ StackInfo stackInfo = deleteStack(tenantId, cloudOwner, cloudSiteId, instanceId, true, timeoutMinutes);
// Populate a VduInstance based on the deleted Cloudify Deployment object
VduInstance vduInstance = stackInfoToVduInstance(stackInfo);
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
index c75aa9a67e..3eb3fe188d 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoMulticloudUtils.java
@@ -51,7 +51,7 @@ import org.onap.so.openstack.exceptions.MsoAdapterException;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.exceptions.MsoOpenstackException;
import org.onap.so.openstack.mappers.StackInfoMapper;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -135,7 +135,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
public StackInfo createStack(String cloudSiteId, String cloudOwner, String tenantId, String stackName,
VduModelInfo vduModel, String heatTemplate, Map<String, ?> stackInputs, boolean pollForCompletion,
int timeoutMinutes, String environment, Map<String, Object> files, Map<String, Object> heatFiles,
- boolean backout) throws MsoException {
+ boolean backout, boolean failIfExists) throws MsoException {
logger.trace("Started MsoMulticloudUtils.createStack");
@@ -821,7 +821,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
private RestClient getMulticloudClient(String endpoint, String tenantId) {
HttpClient client = null;
try {
- client = httpClientFactory.newJsonClient(new URL(endpoint), TargetEntity.MULTICLOUD);
+ client = httpClientFactory.newJsonClient(new URL(endpoint), ONAPComponents.MULTICLOUD);
if (tenantId != null && !tenantId.isEmpty()) {
client.addAdditionalHeader("Project", tenantId);
}
@@ -881,11 +881,11 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
}
try {
- StackInfo stackInfo =
- createStack(cloudSiteId, cloudOwner, tenantId, instanceName, vduModel, heatTemplate, inputs, true, // poll
- // for
- // completion
- vduModel.getTimeoutMinutes(), heatEnvironment, nestedTemplates, files, rollbackOnFailure);
+ StackInfo stackInfo = createStack(cloudSiteId, cloudOwner, tenantId, instanceName, vduModel, heatTemplate,
+ inputs, true, // poll
+ // for
+ // completion
+ vduModel.getTimeoutMinutes(), heatEnvironment, nestedTemplates, files, rollbackOnFailure, false);
// Populate a vduInstance from the StackInfo
return stackInfoToVduInstance(stackInfo);
} catch (Exception e) {
@@ -957,6 +957,7 @@ public class MsoMulticloudUtils extends MsoHeatUtils implements VduPlugin {
/*
* Convert the local DeploymentInfo object (Cloudify-specific) to a generic VduInstance object
*/
+ @Override
protected VduInstance stackInfoToVduInstance(StackInfo stackInfo) {
VduInstance vduInstance = new VduInstance();
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
index e3936e31f7..ab9c8a6dee 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/StackCreationException.java
@@ -24,8 +24,22 @@ import org.onap.so.openstack.exceptions.MsoException;
public class StackCreationException extends MsoException {
+ /**
+ *
+ */
+ private static final long serialVersionUID = 6221508301589330950L;
+
+ boolean stackCreationFailed = false;
+ boolean stackRollbackFailed = false;
+
public StackCreationException(String error) {
super(error);
}
+ public StackCreationException(String error, boolean stackCreationFailed, boolean stackRollbackFailed) {
+ super(error);
+ this.stackRollbackFailed = stackRollbackFailed;
+ this.stackCreationFailed = stackCreationFailed;
+ }
+
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
index 7e783aa7a4..86b1413291 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsITTest.java
@@ -133,7 +133,7 @@ public class MsoHeatUtilsITTest extends BaseTest {
@Test
public void deleteVduTest() throws Exception {
VduInstance expected = new VduInstance();
- expected.setVduInstanceId("instanceId");
+ expected.setVduInstanceId("name/stackId");
expected.setVduInstanceName("instanceId");
VduStatus status = new VduStatus();
status.setState(VduStateType.DELETED);
@@ -209,8 +209,8 @@ public class MsoHeatUtilsITTest extends BaseTest {
StubOpenStack.mockOpenStackResponseAccess(wireMockServer, wireMockPort);
StubOpenStack.mockOpenStackPostStack_200(wireMockServer, "OpenstackResponse_Stack_Created.json");
StubOpenStack.mockOpenStackGet(wireMockServer, "TEST-stack/stackId");
- StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack",
- "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>());
+ StackInfo stackInfo = heatUtils.createStack(cloudSite.getId(), "CloudOwner", "tenantId", "TEST-stack", null,
+ "TEST-heat", new HashMap<>(), false, 1, "TEST-env", new HashMap<>(), new HashMap<>(), false, false);
assertNotNull(stackInfo);
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
index e68364eab8..92cf96ed16 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoHeatUtilsTest.java
@@ -124,7 +124,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
latestStack.setStackStatusReason("Stack Finished");
doReturn(latestStack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
- Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(latestStack);
Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
assertEquals(true, actual != null);
@@ -141,7 +141,7 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
doNothing().when(stackStatusHandler).updateStackStatus(stack);
doReturn(stack).when(heatUtils).queryHeatStack(isA(Heat.class), eq("stackName/id"));
doReturn(heatClient).when(heatUtils).getHeatClient(cloudSiteId, tenantId);
- Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Stack actual = heatUtils.pollStackForStatus(1, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
Mockito.verify(stackStatusHandler, times(1)).updateStackStatus(stack);
Mockito.verify(heatUtils, times(1)).queryHeatStack(isA(Heat.class), eq("stackName/id"));
assertEquals(true, actual != null);
@@ -259,11 +259,12 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
doReturn(stackResource).when(heatClient).getStacks();
doReturn(mockDeleteStack).when(stackResource).deleteByName("stackName/id");
doReturn(deletedStack).when(heatUtils).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId,
- tenantId);
+ tenantId, true);
heatUtils.handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
Mockito.verify(heatUtils, times(1)).executeAndRecordOpenstackRequest(mockDeleteStack);
- Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "DELETE_IN_PROGRESS", cloudSiteId, tenantId,
+ true);
Mockito.verify(heatUtils, times(1)).postProcessStackDelete(deletedStack);
}
@@ -357,12 +358,13 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
createStackParam.setStackName("stackName");
doReturn(createdStack).when(heatUtils).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId,
- tenantId);
+ tenantId, false);
doReturn(createdStack).when(heatUtils).postProcessStackCreate(createdStack, true, 120, true, cloudSiteId,
tenantId, createStackParam);
heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
- Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId,
+ false);
Mockito.verify(heatUtils, times(1)).postProcessStackCreate(createdStack, true, 120, true, cloudSiteId, tenantId,
createStackParam);
}
@@ -387,11 +389,12 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
createStackParam.setStackName("stackName");
doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
- "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
exceptionRule.expect(MsoException.class);
exceptionRule.expectMessage("Error");
heatUtils.processCreateStack(cloudSiteId, tenantId, 120, true, stack, createStackParam, true);
- Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId,
+ false);
Mockito.verify(heatUtils, times(1)).postProcessStackCreate(stack, true, 120, true, cloudSiteId, tenantId,
createStackParam);
}
@@ -527,12 +530,13 @@ public class MsoHeatUtilsTest extends MsoHeatUtils {
createStackParam.setStackName("stackName");
doThrow(new StackCreationException("Error")).when(heatUtils).pollStackForStatus(120, stack,
- "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ "CREATE_IN_PROGRESS", cloudSiteId, tenantId, false);
exceptionRule.expect(MsoException.class);
exceptionRule.expectMessage("Error");
heatUtils.processCreateStack(cloudSiteId, tenantId, 120, false, stack, createStackParam, true);
- Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId);
+ Mockito.verify(heatUtils, times(1)).pollStackForStatus(120, stack, "CREATE_IN_PROGRESS", cloudSiteId, tenantId,
+ false);
Mockito.verify(heatUtils, times(0)).handleUnknownCreateStackFailure(stack, 120, cloudSiteId, tenantId);
}
diff --git a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
index 995db522e9..44a9bc3e10 100644
--- a/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
+++ b/adapters/mso-adapter-utils/src/test/java/org/onap/so/openstack/utils/MsoMulticloudUtilsTest.java
@@ -24,8 +24,8 @@ import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
import static com.github.tomakehurst.wiremock.client.WireMock.delete;
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.urlPathEqualTo;
import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
+import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@@ -95,9 +95,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
wireMockServer.stubFor(get(urlEqualTo(MULTICLOUD_GET_PATH)).inScenario("CREATE").whenScenarioStateIs("UPDATING")
.willReturn(aResponse().withHeader("Content-Type", "application/json")
.withBodyFile("MulticloudGetUpdateResponse.json").withStatus(HttpStatus.SC_OK)));
- StackInfo result =
- multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
- "TEST-heat", new HashMap<>(), true, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false);
+ StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack",
+ new VduModelInfo(), "TEST-heat", new HashMap<>(), true, 200, "TEST-env", new HashMap<>(),
+ new HashMap<>(), false, false);
wireMockServer.resetScenarios();
assertNotNull(result);
assertEquals("TEST-stack", result.getName());
@@ -155,7 +155,8 @@ public class MsoMulticloudUtilsTest extends BaseTest {
cloudSite.setIdentityService(new CloudIdentity());
when(cloudConfigMock.getCloudSite("MTN13")).thenReturn(Optional.of(cloudSite));
multicloudUtilsMock.createStack("MNT14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
- "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false);
+ "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false,
+ false);
} catch (MsoException e) {
assertEquals("0 : Multicloud client could not be initialized", e.toString());
return;
@@ -169,7 +170,8 @@ public class MsoMulticloudUtilsTest extends BaseTest {
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(
aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_BAD_REQUEST)));
multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
- "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false);
+ "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false,
+ false);
} catch (MsoException e) {
assertEquals("0 : Bad Request", e.toString());
return;
@@ -181,9 +183,9 @@ public class MsoMulticloudUtilsTest extends BaseTest {
public void createStackEmptyResponseEntity() throws MsoException {
wireMockServer.stubFor(post(urlPathEqualTo(MULTICLOUD_CREATE_PATH)).willReturn(
aResponse().withHeader("Content-Type", "application/json").withStatus(HttpStatus.SC_CREATED)));
- StackInfo result =
- multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack", new VduModelInfo(),
- "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(), new HashMap<>(), false);
+ StackInfo result = multicloudUtils.createStack("MTN14", "CloudOwner", "TEST-tenant", "TEST-stack",
+ new VduModelInfo(), "TEST-heat", new HashMap<>(), false, 200, "TEST-env", new HashMap<>(),
+ new HashMap<>(), false, false);
assertNotNull(result);
assertEquals("TEST-stack/", result.getName());
}
diff --git a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
index a26a551f7d..ea05b64e08 100644
--- a/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
+++ b/adapters/mso-adapter-utils/src/test/resources/__files/OpenstackResponse_Stack_DeleteComplete.json
@@ -3,7 +3,7 @@
"description": null,
"links": null,
"stack_status_reason": null,
- "stack_name": null,
+ "stack_name": "name",
"updated_time": null,
"creation_time": null,
"stack_status": "DELETE_COMPLETE",
diff --git a/adapters/mso-catalog-db-adapter/pom.xml b/adapters/mso-catalog-db-adapter/pom.xml
index 9ec98cf96c..9745935925 100644
--- a/adapters/mso-catalog-db-adapter/pom.xml
+++ b/adapters/mso-catalog-db-adapter/pom.xml
@@ -14,6 +14,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
+ <swagger.version>2.0.8</swagger.version>
</properties>
<build>
<plugins>
@@ -84,40 +85,6 @@
</plugins>
<pluginManagement>
<plugins>
- <!--This plugin's configuration is used to store Eclipse m2e settings
- only. It has no influence on the Maven build itself. -->
- <plugin>
- <groupId>org.eclipse.m2e</groupId>
- <artifactId>lifecycle-mapping</artifactId>
- <version>1.0.0</version>
- <configuration>
- <lifecycleMappingMetadata>
- <pluginExecutions>
- <pluginExecution>
- <pluginExecutionFilter>
- <groupId>
- org.jvnet.jax-ws-commons
- </groupId>
- <artifactId>
- jaxws-maven-plugin
- </artifactId>
- <versionRange>
- [2.3,)
- </versionRange>
- <goals>
- <goal>wsgen</goal>
- </goals>
- </pluginExecutionFilter>
- <action>
- <ignore>
- </ignore>
- </action>
- </pluginExecution>
- </pluginExecutions>
- </lifecycleMappingMetadata>
- </configuration>
- </plugin>
-
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
@@ -143,10 +110,22 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>com.fasterxml.jackson.dataformat</groupId>
+ <artifactId>jackson-dataformat-yaml</artifactId>
+ <version>2.9.9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.5.16</version>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2</artifactId>
+ <version>2.0.6</version>
</dependency>
<dependency>
<groupId>org.mariadb.jdbc</groupId>
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
index aa19aed515..6fb65ca87e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/CatalogDBApplication.java
@@ -28,7 +28,7 @@ import org.springframework.scheduling.annotation.EnableScheduling;
@SpringBootApplication(scanBasePackages = {"org.onap.so.adapters.catalogdb", "org.onap.so.db.catalog.client",
"org.onap.so.logging.jaxrs.filter", "org.onap.so.logging.spring.interceptor", "org.onap.so.client",
- "org.onap.so.configuration", "org.onap.so.db"})
+ "org.onap.so.configuration", "org.onap.so.db", "org.onap.logging.filter"})
@EnableJpaRepositories("org.onap.so.db.catalog.data.repository")
@EntityScan("org.onap.so.db.catalog.beans")
@EnableScheduling
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
index b43447f5c4..359c8cd46e 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/JerseyConfiguration.java
@@ -20,17 +20,25 @@
package org.onap.so.adapters.catalogdb;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import javax.annotation.PostConstruct;
import javax.ws.rs.ApplicationPath;
import org.glassfish.jersey.server.ResourceConfig;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.adapters.catalogdb.rest.CatalogDbAdapterRest;
import org.onap.so.adapters.catalogdb.rest.ServiceRestImpl;
import org.onap.so.adapters.catalogdb.rest.VnfRestImpl;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.context.annotation.Configuration;
-import io.swagger.jaxrs.config.BeanConfig;
-import io.swagger.jaxrs.listing.ApiListingResource;
-import io.swagger.jaxrs.listing.SwaggerSerializers;
+import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder;
+import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource;
+import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
+import io.swagger.v3.oas.integration.OpenApiConfigurationException;
+import io.swagger.v3.oas.integration.SwaggerConfiguration;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Info;
@Configuration
@ApplicationPath("/ecomp/mso/catalog")
@@ -38,19 +46,27 @@ public class JerseyConfiguration extends ResourceConfig {
@PostConstruct
public void setUp() {
+ System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.CATALOG_DB.toString());
register(CatalogDbAdapterRest.class);
- register(ApiListingResource.class);
- register(SwaggerSerializers.class);
- register(JaxRsFilterLogging.class);
+ register(SOAuditLogContainerFilter.class);
+ register(OpenApiResource.class);
+ register(AcceptHeaderOpenApiResource.class);
register(ServiceRestImpl.class);
register(VnfRestImpl.class);
- BeanConfig beanConfig = new BeanConfig();
- beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[] {"https"});
- beanConfig.setBasePath("/ecomp/mso/catalog");
- beanConfig.setResourcePackage("org.onap.so.adapters.catalogdb.rest");
- beanConfig.setPrettyPrint(true);
- beanConfig.setScan(true);
+
+ OpenAPI oas = new OpenAPI();
+ Info info = new Info();
+ info.title("Swagger catalog-db-adapter bootstrap code");
+ info.setVersion("1.0.2");
+
+ SwaggerConfiguration oasConfig = new SwaggerConfiguration().openAPI(oas).prettyPrint(true)
+ .resourcePackages(Stream.of("org.onap.so.adapters.catalogdb.rest").collect(Collectors.toSet()));
+
+ try {
+ new JaxrsOpenApiContextBuilder().application(this).openApiConfiguration(oasConfig).buildContext(true);
+ } catch (OpenApiConfigurationException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
index 4dabb58f7d..cd3b2a377b 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/WebMvcConfig.java
@@ -21,22 +21,32 @@
package org.onap.so.adapters.catalogdb;
-import org.onap.so.logging.spring.interceptor.LoggingInterceptor;
+import org.onap.logging.filter.spring.LoggingInterceptor;
+import org.onap.logging.filter.spring.StatusLoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.MappedInterceptor;
@Configuration
+@ComponentScan(basePackages = {"org.onap.logging.filter"})
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
- LoggingInterceptor loggingInterceptor;
+ private LoggingInterceptor loggingInterceptor;
+
+ @Autowired
+ private StatusLoggingInterceptor statusLoggingInterceptor;
@Bean
public MappedInterceptor mappedLoggingInterceptor() {
return new MappedInterceptor(new String[] {"/**"}, loggingInterceptor);
}
+ @Bean
+ public MappedInterceptor mappedStatusLoggingInterceptor() {
+ return new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor);
+ }
}
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
index 6f556edfa1..bc4d0064d0 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/ServiceRestImpl.java
@@ -34,11 +34,17 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import com.google.common.base.Strings;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
-@Api(value = "/v1", tags = "model")
+
+@OpenAPIDefinition(info = @Info(title = "/v1", description = "model"))
@Path("/v1/services")
@Component
public class ServiceRestImpl {
@@ -63,14 +69,15 @@ public class ServiceRestImpl {
}
@GET
- @ApiOperation(value = "Find Service Models", response = Service.class, responseContainer = "List")
+ @Operation(description = "Find Service Models", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Service.class)))))
@Produces({MediaType.APPLICATION_JSON})
@Transactional(readOnly = true)
public List<Service> queryServices(
- @ApiParam(value = "modelName", required = false) @QueryParam("modelName") String modelName,
- @ApiParam(value = "distributionStatus",
+ @Parameter(description = "modelName", required = false) @QueryParam("modelName") String modelName,
+ @Parameter(description = "distributionStatus",
required = false) @QueryParam("distributionStatus") String distributionStatus,
- @ApiParam(value = "depth", required = false) @QueryParam("depth") int depth) {
+ @Parameter(description = "depth", required = false) @QueryParam("depth") int depth) {
List<Service> services = new ArrayList<>();
List<org.onap.so.db.catalog.beans.Service> serviceFromDB = new ArrayList<>();
if (!Strings.isNullOrEmpty(modelName) && !Strings.isNullOrEmpty(distributionStatus)) {
diff --git a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
index 4353526872..9202fd21d4 100644
--- a/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
+++ b/adapters/mso-catalog-db-adapter/src/main/java/org/onap/so/adapters/catalogdb/rest/VnfRestImpl.java
@@ -34,14 +34,20 @@ import javax.ws.rs.core.Response;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.VnfCustomizationRepository;
+import org.onap.so.rest.catalog.beans.Service;
import org.onap.so.rest.catalog.beans.Vnf;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
-@Api(value = "/v1/services/{modelUUID}/vnfs", tags = "model")
+@OpenAPIDefinition(info = @Info(title = "/v1/services/{modelUUID}/vnfs", description = "model"))
@Path("/v1/services/{modelUUID}/vnfs")
@Component
public class VnfRestImpl {
@@ -59,7 +65,8 @@ public class VnfRestImpl {
private VnfCustomizationRepository vnfCustRepo;
@GET
- @ApiOperation(value = "Find a VNF model contained within a service", response = Vnf.class)
+ @Operation(description = "Find a VNF model contained within a service", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Vnf.class)))))
@Path("/{modelCustomizationUUID}")
@Produces({MediaType.APPLICATION_JSON})
@Transactional(readOnly = true)
@@ -72,7 +79,7 @@ public class VnfRestImpl {
List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
.filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
.collect(Collectors.toList());
- if (vnfCustom.isEmpty() || vnfCustom == null) {
+ if (vnfCustom.isEmpty()) {
return null;
} else if (vnfCustom.size() > 1) {
throw new RuntimeException(
@@ -82,7 +89,8 @@ public class VnfRestImpl {
}
@PUT
- @ApiOperation(value = "Update a VNF model contained within a service", response = Vnf.class)
+ @Operation(description = "Update a VNF model contained within a service", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Vnf.class)))))
@Path("/{modelCustomizationUUID}")
@Produces({MediaType.APPLICATION_JSON})
@Transactional
@@ -92,7 +100,7 @@ public class VnfRestImpl {
List<VnfResourceCustomization> vnfCustom = service.getVnfCustomizations().stream()
.filter(vnfCust -> vnfCust.getModelCustomizationUUID().equals(modelCustomizationUUID))
.collect(Collectors.toList());
- if (vnfCustom.isEmpty() || vnfCustom == null) {
+ if (vnfCustom.isEmpty()) {
throw new RuntimeException("No Vnf Found");
} else if (vnfCustom.size() > 1) {
throw new RuntimeException(
diff --git a/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql
new file mode 100644
index 0000000000..30b5010c7c
--- /dev/null
+++ b/adapters/mso-catalog-db-adapter/src/main/resources/db/migration/V7.0__AddActivatedForOrchestrationStatus.sql
@@ -0,0 +1,47 @@
+INSERT INTO orchestration_status_state_transition_directive(RESOURCE_TYPE, ORCHESTRATION_STATUS, TARGET_ACTION, FLOW_DIRECTIVE)
+VALUES
+
+('CONFIGURATION', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('CONFIGURATION', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('CONFIGURATION', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('CONFIGURATION', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+
+('NETWORK', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('NETWORK', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('NETWORK', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('NETWORK', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('NETWORK', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'),
+('NETWORK', 'ACTIVATED', 'DELETE', 'FAIL'),
+('NETWORK', 'ACTIVATED', 'UPDATE', 'CONTINUE'),
+('NETWORK_COLLECTION', 'ACTIVATED', 'CREATE', 'FAIL'),
+('NETWORK_COLLECTION', 'ACTIVATED', 'DELETE', 'CONTINUE'),
+('NETWORK_COLLECTION', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+
+('NO_VALIDATE', 'ACTIVATED', 'CUSTOM', 'CONTINUE'),
+
+('SERVICE', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('SERVICE', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('SERVICE', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('SERVICE', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('SERVICE', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'),
+
+('VF_MODULE', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('VF_MODULE', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('VF_MODULE', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('VF_MODULE', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('VF_MODULE', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'),
+('VF_MODULE', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'),
+('VF_MODULE', 'ACTIVATED', 'DELETE', 'FAIL'),
+
+('VNF', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('VNF', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('VNF', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('VNF', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('VNF', 'ACTIVATED', 'CHANGE_MODEL', 'CONTINUE'),
+
+('VOLUME_GROUP', 'ACTIVATED', 'ASSIGN', 'SILENT_SUCCESS'),
+('VOLUME_GROUP', 'ACTIVATED', 'UNASSIGN', 'FAIL'),
+('VOLUME_GROUP', 'ACTIVATED', 'ACTIVATE', 'SILENT_SUCCESS'),
+('VOLUME_GROUP', 'ACTIVATED', 'DEACTIVATE', 'CONTINUE'),
+('VOLUME_GROUP', 'ACTIVATED', 'CREATE', 'SILENT_SUCCESS'),
+('VOLUME_GROUP', 'ACTIVATED', 'DELETE', 'FAIL'); \ No newline at end of file
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
index 145ba50583..e1cca8901e 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/adapters/catalogdb/catalogrest/CatalogDBRestTest.java
@@ -22,13 +22,13 @@ package org.onap.so.adapters.catalogdb.catalogrest;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
-import static org.onap.so.logger.MdcConstants.ENDTIME;
-import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
-import static org.onap.so.logger.MdcConstants.PARTNERNAME;
-import static org.onap.so.logger.MdcConstants.RESPONSECODE;
-import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
-import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
-import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME;
import java.io.IOException;
import java.util.Map;
import javax.ws.rs.core.MediaType;
@@ -815,27 +815,27 @@ public class CatalogDBRestTest extends CatalogDbAdapterBaseTest {
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
assertEquals("v2/vfModules", mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(STATUSCODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker().getName().equals("EXIT")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
+ assertNotNull(mdc.get(LOG_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("500", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("500", mdc.get(RESPONSE_CODE));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
assertEquals("v2/vfModules", mdc.get(SERVICE_NAME));
- assertEquals("ERROR", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
+ assertEquals("ERROR", mdc.get(RESPONSE_STATUS_CODE));
+ assertNotNull(mdc.get(RESPONSE_DESCRIPTION));
}
}
diff --git a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
index f82c7acd38..707a2a45af 100644
--- a/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
+++ b/adapters/mso-catalog-db-adapter/src/test/java/org/onap/so/db/catalog/client/CatalogDbClientTest.java
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.client;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
@@ -733,4 +734,12 @@ public class CatalogDbClientTest extends CatalogDbAdapterBaseTest {
assertNull(workflow);
}
+ @Test
+ public void getCloudSites() {
+ List<CloudSite> cloudSites = client.getCloudSites();
+ assertNotNull(cloudSites);
+ assertNotEquals(0, cloudSites.size());
+ }
+
+
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
index 8edce124ec..0c05df959f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AbstractAuditService.java
@@ -22,19 +22,18 @@
package org.onap.so.adapters.audit;
import java.util.Optional;
-import org.camunda.bpm.client.task.ExternalTask;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.ExternalTaskUtils;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public abstract class AbstractAuditService {
+public abstract class AbstractAuditService extends ExternalTaskUtils {
private static final Logger logger = LoggerFactory.getLogger(AbstractAuditService.class);
@@ -81,23 +80,4 @@ public abstract class AbstractAuditService {
return false;
}
}
-
- protected String[] getRetrySequence() {
- return env.getProperty("mso.workflow.topics.retrySequence", String[].class);
- }
-
- protected void setupMDC(ExternalTask externalTask) {
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty()) {
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
- }
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
- }
-
- protected long calculateRetryDelay(int currentRetries) {
- int retrySequence = getRetrySequence().length - currentRetries;
- long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000"));
- return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier;
- }
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
index 1e5b6de857..54ffc597f4 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditCreateStackService.java
@@ -30,11 +30,11 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
@@ -46,16 +46,16 @@ public class AuditCreateStackService extends AbstractAuditService {
public HeatStackAudit heatStackAudit;
@Autowired
- public Environment environment;
+ private AuditMDCSetup mdcSetup;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
boolean success = false;
try {
- logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory,
- externalTask.getRetries());
+ Integer retryCount = externalTask.getRetries();
+ logger.info("Executing External Task Audit Inventory, Retry Number: {} \n {}", auditInventory, retryCount);
Optional<AAIObjectAuditList> auditListOpt = heatStackAudit.auditHeatStack(auditInventory.getCloudRegion(),
auditInventory.getCloudOwner(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditListOpt.isPresent()) {
@@ -69,29 +69,35 @@ public class AuditCreateStackService extends AbstractAuditService {
logger.error("Error during audit of stack", e);
}
variables.put("auditIsSuccessful", success);
+ mdcSetup.setElapsedTime();
+ String externalTaskId = externalTask.getId();
if (success) {
externalTaskService.complete(externalTask, variables);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
- if (externalTask.getRetries() == null) {
+ Integer retryCount = externalTask.getRetries();
+ if (retryCount == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.complete(externalTask, variables);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1,
+ calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed", externalTaskId);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
index 0aa4f9bdc3..9a4f154347 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditDeleteStackService.java
@@ -28,6 +28,7 @@ import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -44,6 +45,9 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
+ private AuditMDCSetup mdcSetup;
+
+ @Autowired
protected AuditVServer auditVservers;
@Autowired
@@ -53,12 +57,13 @@ public class AuditDeleteStackService extends AbstractAuditService {
protected Environment env;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
Map<String, Object> variables = new HashMap<>();
boolean success = false;
try {
- logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", externalTask.getRetries());
+ Integer retryCount = externalTask.getRetries();
+ logger.info("Executing External Task Delete Audit Inventory. Retry Number: {}", retryCount);
Optional<AAIObjectAuditList> auditListOpt = auditDataService.getStackDataFromRequestDb(auditInventory);
if (auditListOpt.isPresent()) {
auditVservers.auditVservers(auditListOpt.get());
@@ -77,29 +82,35 @@ public class AuditDeleteStackService extends AbstractAuditService {
logger.error("Error during audit of stack", e);
}
variables.put("auditIsSuccessful", success);
+ mdcSetup.setElapsedTime();
+ String externalTaskId = externalTask.getId();
if (success) {
externalTaskService.complete(externalTask, variables);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
- if (externalTask.getRetries() == null) {
+ Integer retryCount = externalTask.getRetries();
+ if (retryCount == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.complete(externalTask, variables);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI,
- UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_FIND_ALL_V_SERVERS_AND_L_INTERACES_IN_A_AI, retryCount - 1,
+ calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed", externalTaskId);
}
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
index 2ef7d5b325..dc672ff017 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditQueryStackService.java
@@ -7,6 +7,7 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -22,47 +23,56 @@ public class AuditQueryStackService extends AbstractAuditService {
protected HeatStackAudit heatStackAudit;
@Autowired
+ private AuditMDCSetup mdcSetup;
+
+ @Autowired
protected AuditDataService auditDataService;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
AuditInventory auditInventory = externalTask.getVariable("auditInventory");
boolean success = false;
Map<String, Object> variables = new HashMap<>();
try {
+ Integer retryCount = externalTask.getRetries();
logger.info("Executing External Task Query Audit Inventory. Audit Inventory: {} \n Retry Number: {}",
- auditInventory.toString(), externalTask.getRetries());
+ auditInventory.toString(), retryCount);
Optional<AAIObjectAuditList> auditList = heatStackAudit.queryHeatStack(auditInventory.getCloudOwner(),
auditInventory.getCloudRegion(), auditInventory.getTenantId(), auditInventory.getHeatStackName());
if (auditList.isPresent()) {
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
success = true;
auditDataService.writeStackDataToRequestDb(auditInventory, auditList.get());
}
+ mdcSetup.setElapsedTime();
+ String externalTaskId = externalTask.getId();
if (success) {
externalTaskService.complete(externalTask, variables);
- logger.debug("The External Task {} was Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task {} was Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
- if (externalTask.getRetries() == null) {
+ if (retryCount == null) {
logger.debug("The External Task {} Failed. Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task {} Failed. All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.complete(externalTask, variables);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task {} Failed. All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else {
logger.debug("The External Task {} Failed. Decrementing Retries to {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK,
- UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_FIND_V_SERVERS_IN_OPENSTACK, retryCount - 1, calculateRetryDelay(retryCount));
}
- logger.debug("The External Task {} Failed", externalTask.getId());
+ logger.debug("The External Task {} Failed", externalTaskId);
}
} catch (Exception e) {
logger.error("Error during audit query of stack", e);
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
index 6a42456715..fb7e925d88 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/audit/AuditStackService.java
@@ -20,13 +20,9 @@
package org.onap.so.adapters.audit;
-import java.security.GeneralSecurityException;
import javax.annotation.PostConstruct;
import org.camunda.bpm.client.ExternalTaskClient;
-import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy;
-import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
-import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
-import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.ExternalTaskServiceUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,10 +52,13 @@ public class AuditStackService {
@Autowired
private AuditQueryStackService auditQueryStack;
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
@PostConstruct
- public void auditAddAAIInventory() {
- for (int i = 0; i < getMaxClients(); i++) {
- ExternalTaskClient client = createExternalTaskClient();
+ public void auditAddAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryAddAudit")
.lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditCreateStack::executeExternalTask).open();
@@ -67,9 +66,9 @@ public class AuditStackService {
}
@PostConstruct
- public void auditDeleteAAIInventory() {
- for (int i = 0; i < getMaxClients(); i++) {
- ExternalTaskClient client = createExternalTaskClient();
+ public void auditDeleteAAIInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryDeleteAudit")
.lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditDeleteStack::executeExternalTask).open();
@@ -77,35 +76,13 @@ public class AuditStackService {
}
@PostConstruct
- public void auditQueryInventory() {
- for (int i = 0; i < getMaxClients(); i++) {
- ExternalTaskClient client = createExternalTaskClient();
+ public void auditQueryInventory() throws Exception {
+ for (int i = 0; i < externalTaskServiceUtils.getMaxClients(); i++) {
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryQueryAudit")
.lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", DEFAULT_AUDIT_LOCK_TIME)))
.handler(auditQueryStack::executeExternalTask).open();
}
}
- protected ExternalTaskClient createExternalTaskClient() {
- ClientRequestInterceptor interceptor = createClientRequestInterceptor();
- return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
- .addInterceptor(interceptor).asyncResponseTimeout(120000)
- .backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
- }
-
- protected ClientRequestInterceptor createClientRequestInterceptor() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
- }
- return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- }
-
- protected int getMaxClients() {
- return Integer.parseInt(env.getProperty("workflow.topics.maxClients", DEFAULT_MAX_CLIENTS_FOR_TOPIC));
- }
-
-
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
index 49a9e7e171..c1cc7428ee 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryService.java
@@ -20,13 +20,9 @@
package org.onap.so.adapters.inventory.create;
-import java.security.GeneralSecurityException;
import javax.annotation.PostConstruct;
import org.camunda.bpm.client.ExternalTaskClient;
-import org.camunda.bpm.client.backoff.ExponentialBackoffStrategy;
-import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
-import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
-import org.onap.so.utils.CryptoUtils;
+import org.onap.so.utils.ExternalTaskServiceUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -46,19 +42,13 @@ public class CreateInventoryService {
@Autowired
private CreateInventoryTask createInventory;
+ @Autowired
+ private ExternalTaskServiceUtils externalTaskServiceUtils;
+
@PostConstruct
- public void auditAAIInventory() {
- String auth = "";
- try {
- auth = CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
- } catch (IllegalStateException | GeneralSecurityException e) {
- logger.error("Error Decrypting Password", e);
- }
- ClientRequestInterceptor interceptor =
- new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
- ExternalTaskClient client = ExternalTaskClient.create()
- .baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1).addInterceptor(interceptor)
- .asyncResponseTimeout(120000).backoffStrategy(new ExponentialBackoffStrategy(0, 0, 0)).build();
+ public void auditAAIInventory() throws Exception {
+
+ ExternalTaskClient client = externalTaskServiceUtils.createExternalTaskClient();
client.subscribe("InventoryCreate")
.lockDuration(Long.parseLong(env.getProperty("mso.audit.lock-time", "60000")))
.handler(createInventory::executeExternalTask).open();
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
index a6c61704ad..3d2d1d2aa3 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/inventory/create/CreateInventoryTask.java
@@ -26,16 +26,16 @@ import org.camunda.bpm.client.task.ExternalTask;
import org.camunda.bpm.client.task.ExternalTaskService;
import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
+import org.onap.so.utils.ExternalTaskUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
-public class CreateInventoryTask {
+public class CreateInventoryTask extends ExternalTaskUtils {
private static final String UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI = "Unable to write all inventory to A&AI";
@@ -47,24 +47,28 @@ public class CreateInventoryTask {
CreateAAIInventory createInventory;
@Autowired
- public Environment env;
+ private AuditMDCSetup mdcSetup;
protected void executeExternalTask(ExternalTask externalTask, ExternalTaskService externalTaskService) {
- setupMDC(externalTask);
+ mdcSetup.setupMDC(externalTask);
boolean success = true;
boolean inventoryException = false;
String auditInventoryString = externalTask.getVariable("auditInventoryResult");
AAIObjectAuditList auditInventory = null;
+ String externalTaskId = externalTask.getId();
try {
GraphInventoryCommonObjectMapperProvider objectMapper = new GraphInventoryCommonObjectMapperProvider();
auditInventory = objectMapper.getMapper().readValue(auditInventoryString, AAIObjectAuditList.class);
} catch (Exception e) {
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
logger.error("Error Parsing Audit Results", e);
}
+ mdcSetup.setElapsedTime();
if (auditInventory != null) {
+ Integer retryCount = externalTask.getRetries();
try {
logger.info("Executing External Task Create Inventory, Retry Number: {} \n {}", auditInventory,
- externalTask.getRetries());
+ retryCount);
createInventory.createInventory(auditInventory);
} catch (InventoryException e) {
logger.error("Error during inventory of stack", e);
@@ -74,58 +78,39 @@ public class CreateInventoryTask {
logger.error("Error during inventory of stack", e);
success = false;
}
+ mdcSetup.setElapsedTime();
if (success) {
externalTaskService.complete(externalTask);
- logger.debug("The External Task Id: {} Successful", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.COMPLETE.toString());
+ logger.debug("The External Task Id: {} Successful", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
+ mdcSetup.clearClientMDCs();
} else if (inventoryException) {
- logger.debug("The External Task Id: {} Failed, Retry not needed", externalTask.getId());
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, Retry not needed", externalTaskId);
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
} else {
- if (externalTask.getRetries() == null) {
+ if (retryCount == null) {
logger.debug("The External Task Id: {} Failed, Setting Retries to Default Start Value: {}",
- externalTask.getId(), getRetrySequence().length);
+ externalTaskId, getRetrySequence().length);
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, getRetrySequence().length, 10000);
- } else if (externalTask.getRetries() != null && externalTask.getRetries() - 1 == 0) {
- logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTask.getId());
+ } else if (retryCount != null && retryCount - 1 == 0) {
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.ERROR.toString());
+ logger.debug("The External Task Id: {} Failed, All Retries Exhausted", externalTaskId);
logger.info(ONAPLogConstants.Markers.EXIT, "Exiting");
} else {
logger.debug("The External Task Id: {} Failed, Decrementing Retries: {} , Retry Delay: ",
- externalTask.getId(), externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ externalTaskId, retryCount - 1, calculateRetryDelay(retryCount));
externalTaskService.handleFailure(externalTask, UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI,
- UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, externalTask.getRetries() - 1,
- calculateRetryDelay(externalTask.getRetries()));
+ UNABLE_TO_WRITE_ALL_INVENTORY_TO_A_AI, retryCount - 1, calculateRetryDelay(retryCount));
}
- logger.debug("The External Task Id: {} Failed", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed", externalTaskId);
}
} else {
- logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTask.getId());
+ logger.debug("The External Task Id: {} Failed, No Audit Results Written", externalTaskId);
externalTaskService.handleBpmnError(externalTask, AAI_INVENTORY_FAILURE);
}
}
-
- private void setupMDC(ExternalTask externalTask) {
- try {
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
- String msoRequestId = externalTask.getVariable("mso-request-id");
- if (msoRequestId != null && !msoRequestId.isEmpty())
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
- } catch (Exception e) {
- logger.error("Error in setting up MDC", e);
- }
- }
-
- protected long calculateRetryDelay(int currentRetries) {
- int retrySequence = getRetrySequence().length - currentRetries;
- long retryMultiplier = Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000"));
- return Integer.parseInt(getRetrySequence()[retrySequence]) * retryMultiplier;
- }
-
- public String[] getRetrySequence() {
- return env.getProperty("mso.workflow.topics.retrySequence", String[].class);
- }
}
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
index 013c7f8a84..52b97da61a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterImpl.java
@@ -24,8 +24,6 @@
package org.onap.so.adapters.network;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -33,7 +31,6 @@ import java.util.Map;
import java.util.Optional;
import javax.jws.WebService;
import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
import org.onap.so.adapters.network.beans.ContrailPolicyRef;
import org.onap.so.adapters.network.beans.ContrailPolicyRefSeq;
import org.onap.so.adapters.network.beans.ContrailSubnet;
@@ -51,6 +48,7 @@ import org.onap.so.db.catalog.data.repository.NetworkResourceRepository;
import org.onap.so.db.catalog.utils.MavenLikeVersioning;
import org.onap.so.entity.MsoRequest;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.NetworkInfo;
@@ -74,6 +72,8 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
@Transactional
@@ -427,7 +427,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
if (backout == null)
backout = true;
heatStack = heat.createStack(cloudSiteId, CLOUD_OWNER, tenantId, networkName, null, template,
- stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue());
+ stackParams, true, heatTemplate.getTimeoutMinutes(), null, null, null, backout.booleanValue(),
+ failIfExists);
} catch (MsoException me) {
me.addContext(CREATE_NETWORK_CONTEXT);
logger.error("{} {} Exception creating network type {} in {}/{} ", MessageEnum.RA_CREATE_NETWORK_EXC,
@@ -1015,13 +1016,7 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
@Override
public void deleteNetwork(String cloudSiteId, String tenantId, String networkType, String modelCustomizationUuid,
String networkId, MsoRequest msoRequest, Holder<Boolean> networkDeleted) throws NetworkException {
-
logger.debug("*** DELETE Network adapter with Network: {} in {}/{}", networkId, cloudSiteId, tenantId);
-
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
-
-
if (commonUtils.isNullOrEmpty(cloudSiteId) || commonUtils.isNullOrEmpty(tenantId)
|| commonUtils.isNullOrEmpty(networkId)) {
String error = "Missing mandatory parameter cloudSiteId, tenantId or networkId";
@@ -1043,20 +1038,15 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
networkResource = nrc.getNetworkResource();
}
}
+
String mode = "";
if (networkResource != null) {
- logger.debug(LOG_DEBUG_MSG, networkResource);
-
+ logger.debug(LOG_DEBUG_MSG, networkResource.toString());
mode = networkResource.getOrchestrationMode();
}
if (NEUTRON_MODE.equals(mode)) {
-
- // Use MsoNeutronUtils for all NEUTRON commands
- long deleteNetworkStarttime = System.currentTimeMillis();
try {
- // The deleteNetwork function in MsoNeutronUtils returns success if the network
- // was not found. So don't bother to query first.
boolean deleted = neutron.deleteNetwork(networkId, tenantId, cloudSiteId);
networkDeleted.value = deleted;
} catch (MsoException me) {
@@ -1065,21 +1055,10 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
ErrorCode.DataError.getValue(), networkId, cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
- } else { // DEFAULT to ("HEAT".equals (mode))
- long deleteStackStarttime = System.currentTimeMillis();
-
+ } else {
try {
- // The deleteStack function in MsoHeatUtils returns NOTFOUND if the stack was not found or if the stack
- // was deleted.
- // So query first to report back if stack WAS deleted or just NOTOFUND
- StackInfo heatStack = null;
- heatStack = heat.queryStack(cloudSiteId, CLOUD_OWNER, tenantId, networkId);
- if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
- networkDeleted.value = true;
- } else {
- networkDeleted.value = false;
- }
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, 120);
+ networkDeleted.value = true;
} catch (MsoException me) {
me.addContext("DeleteNetwork");
logger.error("{} {} Delete Network (heat): {} in {}/{} ", MessageEnum.RA_DELETE_NETWORK_EXC,
@@ -1087,10 +1066,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
throw new NetworkException(me);
}
}
-
-
- // On success, nothing is returned.
- return;
}
/**
@@ -1103,9 +1078,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
*/
@Override
public void rollbackNetwork(NetworkRollback rollback) throws NetworkException {
- // Will capture execution time for metrics
- long startTime = System.currentTimeMillis();
-
if (rollback == null) {
logger.error("{} {} rollback is null", MessageEnum.RA_ROLLBACK_NULL, ErrorCode.DataError.getValue());
return;
@@ -1119,8 +1091,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
String modelCustomizationUuid = rollback.getModelCustomizationUuid();
logger.debug("*** ROLLBACK Network {} in {}/{}", networkId, cloudSiteId, tenantId);
-
-
// Retrieve the Network Resource definition
NetworkResource networkResource = null;
if (commonUtils.isNullOrEmpty(modelCustomizationUuid)) {
@@ -1138,13 +1108,8 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
if (rollback.getNetworkCreated()) {
- // Rolling back a newly created network, so delete it.
if (NEUTRON_MODE.equals(mode)) {
- // Use MsoNeutronUtils for all NEUTRON commands
- long deleteNetworkStarttime = System.currentTimeMillis();
try {
- // The deleteNetwork function in MsoNeutronUtils returns success if the network
- // was not found. So don't bother to query first.
neutron.deleteNetwork(networkId, tenantId, cloudSiteId);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
@@ -1153,12 +1118,9 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
cloudSiteId, tenantId, me);
throw new NetworkException(me);
}
- } else { // DEFAULT to if ("HEAT".equals (mode))
- long deleteStackStarttime = System.currentTimeMillis();
+ } else {
try {
- // The deleteStack function in MsoHeatUtils returns success if the stack
- // was not found. So don't bother to query first.
- heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true);
+ heat.deleteStack(tenantId, CLOUD_OWNER, cloudSiteId, networkId, true, 120);
} catch (MsoException me) {
me.addContext("RollbackNetwork");
logger.error("{} {} Exception - Rollback Network (heat): {} in {}/{} ",
@@ -1168,8 +1130,6 @@ public class MsoNetworkAdapterImpl implements MsoNetworkAdapter {
}
}
}
-
- return;
}
private String validateNetworkParams(NetworkType neutronNetworkType, String networkName, String physicalNetwork,
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
index 436836491d..d9a83e6a9a 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/openstack/MsoOpenstackAdaptersApplication.java
@@ -21,7 +21,7 @@
package org.onap.so.adapters.openstack;
import java.util.concurrent.Executor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
index af2fa24ff9..2c78e593a1 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterImpl.java
@@ -36,7 +36,6 @@ import java.util.Optional;
import java.util.concurrent.TimeUnit;
import javax.jws.WebService;
import javax.xml.ws.Holder;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.commons.collections.CollectionUtils;
import org.onap.so.adapters.valet.GenericValetResponse;
import org.onap.so.adapters.valet.ValetClient;
@@ -47,7 +46,6 @@ import org.onap.so.adapters.valet.beans.ValetDeleteResponse;
import org.onap.so.adapters.valet.beans.ValetRollbackResponse;
import org.onap.so.adapters.valet.beans.ValetStatus;
import org.onap.so.adapters.valet.beans.ValetUpdateResponse;
-import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
import org.onap.so.client.aai.AAIResourcesClient;
@@ -68,6 +66,7 @@ import org.onap.so.entity.MsoRequest;
import org.onap.so.heatbridge.HeatBridgeApi;
import org.onap.so.heatbridge.HeatBridgeImpl;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.openstack.beans.HeatStatus;
import org.onap.so.openstack.beans.StackInfo;
@@ -80,6 +79,10 @@ import org.onap.so.openstack.exceptions.MsoHeatNotFoundException;
import org.onap.so.openstack.utils.MsoHeatEnvironmentEntry;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.onap.so.openstack.utils.MsoHeatUtilsWithUpdate;
+import org.openstack4j.model.compute.Flavor;
+import org.openstack4j.model.compute.Image;
+import org.openstack4j.model.compute.Server;
+import org.openstack4j.model.heat.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -89,10 +92,6 @@ import org.springframework.transaction.annotation.Transactional;
import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.openstack4j.model.compute.Flavor;
-import org.openstack4j.model.compute.Image;
-import org.openstack4j.model.compute.Server;
-import org.openstack4j.model.heat.Resource;
@WebService(serviceName = "VnfAdapter", endpointInterface = "org.onap.so.adapters.vnf.MsoVnfAdapter",
targetNamespace = "http://org.onap.so/vnf")
@@ -133,7 +132,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Autowired
private MsoHeatUtilsWithUpdate heatU;
@Autowired
- private MsoHeatUtils heat;
+ private MsoHeatUtils msoHeatUtils;
@Autowired
private ValetClient vci;
@@ -264,7 +263,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo heatStack;
try {
- heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
+ heatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
me.addContext("QueryVNF");
// Failed to query the Stack due to an openstack exception.
@@ -317,7 +316,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Deleting VNF {} in {}", vnfName, cloudSiteId + "/" + tenantId);
try {
- heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118);
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
@@ -360,7 +359,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// of NOTFOUND (on success) or FAILED (on error). Also, MsoOpenstackException
// could be thrown.
try {
- heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfId, true);
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfId, true, 118);
} catch (MsoException me) {
// Failed to rollback the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -638,96 +637,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
callHeatbridge(baseVfHeatStackId);
}
- StackInfo heatStack = null;
- try {
- if (heat != null) {
- heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
- } else {
- throw new MsoHeatNotFoundException();
- }
- } catch (MsoException me) {
- String error = "Create VF Module: Query " + vfModuleName + " in " + cloudOwner + "/" + cloudSiteId + "/"
- + tenantId + ": " + me;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_QUERY_VNF_ERR.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
- "Exception - " + QUERY_STACK, me);
- logger.debug(error);
- // Failed to query the Stack due to an openstack exception.
- // Convert to a generic VnfException
- me.addContext(CREATE_VFM_MODULE);
- throw new VnfException(me);
- }
- // more precise handling/messaging if the stack already exists
- if (heatStack != null && heatStack.getStatus() != HeatStatus.NOTFOUND) {
- // INIT, CREATED, NOTFOUND, FAILED, BUILDING, DELETING, UNKNOWN, UPDATING, UPDATED
- HeatStatus status = heatStack.getStatus();
- if (status == HeatStatus.INIT || status == HeatStatus.BUILDING || status == HeatStatus.DELETING
- || status == HeatStatus.UPDATING) {
- // fail - it's in progress - return meaningful error
- String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and has status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; please wait for it to complete, or fix manually.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
- STACK + " " + vfModuleName + " already exists");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
- heatStack.getCanonicalName());
- }
- if (status == HeatStatus.FAILED) {
- // fail - it exists and is in a FAILED state
- String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and is in FAILED state in "
- + cloudOwner + "/" + cloudSiteId + "/" + tenantId + "; requires manual intervention.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
- STACK + " " + vfModuleName + " already exists and is " + "in FAILED state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
- heatStack.getCanonicalName());
- }
- if (status == HeatStatus.UNKNOWN || status == HeatStatus.UPDATED) {
- // fail - it exists and is in a FAILED state
- String error = CREATE_VF_STACK + " " + vfModuleName + " already exists and has status "
- + status.toString() + " in " + cloudOwner + "/" + cloudSiteId + "/" + tenantId
- + "; requires manual intervention.";
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName, cloudOwner,
- cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
- STACK + " " + vfModuleName + " already exists and is " + "in UPDATED or UNKNOWN state");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
- heatStack.getCanonicalName());
- }
- if (status == HeatStatus.CREATED) {
- // fail - it exists
- if (failIfExists != null && failIfExists) {
- String error = CREATE_VF_STACK + " " + vfModuleName + " already exists in " + cloudOwner + "/"
- + cloudSiteId + "/" + tenantId;
- logger.error(LoggingAnchor.NINE, MessageEnum.RA_VNF_ALREADY_EXIST.toString(), vfModuleName,
- cloudOwner, cloudSiteId, tenantId, OPENSTACK, QUERY_STACK, ErrorCode.DataError.getValue(),
- STACK + " " + vfModuleName + " already exists");
- logger.debug(error);
- throw new VnfAlreadyExists(vfModuleName, cloudOwner, cloudSiteId, tenantId,
- heatStack.getCanonicalName());
- } else {
- logger.debug("Found Existing stack, status={}", heatStack.getStatus());
- // Populate the outputs from the existing stack.
- vnfId.value = heatStack.getCanonicalName();
- outputs.value = copyStringOutputs(heatStack.getOutputs());
- rollback.value = vfRollback; // Default rollback - no updates performed
- }
- }
- return;
-
- }
-
// handle a nestedStackId if sent- this one would be for the volume - so applies to both Vf and Vnf
StackInfo nestedHeatStack = null;
-
Map<String, Object> nestedVolumeOutputs = null;
if (nestedStackId != null) {
try {
logger.debug("Querying for nestedStackId = {}", nestedStackId);
- nestedHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId);
+ nestedHeatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -761,7 +677,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (nestedBaseStackId != null) {
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
- nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
+ nestedBaseHeatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -790,7 +706,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- // Retrieve the VF
VfModule vf = null;
VnfResource vnfResource = null;
VfModuleCustomization vfmc = null;
@@ -985,7 +900,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.debug("Contents of nestedTemplates - to be added to files: on stack:");
for (HeatTemplate entry : nestedTemplates) {
nestedTemplatesChecked.put(entry.getTemplateName(), entry.getTemplateBody());
- logger.debug(entry.getTemplateName() + " -> " + entry.getTemplateBody());
+ logger.debug("Adding Nested Template", entry.getTemplateName());
}
} else {
logger.debug("No nested templates found - nothing to do here");
@@ -1107,13 +1022,13 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Step 1 - convert what we got as inputs (Map<String, String>) to a
// Map<String, Object> - where the object matches the param type identified in the template
// This will also not copy over params that aren't identified in the template
- goldenInputs = heat.convertInputMap(inputs, heatTemplate);
+ goldenInputs = msoHeatUtils.convertInputMap(inputs, heatTemplate);
// Step 2 - now simply add the outputs as we received them - no need to convert to string
logger.debug("Now add in the base stack outputs if applicable");
- heat.copyBaseOutputsToInputs(goldenInputs, baseStackOutputs, parameterNames, aliasToParam);
+ msoHeatUtils.copyBaseOutputsToInputs(goldenInputs, baseStackOutputs, parameterNames, aliasToParam);
// Step 3 - add the volume inputs if any
logger.debug("Now add in the volume stack outputs if applicable");
- heat.copyBaseOutputsToInputs(goldenInputs, nestedVolumeOutputs, parameterNames, aliasToParam);
+ msoHeatUtils.copyBaseOutputsToInputs(goldenInputs, nestedVolumeOutputs, parameterNames, aliasToParam);
for (HeatTemplateParam parm : heatTemplate.getParameters()) {
logger.debug("Parameter:'" + parm.getParamName() + "', isRequired=" + parm.isRequired() + ", alias="
@@ -1186,15 +1101,16 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
// Have the tenant. Now deploy the stack itself
// Ignore MsoTenantNotFound and MsoStackAlreadyExists exceptions
// because we already checked for those.
+
+ StackInfo heatStack = null;
try {
if (backout == null) {
backout = true;
}
- if (heat != null) {
-
- heatStack = heat.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null, template,
- goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
- nestedTemplatesChecked, heatFilesObjects, backout.booleanValue());
+ if (msoHeatUtils != null) {
+ heatStack = msoHeatUtils.createStack(cloudSiteId, cloudOwner, tenantId, vfModuleName, null,
+ template, goldenInputs, true, heatTemplate.getTimeoutMinutes(), newEnvironmentString,
+ nestedTemplatesChecked, heatFilesObjects, backout.booleanValue(), failIfExists);
} else {
throw new MsoHeatNotFoundException();
}
@@ -1251,15 +1167,9 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
@Override
public void deleteVfModule(String cloudSiteId, String cloudOwner, String tenantId, String vnfName,
MsoRequest msoRequest, Holder<Map<String, String>> outputs) throws VnfException {
-
- logger.debug("Deleting VF {} in ", vnfName, cloudOwner + "/" + cloudSiteId + "/" + tenantId);
- // Will capture execution time for metrics
-
- // 1702 capture the output parameters on a delete
- // so we'll need to query first
Map<String, Object> stackOutputs;
try {
- stackOutputs = heat.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
+ stackOutputs = msoHeatUtils.queryStackForOutputs(cloudSiteId, cloudOwner, tenantId, vnfName);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -1286,7 +1196,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
}
try {
- heat.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true);
+ msoHeatUtils.deleteStack(tenantId, cloudOwner, cloudSiteId, vnfName, true, 118);
} catch (MsoException me) {
me.addContext(DELETE_VNF);
// Failed to query the Stack due to an openstack exception.
@@ -1321,9 +1231,6 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
logger.error("Exception encountered while sending Confirm to Valet ", e);
}
}
-
- // On success, nothing is returned.
- return;
}
@Override
@@ -1417,7 +1324,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
StackInfo heatStack;
logger.debug("UpdateVfModule - querying for {}", vfModuleName);
try {
- heatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
+ heatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, vfModuleName);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -1452,7 +1359,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (nestedStackId != null) {
try {
logger.debug("Querying for nestedStackId = {}", nestedStackId);
- nestedHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId);
+ nestedHeatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, nestedStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -1475,7 +1382,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} else {
logger.debug("Found nested heat stack - copying values to inputs *later*");
nestedVolumeOutputs = nestedHeatStack.getOutputs();
- heat.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
+ msoHeatUtils.copyStringOutputsToInputs(inputs, nestedHeatStack.getOutputs(), false);
}
}
// handle a nestedBaseStackId if sent - this is the stack ID of the base.
@@ -1484,7 +1391,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
if (nestedBaseStackId != null) {
try {
logger.debug("Querying for nestedBaseStackId = {}", nestedBaseStackId);
- nestedBaseHeatStack = heat.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
+ nestedBaseHeatStack = msoHeatUtils.queryStack(cloudSiteId, cloudOwner, tenantId, nestedBaseStackId);
} catch (MsoException me) {
// Failed to query the Stack due to an openstack exception.
// Convert to a generic VnfException
@@ -1507,14 +1414,10 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
} else {
logger.debug("Found nested base heat stack - copying values to inputs *later*");
baseStackOutputs = nestedBaseHeatStack.getOutputs();
- heat.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
+ msoHeatUtils.copyStringOutputsToInputs(inputs, nestedBaseHeatStack.getOutputs(), false);
}
}
- // Ready to deploy the new VNF
-
-
-
// Retrieve the VF definition
VnfResource vnfResource = null;
VfModule vf = null;
@@ -1924,9 +1827,8 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
parsedVfModuleName = "unknown";
}
sendResponseToValet = this.valetUpdateRequest(cloudSiteId, cloudOwner, tenantId, heatFilesObjects,
- nestedTemplatesChecked, parsedVfModuleName, false, heatTemplate, newEnvironmentString,
- (HashMap<String, Object>) goldenInputs, msoRequest, inputs, failRequestOnValetFailure,
- valetModifiedParamsHolder);
+ nestedTemplatesChecked, parsedVfModuleName, false, heatTemplate, newEnvironmentString, goldenInputs,
+ msoRequest, inputs, failRequestOnValetFailure, valetModifiedParamsHolder);
if (sendResponseToValet) {
goldenInputs = valetModifiedParamsHolder.value;
}
@@ -2064,7 +1966,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
boolean valetSucceeded = false;
String valetErrorMessage = "more detail not available";
try {
- String keystoneUrl = heat.getCloudSiteKeystoneUrl(cloudSiteId);
+ String keystoneUrl = msoHeatUtils.getCloudSiteKeystoneUrl(cloudSiteId);
Map<String, Object> files =
this.combineGetFilesAndNestedTemplates(heatFilesObjects, nestedTemplatesChecked);
HeatRequest heatRequest = new HeatRequest(vfModuleName, backout, heatTemplate.getTimeoutMinutes(),
@@ -2126,7 +2028,7 @@ public class MsoVnfAdapterImpl implements MsoVnfAdapter {
boolean valetSucceeded = false;
String valetErrorMessage = "more detail not available";
try {
- String keystoneUrl = heat.getCloudSiteKeystoneUrl(cloudSiteId);
+ String keystoneUrl = msoHeatUtils.getCloudSiteKeystoneUrl(cloudSiteId);
Map<String, Object> files =
this.combineGetFilesAndNestedTemplates(heatFilesObjects, nestedTemplatesChecked);
HeatRequest heatRequest = new HeatRequest(vfModuleName, false, heatTemplate.getTimeoutMinutes(),
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
index 77c9b1e2f5..89eb6a161d 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/VolumeAdapterRestV2.java
@@ -105,7 +105,6 @@ public class VolumeAdapterRestV2 {
@ApiResponse(code = 500, message = "create vnfVolume failed, examine entity object for details")})
public Response createVNFVolumes(@ApiParam(value = "mode", required = true) @QueryParam("mode") String mode,
@ApiParam(value = "CreateVolumeGroupRequest", required = true) final CreateVolumeGroupRequest req) {
- logger.debug("createVNFVolumes enter: {}", req.toJsonString());
CreateVNFVolumesTask task = new CreateVNFVolumesTask(req, mode);
if (req.isSynchronous()) {
// This is a synchronous request
diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
index 137aaa9f41..d8a876016f 100644
--- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
+++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/heatbridge/helpers/AaiHelper.java
@@ -84,11 +84,13 @@ public class AaiHelper {
relationships.add(vfModuleRelationship);
// vserver to image relationship
- Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE,
- ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
- .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
- .put(HeatBridgeConstants.AAI_IMAGE_ID, server.getImage().getId()).build());
- relationships.add(imageRel);
+ if (server.getImage() != null) {
+ Relationship imageRel = buildRelationship(HeatBridgeConstants.AAI_IMAGE,
+ ImmutableMap.<String, String>builder().put(HeatBridgeConstants.AAI_CLOUD_OWNER, cloudOwner)
+ .put(HeatBridgeConstants.AAI_CLOUD_REGION_ID, cloudRegionId)
+ .put(HeatBridgeConstants.AAI_IMAGE_ID, server.getImage().getId()).build());
+ relationships.add(imageRel);
+ }
// vserver to flavor relationship
Relationship flavorRel = buildRelationship(HeatBridgeConstants.AAI_FLAVOR,
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
index 3432e4a8b6..cff4d5f994 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceDataTest.java
@@ -37,6 +37,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.audit.beans.AuditInventory;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAuditList;
import org.springframework.core.env.Environment;
import com.fasterxml.jackson.core.JsonParseException;
@@ -67,6 +68,9 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
@Mock
private AuditDataService auditDataService;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
private ObjectMapper objectMapper = new ObjectMapper();
private AuditInventory auditInventory = new AuditInventory();
@@ -170,47 +174,6 @@ public class AuditStackServiceDataTest extends AuditCreateStackService {
}
@Test
- public void retry_sequence_calculation_Test() {
- long firstRetry = auditStackService.calculateRetryDelay(8);
- assertEquals(6000L, firstRetry);
- long secondRetry = auditStackService.calculateRetryDelay(7);
- assertEquals(6000L, secondRetry);
- long thirdRetry = auditStackService.calculateRetryDelay(6);
- assertEquals(12000L, thirdRetry);
- long fourthRetry = auditStackService.calculateRetryDelay(5);
- assertEquals(18000L, fourthRetry);
- long fifthRetry = auditStackService.calculateRetryDelay(4);
- assertEquals(30000L, fifthRetry);
- long sixRetry = auditStackService.calculateRetryDelay(3);
- assertEquals(48000L, sixRetry);
- long seventhRetry = auditStackService.calculateRetryDelay(2);
- assertEquals(78000L, seventhRetry);
- long eigthRetry = auditStackService.calculateRetryDelay(1);
- assertEquals(120000L, eigthRetry);
- }
-
- @Test
- public void retry_sequence_Test() {
- long firstRetry = auditStackService.calculateRetryDelay(8);
- assertEquals(6000L, firstRetry);
- long secondRetry = auditStackService.calculateRetryDelay(7);
- assertEquals(6000L, secondRetry);
- long thirdRetry = auditStackService.calculateRetryDelay(6);
- assertEquals(12000L, thirdRetry);
- long fourthRetry = auditStackService.calculateRetryDelay(5);
- assertEquals(18000L, fourthRetry);
- long fifthRetry = auditStackService.calculateRetryDelay(4);
- assertEquals(30000L, fifthRetry);
- long sixRetry = auditStackService.calculateRetryDelay(3);
- assertEquals(48000L, sixRetry);
- long seventhRetry = auditStackService.calculateRetryDelay(2);
- assertEquals(78000L, seventhRetry);
- long eigthRetry = auditStackService.calculateRetryDelay(1);
- assertEquals(120000L, eigthRetry);
- }
-
-
- @Test
public void determineAuditResult_Test() throws Exception {
boolean actual = auditStackService.didCreateAuditFail(auditListOptSuccess);
assertEquals(false, actual);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
deleted file mode 100644
index c9aef950f7..0000000000
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/audit/AuditStackServiceTest.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2019 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.audit;
-
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import org.camunda.bpm.client.ExternalTaskClient;
-import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
-import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.Mockito;
-import org.mockito.Spy;
-import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.utils.CryptoUtils;
-import org.springframework.core.env.Environment;
-
-@RunWith(MockitoJUnitRunner.class)
-public class AuditStackServiceTest {
-
- @Spy
- @InjectMocks
- AuditStackService auditStackService;
-
- @Mock
- Environment mockEnvironment;
-
-
- @Before
- public void before() {
- Mockito.doReturn("5").when(mockEnvironment).getProperty("workflow.topics.maxClients", "10");
- Mockito.doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436")
- .when(mockEnvironment).getRequiredProperty("mso.auth");
- Mockito.doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnvironment).getRequiredProperty("mso.msoKey");
- Mockito.doReturn("something").when(mockEnvironment).getRequiredProperty("mso.config.cadi.aafId");
- Mockito.doReturn("host.com").when(mockEnvironment).getRequiredProperty("mso.workflow.endpoint");
- }
-
- @Test
- public void testGetMaxClients() throws Exception {
- int actual = auditStackService.getMaxClients();
- assertEquals(5, actual);
- }
-
- @Test
- public void testCreateClientRequestInterceptor() throws Exception {
- String auth = CryptoUtils.decrypt(
- "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
- "07a7159d3bf51a0e53be7a8f89699be7");
- ClientRequestInterceptor expected = new BasicAuthProvider("something", auth);
- ClientRequestInterceptor actual = auditStackService.createClientRequestInterceptor();
- assertThat(actual, sameBeanAs(expected));
-
- }
-
- @Test
- public void testCreateExternalTaskClient() throws Exception {
- String auth = CryptoUtils.decrypt(
- "6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436",
- "07a7159d3bf51a0e53be7a8f89699be7");
- ClientRequestInterceptor inter = new BasicAuthProvider("something", auth);
- Mockito.doReturn(inter).when(auditStackService).createClientRequestInterceptor();
- ExternalTaskClient actual = auditStackService.createExternalTaskClient();
- assertNotNull(actual);
- Mockito.verify(auditStackService, Mockito.times(1)).createClientRequestInterceptor();
-
- }
-}
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
index 8dc9d7fe5c..c4fa9ee2c5 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/inventory/create/CreateInventoryTaskTest.java
@@ -31,6 +31,7 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.externaltasks.logging.AuditMDCSetup;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
import com.fasterxml.jackson.core.JsonProcessingException;
@@ -46,6 +47,9 @@ public class CreateInventoryTaskTest {
@Mock
ExternalTaskService externalTaskService;
+ @Mock
+ private AuditMDCSetup mdcSetup;
+
@InjectMocks
CreateInventoryTask inventoryTask;
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
index 1f4c205e7a..412abeab3b 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/NetworkAdapterRestTest.java
@@ -194,9 +194,7 @@ public class NetworkAdapterRestTest extends BaseRestTestUtils {
public void testRollbackNetwork() throws IOException {
RollbackNetworkRequest request = new RollbackNetworkRequest();
-
MsoRequest msoReq = new MsoRequest();
-
msoReq.setRequestId(MSO_REQUEST_ID);
msoReq.setServiceInstanceId(MSO_SERVICE_INSTANCE_ID);
diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
index 651e2c9a73..0d972bb4d2 100644
--- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
+++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterImplTest.java
@@ -40,7 +40,6 @@ import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
-import org.onap.so.adapters.vnf.exceptions.VnfAlreadyExists;
import org.onap.so.adapters.vnf.exceptions.VnfException;
import org.onap.so.adapters.vnf.exceptions.VnfNotFound;
import org.onap.so.db.catalog.beans.HeatEnvironment;
@@ -50,15 +49,15 @@ 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.entity.MsoRequest;
-import org.onap.so.openstack.beans.HeatStatus;
-import org.onap.so.openstack.beans.StackInfo;
import org.onap.so.openstack.beans.VnfRollback;
import org.onap.so.openstack.exceptions.MsoException;
import org.onap.so.openstack.utils.MsoHeatUtils;
import org.springframework.beans.factory.annotation.Autowired;
+import com.github.tomakehurst.wiremock.stubbing.Scenario;
public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
+
@Rule
public ExpectedException expectedException = ExpectedException.none();
@@ -71,17 +70,7 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
String vnfName = "DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId";
@Test
- @Ignore
- public void healthCheckVNFTest() {
- MsoVnfAdapterImpl instance = new MsoVnfAdapterImpl();
- instance.healthCheck();
- }
-
- @Test
public void createVnfTest() throws Exception {
- StackInfo info = new StackInfo();
- info.setStatus(HeatStatus.CREATED);
-
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
mockOpenStackGetStackVfModule_200(wireMockServer);
@@ -90,105 +79,57 @@ public class MsoVnfAdapterImplTest extends BaseRestTestUtils {
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
- "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
+ "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE,
+ Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
}
@Test
- public void createVnfTest_HeatStatusUpdating() throws Exception {
- expectedException.expect(VnfAlreadyExists.class);
+ public void createVnfTest_HeatStatusFailed() throws Exception {
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
wireMockServer.stubFor(get(
urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_Stack_Updating_VfModule.json")
- .withStatus(HttpStatus.SC_OK)));
-
- MsoRequest msoRequest = getMsoRequest();
-
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
- "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
- public void createVnfTest_HeatStatusUpdated() throws Exception {
- expectedException.expect(VnfAlreadyExists.class);
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
+ .withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json")
+ .withStatus(HttpStatus.SC_OK))
+ .inScenario("HeatStatusFailure").whenScenarioStateIs(Scenario.STARTED)
+ .willSetStateTo("HeatStackFailed"));
wireMockServer.stubFor(get(
urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
.willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_StackId.json").withStatus(HttpStatus.SC_OK)));
+ .withBodyFile("OpenstackResponse_Stack_Created_VfModule.json")
+ .withStatus(HttpStatus.SC_OK))
+ .inScenario("HeatStatusFailure").whenScenarioStateIs("HeatStackFailed")
+ .willSetStateTo("HeatStackSuccess"));
MsoRequest msoRequest = getMsoRequest();
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
- "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
+ "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.FALSE, Boolean.TRUE,
+ Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
}
- @Test
- public void createVnfTest_HeatStatusFailed() throws Exception {
- expectedException.expect(VnfAlreadyExists.class);
- mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
- wireMockServer.stubFor(get(
- urlPathEqualTo("/mockPublicUrl/stacks/DEV-VF-1802-it3-pwt3-v6-vSAMP10a-addon2-Replace-1001/stackId"))
- .willReturn(aResponse().withHeader("Content-Type", "application/json")
- .withBodyFile("OpenstackResponse_Stack_Failed_VfModule.json")
- .withStatus(HttpStatus.SC_OK)));
-
- MsoRequest msoRequest = getMsoRequest();
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
- "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
@Test
public void createVnfTest_HeatStatusCreated() throws Exception {
- expectedException.expect(VnfAlreadyExists.class);
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
-
mockOpenStackGetStackVfModule_200(wireMockServer);
-
MsoRequest msoRequest = getMsoRequest();
-
Map<String, Object> map = new HashMap<>();
map.put("key1", "value1");
instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
- "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.TRUE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
+ "VFMOD", null, null, "b4ea86b4-253f-11e7-93ae-92361f002671", map, Boolean.TRUE, Boolean.TRUE,
+ Boolean.FALSE, msoRequest, new Holder<>(), new Holder<Map<String, String>>(),
+ new Holder<VnfRollback>());
}
@Test
- public void createVnfTest_ExceptionInGettingHeat() throws Exception {
- expectedException.expect(VnfException.class);
- MsoRequest msoRequest = getMsoRequest();
-
- Map<String, Object> map = new HashMap<>();
- map.put("key1", "value1");
- instance.createVfModule("mtn13", "CloudOwner", "88a6ca3ee0394ade9403f075db23167e", "vnf", "1", "", vnfName, "",
- "VFMOD", "volumeGroupHeatStackId|1", "baseVfHeatStackId", "88a6ca3ee0394ade9403f075db23167e", map,
- Boolean.FALSE, Boolean.TRUE, Boolean.FALSE, msoRequest, new Holder<>(),
- new Holder<Map<String, String>>(), new Holder<VnfRollback>());
- }
-
- @Test
public void createVnfTest_NestedHeatStatusNotFound() throws Exception {
expectedException.expect(VnfException.class);
mockOpenStackResponseAccess(wireMockServer, wireMockPort);
diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
index 7cc7697129..20fd812ab9 100644
--- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
+++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml
@@ -1,5 +1,3 @@
-# will be used as entry in DB to say SITE OFF/ON for healthcheck
-# MSO Properties go here
org:
onap:
so:
@@ -41,7 +39,7 @@ org:
default_keystone_reg_ex: "/[vV][0-9]"
default_tenant_description: ECOMP Tenant
default_region_type: single
- default_user_role: admin
+ default_user_role: adminev
default_success_status_string: Success
default_no_regions_status_string: no regions
default_orm_request_path: /v1/orm/customers/
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
index 85c05decb1..3a14b2ff84 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/MSORequestDBApplication.java
@@ -24,6 +24,8 @@ package org.onap.so.adapters.requestsdb.application;
import java.time.Duration;
import javax.sql.DataSource;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
@@ -39,8 +41,7 @@ import net.javacrumbs.shedlock.spring.ScheduledLockConfigurationBuilder;
* @since Version 1.0
*
*/
-
-@SpringBootApplication(scanBasePackages = {"org.onap.so"})
+@SpringBootApplication(scanBasePackages = {"org.onap.so", "org.onap.logging.filter"})
@EnableScheduling
@EnableMBeanExport(registration = RegistrationPolicy.IGNORE_EXISTING)
public class MSORequestDBApplication {
@@ -54,6 +55,7 @@ public class MSORequestDBApplication {
}
public static void main(String... args) {
+ System.setProperty(Constants.Property.PARTNER_NAME, ONAPComponents.REQUEST_DB.toString());
SpringApplication.run(MSORequestDBApplication.class, args);
java.security.Security.setProperty("networkaddress.cache.ttl", "10");
setLogsDir();
diff --git a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
index 579afe9243..9135d31ac3 100644
--- a/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
+++ b/adapters/mso-requests-db-adapter/src/main/java/org/onap/so/adapters/requestsdb/application/WebMvcConfig.java
@@ -21,22 +21,32 @@
package org.onap.so.adapters.requestsdb.application;
-import org.onap.so.logging.spring.interceptor.LoggingInterceptor;
+import org.onap.logging.filter.spring.LoggingInterceptor;
+import org.onap.logging.filter.spring.StatusLoggingInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.handler.MappedInterceptor;
@Configuration
+@ComponentScan(basePackages = {"org.onap.logging.filter"})
public class WebMvcConfig extends WebMvcConfigurerAdapter {
@Autowired
- LoggingInterceptor loggingInterceptor;
+ private LoggingInterceptor loggingInterceptor;
+
+ @Autowired
+ private StatusLoggingInterceptor statusLoggingInterceptor;
@Bean
public MappedInterceptor mappedLoggingInterceptor() {
return new MappedInterceptor(new String[] {"/**"}, loggingInterceptor);
}
+ @Bean
+ public MappedInterceptor mappedStatusLoggingInterceptor() {
+ return new MappedInterceptor(new String[] {"/**"}, statusLoggingInterceptor);
+ }
}
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql
new file mode 100644
index 0000000000..eac9a65f65
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.4.1__Rename_Infra_active_requests_AIC_CLOUD_REGION_Column.sql
@@ -0,0 +1,12 @@
+use requestdb;
+
+DROP INDEX `infra_active_requests__aic_cloud_region_idx` on `infra_active_requests`;
+
+ALTER TABLE
+ `infra_active_requests` CHANGE AIC_CLOUD_REGION CLOUD_REGION varchar(50) DEFAULT NULL;
+
+ALTER TABLE
+ `archived_infra_requests` CHANGE AIC_CLOUD_REGION CLOUD_REGION VARCHAR(50) NULL DEFAULT NULL;
+
+ALTER TABLE `infra_active_requests`
+ ADD INDEX IF NOT EXISTS `infra_active_requests__cloud_region_idx` (`CLOUD_REGION` ASC);
diff --git a/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.5__Drop_Table_Active_Requests.sql b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.5__Drop_Table_Active_Requests.sql
new file mode 100644
index 0000000000..c3d385ccc2
--- /dev/null
+++ b/adapters/mso-requests-db-adapter/src/main/resources/db/migration/V6.5__Drop_Table_Active_Requests.sql
@@ -0,0 +1,4 @@
+
+use requestdb;
+
+DROP TABLE IF EXISTS active_requests; \ No newline at end of file
diff --git a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
index e53b957210..fa2acbc0ca 100644
--- a/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
+++ b/adapters/mso-requests-db-adapter/src/test/java/org/onap/so/adapters/requestsdb/adapters/MSORequestDBImplTest.java
@@ -449,7 +449,7 @@ public class MSORequestDBImplTest extends RequestsAdapterBase {
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INSTANCE_UUID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
} else if (logEvent.getLoggerName().equals("org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor")
@@ -458,9 +458,9 @@ public class MSORequestDBImplTest extends RequestsAdapterBase {
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals(null, mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
- assertEquals("", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
assertEquals("/services/RequestsDbAdapter", mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
- assertEquals("COMPLETED", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
}
}
diff --git a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
index 9c2ea6d3bf..65fac11d41 100644
--- a/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
+++ b/adapters/mso-requests-db-adapter/src/test/resources/db/migration/afterMigrate.sql
@@ -4,7 +4,7 @@ insert into operation_status(service_id, operation_id, service_name, user_id, re
('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, request_url) values
+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, 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, request_url) 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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
index 6149f7ed25..dd1da98dd8 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
@@ -32,7 +32,7 @@ import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -51,7 +51,7 @@ public class CXFConfiguration {
private Bus bus;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private SDNCAdapterPortType sdncAdapterPortImpl;
@@ -70,7 +70,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(sniroResponse));
endpoint.setAddress("/rest");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
index 55023088bc..fc6d0a6fc9 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
@@ -23,7 +23,7 @@
package org.onap.so.adapters.sdnc;
import java.util.concurrent.Executor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
index 5ea68f08a2..dd875c573e 100644
--- a/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
+++ b/adapters/mso-vfc-adapter/src/main/java/org/onap/so/adapters/vfc/CXFConfiguration.java
@@ -28,7 +28,7 @@ import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
import org.apache.cxf.transport.servlet.CXFServlet;
import org.onap.so.adapters.vfc.rest.VfcAdapterRest;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -47,7 +47,7 @@ public class CXFConfiguration {
private VfcAdapterRest vfcAdapterRest;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private ObjectMapper mapper;
@@ -64,7 +64,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(vfcAdapterRest));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
index 66876311db..aaad60320d 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/Readme.txt
@@ -1,5 +1,9 @@
The following describes how to configure authentication for the VNFM adapter.
+TLS should always be configured to ensure secure communication between the VNFM-adapter <-> BPMN infra and VNFM-adapter <-> VNFM
+If two-way TLS is configured then there is no need for any further authentication (i.e. no need for token or basic auth).
+If two-way TLS is NOT configured then authentication is REQUIRED. Oauth token based authentication must be used for requests, while for notifications either oauth tokens or basic auth can be used.
+
==========================================
To confgure TLS
@@ -12,8 +16,8 @@ The following parameters can be set to configure the certificate for the VNFM ad
server:
ssl:
key-alias: so@so.onap.org
- key--store-password: 'I,re7WWEJR$e]x370wRgx?qE'
- key-store: classpath:org.onap.so.p12
+ key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L'
+ key-store: classpath:so-vnfm-adapter.p12
key-store-type: PKCS12
The values shown above relate to the certificate included in the VNFM adapter jar which has been generated from AAF. If a different certificate is to be used then these values should be changed accordingly.
@@ -21,8 +25,8 @@ The following paramters can be set to configure the trust store for the VNFM ada
http:
client:
ssl:
- trust-store: org.onap.so.trust.jks
- trust-store-password: NyRD](z:EJJNIt?},QgM3o7H
+ trust-store: classpath:org.onap.so.trust.jks
+ trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H'
The values shown above relate to the trust store included in the VNFM adapter jar which has been generated from AAI. If a different trust store is to be used then these values should be changed accordingly.
Ensure the value for the below parameter uses https instead of http
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
index 110bbabdb2..fc9efef947 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiHelper.java
@@ -31,14 +31,10 @@ import org.onap.aai.domain.yang.EsrVnfmList;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipData;
-import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.Vserver;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOperationOccurrenceNotificationAffectedVnfcs;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.TenantNotFoundException;
import org.onap.so.adapters.vnfmadapter.rest.exceptions.VnfmNotFoundException;
-import org.onap.so.client.aai.AAIObjectType;
-import org.onap.so.client.aai.AAIVersion;
-import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.vnfmadapter.v1.model.Tenant;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -61,38 +57,6 @@ public class AaiHelper {
}
/**
- * Add a relationship to the given generic VNF to the given VNFM.
- *
- * @param vnf the generic VNF
- * @param vnfmId the ID of the VNFM
- */
- public void addRelationshipFromGenericVnfToVnfm(final GenericVnf vnf, final String vnfmId) {
- if (vnf.getRelationshipList() == null) {
- vnf.setRelationshipList(new RelationshipList());
- }
- final RelationshipList vnfmRelationshiplist = vnf.getRelationshipList();
- vnfmRelationshiplist.getRelationship().add(createRelationshipToVnfm(vnfmId));
-
- }
-
- private Relationship createRelationshipToVnfm(final String vnfmId) {
- final Relationship relationship = new Relationship();
- relationship.setRelatedTo("esr-vnfm");
- relationship.setRelationshipLabel("tosca.relationships.DependsOn");
- relationship.setRelatedLink("/aai/" + AAIVersion.LATEST
- + AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId).build().toString());
- relationship.getRelationshipData().add(createRelationshipData("esr-vnfm.vnfm-id", vnfmId));
- return relationship;
- }
-
- private RelationshipData createRelationshipData(final String key, final String value) {
- final RelationshipData data = new RelationshipData();
- data.setRelationshipKey(key);
- data.setRelationshipValue(value);
- return data;
- }
-
- /**
* Get the VNFM assigned for use for the given generic VNF.
*
* @param vnf the generic VNF
@@ -242,30 +206,6 @@ public class AaiHelper {
return vserver;
}
- /**
- * Add a relationship to the given vserver to the given VNF.
- *
- * @param vnf the vserver
- * @param vnfmId the ID of the VNF
- */
- public void addRelationshipFromVserverVnfToGenericVnf(final Vserver vserver, final String vnfId) {
- if (vserver.getRelationshipList() == null) {
- vserver.setRelationshipList(new RelationshipList());
- }
- final RelationshipList vserverRelationshiplist = vserver.getRelationshipList();
- vserverRelationshiplist.getRelationship().add(createRelationshipToGenericVnf(vnfId));
- }
-
- private Relationship createRelationshipToGenericVnf(final String vnfId) {
- final Relationship relationship = new Relationship();
- relationship.setRelatedTo("generic-vnf");
- relationship.setRelationshipLabel("tosca.relationships.HostedOn");
- relationship.setRelatedLink("/aai/" + AAIVersion.LATEST
- + AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId).build().toString());
- relationship.getRelationshipData().add(createRelationshipData("generic-vnf.vnf-id", vnfId));
- return relationship;
- }
-
public void setOamIpAddressSource(final String vnfId, final OamIpAddressSource oamIpAddressSource) {
mapOfVnfIdToOamIpAddressHolder.put(vnfId, oamIpAddressSource);
}
@@ -274,32 +214,4 @@ public class AaiHelper {
return mapOfVnfIdToOamIpAddressHolder.get(vnfId);
}
- /**
- * Add a relationship to the given tenant to the given VNF.
- *
- * @param vnf the generic vnf
- * @param tenant the Tenant
- */
-
- public void addRelationshipFromGenericVnfToTenant(final GenericVnf vnf, final Tenant tenant) {
- if (vnf.getRelationshipList() == null) {
- vnf.setRelationshipList(new RelationshipList());
- }
- final RelationshipList vnfmRelationshiplist = vnf.getRelationshipList();
- vnfmRelationshiplist.getRelationship().add(createRelationshipToTenant(tenant));
- }
-
- private Relationship createRelationshipToTenant(final Tenant tenant) {
- final Relationship relationship = new Relationship();
- relationship.setRelatedTo("tenant");
- relationship.setRelatedLink("/aai/" + AAIVersion.LATEST + AAIUriFactory.createResourceUri(AAIObjectType.TENANT,
- tenant.getCloudOwner(), tenant.getRegionName(), tenant.getTenantId()).build().toString());
- relationship.getRelationshipData()
- .add(createRelationshipData("cloud-region.cloud-owner", tenant.getCloudOwner()));
- relationship.getRelationshipData()
- .add(createRelationshipData("cloud-region.cloud-region-id", tenant.getRegionName()));
- relationship.getRelationshipData().add(createRelationshipData("tenant.tenant-id", tenant.getTenantId()));
- return relationship;
- }
-
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
index 7021c02511..d19190d88e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProvider.java
@@ -72,12 +72,22 @@ public interface AaiServiceProvider {
EsrVnfm invokeGetVnfm(final String vnfmId);
/**
- * Invoke a PUT request for a generic vnf.
+ * Invoke a PATCH request for a generic vnf.
*
* @param vnf the generic vnf
* @return
*/
- void invokePutGenericVnf(GenericVnf vnf);
+ void invokePatchGenericVnf(GenericVnf vnf);
+
+ /**
+ * Invoke a PUT request for a relationship from a generic vnf to a VNFM.
+ *
+ * @param vnf the generic vnf
+ * @param vnfmId the ID of the VNFM
+ * @return
+ */
+ void invokePutGenericVnfToVnfmRelationship(GenericVnf vnf, final String vnfmId);
+
/**
* Invoke a PUT request for a vserver.
@@ -92,6 +102,19 @@ public interface AaiServiceProvider {
final Vserver vserver);
/**
+ * Invoke a PUT request for a relationship from a vserver to a generic vnf.
+ *
+ * @param cloudOwner the cloud owner
+ * @param cloudRegion the cloud region the vserver is deployed on
+ * @param tenantId the ID of the tenant the vserver is deployed on
+ * @param vserver the vserver
+ * @param vnfId the ID of the generic vnf
+ * @return
+ */
+ void invokePutVserverToVnfRelationship(final String cloudOwner, final String cloudRegion, final String tenantId,
+ final Vserver vserver, final String vnfId);
+
+ /**
* Invoke a DELETE request for a vserver.
*
* @param cloudOwner the cloud owner
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
index 019a08af78..6dc6020834 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/aai/AaiServiceProviderImpl.java
@@ -98,12 +98,18 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
}
@Override
- public void invokePutGenericVnf(final GenericVnf vnf) {
+ public void invokePatchGenericVnf(final GenericVnf vnf) {
aaiClientProvider.getAaiClient()
.update(AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()), vnf);
}
@Override
+ public void invokePutGenericVnfToVnfmRelationship(final GenericVnf vnf, final String vnfmId) {
+ aaiClientProvider.getAaiClient().connect(AAIUriFactory.createResourceUri(AAIObjectType.VNFM, vnfmId),
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnf.getVnfId()));
+ }
+
+ @Override
public void invokePutVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final Vserver vserver) {
aaiClientProvider.getAaiClient().create(AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner,
@@ -111,6 +117,16 @@ public class AaiServiceProviderImpl implements AaiServiceProvider {
}
@Override
+ public void invokePutVserverToVnfRelationship(final String cloudOwner, final String cloudRegion,
+ final String tenant, final Vserver vserver, final String vnfId) {
+ aaiClientProvider.getAaiClient()
+ .connect(
+ AAIUriFactory.createResourceUri(AAIObjectType.VSERVER, cloudOwner, cloudRegion, tenant,
+ vserver.getVserverId()),
+ AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId));
+ }
+
+ @Override
public void invokeDeleteVserver(final String cloudOwner, final String cloudRegion, final String tenant,
final String vserverId) {
aaiClientProvider.getAaiClient().delete(
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
index 93312cfa64..ae9316cfdf 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/extclients/vnfm/VnfmServiceProviderConfiguration.java
@@ -30,6 +30,7 @@ import java.security.NoSuchAlgorithmException;
import java.security.UnrecoverableKeyException;
import java.security.cert.CertificateException;
import java.util.Iterator;
+import java.util.ListIterator;
import java.util.Map;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
@@ -41,8 +42,10 @@ import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContextBuilder;
import org.onap.aai.domain.yang.EsrSystemInfo;
import org.onap.aai.domain.yang.EsrVnfm;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.JSON;
import org.onap.so.configuration.rest.BasicHttpHeadersProvider;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.onap.so.rest.service.HttpRestServiceProvider;
import org.onap.so.rest.service.HttpRestServiceProviderImpl;
import org.slf4j.Logger;
@@ -53,6 +56,7 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.client.BufferingClientHttpRequestFactory;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.http.converter.HttpMessageConverter;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
@@ -167,4 +171,14 @@ public class VnfmServiceProviderConfiguration {
}
}
+ private void removeSpringClientFilter(final RestTemplate restTemplate) {
+ ListIterator<ClientHttpRequestInterceptor> interceptorIterator = restTemplate.getInterceptors().listIterator();
+ while (interceptorIterator.hasNext()) {
+ ClientHttpRequestInterceptor interceptor = interceptorIterator.next();
+ if (interceptor instanceof SOSpringClientFilter || interceptor instanceof SpringClientPayloadFilter) {
+ interceptorIterator.remove();
+ }
+ }
+ }
+
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
index 0aad91e5be..461c15a512 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/lifecycle/LifecycleManager.java
@@ -81,21 +81,25 @@ public class LifecycleManager {
* @return the response to the request
*/
public CreateVnfResponse createVnf(final String vnfIdInAai, final CreateVnfRequest request) {
- final GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
+ GenericVnf genericVnf = getGenericVnfFromAai(vnfIdInAai);
EsrVnfm vnfm = aaiHelper.getAssignedVnfm(genericVnf);
checkIfVnfAlreadyExistsInVnfm(vnfm, genericVnf);
if (vnfm == null) {
vnfm = aaiHelper.selectVnfm(genericVnf);
- aaiHelper.addRelationshipFromGenericVnfToVnfm(genericVnf, vnfm.getVnfmId());
+ aaiServiceProvider.invokePutGenericVnfToVnfmRelationship(genericVnf, vnfm.getVnfmId());
}
- aaiHelper.addRelationshipFromGenericVnfToTenant(genericVnf, request.getTenant());
final InlineResponse201 vnfmResponse = sendCreateRequestToVnfm(request, genericVnf, vnfIdInAai, vnfm);
logger.info("Create response: {}", vnfmResponse);
genericVnf.setSelflink(getSelfLink(vnfmResponse, vnfm));
- aaiServiceProvider.invokePutGenericVnf(genericVnf);
+
+ GenericVnf genericVnfPatch = new GenericVnf();
+ genericVnfPatch.setVnfId(genericVnf.getVnfId());
+ genericVnfPatch.setSelflink(genericVnf.getSelflink());
+ aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
+
final String vnfIdInVnfm = vnfmResponse.getId();
final OamIpAddressSource oamIpAddressSource = extractOamIpAddressSource(request);
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
index eb912c8775..7a6bbfe0d9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/java/org/onap/so/adapters/vnfmadapter/notificationhandling/NotificationHandler.java
@@ -97,10 +97,12 @@ public class NotificationHandler implements Runnable {
private void handleVnfInstantiateCompleted() {
final GenericVnf genericVnf = aaiServiceProvider
.invokeQueryGenericVnf(vnfInstance.getLinks().getSelf().getHref()).getGenericVnf().get(0);
- setOamIpAddress(genericVnf, vnfInstance);
- genericVnf.setOrchestrationStatus("Created");
- aaiServiceProvider.invokePutGenericVnf(genericVnf);
+ final GenericVnf genericVnfPatch = new GenericVnf();
+ genericVnfPatch.setVnfId(genericVnf.getVnfId());
+ setOamIpAddress(genericVnfPatch, vnfInstance);
+ genericVnfPatch.setOrchestrationStatus("Created");
+ aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
addVservers(vnfLcmOperationOccurrenceNotification, genericVnf.getVnfId(), vnfInstance.getVimConnectionInfo());
@@ -162,9 +164,12 @@ public class NotificationHandler implements Runnable {
jobManager.notificationProcessedForOperation(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId(),
deleteSuccessful);
jobManager.vnfDeleted(vnfLcmOperationOccurrenceNotification.getVnfLcmOpOccId());
- genericVnf.setOrchestrationStatus("Assigned");
- genericVnf.setSelflink("");
- aaiServiceProvider.invokePutGenericVnf(genericVnf);
+
+ final GenericVnf genericVnfPatch = new GenericVnf();
+ genericVnfPatch.setVnfId(genericVnf.getVnfId());
+ genericVnfPatch.setOrchestrationStatus("Assigned");
+ genericVnfPatch.setSelflink("");
+ aaiServiceProvider.invokePatchGenericVnf(genericVnfPatch);
}
}
@@ -180,10 +185,11 @@ public class NotificationHandler implements Runnable {
getVimConnectionInfo(vimConnectionIdToVimConnectionInfo, vnfc);
if (ChangeTypeEnum.ADDED.equals(vnfc.getChangeType())) {
final Vserver vserver = aaiHelper.createVserver(vnfc);
- aaiHelper.addRelationshipFromVserverVnfToGenericVnf(vserver, vnfId);
-
aaiServiceProvider.invokePutVserver(getCloudOwner(vimConnectionInfo), getCloudRegion(vimConnectionInfo),
getTenant(vimConnectionInfo), vserver);
+
+ aaiServiceProvider.invokePutVserverToVnfRelationship(getCloudOwner(vimConnectionInfo),
+ getCloudRegion(vimConnectionInfo), getTenant(vimConnectionInfo), vserver, vnfId);
}
}
}
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
index 4434d2edd9..951d4a3bb9 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/main/resources/application.yaml
@@ -23,22 +23,11 @@ spring:
http:
converters:
preferred-json-mapper: gson
-
-http:
- client:
- ssl:
- trust-store: classpath:org.onap.so.trust.jks
- trust-store-password: ',sx#.C*W)]wVgJC6ccFHI#:H'
server:
port: 9092
tomcat:
max-threads: 50
- ssl:
- key-alias: so@so.onap.org
- key--store-password: 'ywsqCy:EEo#j}HJHM7z^Rk[L'
- key-store: classpath:so-vnfm-adapter.p12
- key-store-type: PKCS12
mso:
key: 07a7159d3bf51a0e53be7a8f89699be7
@@ -55,7 +44,7 @@ sdc:
endpoint: http://sdc.onap/1234A
vnfmadapter:
- endpoint: https://so-vnfm-adapter.onap:9092
+ endpoint: http://so-vnfm-adapter.onap:9092
#Actuator
management:
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
index 89a2c102f4..f83e9c94d2 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/Sol003LcnControllerTest.java
@@ -212,12 +212,16 @@ public class Sol003LcnControllerTest {
final Vserver vserver = (Vserver) bodyArgument2.getAllValues().get(0);
assertEquals("myVnfc1", vserver.getVserverId());
- final Relationship relationship = vserver.getRelationshipList().getRelationship().get(0);
- assertEquals("generic-vnf", relationship.getRelatedTo());
- assertEquals("tosca.relationships.HostedOn", relationship.getRelationshipLabel());
- assertEquals("/aai/v15/network/generic-vnfs/generic-vnf/myTestVnfId", relationship.getRelatedLink());
- assertEquals("generic-vnf.vnf-id", relationship.getRelationshipData().get(0).getRelationshipKey());
- assertEquals("myTestVnfId", relationship.getRelationshipData().get(0).getRelationshipValue());
+
+ final ArgumentCaptor<AAIResourceUri> uriArgument1Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).connect(uriArgument1Connect.capture(), uriArgument2Connect.capture());
+ assertEquals(
+ "/cloud-infrastructure/cloud-regions/cloud-region/" + CLOUD_OWNER + "/" + REGION + "/tenants/tenant/"
+ + TENANT_ID + "/vservers/vserver/myVnfc1",
+ uriArgument1Connect.getAllValues().get(0).build().toString());
+ assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
+ uriArgument2Connect.getAllValues().get(0).build().toString());
}
@Test
diff --git a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
index fe55907420..297f74433e 100644
--- a/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
+++ b/adapters/mso-vnfm-adapter/mso-vnfm-etsi-adapter/src/test/java/org/onap/so/adapters/vnfmadapter/rest/VnfmAdapterControllerTest.java
@@ -25,6 +25,7 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.timeout;
import static org.mockito.Mockito.verify;
import static org.onap.so.client.RestTemplateConfig.CONFIGURABLE_REST_TEMPLATE;
import static org.springframework.test.web.client.match.MockRestRequestMatchers.content;
@@ -175,20 +176,14 @@ public class VnfmAdapterControllerTest {
assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId", uriArgument.getValue().build().toString());
assertEquals("myTestVnfId", genericVnfArgument.getValue().getVnfId());
- assertEquals(2, genericVnfArgument.getValue().getRelationshipList().getRelationship().size());
- final Relationship vnfmRelationship =
- genericVnfArgument.getValue().getRelationshipList().getRelationship().get(0);
- assertEquals("esr-vnfm", vnfmRelationship.getRelatedTo());
- assertEquals("tosca.relationships.DependsOn", vnfmRelationship.getRelationshipLabel());
- assertEquals("/aai/v15/external-system/esr-vnfm-list/esr-vnfm/vnfm2", vnfmRelationship.getRelatedLink());
-
- final Relationship tenantRelationship =
- genericVnfArgument.getValue().getRelationshipList().getRelationship().get(1);
- assertEquals("tenant", tenantRelationship.getRelatedTo());
- assertEquals(
- "/aai/v15/cloud-infrastructure/cloud-regions/cloud-region/myTestCloudOwner/myTestRegion/tenants/tenant/myTestTenantId",
- tenantRelationship.getRelatedLink());
+ final ArgumentCaptor<AAIResourceUri> uriArgument1Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ final ArgumentCaptor<AAIResourceUri> uriArgument2Connect = ArgumentCaptor.forClass(AAIResourceUri.class);
+ verify(aaiResourcesClient, timeout(1000)).connect(uriArgument1Connect.capture(), uriArgument2Connect.capture());
+ assertEquals("/external-system/esr-vnfm-list/esr-vnfm/vnfm2",
+ uriArgument1Connect.getAllValues().get(0).build().toString());
+ assertEquals("/network/generic-vnfs/generic-vnf/myTestVnfId",
+ uriArgument2Connect.getAllValues().get(0).build().toString());
// check the job status
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java
deleted file mode 100644
index 21917c3d2c..0000000000
--- a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/BPRestCallbackTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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.adapters.workflowmessage;
-
-import org.apache.http.entity.ContentType;
-import org.junit.Test;
-import org.mockito.Mock;
-
-import static junit.framework.Assert.assertFalse;
-
-public class BPRestCallbackTest {
-
- @Mock
- ContentType contentType;
-
- @Test
- public void testSendExceptionCase() {
-
- BPRestCallback test = new BPRestCallback();
- test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message");
- assertFalse(test.send("workflowMessageUrl/", "messageType", "correlator", contentType,"message"));
-
- }
- }
diff --git a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java b/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java
deleted file mode 100644
index 08728fa339..0000000000
--- a/adapters/mso-workflow-message-adapter/src/test/java/org/onap/so/adapters/workflowmessage/WMAdapterRestTest.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2018 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
- *l
- * 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.workflowmessage;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-public class WMAdapterRestTest {
-
- @Test(expected = ClassFormatError.class)
- public void testHealthCheckException() throws Exception {
-
- WMAdapterRest test = new WMAdapterRest();
- test.healthcheck("34388737-cdad-4d96-ae6f-39d08024b495");
- Assert.assertFalse(true);
-
- }
-
- @Test(expected = ClassFormatError.class)
- public void testReceiveWorkflowMsgException() throws Exception {
- WMAdapterRest test = new WMAdapterRest();
- test.receiveWorkflowMessage("contentTypeHeader", "messageType", "correlator", "content");
- Assert.assertFalse(true);
-
- }
-}
-
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
index c37eccf594..06887f1253 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/ActivitySpecsActions.java
@@ -29,7 +29,8 @@ import org.onap.so.asdc.activity.beans.ActivitySpec;
import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -62,7 +63,7 @@ public class ActivitySpecsActions {
String urlString = UriBuilder.fromUri(hostname).path(ACTIVITY_SPEC_URI).build().toString();
URL url = new URL(urlString);
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString());
Response response = httpClient.post(payload);
@@ -104,7 +105,7 @@ public class ActivitySpecsActions {
String urlString = UriBuilder.fromUri(hostname).path(path).build().toString();
URL url = new URL(urlString);
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addAdditionalHeader("Content-Type", ContentType.APPLICATION_JSON.toString());
Response response = httpClient.put(CERTIFY_ACTIVITY_PAYLOAD);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
index 7f1c1968c1..d60c377730 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/activity/DeployActivitySpecs.java
@@ -65,7 +65,7 @@ public class DeployActivitySpecs {
logger.warn("The hostname for SDC activities deployment is not configured in SO");
return;
}
- if (!checkHttpOk(hostname)) {
+ if (!checkHttpServerUp(hostname)) {
logger.warn("The sdc end point is not alive");
return;
}
@@ -144,21 +144,22 @@ public class DeployActivitySpecs {
return;
}
- public boolean checkHttpOk(String host) {
+ public boolean checkHttpServerUp(String host) {
URL url = null;
- boolean isOk = false;
+ boolean isUp = false;
int responseCode = 0;
try {
url = new URL(host);
HttpURLConnection connection = (HttpURLConnection) url.openConnection();
+ connection.setConnectTimeout(5000);
responseCode = connection.getResponseCode();
} catch (Exception e) {
logger.warn("Exception on connecting to SDC WFD endpoint: " + e.getMessage());
}
- if (responseCode == HttpStatus.SC_OK) {
- isOk = true;
+ if (responseCode == HttpStatus.SC_OK || responseCode == HttpStatus.SC_NOT_FOUND) {
+ isUp = true;
}
- return isOk;
+ return isUp;
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
index 639a96eab6..7b526b513d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java
@@ -56,10 +56,9 @@ public class ASDCConfiguration implements IConfiguration {
public static final String TOSCA_CSAR = "TOSCA_CSAR";
public static final String WORKFLOW = "WORKFLOW";
public static final String VF_MODULES_METADATA = "VF_MODULES_METADATA";
- public static final String CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT = "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT";
private static final String[] SUPPORTED_ARTIFACT_TYPES = {HEAT, HEAT_ARTIFACT, HEAT_ENV, HEAT_NESTED, HEAT_NET,
- HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT, WORKFLOW};
+ HEAT_VOL, OTHER, TOSCA_CSAR, VF_MODULES_METADATA, WORKFLOW};
public static final List<String> SUPPORTED_ARTIFACT_TYPES_LIST =
Collections.unmodifiableList(Arrays.asList(SUPPORTED_ARTIFACT_TYPES));
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
index 90116ad4f5..37f6462bba 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCController.java
@@ -723,7 +723,6 @@ public class ASDCController {
// For each artifact, create a structure describing the VFModule in a ordered flat level
ResourceStructure resourceStructure = null;
String msoConfigPath = getMsoConfigPath();
- boolean hasVFResource = false;
ToscaResourceStructure toscaResourceStructure = new ToscaResourceStructure(msoConfigPath);
DistributionStatusEnum deployStatus = DistributionStatusEnum.DEPLOY_OK;
String errorMessage = null;
@@ -738,7 +737,7 @@ public class ASDCController {
for (IResourceInstance resource : iNotif.getResources()) {
String resourceType = resource.getResourceType();
-
+ boolean hasVFResource = false;
logger.info("Processing Resource Type: {}, Model UUID: {}", resourceType, resource.getResourceUUID());
@@ -801,19 +800,20 @@ public class ASDCController {
errorMessage = e.getMessage();
logger.error("Exception occurred", e);
}
- }
- if (!hasVFResource) {
+ if (!hasVFResource) {
- logger.debug("No resources found for Service: " + iNotif.getServiceUUID());
+ logger.debug("No resources found for Service: " + iNotif.getServiceUUID());
- logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
- try {
- this.deployResourceStructure(resourceStructure, toscaResourceStructure);
- } catch (ArtifactInstallerException e) {
- deployStatus = DistributionStatusEnum.DEPLOY_ERROR;
- errorMessage = e.getMessage();
- logger.error("Exception occurred", e);
+ logger.debug("Preparing to deploy Service: {}", iNotif.getServiceUUID());
+ try {
+ this.deployResourceStructure(resourceStructure, toscaResourceStructure);
+ serviceDeployed = true;
+ } catch (ArtifactInstallerException e) {
+ deployStatus = DistributionStatusEnum.DEPLOY_ERROR;
+ errorMessage = e.getMessage();
+ logger.error("Exception occurred", e);
+ }
}
}
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
index f954fe0c5a..8c1598226d 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/VfResourceStructure.java
@@ -117,7 +117,6 @@ public class VfResourceStructure extends ResourceStructure {
case ASDCConfiguration.HEAT_ARTIFACT:
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
- case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
artifactsMapByUUID.put(artifactinfo.getArtifactUUID(), vfModuleArtifact);
break;
case ASDCConfiguration.VF_MODULES_METADATA:
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
index e8e068a71a..b2dbcb4639 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/heat/ToscaResourceInstaller.java
@@ -1216,7 +1216,6 @@ public class ToscaResourceInstaller {
break;
case ASDCConfiguration.HEAT_NET:
case ASDCConfiguration.OTHER:
- case ASDCConfiguration.CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT:
logger.warn(LoggingAnchor.FOUR, MessageEnum.ASDC_ARTIFACT_TYPE_NOT_SUPPORT.toString(),
vfModuleArtifact.getArtifactInfo().getArtifactType() + "(Artifact Name:"
+ vfModuleArtifact.getArtifactInfo().getArtifactName() + ")",
@@ -2793,7 +2792,7 @@ public class ToscaResourceInstaller {
+ vfModuleStructure.getVfModuleMetadata().getVfModuleModelName();
}
- protected List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct,
+ public List<IEntityDetails> getEntityDetails(ToscaResourceStructure toscaResourceStruct,
EntityQueryBuilder entityType, TopologyTemplateQueryBuilder topologyTemplateBuilder, boolean nestedSearch) {
EntityQuery entityQuery = entityType.build();
@@ -2805,7 +2804,7 @@ public class ToscaResourceInstaller {
}
- protected String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
+ public String getLeafPropertyValue(IEntityDetails entityDetails, String propName) {
Property leafProperty = entityDetails.getProperties().get(propName);
diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
index 4b069e6ac7..07eca567d5 100644
--- a/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
+++ b/asdc-controller/src/main/java/org/onap/so/asdc/util/ASDCNotificationLogging.java
@@ -26,15 +26,16 @@ import java.util.Map;
import org.onap.sdc.api.notification.IArtifactInfo;
import org.onap.sdc.api.notification.INotificationData;
import org.onap.sdc.api.notification.IResourceInstance;
+import org.onap.sdc.tosca.parser.api.IEntityDetails;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
+import org.onap.sdc.tosca.parser.elements.queries.EntityQuery;
+import org.onap.sdc.tosca.parser.elements.queries.TopologyTemplateQuery;
import org.onap.sdc.tosca.parser.enums.SdcTypes;
import org.onap.sdc.tosca.parser.impl.SdcPropertyNames;
-import org.onap.sdc.toscaparser.api.Group;
-import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.so.asdc.installer.IVfModuleData;
import org.onap.so.asdc.installer.ToscaResourceStructure;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.asdc.installer.heat.ToscaResourceInstaller;
public class ASDCNotificationLogging {
@@ -63,7 +64,7 @@ public class ASDCNotificationLogging {
return "NULL";
}
-
+ ToscaResourceInstaller toscaResourceInstaller = new ToscaResourceInstaller();
StringBuilder buffer = new StringBuilder("CSAR Notification:");
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -103,33 +104,33 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
- List<NodeTemplate> serviceProxyResourceList =
- toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.SERVICE_PROXY);
+ List<IEntityDetails> serviceProxyResourceList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.SERVICE_PROXY), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE),
+ true);
+
if (serviceProxyResourceList != null) {
- for (NodeTemplate serviceProxyNodeTemplate : serviceProxyResourceList) {
+ for (IEntityDetails serviceProxyEntity : serviceProxyResourceList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("Service Proxy Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(
- serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -138,31 +139,31 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(serviceProxyNodeTemplate.getMetaData()
- .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(
+ serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(serviceProxyNodeTemplate.getName());
+ buffer.append(serviceProxyEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(serviceProxyNodeTemplate.getType());
+ buffer.append(serviceProxyEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- serviceProxyNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(serviceProxyEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> configurationNodeTemplatesList =
- toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CONFIGURATION);
+ List<IEntityDetails> configurationList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CONFIGURATION), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE),
+ true);
- if (configurationNodeTemplatesList != null) {
- for (NodeTemplate configNodeTemplate : configurationNodeTemplatesList) {
+ if (configurationList != null) {
+ for (IEntityDetails configEntity : configurationList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -170,22 +171,22 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(configNodeTemplate.getType());
+ buffer.append(configEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -193,62 +194,63 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(
- configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(configNodeTemplate.getName());
+ buffer.append(configEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
buffer.append(System.lineSeparator());
buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
buffer.append(System.lineSeparator());
buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplatePropertyLeafValue(configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> vfNodeTemplatesList = toscaResourceStructure.getSdcCsarHelper().getServiceVfList();
- for (NodeTemplate vfNodeTemplate : vfNodeTemplatesList) {
+ List<IEntityDetails> vfEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+
+ for (IEntityDetails vfEntity : vfEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VNF Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("Type:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
buffer.append(System.lineSeparator());
buffer.append("Category:");
- buffer.append(testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY)));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("Max Instances:");
- buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
+ buffer.append(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES));
buffer.append(System.lineSeparator());
buffer.append("Min Instances:");
- buffer.append(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES));
+ buffer.append(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES));
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -256,37 +258,35 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Customization UUID:");
- buffer.append(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(testNull(vfEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(
+ toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
buffer.append(System.lineSeparator());
buffer.append("NFCode:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- "nf_naming_code"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, "nf_naming_code"));
buffer.append(System.lineSeparator());
buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFROLE));
buffer.append(System.lineSeparator());
buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
buffer.append(System.lineSeparator());
buffer.append("MultiStageDesign:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vfNodeTemplate,
- "multi_stage_design"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vfEntity, "multi_stage_design"));
buffer.append(System.lineSeparator());
- List<Group> groupList =
- toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- vfNodeTemplate, "org.openecomp.groups.VfcInstanceGroup");
- if (groupList != null) {
- for (Group group : groupList) {
- Metadata instanceMetadata = group.getMetadata();
+ List<IEntityDetails> vfcInstanceEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfcInstanceGroup"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF)
+ .customizationUUID(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID),
+ false);
+
+ if (vfcInstanceEntityList != null) {
+ for (IEntityDetails vfcEntity : vfcInstanceEntityList) {
+ Metadata instanceMetadata = vfcEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -300,7 +300,7 @@ public class ASDCNotificationLogging {
buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("Type:");
- buffer.append(vfNodeTemplate.getType());
+ buffer.append(vfcEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
buffer.append(instanceMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
@@ -309,43 +309,43 @@ public class ASDCNotificationLogging {
}
+ List<IEntityDetails> vfModuleEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE)
+ .customizationUUID(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID),
+ false);
- List<Group> vfGroups = toscaResourceStructure.getSdcCsarHelper().getVfModulesByVf(
- testNull(vfNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- for (Group group : vfGroups) {
+ for (IEntityDetails vfModuleEntity : vfModuleEntityList) {
- Metadata vfMetadata = group.getMetadata();
+ Metadata vfMetadata = vfModuleEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VF Module Properties:");
buffer.append(System.lineSeparator());
buffer.append("ModelInvariantUuid:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELINVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelName:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELNAME)));
buffer.append(System.lineSeparator());
buffer.append("ModelUuid:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelVersion:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELVERSION)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
- SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(vfMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
- List<NodeTemplate> groupMembers =
- toscaResourceStructure.getSdcCsarHelper().getMembersOfVfModule(vfNodeTemplate, group);
+ List<IEntityDetails> groupMembers = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.VfModule")
+ .uUID(SdcPropertyNames.PROPERTY_NAME_VFMODULEMODELUUID),
+ TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
- for (NodeTemplate node : groupMembers) {
+ for (IEntityDetails node : groupMembers) {
buffer.append("Member Name:");
buffer.append(testNull(node.getName()));
buffer.append(System.lineSeparator());
@@ -355,17 +355,18 @@ public class ASDCNotificationLogging {
buffer.append("VF Module Customization Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(testNull(toscaResourceStructure.getSdcCsarHelper().getMetadataPropertyValue(vfMetadata,
+ buffer.append(testNull(toscaResourceInstaller.getLeafPropertyValue(vfModuleEntity,
SdcPropertyNames.PROPERTY_NAME_VFMODULECUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
}
- List<NodeTemplate> vfConfigList = toscaResourceStructure.getSdcCsarHelper()
- .getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CONFIGURATION);
+ List<IEntityDetails> fabricEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CONFIGURATION), TopologyTemplateQuery.newBuilder(SdcTypes.VF),
+ false);
- if (vfConfigList != null) {
- for (NodeTemplate configNodeTemplate : vfConfigList) {
+ if (fabricEntityList != null) {
+ for (IEntityDetails configEntity : fabricEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -373,24 +374,22 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(
- configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(
- configNodeTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(configNodeTemplate.getType());
+ buffer.append(configEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -398,95 +397,96 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(configNodeTemplate.getMetaData()
- .getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(
+ configEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(configNodeTemplate.getName());
+ buffer.append(configEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
buffer.append(System.lineSeparator());
buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
buffer.append(System.lineSeparator());
buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(
- configNodeTemplate, SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(configEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> cvfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(vfNodeTemplate, SdcTypes.CVFC);
+ List<IEntityDetails> cvnfcEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CVFC), TopologyTemplateQuery.newBuilder(SdcTypes.VF), false);
- for (NodeTemplate cvfcTemplate : cvfcList) {
+ for (IEntityDetails cvnfcEntity : cvnfcEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("CVNFC Properties:");
buffer.append(System.lineSeparator());
buffer.append("ModelCustomizationUuid:");
- buffer.append(testNull(
- cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(
+ testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelInvariantUuid:");
buffer.append(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelName:");
- buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("ModelUuid:");
- buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelVersion:");
- buffer.append(testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(
- testNull(cvfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
buffer.append("Template Name:");
- buffer.append(testNull(cvfcTemplate.getName()));
+ buffer.append(testNull(cvnfcEntity.getName()));
buffer.append(System.lineSeparator());
+ List<IEntityDetails> vfcEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VFC),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CVFC).customizationUUID(
+ cvnfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
- List<NodeTemplate> vfcList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(cvfcTemplate, SdcTypes.VFC);
-
- for (NodeTemplate vfcTemplate : vfcList) {
+ for (IEntityDetails vfcEntity : vfcEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("VNFC Properties:");
buffer.append(System.lineSeparator());
buffer.append("ModelCustomizationUuid:");
buffer.append(testNull(
- vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelInvariantUuid:");
buffer.append(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelName:");
- buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("ModelUuid:");
- buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("ModelVersion:");
- buffer.append(testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
buffer.append(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
buffer.append("Sub Category:");
buffer.append(
- testNull(vfcTemplate.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
+ testNull(vfcEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY)));
buffer.append(System.lineSeparator());
}
@@ -495,41 +495,40 @@ public class ASDCNotificationLogging {
}
+ List<IEntityDetails> vlEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VL), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+ if (vlEntityList != null) {
- List<NodeTemplate> nodeTemplatesVLList = toscaResourceStructure.getSdcCsarHelper().getServiceVlList();
-
- if (nodeTemplatesVLList != null) {
-
- for (NodeTemplate vlNode : nodeTemplatesVLList) {
+ for (IEntityDetails vlEntity : vlEntityList) {
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("NETWORK Level Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
buffer.append(System.lineSeparator());
buffer.append("Model InvariantUuid:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
buffer.append(System.lineSeparator());
buffer.append("Model Version:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
buffer.append(System.lineSeparator());
buffer.append("AIC Max Version:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MAXINSTANCES)));
buffer.append(System.lineSeparator());
buffer.append("AIC Min Version:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_MININSTANCES)));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_TYPE)));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(testNull(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
+ buffer.append(testNull(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION)));
buffer.append(System.lineSeparator());
@@ -537,22 +536,22 @@ public class ASDCNotificationLogging {
buffer.append("NETWORK Customization Properties:");
buffer.append(System.lineSeparator());
buffer.append("CustomizationUUID:");
- buffer.append(vlNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(vlEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Network Technology:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
buffer.append(System.lineSeparator());
buffer.append("Network Type:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
buffer.append(System.lineSeparator());
buffer.append("Network Role:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
buffer.append(System.lineSeparator());
buffer.append("Network Scope:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(vlNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(vlEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
buffer.append(System.lineSeparator());
@@ -560,52 +559,55 @@ public class ASDCNotificationLogging {
}
+ List<IEntityDetails> crEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.CR), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
- List<NodeTemplate> networkCollectionList =
- toscaResourceStructure.getSdcCsarHelper().getServiceNodeTemplateBySdcType(SdcTypes.CR);
-
- if (networkCollectionList != null) {
- for (NodeTemplate crNode : networkCollectionList) {
+ if (crEntityList != null) {
+ for (IEntityDetails crEntity : crEntityList) {
buffer.append(System.lineSeparator());
buffer.append("Network Collection Properties:");
buffer.append(System.lineSeparator());
buffer.append("Model Name:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME));
buffer.append(System.lineSeparator());
buffer.append("Model UUID:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID));
+ buffer.append(System.lineSeparator());
+ buffer.append("Customization UUID:");
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("InvariantUuid:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID));
buffer.append(System.lineSeparator());
buffer.append("Description:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Version:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(crNode.getType());
+ buffer.append(crEntity.getToscaType());
buffer.append(System.lineSeparator());
buffer.append("CR Function:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
- "cr_function"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_function"));
buffer.append(System.lineSeparator());
buffer.append("CR Role:");
- buffer.append(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_role"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_role"));
buffer.append(System.lineSeparator());
buffer.append("CR Type:");
- buffer.append(
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode, "cr_type"));
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity, "cr_type"));
buffer.append(System.lineSeparator());
- List<NodeTemplate> vlNodeList =
- toscaResourceStructure.getSdcCsarHelper().getNodeTemplateBySdcType(crNode, SdcTypes.VL);
+ List<IEntityDetails> networkEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VL),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
+
- for (NodeTemplate vlNodeTemplate : vlNodeList) {
+ for (IEntityDetails vlEntity : networkEntityList) {
- Metadata vlMetadata = vlNodeTemplate.getMetaData();
+ Metadata vlMetadata = vlEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
@@ -631,19 +633,20 @@ public class ASDCNotificationLogging {
buffer.append(vlMetadata.getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
buffer.append(System.lineSeparator());
buffer.append("Tosca Node Type:");
- buffer.append(vlNodeTemplate.getType());
+ buffer.append(vlEntity.getToscaType());
buffer.append(System.lineSeparator());
}
+ List<IEntityDetails> ncEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder("org.openecomp.groups.NetworkCollection"),
+ TopologyTemplateQuery.newBuilder(SdcTypes.CR).customizationUUID(
+ crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)),
+ false);
- List<Group> groupList =
- toscaResourceStructure.getSdcCsarHelper().getGroupsOfOriginOfNodeTemplateByToscaGroupType(
- crNode, "org.openecomp.groups.NetworkCollection");
-
- if (groupList != null) {
- for (Group group : groupList) {
- Metadata instanceMetadata = group.getMetadata();
+ if (ncEntityList != null) {
+ for (IEntityDetails ncEntity : ncEntityList) {
+ Metadata instanceMetadata = ncEntity.getMetadata();
buffer.append(System.lineSeparator());
buffer.append(System.lineSeparator());
buffer.append("Network Instance Group Properties:");
@@ -670,96 +673,172 @@ public class ASDCNotificationLogging {
buffer.append(System.lineSeparator());
buffer.append("Model Customization UUID:");
- buffer.append(crNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
+ buffer.append(crEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID));
buffer.append(System.lineSeparator());
buffer.append("Model Instance Name:");
- buffer.append(crNode.getName());
+ buffer.append(crEntity.getName());
buffer.append(System.lineSeparator());
buffer.append("Network Scope:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKSCOPE));
buffer.append(System.lineSeparator());
buffer.append("Network Role:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKROLE));
buffer.append(System.lineSeparator());
buffer.append("Network Type:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTYPE));
buffer.append(System.lineSeparator());
buffer.append("Network Technology:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(crNode,
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(crEntity,
SdcPropertyNames.PROPERTY_NAME_NETWORKTECHNOLOGY));
buffer.append(System.lineSeparator());
}
}
- List<NodeTemplate> allottedResourceList = toscaResourceStructure.getSdcCsarHelper().getAllottedResources();
+ List<IEntityDetails> arEntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.VF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
- if (allottedResourceList != null) {
+ if (arEntityList != null) {
buffer.append(System.lineSeparator());
- buffer.append("Allotted Resource Properties:");
+ buffer.append("VF Allotted Resource Properties:");
buffer.append(System.lineSeparator());
- for (NodeTemplate allottedNode : allottedResourceList) {
+ for (IEntityDetails arEntity : arEntityList) {
- buffer.append("Model Name:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- buffer.append(System.lineSeparator());
- buffer.append("Model Name:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
- buffer.append(System.lineSeparator());
- buffer.append("Model InvariantUuid:");
- buffer.append(
- testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
- buffer.append(System.lineSeparator());
- buffer.append("Model Version:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
- buffer.append(System.lineSeparator());
- buffer.append("Model UUID:");
- buffer.append(testNull(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
- buffer.append(System.lineSeparator());
- buffer.append("Model Subcategory:");
- buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
- buffer.append(System.lineSeparator());
- buffer.append("Model Category:");
- buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
- buffer.append(System.lineSeparator());
- buffer.append("Model Description:");
- buffer.append(allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
- buffer.append(System.lineSeparator());
+ Metadata metadata = arEntity.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+ if ("Allotted Resource".equalsIgnoreCase(category)) {
- buffer.append("Allotted Resource Customization Properties:");
- buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model InvariantUuid:");
+ buffer.append(
+ testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Version:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(testNull(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Subcategory:");
+ buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Category:");
+ buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Description:");
+ buffer.append(arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
- buffer.append("Model Cutomization UUID:");
- buffer.append(testNull(
- allottedNode.getMetaData().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
- buffer.append(System.lineSeparator());
- buffer.append("NFFunction:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
- buffer.append(System.lineSeparator());
- buffer.append("NFCode:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- "nf_naming_code"));
- buffer.append(System.lineSeparator());
- buffer.append("NFRole:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- SdcPropertyNames.PROPERTY_NAME_NFROLE));
- buffer.append(System.lineSeparator());
- buffer.append("NFType:");
- buffer.append(toscaResourceStructure.getSdcCsarHelper().getNodeTemplatePropertyLeafValue(allottedNode,
- SdcPropertyNames.PROPERTY_NAME_NFTYPE));
- buffer.append(System.lineSeparator());
+ buffer.append("Allotted Resource Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Cutomization UUID:");
+ buffer.append(testNull(
+ arEntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFFunction:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFCode:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity, "nf_naming_code"));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFRole:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFType:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(arEntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(System.lineSeparator());
+ }
}
}
+ List<IEntityDetails> pnfAREntityList = toscaResourceInstaller.getEntityDetails(toscaResourceStructure,
+ EntityQuery.newBuilder(SdcTypes.PNF), TopologyTemplateQuery.newBuilder(SdcTypes.SERVICE), false);
+
+ if (pnfAREntityList != null) {
+
+ buffer.append(System.lineSeparator());
+ buffer.append("PNF Allotted Resource Properties:");
+ buffer.append(System.lineSeparator());
+
+ for (IEntityDetails pnfAREntity : pnfAREntityList) {
+
+ Metadata metadata = pnfAREntity.getMetadata();
+ String category = metadata.getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY);
+
+ if ("Allotted Resource".equalsIgnoreCase(category)) {
+
+ buffer.append("Model Name:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Name:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_NAME)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model InvariantUuid:");
+ buffer.append(
+ testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_INVARIANTUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Version:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_VERSION)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model UUID:");
+ buffer.append(testNull(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_UUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Subcategory:");
+ buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_SUBCATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Category:");
+ buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CATEGORY));
+ buffer.append(System.lineSeparator());
+ buffer.append("Model Description:");
+ buffer.append(pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_DESCRIPTION));
+ buffer.append(System.lineSeparator());
+
+
+ buffer.append("Allotted Resource Customization Properties:");
+ buffer.append(System.lineSeparator());
+
+ buffer.append("Model Cutomization UUID:");
+ buffer.append(testNull(
+ pnfAREntity.getMetadata().getValue(SdcPropertyNames.PROPERTY_NAME_CUSTOMIZATIONUUID)));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFFunction:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity,
+ SdcPropertyNames.PROPERTY_NAME_NFFUNCTION));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFCode:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity, "nf_naming_code"));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFRole:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity,
+ SdcPropertyNames.PROPERTY_NAME_NFROLE));
+ buffer.append(System.lineSeparator());
+ buffer.append("NFType:");
+ buffer.append(toscaResourceInstaller.getLeafPropertyValue(pnfAREntity,
+ SdcPropertyNames.PROPERTY_NAME_NFTYPE));
+ buffer.append(System.lineSeparator());
+ }
+
+ }
+ }
+
+
return buffer.toString();
}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
index b41fbaf658..75ab089719 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsITTest.java
@@ -29,7 +29,9 @@ import static com.github.tomakehurst.wiremock.client.WireMock.verify;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import org.junit.Test;
+import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.onap.so.asdc.BaseTest;
import org.onap.so.asdc.activity.DeployActivitySpecs;
import org.onap.so.asdc.activity.beans.ActivitySpecCreateResponse;
@@ -50,6 +52,10 @@ public class DeployActivitySpecsITTest extends BaseTest {
@Autowired
private DeployActivitySpecs deployActivitySpecs;
+ @InjectMocks
+ @Spy
+ DeployActivitySpecs deployActivitySpecsM;
+
@Test
public void deployActivitySpecsIT_Test() throws Exception {
ActivitySpecCreateResponse activitySpecCreateResponse = new ActivitySpecCreateResponse();
@@ -100,7 +106,9 @@ public class DeployActivitySpecsITTest extends BaseTest {
put(urlPathMatching(urlPath)).willReturn(aResponse().withHeader("Content-Type", "application/json")
.withStatus(org.springframework.http.HttpStatus.OK.value())));
- deployActivitySpecs.deployActivities();
+ String host = "http://localhost:8090";
+ when(deployActivitySpecsM.checkHttpServerUp(host)).thenReturn(false);
+ deployActivitySpecsM.deployActivities();
verify(0, putRequestedFor(urlEqualTo(urlPath)));
}
diff --git a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
index 7a876a67a2..6d88ab6630 100644
--- a/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
+++ b/asdc-controller/src/test/java/org/onap/asdc/activity/DeployActivitySpecsTest.java
@@ -71,7 +71,7 @@ public class DeployActivitySpecsTest {
new ArrayList<org.onap.so.db.catalog.beans.ActivitySpec>();
catalogActivitySpecList.add(catalogActivitySpec);
when(env.getProperty("mso.asdc.config.activity.endpoint")).thenReturn("http://testEndpoint");
- doReturn(true).when(deployActivitySpecs).checkHttpOk("http://testEndpoint");
+ doReturn(true).when(deployActivitySpecs).checkHttpServerUp("http://testEndpoint");
when(activitySpecRepository.findAll()).thenReturn(catalogActivitySpecList);
doReturn("testActivityId").when(activitySpecsActions).createActivitySpec(Mockito.any(), Mockito.any());
doReturn(true).when(activitySpecsActions).certifyActivitySpec(Mockito.any(), Mockito.any());
diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
index e1b124775b..7171fff812 100644
--- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
+++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java
@@ -56,12 +56,16 @@ import org.onap.so.db.catalog.beans.NetworkResource;
import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ToscaCsar;
+import org.onap.so.db.catalog.beans.VnfResource;
+import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.Workflow;
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.NetworkResourceRepository;
import org.onap.so.db.catalog.data.repository.ServiceRepository;
import org.onap.so.db.catalog.data.repository.ToscaCsarRepository;
+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.WorkflowRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.web.client.TestRestTemplate;
@@ -88,6 +92,9 @@ public class ASDCRestInterfaceTest extends BaseTest {
private NetworkResourceRepository networkRepo;
@Autowired
+ private VnfCustomizationRepository vnfCustRepo;
+
+ @Autowired
private WorkflowRepository workflowRepo;
@Autowired
@@ -297,6 +304,18 @@ public class ASDCRestInterfaceTest extends BaseTest {
Optional<NetworkResource> networkResource = networkRepo.findById("89789b26-a46b-4cee-aed0-d46e21f93a5e");
assertTrue(networkResource.isPresent());
assertEquals("Generic NeutronNet", networkResource.get().getModelName());
+
+ List<VnfResourceCustomization> vnfCustomizationResources =
+ vnfCustRepo.findByModelCustomizationUUID("01564fe7-0541-4d92-badc-464cc35f83ba");
+
+ for (VnfResourceCustomization vnfResourceCustomization : vnfCustomizationResources) {
+
+ assertTrue(vnfResourceCustomization.getVfModuleCustomizations().stream()
+ .anyMatch(vfModuleCust -> "354b1e83-47db-4af1-8af4-9c14b03b482d"
+ .equals(vfModuleCust.getModelCustomizationUUID())));
+
+ }
+
}
@Test
diff --git a/asdc-controller/src/test/resources/schema.sql b/asdc-controller/src/test/resources/schema.sql
index ad6b156956..f2c04802a5 100644
--- a/asdc-controller/src/test/resources/schema.sql
+++ b/asdc-controller/src/test/resources/schema.sql
@@ -1447,7 +1447,7 @@ CREATE TABLE `infra_active_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
@@ -1500,7 +1500,7 @@ CREATE TABLE `archived_infra_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
index f14e3dcc42..ee70dcc89c 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/AaiUtil.groovy
@@ -44,7 +44,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.openpojo.rules.HasToStringRule
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@Deprecated
class AaiUtil {
@@ -96,7 +96,7 @@ class AaiUtil {
String regionId = ""
try{
URL Url = new URL(url)
- HttpClient client = new HttpClientFactory().newXmlClient(Url, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(Url, ONAPComponents.AAI)
client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
index 2bf7298584..83784e1960 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtils.groovy
@@ -37,7 +37,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.web.util.UriUtils
import javax.ws.rs.core.MediaType
@@ -442,7 +442,7 @@ class CatalogDbUtils {
String catalogDbEndpoint = UrnPropertiesReader.getVariable("mso.catalog.db.endpoint",execution)
String queryEndpoint = catalogDbEndpoint + "/" + defaultDbAdapterVersion + endPoint
def responseData = ''
- HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)
+ HttpClient client = httpClientFactory.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', "BPMN")
client.addAdditionalHeader('Accept', MediaType.APPLICATION_JSON)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
index c23150384e..195b1fc0d6 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExceptionUtil.groovy
@@ -34,7 +34,7 @@ import org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.so.bpmn.core.WorkflowException
import org.onap.so.logger.MessageEnum
-import org.onap.so.utils.TargetEntities
+import org.onap.logging.filter.base.ONAPComponentsList
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -285,7 +285,7 @@ class ExceptionUtil extends AbstractServiceTaskProcessor {
logger.debug("Outgoing WorkflowException is " + exception)
}
- public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, TargetEntities extSystemErrorSource) {
+ public void buildWorkflowException(DelegateExecution execution, int errorCode, String errorMessage, ONAPComponentsList extSystemErrorSource) {
MsoUtils utils = new MsoUtils()
String processKey = getProcessKey(execution);
logger.debug("Building a WorkflowException for " + processKey)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
index 5525c2642b..a5111a62d3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtil.groovy
@@ -29,7 +29,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.MediaType
import javax.ws.rs.core.Response
@@ -145,7 +145,7 @@ class ExternalAPIUtil {
logger.debug( "URL to be used is: " + url)
logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
- HttpClient client = httpClientFactory.newJsonClient(new URL(url), TargetEntity.EXTERNAL)
+ HttpClient client = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.EXTERNAL)
client.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader(ONAPLogConstants.Headers.REQUEST_ID, uuid)
@@ -183,7 +183,7 @@ class ExternalAPIUtil {
logger.debug( "URL to be used is: " + url)
logger.debug("URL to be passed in header is: " + execution.getVariable("SPPartnerUrl"))
- HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), TargetEntity.AAI)
+ HttpClient httpClient = httpClientFactory.newJsonClient(new URL(url), ONAPComponents.AAI)
httpClient.addBasicAuthHeader(execution.getVariable("URN_externalapi_auth"), execution.getVariable("URN_mso_msoKey"))
httpClient.addAdditionalHeader("X-FromAppId", "MSO")
httpClient.addAdditionalHeader("X-TransactionId", uuid)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
index 3008f77b62..6d4b50f690 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/GenerateVfModuleName.groovy
@@ -42,7 +42,7 @@ import org.onap.so.client.aai.AAIObjectType
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.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -92,7 +92,7 @@ public class GenerateVfModuleName extends AbstractServiceTaskProcessor{
logger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
index 6583ded413..b082c1830e 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofHoming.groovy
@@ -41,7 +41,7 @@ import org.onap.so.db.catalog.beans.CloudIdentity
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
import org.onap.so.db.catalog.beans.ServerType
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger
import org.slf4j.LoggerFactory
@@ -165,7 +165,7 @@ class OofHoming extends AbstractServiceTaskProcessor {
URL url = new URL(urlString)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.OOF)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF)
httpClient.addAdditionalHeader("Authorization", authHeader)
Response httpResponse = httpClient.post(oofRequest)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
index 4bfb29bc45..606b97bec2 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy
@@ -40,7 +40,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
import org.onap.so.db.catalog.beans.CloudSite
import org.onap.so.db.catalog.beans.HomingInstance
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.http.HttpEntity
import org.springframework.http.HttpHeaders
import org.springframework.http.HttpMethod
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
index c30d807bf3..52d6758b2b 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SDNCAdapterRestV1.groovy
@@ -47,7 +47,7 @@ import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@@ -223,7 +223,7 @@ class SDNCAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(sdncAdapterUrl)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SDNC_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SDNC_ADAPTER)
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
httpClient.addAdditionalHeader("X-ONAP-InvocationID", UUID.randomUUID().toString())
httpClient.addAdditionalHeader("X-ONAP-PartnerName", "SO-SDNCAdapter")
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
index 8c2da2c112..08c032fba3 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/SniroHomingV1.groovy
@@ -37,7 +37,7 @@ import org.onap.so.bpmn.core.domain.VnfResource
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor
import org.json.JSONArray
@@ -136,7 +136,7 @@ class SniroHomingV1 extends AbstractServiceTaskProcessor{
logger.debug("Sniro Url is: " + urlString)
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.SNIRO)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.SNIRO)
httpClient.addAdditionalHeader("Authorization", authHeader)
Response httpResponse = httpClient.post(sniroRequest)
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
index 866229f6b8..803a3f71de 100644
--- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
+++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/VnfAdapterRestV1.groovy
@@ -35,8 +35,9 @@ import org.onap.so.client.HttpClient
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import java.util.UUID
+import org.onap.so.utils.Components
@@ -80,7 +81,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no messageId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable('VNFAResponse_CORRELATOR', messageId)
@@ -94,7 +95,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no notificationUrl in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + 'notificationUrl', notificationUrl)
@@ -108,7 +109,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': mso:adapters:vnf:rest:endpoint URN mapping is not defined'
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
while (vnfAdapterEndpoint.endsWith('/')) {
@@ -126,7 +127,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'POST'
@@ -139,7 +140,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -148,7 +149,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'PUT'
@@ -162,7 +163,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(root, 'vfModuleId')
@@ -171,7 +172,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -185,7 +186,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleRollback in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vnfId = getChildText(vfModuleRollbackNode, 'vnfId')
@@ -194,7 +195,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vnfId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
String vfModuleId = getChildText(vfModuleRollbackNode, 'vfModuleId')
@@ -203,7 +204,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no vfModuleId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -224,7 +225,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'PUT'
@@ -240,7 +241,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -256,7 +257,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': no volumeGroupId in ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
vnfAdapterMethod = 'DELETE'
@@ -269,7 +270,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = getProcessKey(execution) + ': Unsupported request type: ' + requestType
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + 'vnfAdapterMethod', vnfAdapterMethod)
@@ -306,7 +307,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
logger.debug(msg)
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
}
@@ -337,7 +338,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
URL url = new URL(vnfAdapterUrl);
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable(prefix + "basicAuthHeaderValue"))
httpClient.addAdditionalHeader("X-ONAP-RequestID", execution.getVariable("mso-request-id"))
@@ -357,7 +358,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Unsupported HTTP method "' + vnfAdapterMethod + '" in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
execution.setVariable(prefix + "vnfAdapterStatusCode", response.getStatus())
@@ -370,7 +371,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String msg = 'Caught exception in ' + method + ": " + e
logger.error(LoggingAnchor.FOUR, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), msg, "BPMN",
ErrorCode.UnknownError.getValue());
- exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 2000, msg, ONAPComponents.SO)
}
}
@@ -399,7 +400,7 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
}
} catch (Exception e) {
logger.debug("Error encountered within VnfAdapterRest ProcessCallback method: {}", e.getMessage(), e)
- exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", TargetEntity.SO)
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7020, "Error encountered within VnfAdapterRest ProcessCallback method", ONAPComponents.SO)
}
}
@@ -418,10 +419,10 @@ class VnfAdapterRestV1 extends AbstractServiceTaskProcessor {
String rolledBack = getChildText(root, "rolledBack")
rolledBack = rolledBack == null || rolledBack.isEmpty() ? "" : " rolledBack='" + rolledBack + "'"
exceptionUtil.buildWorkflowException(execution, 7020, "Received " + root.name() +
- " from VnfAdapter:" + category + message + rolledBack, TargetEntity.OPENSTACK);
+ " from VnfAdapter:" + category + message + rolledBack, Components.OPENSTACK);
} catch (Exception e) {
response = response == null || String.valueOf(response).isEmpty() ? "NONE" : response
- exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, TargetEntity.OPENSTACK)
+ exceptionUtil.buildWorkflowException(execution, 7020, "Received error from VnfAdapter: " + response, Components.OPENSTACK)
}
}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntities.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java
index 67016a1fa9..1018d7f025 100644
--- a/common/src/main/java/org/onap/so/utils/TargetEntities.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionCompletion.java
@@ -2,14 +2,14 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * 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.
@@ -18,10 +18,8 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.utils;
+package org.onap.so.bpmn.common.listener.validation;
-import java.io.Serializable;
-
-public interface TargetEntities extends Serializable {
+public interface WorkflowActionCompletion extends WorkflowActionListener {
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java
index e644f9e030..4788c55053 100644
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCTaskDecorator.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListener.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017 - 2019 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.
@@ -18,26 +18,27 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.logging.jaxrs.filter;
+package org.onap.so.bpmn.common.listener.validation;
-import java.util.Map;
-import org.slf4j.MDC;
-import org.springframework.core.task.TaskDecorator;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
-public class MDCTaskDecorator implements TaskDecorator {
+public interface WorkflowActionListener {
+
+ /**
+ * Should this listener run for given bb
+ *
+ * @return
+ *
+ */
+ public boolean shouldRunFor(String bbName, String eventName);
+
+ /**
+ * Determines whether or not the listener should be executed
+ *
+ *
+ * @param execution
+ * @return
+ */
+ public void executeListener(DelegateExecution execution);
- @Override
- public Runnable decorate(Runnable runnable) {
- Map<String, String> contextMap = MDC.getCopyOfContextMap();
- return () -> {
- try {
- if (contextMap != null) {
- MDC.setContextMap(contextMap);
- runnable.run();
- }
- } finally {
- MDC.clear();
- }
- };
- }
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java
new file mode 100644
index 0000000000..806c1b835d
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/listener/validation/WorkflowActionListenerRunner.java
@@ -0,0 +1,64 @@
+/*-
+ * ============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.listener.validation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Optional;
+import javax.annotation.PostConstruct;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.listener.ListenerRunner;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class WorkflowActionListenerRunner extends ListenerRunner {
+
+ private static Logger logger = LoggerFactory.getLogger(WorkflowActionListenerRunner.class);
+
+ protected List<WorkflowActionListener> workflowActionListeners;
+
+ @PostConstruct
+ protected void init() {
+ workflowActionListeners = new ArrayList<>(Optional
+ .ofNullable(context.getBeansOfType(WorkflowActionListener.class)).orElse(new HashMap<>()).values());
+ }
+
+ public void executeAsyncListeners(String bbName, DelegateExecution execution, String eventName) {
+ try {
+ logger.info("NotifyingWorkflowActionListeners");
+ runNotifications(workflowActionListeners, bbName, execution, eventName);
+ } catch (Exception e) {
+ logger.error("Error in Notifying Workflow Action Listeners", e);
+ }
+ }
+
+ protected void runNotifications(List<? extends WorkflowActionListener> listeners, String bbName,
+ DelegateExecution execution, String eventName) {
+ List<? extends WorkflowActionListener> filtered =
+ filterListeners(listeners, (item -> item.shouldRunFor(bbName, eventName)));
+ filtered.forEach(item -> item.executeListener(execution));
+ }
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
index 2c1d36273d..8efb6a3e1c 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/common/resource/ResourceRequestBuilder.java
@@ -44,7 +44,7 @@ import org.onap.so.bpmn.core.domain.VnfResource;
import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.client.HttpClient;
import org.onap.so.client.HttpClientFactory;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
@@ -383,7 +383,7 @@ public class ResourceRequestBuilder {
HttpClient client = new HttpClientFactory().newJsonClient(UriBuilder.fromUri(catalogEndPoint)
.path(SERVICE_URL_SERVICE_INSTANCE).queryParam("serviceModelUuid", uuid).build().toURL(),
- TargetEntity.CATALOG_DB);
+ ONAPComponents.CATALOG_DB);
client.addAdditionalHeader("Accept", "application/json");
client.addAdditionalHeader("Authorization", UrnPropertiesReader.getVariable("mso.db.auth"));
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 3cf5a60de7..433aa0c11a 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -389,11 +389,8 @@ public class BBInputSetup implements JavaDelegate {
String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) {
Configuration configuration = null;
for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
- if ((bbName.contains("Fabric") && configurationTemp.getConfigurationSubType() != null
- && configurationTemp.getConfigurationSubType().equalsIgnoreCase("Fabric Config"))
- || (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
- .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID)))) {
- lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, configurationTemp.getConfigurationId());
+ if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
+ .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
configuration = configurationTemp;
org.onap.aai.domain.yang.Configuration aaiConfiguration =
bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index dcb9e08d0b..fcac86b251 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -23,9 +23,7 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
import java.io.IOException;
-import java.io.ObjectOutputStream;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Optional;
@@ -76,12 +74,11 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
-import com.fasterxml.jackson.databind.JsonMappingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
+import com.fasterxml.jackson.databind.type.TypeFactory;
@Component("BBInputSetupUtils")
public class BBInputSetupUtils {
@@ -177,39 +174,32 @@ public class BBInputSetupUtils {
}
public InfraActiveRequests loadOriginalInfraActiveRequestById(String requestId) {
-
return this.requestsDbClient.getInfraActiveRequestbyRequestId(
this.requestsDbClient.getInfraActiveRequestbyRequestId(requestId).getOriginalRequestId());
}
public List<ExecuteBuildingBlock> loadOriginalFlowExecutionPath(String requestId) {
-
- List<ExecuteBuildingBlock> asList = null;
if (requestId != null) {
-
InfraActiveRequests request = loadInfraActiveRequestById(requestId);
-
if (request.getOriginalRequestId() != null) {
-
RequestProcessingData requestProcessingData =
this.requestsDbClient.getRequestProcessingDataBySoRequestIdAndName(
request.getOriginalRequestId(), PROCESSING_DATA_NAME_EXECUTION_FLOWS);
-
- ObjectMapper om = new ObjectMapper();
try {
- ExecuteBuildingBlock[] asArray =
- om.readValue(requestProcessingData.getValue(), ExecuteBuildingBlock[].class);
- asList = Arrays.asList(asArray);
+ ObjectMapper om = new ObjectMapper();
+ TypeFactory typeFactory = objectMapper.getTypeFactory();
+ return om.readValue(requestProcessingData.getValue(),
+ typeFactory.constructCollectionType(List.class, ExecuteBuildingBlock.class));
} catch (Exception e) {
logger.error(DATA_LOAD_ERROR, e);
+ throw new RuntimeException("Error Loading Original Request Data", e);
}
+ } else {
+ throw new RuntimeException("Original Request Id is null for record: " + requestId);
}
-
} else {
- logger.debug(REQUEST_ERROR);
+ throw new RuntimeException("Null Request Id Passed in");
}
-
- return asList;
}
public Service getCatalogServiceByModelUUID(String modelUUID) {
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
index be53e505ac..ae7addcc57 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDay.java
@@ -25,6 +25,7 @@ package org.onap.so.bpmn.servicedecomposition.tasks;
import java.util.Map;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.logging.filter.base.ONAPComponentsList;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
@@ -35,8 +36,7 @@ import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
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.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -104,7 +104,7 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default serviceType value
- logger.error("Exception in serviceType retrivel", ex);
+ logger.error("Exception in serviceType retrieval", ex);
}
String vnfType = ASTERISK;
try {
@@ -116,22 +116,21 @@ public class ExecuteBuildingBlockRainyDay {
}
} catch (Exception ex) {
// keep default vnfType value
- logger.error("Exception in vnfType retrivel", ex);
+ logger.error("Exception in vnfType retrieval", ex);
}
String errorCode = ASTERISK;
- try {
+ if (workflowException != null) {
errorCode = "" + workflowException.getErrorCode();
- } catch (Exception ex) {
- // keep default errorCode value
- logger.error("Exception in errorCode retrivel", ex);
+ } else {
+ logger.debug("WorkflowException is null, unable to get error code");
}
try {
errorCode = "" + (String) execution.getVariable("WorkflowExceptionCode");
} catch (Exception ex) {
// keep default errorCode value
- logger.error("Exception in errorCode retrivel", ex);
+ logger.error("Exception in errorCode retrieval", ex);
}
String workStep = ASTERISK;
@@ -139,7 +138,7 @@ public class ExecuteBuildingBlockRainyDay {
workStep = workflowException.getWorkStep();
} catch (Exception ex) {
// keep default workStep value
- logger.error("Exception in workStep retrivel", ex);
+ logger.error("Exception in workStep retrieval", ex);
}
String errorMessage = ASTERISK;
@@ -147,7 +146,7 @@ public class ExecuteBuildingBlockRainyDay {
errorMessage = workflowException.getErrorMessage();
} catch (Exception ex) {
// keep default workStep value
- logger.error("Exception in errorMessage retrivel", ex);
+ logger.error("Exception in errorMessage retrieval", ex);
}
String serviceRole = ASTERISK;
@@ -223,7 +222,7 @@ public class ExecuteBuildingBlockRainyDay {
try {
String requestId = (String) execution.getVariable("mso-request-id");
WorkflowException exception = (WorkflowException) execution.getVariable("WorkflowException");
- TargetEntities extSystemErrorSource = exception.getExtSystemErrorSource();
+ ONAPComponentsList extSystemErrorSource = exception.getExtSystemErrorSource();
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
Boolean isRollbackFailure = (Boolean) execution.getVariable("isRollback");
if (isRollbackFailure == null) {
@@ -244,10 +243,10 @@ public class ExecuteBuildingBlockRainyDay {
} else if (isRollbackFailure) {
logger.debug(
"rollbackExtSystemErrorSource is null for isRollbackFailure. Setting rollbackExtSystemErrorSource to UNKNOWN");
- request.setRollbackExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setRollbackExtSystemErrorSource(Components.UNKNOWN.toString());
} else {
logger.debug("extSystemErrorSource is null. Setting extSystemErrorSource to UNKNOWN");
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
}
request.setLastModifiedBy("CamundaBPMN");
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
index 729f5c95c4..903280ce05 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/client/exception/ExceptionBuilder.java
@@ -26,25 +26,25 @@ import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
-import org.onap.so.logger.LoggingAnchor;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.aai.domain.yang.LInterface;
import org.onap.aai.domain.yang.Vserver;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.core.WorkflowException;
-import org.onap.so.logger.ErrorCode;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.graphinventory.GraphInventoryCommonObjectMapperProvider;
+import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.onap.so.objects.audit.AAIObjectAudit;
import org.onap.so.objects.audit.AAIObjectAuditList;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -92,7 +92,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, Exception exception,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -156,7 +156,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, Exception exception,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String msg = "Exception in %s.%s ";
try {
logger.error("Exception occurred", exception);
@@ -187,6 +187,10 @@ public class ExceptionBuilder {
buildAndThrowWorkflowException(execution, errorCode, msg, extSystemErrorSource);
}
+ /**
+ * @deprecated Please utilize method that specifies where the failure occured
+ */
+ @Deprecated
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage) {
if (execution instanceof DelegateExecutionImpl) {
buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
@@ -195,7 +199,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(BuildingBlockExecution execution, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
if (execution instanceof DelegateExecutionImpl) {
buildAndThrowWorkflowException(((DelegateExecutionImpl) execution).getDelegateExecution(), errorCode,
errorMessage, extSystemErrorSource);
@@ -215,7 +219,7 @@ public class ExceptionBuilder {
}
public void buildAndThrowWorkflowException(DelegateExecution execution, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
String processKey = getProcessKey(execution);
logger.info("Building a WorkflowException for Subflow");
@@ -293,7 +297,7 @@ public class ExceptionBuilder {
execution.setVariable("StatusMessage", errorMessage.toString());
} else {
WorkflowException exception =
- new WorkflowException(processKey, 400, errorMessage.toString(), TargetEntity.SO);
+ new WorkflowException(processKey, 400, errorMessage.toString(), ONAPComponents.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage.toString());
logger.info("Outgoing WorkflowException is {}", exception);
@@ -303,7 +307,7 @@ public class ExceptionBuilder {
} else {
String errorMessage = "Unable to process audit results due to auditInventoryResult being null";
- WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, TargetEntity.SO);
+ WorkflowException exception = new WorkflowException(processKey, 400, errorMessage, ONAPComponents.SO);
execution.setVariable("WorkflowException", exception);
execution.setVariable("WorkflowExceptionErrorMessage", errorMessage);
logger.info("Outgoing WorkflowException is {}", exception);
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
index d7438f80f9..fda6b8e6e3 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/CatalogDbUtilsTest.groovy
@@ -32,7 +32,7 @@ import org.onap.so.bpmn.core.UrnPropertiesReader
import org.onap.so.bpmn.core.json.JsonUtils
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.skyscreamer.jsonassert.JSONAssert
import org.skyscreamer.jsonassert.JSONCompareMode
import org.springframework.core.env.Environment
@@ -127,7 +127,7 @@ class CatalogDbUtilsTest {
private void mockGetResponseFromCatalogDb(String queryEndpoint) {
Environment environmentMock = createEnvironmentMock()
when(environmentMock.getProperty("mso.catalog.db.endpoint")).thenReturn("http://testUrl")
- when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), TargetEntity.CATALOG_DB)).thenReturn(httpClientMock)
+ when(httpClientFactoryMock.newJsonClient(new URL(queryEndpoint), ONAPComponents.CATALOG_DB)).thenReturn(httpClientMock)
Response responseMock = mock(Response.class)
when(httpClientMock.get()).thenReturn(responseMock)
diff --git a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
index 837bc77f19..7abfcffb13 100644
--- a/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
+++ b/bpmn/MSOCommonBPMN/src/test/groovy/org/onap/so/bpmn/common/scripts/ExternalAPIUtilTest.groovy
@@ -26,7 +26,7 @@ import org.junit.Test
import org.onap.logging.ref.slf4j.ONAPLogConstants
import org.onap.so.client.HttpClient
import org.onap.so.client.HttpClientFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.http.HttpStatus
import javax.ws.rs.core.MediaType
@@ -53,7 +53,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
given(httpClient.get()).willReturn(expectedResponse)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient)
// WHEN
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil())
@@ -75,7 +75,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
willThrow(new RuntimeException("error occurred")).given(httpClient).get()
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.EXTERNAL)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.EXTERNAL)).willReturn(httpClient)
DelegateExecution delegateExecution = createDelegateExecution()
DummyExceptionUtil exceptionUtil = new DummyExceptionUtil()
@@ -97,7 +97,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
willThrow(new RuntimeException("error occurred")).given(httpClient).post(BODY_PAYLOAD)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient)
DelegateExecution delegateExecution = createDelegateExecution()
DummyExceptionUtil exceptionUtil = new DummyExceptionUtil()
@@ -120,7 +120,7 @@ class ExternalAPIUtilTest {
HttpClient httpClient = mock(HttpClient.class)
given(httpClient.post(BODY_PAYLOAD)).willReturn(expectedResponse)
HttpClientFactory httpClientFactory = mock(HttpClientFactory.class)
- given(httpClientFactory.newJsonClient(new URL(URL), TargetEntity.AAI)).willReturn(httpClient)
+ given(httpClientFactory.newJsonClient(new URL(URL), ONAPComponents.AAI)).willReturn(httpClient)
// WHEN
ExternalAPIUtil externalAPIUtil = new ExternalAPIUtil(httpClientFactory, new DummyMsoUtils(UUID_STR), new ExceptionUtil())
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
index 6a48558d11..6d5ce622d9 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/ExecuteBuildingBlockRainyDayUnitTest.java
@@ -33,10 +33,11 @@ import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
@RunWith(MockitoJUnitRunner.class)
public class ExecuteBuildingBlockRainyDayUnitTest {
@@ -57,7 +58,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
@Before
public void setup() {
- exception = new WorkflowException("Test exception", 7000, "", "", TargetEntity.SDNC);
+ exception = new WorkflowException("Test exception", 7000, "", "", ONAPComponents.SDNC);
noExtSystemErrorSourceException =
new WorkflowException("Test exception without extsystemErrorSource", 7000, "", "");
@@ -75,7 +76,7 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
execution.setVariable("isRollback", false);
execution.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@@ -87,42 +88,42 @@ public class ExecuteBuildingBlockRainyDayUnitTest {
execution.setVariable("isRollback", true);
execution.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceisRollbackTargetEntityNullTest() {
+ public void updateExtSystemErrorSourceisRollbackONAPComponentsNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
execution.setVariable("isRollback", true);
execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceTargetEntityNullTest() {
+ public void updateExtSystemErrorSourceONAPComponentsNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
execution.setVariable("isRollback", false);
execution.setVariable("WorkflowException", noExtSystemErrorSourceException);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(execution);
- request.setExtSystemErrorSource(TargetEntity.UNKNOWN.toString());
+ request.setExtSystemErrorSource(Components.UNKNOWN.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
@Test
- public void updateExtSystemErrorSourceTargetEntityisRollbackNullTest() {
+ public void updateExtSystemErrorSourceONAPComponentsisRollbackNullTest() {
doReturn(request).when(requestsDbClient).getInfraActiveRequestbyRequestId(msoRequestId);
doNothing().when(requestsDbClient).updateInfraActiveRequests(request);
executionNullisRollback.setVariable("WorkflowException", exception);
executeBuildingBlockRainyDay.updateExtSystemErrorSource(executionNullisRollback);
- request.setExtSystemErrorSource(TargetEntity.SDNC.toString());
+ request.setExtSystemErrorSource(ONAPComponents.SDNC.toString());
verify(requestsDbClient, Mockito.times(1)).updateInfraActiveRequests(request);
}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
index b109ae258d..5baafbba67 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/client/exception/ExceptionBuilderUnitTest.java
@@ -39,7 +39,7 @@ import org.mockito.Mock;
import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
public class ExceptionBuilderUnitTest {
@@ -67,12 +67,12 @@ public class ExceptionBuilderUnitTest {
String expectedErrorMessage =
"Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SDNC);
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(execution, 7000, expectedErrorMessage,
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
}
@Test
@@ -80,12 +80,12 @@ public class ExceptionBuilderUnitTest {
String expectedErrorMessage =
"Exception in org.onap.so.client.exception.ExceptionBuilder.buildAndThrowWorkflowException failure message";
doNothing().when(exceptionBuilder).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
- expectedErrorMessage, TargetEntity.SDNC);
+ expectedErrorMessage, ONAPComponents.SDNC);
- exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(buildingBlockExecution, 7000, e, ONAPComponents.SDNC);
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(buildingBlockExecution, 7000,
- expectedErrorMessage, TargetEntity.SDNC);
+ expectedErrorMessage, ONAPComponents.SDNC);
}
@Test
@@ -93,6 +93,6 @@ public class ExceptionBuilderUnitTest {
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
thrown.expect(BpmnError.class);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
}
}
diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
index 7d5bb0dcf1..f8dfad61f2 100644
--- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
+++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/WorkflowException.java
@@ -21,7 +21,7 @@
package org.onap.so.bpmn.core;
import java.io.Serializable;
-import org.onap.so.utils.TargetEntities;
+import org.onap.logging.filter.base.ONAPComponentsList;
/**
* An object that represents a workflow exception.
@@ -33,7 +33,7 @@ public class WorkflowException implements Serializable {
private final int errorCode;
private final String errorMessage;
private final String workStep;
- private TargetEntities extSystemErrorSource;
+ private ONAPComponentsList extSystemErrorSource;
/**
* Constructor
@@ -50,7 +50,7 @@ public class WorkflowException implements Serializable {
}
public WorkflowException(String processKey, int errorCode, String errorMessage,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
this.processKey = processKey;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
@@ -66,7 +66,7 @@ public class WorkflowException implements Serializable {
}
public WorkflowException(String processKey, int errorCode, String errorMessage, String workStep,
- TargetEntities extSystemErrorSource) {
+ ONAPComponentsList extSystemErrorSource) {
this.processKey = processKey;
this.errorCode = errorCode;
this.errorMessage = errorMessage;
@@ -102,7 +102,7 @@ public class WorkflowException implements Serializable {
return workStep;
}
- public TargetEntities getExtSystemErrorSource() {
+ public ONAPComponentsList getExtSystemErrorSource() {
return extSystemErrorSource;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
index 5f70ab5924..3a1e126fef 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImpl.java
@@ -82,7 +82,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
String correlationValue = messageId;
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "queryVnfNotification")
@@ -117,7 +117,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setOutputs(outputs);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "createVnfNotification")
@@ -150,7 +150,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "updateVnfNotification")
@@ -181,7 +181,7 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setRollback(rollback);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
@WebMethod(operationName = "deleteVnfNotification")
@@ -208,6 +208,6 @@ public class VnfAdapterNotifyServiceImpl extends ProcessEngineAwareService imple
message.setErrorMessage(errorMessage);
callback.handleCallback(method, message, messageEventName, messageVariable, correlationVariable,
- correlationValue, logMarker);
+ correlationValue, logMarker, null);
}
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
index d33e7aed0c..70365b744c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/common/workflow/service/WorkflowProcessor.java
@@ -85,12 +85,14 @@ public class WorkflowProcessor extends ProcessEngineAwareService {
Map<String, Object> inputVariables = new HashMap<>();
@SuppressWarnings("unchecked")
Map<String, Object> vMap = (Map<String, Object>) variableMap.get("variables");
- for (Map.Entry<String, Object> entry : vMap.entrySet()) {
- String vName = entry.getKey();
- Object value = entry.getValue();
- @SuppressWarnings("unchecked")
- Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
- inputVariables.put(vName, valueMap.get("value"));
+ if (vMap != null) {
+ for (Map.Entry<String, Object> entry : vMap.entrySet()) {
+ String vName = entry.getKey();
+ Object value = entry.getValue();
+ @SuppressWarnings("unchecked")
+ Map<String, Object> valueMap = (Map<String, Object>) value; // value, type
+ inputVariables.put(vName, valueMap.get("value"));
+ }
}
return inputVariables;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java
new file mode 100644
index 0000000000..56526c7f89
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutor.java
@@ -0,0 +1,21 @@
+package org.onap.so.bpmn.core.plugins;
+
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.camunda.bpm.engine.impl.bpmn.parser.AbstractBpmnParseListener;
+import org.camunda.bpm.engine.impl.pvm.process.ActivityImpl;
+import org.camunda.bpm.engine.impl.pvm.process.ScopeImpl;
+import org.camunda.bpm.engine.impl.util.xml.Element;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AsyncTaskExecutor extends AbstractBpmnParseListener {
+
+ private void injectTaskExecutorExecutionListener(ActivityImpl activity) {
+ activity.addListener(ExecutionListener.EVENTNAME_END, new AsyncTaskExecutorListener());
+ }
+
+ @Override
+ public void parseEndEvent(Element endEventElement, ScopeImpl scope, ActivityImpl activity) {
+ injectTaskExecutorExecutionListener(activity);
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java
new file mode 100644
index 0000000000..94f4b313d4
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/AsyncTaskExecutorListener.java
@@ -0,0 +1,42 @@
+package org.onap.so.bpmn.core.plugins;
+
+import org.camunda.bpm.engine.RepositoryService;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.engine.delegate.ExecutionListener;
+import org.onap.so.bpmn.common.listener.validation.WorkflowActionListenerRunner;
+import org.onap.so.spring.SpringContextHelper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class AsyncTaskExecutorListener implements ExecutionListener {
+ private final Logger logger = LoggerFactory.getLogger(AsyncTaskExecutorListener.class);
+
+
+ private WorkflowActionListenerRunner listenerRunner;
+
+ @Override
+ public void notify(DelegateExecution execution) throws Exception {
+ if (!isBlank(execution.getCurrentActivityName())) {
+ try {
+ String id = execution.getId();
+ if (id != null) {
+ RepositoryService repositoryService = execution.getProcessEngineServices().getRepositoryService();
+ String processName = repositoryService.createProcessDefinitionQuery()
+ .processDefinitionId(execution.getProcessDefinitionId()).singleResult().getName();
+ logger.info("ProcessName : {}", processName);
+ if (processName != null) {
+ listenerRunner =
+ SpringContextHelper.getAppContext().getBean(WorkflowActionListenerRunner.class);
+ listenerRunner.executeAsyncListeners(processName, execution, ExecutionListener.EVENTNAME_END);
+ }
+ }
+ } catch (Exception e) {
+ logger.error("Error occured in executing Complete Task Listeners", e);
+ }
+ }
+ }
+
+ private boolean isBlank(Object object) {
+ return object == null || "".equals(object.toString().trim());
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java
new file mode 100644
index 0000000000..96c6af42ed
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/core/plugins/BPMNProcessCompletePlugin.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Modifications Copyright (c) 2019 Samsung
+ * ================================================================================
+ * 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.core.plugins;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.camunda.bpm.engine.impl.bpmn.parser.BpmnParseListener;
+import org.camunda.bpm.engine.impl.cfg.AbstractProcessEnginePlugin;
+import org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+
+
+@Component
+public class BPMNProcessCompletePlugin extends AbstractProcessEnginePlugin {
+
+ @Autowired
+ private AsyncTaskExecutor asyncTaskExecutor;
+
+ @Override
+ public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
+ List<BpmnParseListener> preParseListeners = processEngineConfiguration.getCustomPreBPMNParseListeners();
+ if (preParseListeners == null) {
+ preParseListeners = new ArrayList<>();
+ processEngineConfiguration.setCustomPreBPMNParseListeners(preParseListeners);
+ }
+ preParseListeners.add(asyncTaskExecutor);
+ }
+
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
index a049f81906..03feda6d0f 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/CXFConfiguration.java
@@ -38,9 +38,7 @@ import org.onap.so.bpmn.common.workflow.service.WorkflowMessageResource;
import org.onap.so.bpmn.common.workflow.service.WorkflowResource;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingInInterceptor;
import org.onap.so.logging.cxf.interceptor.SOAPLoggingOutInterceptor;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
import org.springframework.context.annotation.Bean;
@@ -65,7 +63,7 @@ public class CXFConfiguration {
private WorkflowAsyncResource workflowAsyncResource;
@Autowired
- private JaxRsFilterLogging jaxRsFilterLogging;
+ private SOAuditLogContainerFilter soAuditLogContainerFilter;
@Autowired
private ObjectMapper mapper;
@@ -108,7 +106,7 @@ public class CXFConfiguration {
endpoint.setServiceBeans(Arrays.<Object>asList(wmr, workflowResource, workflowAsyncResource));
endpoint.setAddress("/");
endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
- endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), jaxRsFilterLogging));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper), soAuditLogContainerFilter));
return endpoint.create();
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index a4fc6e54b0..29fc4e93fc 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -33,7 +33,7 @@ import org.camunda.bpm.engine.repository.DeploymentBuilder;
import org.onap.so.bpmn.common.DefaultToShortClassNameBeanNameGenerator;
import org.onap.so.db.catalog.beans.Workflow;
import org.onap.so.db.catalog.client.CatalogDbClient;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
index a94713e9e0..7a50e5f9d3 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/BPMNUtil.java
@@ -155,24 +155,11 @@ public class BPMNUtil {
}
}
- private static String getProcessInstanceId(HistoryService historyService, String processDefinitionID) {
- List<HistoricProcessInstance> historyList = historyService.createHistoricProcessInstanceQuery().list();
- String pID = null;
- for (HistoricProcessInstance hInstance : historyList) {
- if (hInstance.getProcessDefinitionKey().equals(processDefinitionID)) {
- pID = hInstance.getId();
- break;
- }
- }
- return pID;
- }
-
public static boolean isProcessInstanceFinished(ProcessEngineServices processEngineServices, String pid) {
return processEngineServices.getHistoryService().createHistoricProcessInstanceQuery().processInstanceId(pid)
.finished().count() == 1 ? true : false;
}
-
private static void buildVariable(String key, String value, Map<String, Object> variableValueType) {
Map<String, Object> host = new HashMap<>();
host.put("value", value);
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
new file mode 100644
index 0000000000..d15d71a9e9
--- /dev/null
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/common/workflow/service/VnfAdapterNotifyServiceImplTest.java
@@ -0,0 +1,118 @@
+package org.onap.so.bpmn.common.workflow.service;
+
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.adapter.vnf.CreateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.DeleteVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.MsoExceptionCategory;
+import org.onap.so.bpmn.common.adapter.vnf.QueryVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.RollbackVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.UpdateVnfNotification;
+import org.onap.so.bpmn.common.adapter.vnf.VnfRollback;
+import org.onap.so.bpmn.common.adapter.vnf.VnfStatus;
+import org.onap.so.bpmn.common.workflow.service.CallbackHandlerService.CallbackResult;
+
+@RunWith(MockitoJUnitRunner.class)
+public class VnfAdapterNotifyServiceImplTest {
+
+
+ @InjectMocks
+ @Spy
+ private VnfAdapterNotifyServiceImpl vnfAdapterNotifyServiceImpl;
+
+ @Mock
+ private CallbackHandlerService callbackHandlerService;
+
+ @Mock
+ private CallbackResult callbackResult;
+
+ protected CreateVnfNotification.Outputs outputs = new CreateVnfNotification.Outputs();
+ protected QueryVnfNotification.Outputs queryOutputs = new QueryVnfNotification.Outputs();
+ protected UpdateVnfNotification.Outputs updateOutputs = new UpdateVnfNotification.Outputs();
+
+ protected VnfRollback vnfRollback = new VnfRollback();
+
+ @Test
+ public void rollbackVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.rollbackVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK,
+ "Error creating stack");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("rollbackVnfNotification"),
+ any(RollbackVnfNotification.class), eq("rollbackVnfNotificationCallback"),
+ eq("rollbackVnfNotificationCallback"), eq("VNFRB_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void queryVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.queryVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ Boolean.TRUE, "vnfid", VnfStatus.ACTIVE, queryOutputs);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("queryVnfNotification"),
+ any(QueryVnfNotification.class), eq("queryVnfNotificationCallback"), eq("queryVnfNotificationCallback"),
+ eq("VNFQ_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+
+ @Test
+ public void createVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.createVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ "vnfId", outputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("createVnfNotification"),
+ any(CreateVnfNotification.class), eq("createVnfNotificationCallback"),
+ eq("createVnfNotificationCallback"), eq("VNFC_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void updateVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+
+ vnfAdapterNotifyServiceImpl.updateVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "",
+ updateOutputs, vnfRollback);
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("updateVnfNotification"),
+ any(UpdateVnfNotification.class), eq("updateVnfNotificationCallback"),
+ eq("updateVnfNotificationCallback"), eq("VNFU_messageId"), eq("messageId"), eq("[VNF-NOTIFY]"),
+ eq(null));
+ }
+
+ @Test
+ public void deleteVnfNotificationTest() {
+ doReturn(callbackResult).when(callbackHandlerService).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+
+ vnfAdapterNotifyServiceImpl.deleteVnfNotification("messageId", true, MsoExceptionCategory.OPENSTACK, "");
+
+ verify(callbackHandlerService, times(1)).handleCallback(eq("deleteVnfNotification"),
+ any(DeleteVnfNotification.class), eq("deleteVnfACallback"), eq("deleteVnfACallback"), eq("VNFDEL_uuid"),
+ eq("messageId"), eq("[VNF-NOTIFY]"), eq(null));
+ }
+}
diff --git a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index dd993bca51..078317885c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/mso-infrastructure-bpmn/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -20,9 +20,8 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
-import java.util.HashMap;
+import java.util.Map;
import java.util.Objects;
-import java.util.Optional;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;
@@ -35,8 +34,7 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
index efdee8601e..bb900420e3 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/WorkflowActionBB.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.0.3">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
<bpmn:process id="WorkflowActionBB" name="WorkflowActionBB" isExecutable="true">
<bpmn:startEvent id="Start_WorkflowActionBB" name="start">
<bpmn:outgoing>SequenceFlow_15s0okp</bpmn:outgoing>
@@ -46,7 +46,7 @@
<bpmn:outgoing>SequenceFlow_0l7kaba</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_1m2eezj" name="Completed = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowC">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==false&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==false&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RetrieveBBExectuionList" name="Retrieve BB Execution List" camunda:expression="${WorkflowAction.selectExecutionList(execution)}">
<bpmn:incoming>SequenceFlow_15s0okp</bpmn:incoming>
@@ -54,7 +54,7 @@
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_SendSync" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
<bpmn:incoming>SequenceFlow_0sckerv</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_1wb59ic</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_1lrz41x</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="Task_UpdateRequestComplete" name="Update Request To Complete" camunda:expression="${WorkflowActionBBTasks.updateRequestStatusToComplete(execution)}">
<bpmn:incoming>SequenceFlow_0kf5sen</bpmn:incoming>
@@ -83,7 +83,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_024g0d1" name="no" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_UpdateDb" />
<bpmn:sequenceFlow id="SequenceFlow_0vi883o" name="yes" sourceRef="ExclusiveGateway_10q79b6" targetRef="Task_SendSyncAckError">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==true&amp;&amp;execution.getVariable("sentSyncResponse")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==true&&execution.getVariable("sentSyncResponse")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0eana0l" sourceRef="Task_SendSyncAckError" targetRef="Task_UpdateDb" />
<bpmn:serviceTask id="Task_SendSyncAckError" name="Send Sync Ack API Handler" camunda:asyncAfter="true" camunda:expression="${WorkflowActionBBTasks.sendSyncAck(execution)}">
@@ -92,10 +92,10 @@
</bpmn:serviceTask>
</bpmn:subProcess>
<bpmn:sequenceFlow id="SequenceFlow_0v588sm" name="Rollback = true" sourceRef="ExclusiveGateway_Finished" targetRef="Task_RollbackExecutionPath">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Rollback"||execution.getVariable("handlingCode")=="RollbackToAssigned"||execution.getVariable("handlingCode")=="RollbackToCreated"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1atzsgn" sourceRef="Task_RollbackExecutionPath" targetRef="Task_SelectBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==true}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==true}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_RollbackExecutionPath" name="Rollback Execution Path" camunda:expression="${WorkflowActionBBTasks.rollbackExecutionPath(execution)}">
<bpmn:incoming>SequenceFlow_0v588sm</bpmn:incoming>
@@ -104,7 +104,7 @@
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0vc9go9" sourceRef="Task_RetrieveBBExectuionList" targetRef="ExclusiveGateway_isTopLevelFlow" />
<bpmn:sequenceFlow id="SequenceFlow_11530ei" name="Abort = true" sourceRef="ExclusiveGateway_Finished" targetRef="ExclusiveGateway_isTopLevelFlowAbort">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("handlingCode")=="Abort"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("handlingCode")=="Abort"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_AbortAndCallErrorHandling" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailed(execution)}">
<bpmn:incoming>SequenceFlow_02ksbt0</bpmn:incoming>
@@ -115,7 +115,6 @@
<bpmn:incoming>SequenceFlow_1r570x3</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_1p8yxu6" sourceRef="Task_AbortAndCallErrorHandling" targetRef="EndEvent_0lzz1ya" />
- <bpmn:sequenceFlow id="SequenceFlow_1wb59ic" sourceRef="Task_SendSync" targetRef="Task_PreValidateWorkflow" />
<bpmn:sequenceFlow id="SequenceFlow_01j184u" sourceRef="ExclusiveGateway_Finished" targetRef="Task_0a31dkf" />
<bpmn:serviceTask id="Task_0a31dkf" name="Check Retry Status" camunda:expression="${WorkflowActionBBTasks.checkRetryStatus(execution)}">
<bpmn:incoming>SequenceFlow_01j184u</bpmn:incoming>
@@ -128,7 +127,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0sckerv" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_SendSync" />
<bpmn:sequenceFlow id="SequenceFlow_0unbew4" name="no" sourceRef="ExclusiveGateway_isTopLevelFlow" targetRef="Task_PreValidateWorkflow">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowAbort" name="Is Top-Level Flow?" default="SequenceFlow_02ksbt0">
<bpmn:incoming>SequenceFlow_11530ei</bpmn:incoming>
@@ -137,7 +136,7 @@
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_02ksbt0" name="yes" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="Task_AbortAndCallErrorHandling" />
<bpmn:sequenceFlow id="SequenceFlow_1r570x3" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowAbort" targetRef="EndEvent_0lzz1ya">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:exclusiveGateway id="ExclusiveGateway_isTopLevelFlowC" name="Is Top-Level Flow?" default="SequenceFlow_0kf5sen">
<bpmn:incoming>SequenceFlow_1m2eezj</bpmn:incoming>
@@ -145,13 +144,13 @@
<bpmn:outgoing>SequenceFlow_0kf5sen</bpmn:outgoing>
</bpmn:exclusiveGateway>
<bpmn:sequenceFlow id="SequenceFlow_0x4urgp" name="no" sourceRef="ExclusiveGateway_isTopLevelFlowC" targetRef="End_WorkflowActionBB">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isTopLevelFlow")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isTopLevelFlow")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:endEvent id="End_RollbackFailed" name="end">
<bpmn:incoming>SequenceFlow_1ui67mc</bpmn:incoming>
</bpmn:endEvent>
<bpmn:sequenceFlow id="SequenceFlow_11dlyzt" name="Rollback Not Needed" sourceRef="Task_RollbackExecutionPath" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("isRollbackNeeded")==false}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("isRollbackNeeded")==false}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:serviceTask id="Task_UpdateRequestToFailed" name="Update Request To Failed" camunda:expression="${WorkflowActionBBFailure.updateRequestStatusToFailedWithRollback(execution)}">
<bpmn:incoming>SequenceFlow_11dlyzt</bpmn:incoming>
@@ -159,7 +158,7 @@
<bpmn:outgoing>SequenceFlow_1ui67mc</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:sequenceFlow id="SequenceFlow_0l7kaba" name="Rollback Completed" sourceRef="ExclusiveGateway_Finished" targetRef="Task_UpdateRequestToFailed">
- <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">${execution.getVariable("completed")==true&amp;&amp;execution.getVariable("isRollback")==true&amp;&amp;execution.getVariable("handlingCode")=="Success"}</bpmn:conditionExpression>
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("completed")==true&&execution.getVariable("isRollback")==true&&execution.getVariable("handlingCode")=="Success"}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_1ui67mc" sourceRef="Task_UpdateRequestToFailed" targetRef="End_RollbackFailed" />
<bpmn:subProcess id="SubProcess_0fuugr9" name="Java Exception Handling Sub Process" triggeredByEvent="true">
@@ -186,7 +185,7 @@
<bpmn:sequenceFlow id="SequenceFlow_1tfizxf" sourceRef="Task_PreValidateWorkflow" targetRef="Task_SelectBB" />
<bpmn:serviceTask id="Task_PreValidateWorkflow" name="PreValidate Workflow" camunda:expression="${WorkflowValidatorRunner.preValidate(execution.getVariable(&#34;requestAction&#34;), execution)}">
<bpmn:incoming>SequenceFlow_0unbew4</bpmn:incoming>
- <bpmn:incoming>SequenceFlow_1wb59ic</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_0etawv5</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1tfizxf</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:serviceTask id="ServiceTask_0lbkcyp" name="Post Processing Execute BB" camunda:expression="${WorkflowActionBBTasks.postProcessingExecuteBB(execution)}">
@@ -196,6 +195,19 @@
<bpmn:sequenceFlow id="SequenceFlow_1hsqed1" sourceRef="Call_ExecuteBB" targetRef="ServiceTask_0lbkcyp" />
<bpmn:sequenceFlow id="SequenceFlow_1fftixk" sourceRef="ServiceTask_0lbkcyp" targetRef="ExclusiveGateway_Finished" />
<bpmn:sequenceFlow id="SequenceFlow_1pnkpim" sourceRef="Task_0a31dkf" targetRef="Task_SelectBB" />
+ <bpmn:exclusiveGateway id="ExclusiveGateway_1dez26n" name="Generated Id&#39;s?">
+ <bpmn:incoming>SequenceFlow_1lrz41x</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_0etawv5</bpmn:outgoing>
+ <bpmn:outgoing>SequenceFlow_0ilo6lo</bpmn:outgoing>
+ </bpmn:exclusiveGateway>
+ <bpmn:sequenceFlow id="SequenceFlow_1lrz41x" sourceRef="Task_SendSync" targetRef="ExclusiveGateway_1dez26n" />
+ <bpmn:sequenceFlow id="SequenceFlow_0etawv5" name="no" sourceRef="ExclusiveGateway_1dez26n" targetRef="Task_PreValidateWorkflow">
+ <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[${execution.getVariable("generateIdsOnly") == null || execution.getVariable("generateIdsOnly")==false}]]></bpmn:conditionExpression>
+ </bpmn:sequenceFlow>
+ <bpmn:endEvent id="EndEvent_12f15tu" name="End">
+ <bpmn:incoming>SequenceFlow_0ilo6lo</bpmn:incoming>
+ </bpmn:endEvent>
+ <bpmn:sequenceFlow id="SequenceFlow_0ilo6lo" name="yes" sourceRef="ExclusiveGateway_1dez26n" targetRef="EndEvent_12f15tu" />
</bpmn:process>
<bpmn:error id="Error_0kd2o2a" name="java.lang.Exception" errorCode="java.lang.Exception" />
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
@@ -213,8 +225,8 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_15s0okp_di" bpmnElement="SequenceFlow_15s0okp">
- <di:waypoint x="-398" y="120" />
- <di:waypoint x="-365" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-398" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-365" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-381" y="99" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -223,8 +235,8 @@
<dc:Bounds x="560" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mqrkxv_di" bpmnElement="SequenceFlow_0mqrkxv">
- <di:waypoint x="339" y="120" />
- <di:waypoint x="400" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="400" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="324.5" y="105" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -239,9 +251,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1m2eezj_di" bpmnElement="SequenceFlow_1m2eezj">
- <di:waypoint x="949" y="132" />
- <di:waypoint x="980" y="165" />
- <di:waypoint x="1060" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="949" y="132" />
+ <di:waypoint xsi:type="dc:Point" x="980" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="968" y="168" width="83" height="12" />
</bpmndi:BPMNLabel>
@@ -250,15 +262,15 @@
<dc:Bounds x="-365" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0654g3m_di" bpmnElement="Task_SendSync">
- <dc:Bounds x="-132" y="-6" width="100" height="80" />
+ <dc:Bounds x="-100" y="-76" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ServiceTask_0wzh11j_di" bpmnElement="Task_UpdateRequestComplete">
<dc:Bounds x="1161" y="206" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1pz6edz_di" bpmnElement="SequenceFlow_1pz6edz">
- <di:waypoint x="1261" y="246" />
- <di:waypoint x="1322" y="246" />
- <di:waypoint x="1322" y="183" />
+ <di:waypoint xsi:type="dc:Point" x="1261" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1322" y="183" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1247" y="231" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -279,16 +291,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0v588sm_di" bpmnElement="SequenceFlow_0v588sm">
- <di:waypoint x="936" y="145" />
- <di:waypoint x="936" y="262" />
- <di:waypoint x="339" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="145" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="262" />
+ <di:waypoint xsi:type="dc:Point" x="339" y="262" />
<bpmndi:BPMNLabel>
<dc:Bounds x="769.202380952381" y="272" width="73" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1atzsgn_di" bpmnElement="SequenceFlow_1atzsgn">
- <di:waypoint x="289" y="222" />
- <di:waypoint x="289" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="222" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="160" />
<bpmndi:BPMNLabel>
<dc:Bounds x="259" y="191" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -297,16 +309,16 @@
<dc:Bounds x="239" y="222" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0vc9go9_di" bpmnElement="SequenceFlow_0vc9go9">
- <di:waypoint x="-265" y="120" />
- <di:waypoint x="-228" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-265" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-228" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-246" y="105" width="0" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_11530ei_di" bpmnElement="SequenceFlow_11530ei">
- <di:waypoint x="946" y="105" />
- <di:waypoint x="983" y="44" />
- <di:waypoint x="1060" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="946" y="105" />
+ <di:waypoint xsi:type="dc:Point" x="983" y="44" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="975" y="17" width="58" height="12" />
</bpmndi:BPMNLabel>
@@ -321,28 +333,19 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1p8yxu6_di" bpmnElement="SequenceFlow_1p8yxu6">
- <di:waypoint x="1276" y="-36" />
- <di:waypoint x="1359" y="-36" />
- <di:waypoint x="1359" y="45" />
- <di:waypoint x="1386" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1276" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="1359" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1329" y="5" width="90" height="0" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
- <bpmndi:BPMNEdge id="SequenceFlow_1wb59ic_di" bpmnElement="SequenceFlow_1wb59ic">
- <di:waypoint x="-32" y="34" />
- <di:waypoint x="32" y="34" />
- <di:waypoint x="32" y="120" />
- <di:waypoint x="80" y="120" />
- <bpmndi:BPMNLabel>
- <dc:Bounds x="47" y="77" width="0" height="0" />
- </bpmndi:BPMNLabel>
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_01j184u_di" bpmnElement="SequenceFlow_01j184u">
- <di:waypoint x="936" y="95" />
- <di:waypoint x="936" y="55" />
- <di:waypoint x="936" y="55" />
- <di:waypoint x="936" y="4" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="95" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="55" />
+ <di:waypoint xsi:type="dc:Point" x="936" y="4" />
<bpmndi:BPMNLabel>
<dc:Bounds x="906" y="49" width="90" height="0" />
</bpmndi:BPMNLabel>
@@ -357,16 +360,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0sckerv_di" bpmnElement="SequenceFlow_0sckerv">
- <di:waypoint x="-202" y="96" />
- <di:waypoint x="-202" y="34" />
- <di:waypoint x="-132" y="34" />
+ <di:waypoint xsi:type="dc:Point" x="-202" y="96" />
+ <di:waypoint xsi:type="dc:Point" x="-202" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="-100" y="-36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="-195" y="55.55555555555556" width="18" height="12" />
+ <dc:Bounds x="-195" y="17.612903225806477" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0unbew4_di" bpmnElement="SequenceFlow_0unbew4">
- <di:waypoint x="-178" y="120" />
- <di:waypoint x="80" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="-178" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="80" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="-87" y="99.95468180757382" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -378,16 +381,16 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_02ksbt0_di" bpmnElement="SequenceFlow_02ksbt0">
- <di:waypoint x="1085" y="20" />
- <di:waypoint x="1085" y="-37" />
- <di:waypoint x="1176" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="20" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="-37" />
+ <di:waypoint xsi:type="dc:Point" x="1176" y="-37" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="-8" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1r570x3_di" bpmnElement="SequenceFlow_1r570x3">
- <di:waypoint x="1110" y="45" />
- <di:waypoint x="1386" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="45" />
+ <di:waypoint xsi:type="dc:Point" x="1386" y="45" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1242" y="20" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -399,10 +402,10 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0x4urgp_di" bpmnElement="SequenceFlow_0x4urgp">
- <di:waypoint x="1110" y="165" />
- <di:waypoint x="1220" y="165" />
- <di:waypoint x="1220" y="165" />
- <di:waypoint x="1304" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1110" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1220" y="165" />
+ <di:waypoint xsi:type="dc:Point" x="1304" y="165" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1256" y="140" width="12" height="12" />
</bpmndi:BPMNLabel>
@@ -414,9 +417,9 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11dlyzt_di" bpmnElement="SequenceFlow_11dlyzt">
- <di:waypoint x="289" y="302" />
- <di:waypoint x="289" y="368" />
- <di:waypoint x="960" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="302" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="368" />
+ <di:waypoint xsi:type="dc:Point" x="960" y="368" />
<bpmndi:BPMNLabel>
<dc:Bounds x="381.45685840707966" y="325" width="63" height="24" />
</bpmndi:BPMNLabel>
@@ -428,33 +431,33 @@
<dc:Bounds x="960" y="325" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0l7kaba_di" bpmnElement="SequenceFlow_0l7kaba">
- <di:waypoint x="942" y="139" />
- <di:waypoint x="976" y="252" />
- <di:waypoint x="1016" y="252" />
- <di:waypoint x="1016" y="325" />
+ <di:waypoint xsi:type="dc:Point" x="942" y="139" />
+ <di:waypoint xsi:type="dc:Point" x="976" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="252" />
+ <di:waypoint xsi:type="dc:Point" x="1016" y="325" />
<bpmndi:BPMNLabel>
<dc:Bounds x="959" y="255" width="52" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1edjl5x_di" bpmnElement="SequenceFlow_1edjl5x">
- <di:waypoint x="556" y="657" />
- <di:waypoint x="602" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="556" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="602" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="534" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0wvzfgf_di" bpmnElement="SequenceFlow_0wvzfgf">
- <di:waypoint x="813" y="657" />
- <di:waypoint x="880" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="813" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="880" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="801.5" y="636" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1ui67mc_di" bpmnElement="SequenceFlow_1ui67mc">
- <di:waypoint x="1060" y="365" />
- <di:waypoint x="1134" y="365" />
- <di:waypoint x="1134" y="365" />
- <di:waypoint x="1159" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1060" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1134" y="365" />
+ <di:waypoint xsi:type="dc:Point" x="1159" y="365" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1104" y="359" width="90" height="13" />
</bpmndi:BPMNLabel>
@@ -466,25 +469,25 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_024g0d1_di" bpmnElement="SequenceFlow_024g0d1">
- <di:waypoint x="652" y="657" />
- <di:waypoint x="683" y="657" />
- <di:waypoint x="683" y="657" />
- <di:waypoint x="713" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="652" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="683" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="683" y="657" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="657" />
<bpmndi:BPMNLabel>
<dc:Bounds x="677" y="634" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0vi883o_di" bpmnElement="SequenceFlow_0vi883o">
- <di:waypoint x="627" y="632" />
- <di:waypoint x="627" y="548" />
- <di:waypoint x="713" y="548" />
+ <di:waypoint xsi:type="dc:Point" x="627" y="632" />
+ <di:waypoint xsi:type="dc:Point" x="627" y="548" />
+ <di:waypoint xsi:type="dc:Point" x="713" y="548" />
<bpmndi:BPMNLabel>
<dc:Bounds x="633" y="584" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0eana0l_di" bpmnElement="SequenceFlow_0eana0l">
- <di:waypoint x="763" y="588" />
- <di:waypoint x="763" y="617" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="588" />
+ <di:waypoint xsi:type="dc:Point" x="763" y="617" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="596.5" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -511,15 +514,15 @@
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_11d126w_di" bpmnElement="SequenceFlow_11d126w">
- <di:waypoint x="606" y="875" />
- <di:waypoint x="690" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="606" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="690" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="603" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0w4sx88_di" bpmnElement="SequenceFlow_0w4sx88">
- <di:waypoint x="790" y="875" />
- <di:waypoint x="856" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="790" y="875" />
+ <di:waypoint xsi:type="dc:Point" x="856" y="875" />
<bpmndi:BPMNLabel>
<dc:Bounds x="778" y="854" width="0" height="12" />
</bpmndi:BPMNLabel>
@@ -528,25 +531,25 @@
<dc:Bounds x="400" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0mew9im_di" bpmnElement="SequenceFlow_0mew9im">
- <di:waypoint x="500" y="120" />
- <di:waypoint x="560" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="500" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="560" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="530" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0kf5sen_di" bpmnElement="SequenceFlow_0kf5sen">
- <di:waypoint x="1085" y="190" />
- <di:waypoint x="1085" y="246" />
- <di:waypoint x="1161" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="190" />
+ <di:waypoint xsi:type="dc:Point" x="1085" y="246" />
+ <di:waypoint xsi:type="dc:Point" x="1161" y="246" />
<bpmndi:BPMNLabel>
<dc:Bounds x="1091" y="218" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1tfizxf_di" bpmnElement="SequenceFlow_1tfizxf">
- <di:waypoint x="180" y="120" />
- <di:waypoint x="211" y="120" />
- <di:waypoint x="211" y="120" />
- <di:waypoint x="239" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="180" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="211" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="239" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="226" y="120" width="0" height="0" />
</bpmndi:BPMNLabel>
@@ -558,27 +561,60 @@
<dc:Bounds x="735" y="80" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1hsqed1_di" bpmnElement="SequenceFlow_1hsqed1">
- <di:waypoint x="660" y="120" />
- <di:waypoint x="735" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="660" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="735" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="697.5" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fftixk_di" bpmnElement="SequenceFlow_1fftixk">
- <di:waypoint x="835" y="120" />
- <di:waypoint x="911" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="835" y="120" />
+ <di:waypoint xsi:type="dc:Point" x="911" y="120" />
<bpmndi:BPMNLabel>
<dc:Bounds x="873" y="99" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1pnkpim_di" bpmnElement="SequenceFlow_1pnkpim">
- <di:waypoint x="886" y="-36" />
- <di:waypoint x="289" y="-36" />
- <di:waypoint x="289" y="80" />
+ <di:waypoint xsi:type="dc:Point" x="886" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="289" y="80" />
<bpmndi:BPMNLabel>
<dc:Bounds x="587.5" y="-57" width="0" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ExclusiveGateway_1dez26n_di" bpmnElement="ExclusiveGateway_1dez26n" isMarkerVisible="true">
+ <dc:Bounds x="105" y="-61" width="50" height="50" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="163" y="-48" width="61" height="24" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_1lrz41x_di" bpmnElement="SequenceFlow_1lrz41x">
+ <di:waypoint xsi:type="dc:Point" x="0" y="-36" />
+ <di:waypoint xsi:type="dc:Point" x="105" y="-36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="52.5" y="-57" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_0etawv5_di" bpmnElement="SequenceFlow_0etawv5">
+ <di:waypoint xsi:type="dc:Point" x="130" y="-11" />
+ <di:waypoint xsi:type="dc:Point" x="130" y="80" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="139" y="29" width="12" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="EndEvent_12f15tu_di" bpmnElement="EndEvent_12f15tu">
+ <dc:Bounds x="112" y="-169.83592938733125" width="36" height="36" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="120" y="-195" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_0ilo6lo_di" bpmnElement="SequenceFlow_0ilo6lo">
+ <di:waypoint xsi:type="dc:Point" x="130" y="-61" />
+ <di:waypoint xsi:type="dc:Point" x="130" y="-134" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="136" y="-103" width="19" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
index 901964f465..2e664d90da 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateVFCNSResource.groovy
@@ -37,7 +37,7 @@ import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
* This groovy class supports the <class>DoCreateVFCNetworkServiceInstance.bpmn</class> process.
@@ -273,7 +273,7 @@ public class CreateVFCNSResource extends AbstractServiceTaskProcessor {
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
index 7abdd49d1d..1d3b2757e7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteDeviceResource.groovy
@@ -52,7 +52,7 @@ import org.camunda.bpm.engine.delegate.DelegateExecution
import org.apache.commons.lang3.*
import javax.ws.rs.core.MediaType
import org.apache.commons.codec.binary.Base64
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
index 41a302f5f1..e34e505e55 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateNetworkInstanceRollback.groovy
@@ -35,7 +35,7 @@ import org.onap.so.bpmn.common.scripts.NetworkUtils
import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils
import org.onap.so.bpmn.common.scripts.VidUtils
import org.onap.so.bpmn.core.WorkflowException
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.Response
import org.camunda.bpm.engine.delegate.BpmnError
@@ -199,7 +199,7 @@ public class DoCreateNetworkInstanceRollback extends AbstractServiceTaskProcesso
execution.setVariable(Prefix + "urlRollbackPoNetwork", urlRollbackPoNetwork)
URL url = new URL(urlRollbackPoNetwork)
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER)
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(rollbackNetworkRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
index 1517a335d9..2def9e2d06 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVFCNetworkServiceInstance.groovy
@@ -39,7 +39,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.onap.so.bpmn.core.UrnPropertiesReader
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import javax.ws.rs.core.Response
@@ -258,7 +258,7 @@ public class DoCreateVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
index 731c5b8dc5..dafc4b5470 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateVfModule.groovy
@@ -67,7 +67,7 @@ import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document
import org.w3c.dom.Element
import org.w3c.dom.NamedNodeMap
@@ -698,7 +698,7 @@ public class DoCreateVfModule extends VfModuleBase {
String endPoint = aaiUriUtil.createAaiUri(uri)
try {
- HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
@@ -781,7 +781,7 @@ public class DoCreateVfModule extends VfModuleBase {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectPlurals.VF_MODULE, vnfId).queryParam("vf-module-name",vfModuleName)
String endPoint = aaiUriUtil.createAaiUri(uri)
- HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = httpClientFactory.newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', MediaType.APPLICATION_XML)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
index 34ea20ba62..a24bc4411e 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy
@@ -54,7 +54,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.springframework.web.util.UriUtils
import javax.ws.rs.NotFoundException
@@ -388,7 +388,7 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
String serviceAaiPath = "${aai_endpoint}${urlLink}"
URL url = new URL(serviceAaiPath)
- HttpClient client = new HttpClientFactory().newXmlClient(url, TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(url, ONAPComponents.AAI)
client.addBasicAuthHeader(UrnPropertiesReader.getVariable("aai.auth", execution), UrnPropertiesReader.getVariable("mso.msoKey", execution))
client.addAdditionalHeader("X-FromAppId", "MSO")
client.addAdditionalHeader("X-TransactionId", utils.getRequestID())
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
index df8735aaaa..09eb7994a8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteNetworkInstance.groovy
@@ -51,7 +51,7 @@ import org.slf4j.Logger
import org.slf4j.LoggerFactory
import org.springframework.web.util.UriUtils
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import groovy.json.JsonOutput
import javax.ws.rs.core.Response
@@ -455,7 +455,7 @@ public class DoDeleteNetworkInstance extends AbstractServiceTaskProcessor {
String vnfAdapterRequest = execution.getVariable(Prefix + "deleteNetworkRequest")
URL url = new URL(vnfAdapterUrl)
- HttpClient httpClient = new HttpClientFactory().newXmlClient(url, TargetEntity.OPENSTACK_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newXmlClient(url, ONAPComponents.OPENSTACK_ADAPTER)
httpClient.accept = "application/xml"
httpClient.addAdditionalHeader("Authorization", execution.getVariable("BasicAuthHeaderValuePO"))
Response response = httpClient.delete(vnfAdapterRequest)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
index 00244aded0..28f4460d71 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
@@ -34,7 +34,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri
import org.onap.so.client.aai.entities.uri.AAIUriFactory
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.core.UrnPropertiesReader
import javax.ws.rs.core.Response
@@ -226,7 +226,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
@@ -257,7 +257,7 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
// Get the Basic Auth credentials for the VFCAdapter, username is 'bpel', auth is '07a7159d3bf51a0e53be7a8f89699be7'
// user 'bepl' authHeader is the same with mso.db.auth
String basicAuthValuedb = UrnPropertiesReader.getVariable("mso.db.auth", execution)
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Accept", "application/json")
httpClient.addAdditionalHeader("Authorization", basicAuthValuedb)
httpClient.addAdditionalHeader("Content-Type", "application/json")
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
index 2a8cc08cdf..367975e003 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoScaleVFCNetworkServiceInstance.groovy
@@ -51,7 +51,7 @@ import org.onap.so.bpmn.infrastructure.vfcmodel.LocationConstraint
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
@@ -209,7 +209,7 @@ public class DoScaleVFCNetworkServiceInstance extends AbstractServiceTaskProcess
try{
URL url = new URL(urlString);
- HttpClient httpClient = new HttpClientFactory().newJsonClient(url, TargetEntity.VNF_ADAPTER)
+ HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.VNF_ADAPTER)
httpClient.addAdditionalHeader("Authorization", "Basic QlBFTENsaWVudDpwYXNzd29yZDEk")
apiResponse = httpClient.post(requestBody)
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
index 75ac6900fa..cfdba89db7 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoUpdateVnfAndModules.groovy
@@ -45,7 +45,7 @@ import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.logger.MessageEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
-import org.onap.so.utils.TargetEntity
+import org.onap.logging.filter.base.ONAPComponents;
/**
* This class supports the VID Flow
@@ -164,7 +164,7 @@ class DoUpdateVnfAndModules extends AbstractServiceTaskProcessor {
logger.debug("AAI endPoint: " + endPoint)
try {
- HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), TargetEntity.AAI)
+ HttpClient client = new HttpClientFactory().newXmlClient(new URL(endPoint), ONAPComponents.AAI)
client.addAdditionalHeader('X-TransactionId', UUID.randomUUID().toString())
client.addAdditionalHeader('X-FromAppId', 'MSO')
client.addAdditionalHeader('Content-Type', 'application/xml')
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
index 2ababac7e3..a55f32aaaa 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/InformDmaapClient.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,14 +21,12 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import java.util.Map;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.camunda.bpm.engine.runtime.Execution;
-import org.onap.aai.domain.yang.v13.Metadatum;
import org.onap.so.bpmn.common.recipe.ResourceInput;
import org.onap.so.bpmn.common.resource.ResourceRequestBuilder;
-import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,7 +38,7 @@ import java.util.Optional;
@Component
public class InformDmaapClient implements JavaDelegate {
- private Logger logger = LoggerFactory.getLogger(getClass());
+ private static final Logger LOGGER = LoggerFactory.getLogger(InformDmaapClient.class);
private DmaapClient dmaapClient;
@Override
@@ -47,25 +46,34 @@ public class InformDmaapClient implements JavaDelegate {
String pnfCorrelationId = (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID);
RuntimeService runtimeService = execution.getProcessEngineServices().getRuntimeService();
String processBusinessKey = execution.getProcessBusinessKey();
- HashMap<String, String> updateInfo = createUpdateInfo(execution);
- updateInfo.put("pnfCorrelationId", pnfCorrelationId);
- dmaapClient
- .registerForUpdate(pnfCorrelationId,
- () -> runtimeService.createMessageCorrelation("WorkflowMessage")
- .processInstanceBusinessKey(processBusinessKey).correlateWithResult(),
- Optional.of(updateInfo));
+ dmaapClient.registerForUpdate(pnfCorrelationId,
+ () -> runtimeService.createMessageCorrelation("WorkflowMessage")
+ .processInstanceBusinessKey(processBusinessKey).correlateWithResult(),
+ createUpdateInfoMap(execution));
}
- private HashMap<String, String> createUpdateInfo(DelegateExecution execution) {
- HashMap<String, String> map = new HashMap();
-
- ResourceInput resourceInputObj = ResourceRequestBuilder
+ private Map<String, String> createUpdateInfoMap(DelegateExecution execution) {
+ Map<String, String> updateInfoMap = new HashMap<>();
+ updateInfoMap.put("pnfCorrelationId",
+ (String) execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID));
+ getResourceInput(execution).ifPresent(resourceInput -> {
+ updateInfoMap.put("globalSubscriberID", resourceInput.getGlobalSubscriberId());
+ updateInfoMap.put("serviceType", resourceInput.getServiceType());
+ updateInfoMap.put("serviceInstanceId", resourceInput.getServiceInstanceId());
+ });
+ return updateInfoMap;
+ }
- .getJsonObject((String) execution.getVariable("resourceInput"), ResourceInput.class);
- map.put("globalSubscriberID", resourceInputObj.getGlobalSubscriberId());
- map.put("serviceType", resourceInputObj.getServiceType());
- map.put("serviceInstanceId", resourceInputObj.getServiceInstanceId());
- return map;
+ private Optional<ResourceInput> getResourceInput(DelegateExecution execution) {
+ ResourceInput resourceInput = null;
+ if (execution.getVariable("resourceInput") != null) {
+ resourceInput = ResourceRequestBuilder.getJsonObject((String) execution.getVariable("resourceInput"),
+ ResourceInput.class);
+ } else {
+ LOGGER.warn("resourceInput value is null for correlation id: {}",
+ execution.getVariable(ExecutionVariableNames.PNF_CORRELATION_ID));
+ }
+ return Optional.ofNullable(resourceInput);
}
@Autowired
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
index d513684659..bafb749e15 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/DmaapClient.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,13 +21,11 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
-import java.util.HashMap;
-import java.util.Optional;
+import java.util.Map;
public interface DmaapClient {
- void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo);
+ void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo);
Runnable unregister(String pnfCorrelationId);
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
index 8010ce62ab..a932e4ac50 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationId.java
@@ -28,6 +28,7 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.Spliterator;
@@ -41,6 +42,9 @@ public final class JsonUtilForPnfCorrelationId {
}
static List<String> parseJsonToGelAllPnfCorrelationId(String json) {
+ if (json == null || json.isEmpty()) {
+ return Collections.emptyList();
+ }
JsonElement je = new JsonParser().parse(json);
JsonArray array = je.getAsJsonArray();
List<String> list = new ArrayList<>();
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
index 48061db887..bd1a45c64d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClient.java
@@ -23,12 +23,14 @@
package org.onap.so.bpmn.infrastructure.pnf.dmaap;
import java.io.IOException;
+import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpResponse;
+import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.impl.client.HttpClientBuilder;
@@ -42,6 +44,7 @@ import org.onap.so.client.aai.entities.uri.AAIResourceUri;
import org.onap.so.client.aai.entities.uri.AAIUriFactory;
import org.onap.so.client.aai.AAIResourcesClient;
import org.onap.so.client.aai.AAIObjectType;
+import static org.onap.so.bpmn.infrastructure.pnf.dmaap.JsonUtilForPnfCorrelationId.*;
@Component
public class PnfEventReadyDmaapClient implements DmaapClient {
@@ -54,8 +57,7 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
private int topicListenerDelayInSeconds;
private volatile ScheduledThreadPoolExecutor executor;
private volatile boolean dmaapThreadListenerIsRunning;
-
- public volatile List<HashMap<String, String>> updateInfoMap;
+ private volatile List<Map<String, String>> listOfUpdateInfoMap;
@Autowired
public PnfEventReadyDmaapClient(Environment env) {
@@ -68,18 +70,15 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
.port(env.getProperty("pnf.dmaap.port", Integer.class)).path(env.getProperty("pnf.dmaap.topicName"))
.path(env.getProperty("pnf.dmaap.consumerGroup")).path(env.getProperty("pnf.dmaap.consumerId"))
.build());
- updateInfoMap = new ArrayList<>();
+ listOfUpdateInfoMap = new ArrayList<>();
}
@Override
public synchronized void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo) {
+ Map<String, String> updateInfo) {
logger.debug("registering for pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
- HashMap<String, String> map = updateInfo.get();
- if (map != null && map.size() > 0) {
- synchronized (updateInfoMap) {
- updateInfoMap.add(map);
- }
+ synchronized (listOfUpdateInfoMap) {
+ listOfUpdateInfoMap.add(updateInfo);
}
pnfCorrelationIdToThreadMap.put(pnfCorrelationId, informConsumer);
if (!dmaapThreadListenerIsRunning) {
@@ -91,14 +90,14 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
public synchronized Runnable unregister(String pnfCorrelationId) {
logger.debug("unregistering from pnf ready dmaap event for pnf correlation id: {}", pnfCorrelationId);
Runnable runnable = pnfCorrelationIdToThreadMap.remove(pnfCorrelationId);
- synchronized (updateInfoMap) {
- for (int i = updateInfoMap.size() - 1; i >= 0; i--) {
- if (!updateInfoMap.get(i).containsKey("pnfCorrelationId"))
+ synchronized (listOfUpdateInfoMap) {
+ for (int i = listOfUpdateInfoMap.size() - 1; i >= 0; i--) {
+ if (!listOfUpdateInfoMap.get(i).containsKey("pnfCorrelationId"))
continue;
- String id = updateInfoMap.get(i).get("pnfCorrelationId");
+ String id = listOfUpdateInfoMap.get(i).get("pnfCorrelationId");
if (id != pnfCorrelationId)
continue;
- updateInfoMap.remove(i);
+ listOfUpdateInfoMap.remove(i);
}
}
if (pnfCorrelationIdToThreadMap.isEmpty()) {
@@ -133,15 +132,10 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
try {
logger.debug("dmaap listener starts listening pnf ready dmaap topic");
HttpResponse response = httpClient.execute(getRequest);
- List<String> idList = getPnfCorrelationIdListFromResponse(response);
-
- // idList is never null
- if (!idList.isEmpty()) {
- // send only body of response
- registerClientResponse(idList.get(0), EntityUtils.toString(response.getEntity(), "UTF-8"));
- }
-
- if (idList != null) {
+ if (response.getStatusLine().getStatusCode() == HttpStatus.SC_OK) {
+ String responseString = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
+ List<String> idList = parseJsonToGelAllPnfCorrelationId(responseString);
+ idList.stream().findFirst().ifPresent(id -> registerClientResponse(id, responseString));
idList.forEach(this::informAboutPnfReadyIfPnfCorrelationIdFound);
}
} catch (IOException e) {
@@ -151,16 +145,6 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
}
}
- private List<String> getPnfCorrelationIdListFromResponse(HttpResponse response) throws IOException {
- if (response.getStatusLine().getStatusCode() == 200) {
- String responseString = EntityUtils.toString(response.getEntity(), "UTF-8");
- if (responseString != null) {
- return JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(responseString);
- }
- }
- return Collections.emptyList();
- }
-
private void informAboutPnfReadyIfPnfCorrelationIdFound(String pnfCorrelationId) {
Runnable runnable = unregister(pnfCorrelationId);
if (runnable != null) {
@@ -174,8 +158,8 @@ public class PnfEventReadyDmaapClient implements DmaapClient {
String customerId = null;
String serviceType = null;
String serId = null;
- synchronized (updateInfoMap) {
- for (HashMap<String, String> map : updateInfoMap) {
+ synchronized (listOfUpdateInfoMap) {
+ for (Map<String, String> map : listOfUpdateInfoMap) {
if (!map.containsKey("pnfCorrelationId"))
continue;
if (pnfCorrelationId != map.get("pnfCorrelationId"))
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
index afbace76d6..715a7dff6d 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCompareServiceInstanceDataTest.groovy
@@ -1,3 +1,23 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 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.scripts
import org.camunda.bpm.engine.delegate.BpmnError
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
index 2634f03d4b..598582bfd8 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/DmaapClientTestImpl.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,10 +21,9 @@
package org.onap.so.bpmn.infrastructure.pnf.delegate;
+import java.util.Map;
import org.onap.so.bpmn.infrastructure.pnf.dmaap.DmaapClient;
-import java.util.HashMap;
import java.util.Objects;
-import java.util.Optional;
public class DmaapClientTestImpl implements DmaapClient {
@@ -31,8 +31,7 @@ public class DmaapClientTestImpl implements DmaapClient {
private Runnable informConsumer;
@Override
- public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer,
- Optional<HashMap<String, String>> updateInfo) {
+ public void registerForUpdate(String pnfCorrelationId, Runnable informConsumer, Map<String, String> updateInfo) {
this.pnfCorrelationId = pnfCorrelationId;
this.informConsumer = informConsumer;
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
index 8741208d26..4edee24531 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/JsonUtilForPnfCorrelationIdTest.java
@@ -63,4 +63,13 @@ public class JsonUtilForPnfCorrelationIdTest {
assertThat(expectedResult).isEmpty();
}
+ @Test
+ public void shouldReturnEmptyListWhenInputIsNull() {
+ assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId(null)).isEmpty();
+ }
+
+ @Test
+ public void shouldReturnEmptyListWhenInputIsEmpty() {
+ assertThat(JsonUtilForPnfCorrelationId.parseJsonToGelAllPnfCorrelationId("")).isEmpty();
+ }
}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
index 19e08d9d59..cccfe0c762 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/dmaap/PnfEventReadyDmaapClientTest.java
@@ -30,8 +30,8 @@ import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.verifyZeroInteractions;
import static org.mockito.Mockito.when;
+import java.io.ByteArrayInputStream;
import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -41,7 +41,7 @@ import org.apache.http.HttpResponse;
import org.apache.http.ProtocolVersion;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
-import org.apache.http.entity.StringEntity;
+import org.apache.http.entity.InputStreamEntity;
import org.apache.http.message.BasicHttpResponse;
import org.junit.Before;
import org.junit.Test;
@@ -182,8 +182,8 @@ public class PnfEventReadyDmaapClientTest {
threadRunFlag.setAccessible(false);
}
- private HttpResponse createResponse(String json) throws UnsupportedEncodingException {
- HttpEntity entity = new StringEntity(json);
+ private HttpResponse createResponse(String json) {
+ HttpEntity entity = new InputStreamEntity(new ByteArrayInputStream(json.getBytes()));
ProtocolVersion protocolVersion = new ProtocolVersion("", 1, 1);
HttpResponse response = new BasicHttpResponse(protocolVersion, 1, "");
response.setEntity(entity);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
index 4e74e5d414..c223d3ff11 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/HomingV2.java
@@ -2,14 +2,15 @@
* ============LICENSE_START=======================================================
* ONAP - SO
* ================================================================================
- * Copyright (C) Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2018 Bell Canada.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,7 +21,6 @@
package org.onap.so.bpmn.buildingblock;
-import java.util.Map;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -28,37 +28,37 @@ import org.springframework.stereotype.Component;
@Component
public class HomingV2 {
- @Autowired
- private OofHomingV2 oofHomingV2;
- @Autowired
+ static final String HOMING_SNIRO = "sniro";
+ static final String HOMING_OOF = "oof";
+ static final String HOMING_SOLUTION = "Homing_Solution";
+
private SniroHomingV2 sniroHomingV2;
+ private OofHomingV2 oofHomingV2;
- private static final String HOMINGSOLUTION = "Homing_Solution";
+ @Autowired
+ public HomingV2(OofHomingV2 oofHomingV2, SniroHomingV2 sniroHomingV2) {
+ this.oofHomingV2 = oofHomingV2;
+ this.sniroHomingV2 = sniroHomingV2;
+ }
public void callHoming(BuildingBlockExecution execution) {
- if (isOof(execution)) {
- oofHomingV2.callOof(execution);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.callSniro(execution);
+ } else {
+ oofHomingV2.callOof(execution);
}
}
public void processSolution(BuildingBlockExecution execution, String asyncResponse) {
- if (isOof(execution)) {
- oofHomingV2.processSolution(execution, asyncResponse);
- } else {
+ if (isSniro(execution)) {
sniroHomingV2.processSolution(execution, asyncResponse);
+ } else {
+ oofHomingV2.processSolution(execution, asyncResponse);
}
}
- // Default solution is SNIRO. OOF gets called only if specified.
- private boolean isOof(BuildingBlockExecution execution) {
- for (Map<String, Object> params : execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters()
- .getUserParams()) {
- if (params.containsKey(HOMINGSOLUTION) && ("oof").equals(params.get(HOMINGSOLUTION))) {
- return true;
- }
- }
- return false;
+ private boolean isSniro(BuildingBlockExecution execution) {
+ return execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams().stream()
+ .anyMatch(params -> HOMING_SNIRO.equals(params.get(HOMING_SOLUTION)));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
index f1fd23fe82..f10b503ed3 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/buildingblock/SniroHomingV2.java
@@ -65,7 +65,7 @@ import org.onap.so.client.sniro.beans.ServiceInfo;
import org.onap.so.client.sniro.beans.SniroManagerRequest;
import org.onap.so.client.sniro.beans.SubscriberInfo;
import org.onap.so.db.catalog.beans.OrchestrationStatus;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -162,14 +162,14 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
- "Internal Error - occurred while preparing sniro request: " + e.getMessage(), TargetEntity.SO);
+ "Internal Error - occurred while preparing sniro request: " + e.getMessage(), ONAPComponents.SO);
}
}
@@ -214,15 +214,15 @@ public class SniroHomingV2 {
} catch (BpmnError e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, Integer.parseInt(e.getErrorCode()), e.getMessage(),
- TargetEntity.SNIRO);
+ ONAPComponents.SNIRO);
} catch (BadResponseException e) {
logger.error(EXCEPTION_OCCURRED, e);
- exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), TargetEntity.SNIRO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 400, e.getMessage(), ONAPComponents.SNIRO);
} catch (Exception e) {
logger.error(EXCEPTION_OCCURRED, e);
exceptionUtil.buildAndThrowWorkflowException(execution, INTERNAL,
"Internal Error - occurred while processing sniro asynchronous response: " + e.getMessage(),
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
index d9c6857ef1..0c31dfa16f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivity.java
@@ -138,7 +138,9 @@ public class ExecuteActivity implements JavaDelegate {
execution.setVariable(WORKFLOW_EXCEPTION, workflowException);
} catch (Exception e) {
- buildAndThrowException(execution, e.getMessage());
+ logger.error("BPMN exception on activity execution: " + e.getMessage());
+ workflowException = new WorkflowException(EXECUTE_BUILDING_BLOCK, 7000, e.getMessage());
+ handlingCode = ABORT_HANDLING_CODE;
}
if (workflowException != null && handlingCode != null && handlingCode.equals(ABORT_HANDLING_CODE)) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
index e9d33f46ab..2705d00d6b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1.java
@@ -38,11 +38,12 @@ import org.onap.so.adapters.nwrest.UpdateNetworkRequest;
import org.onap.so.adapters.nwrest.UpdateNetworkResponse;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.NetworkAdapterResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
+import org.onap.so.utils.Components;
@Component
public class NetworkAdapterRestV1 {
@@ -94,7 +95,7 @@ public class NetworkAdapterRestV1 {
throw new Exception("No Network Request was created. networkAdapterRequest was null.");
}
} catch (Exception ex) {
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -139,7 +140,7 @@ public class NetworkAdapterRestV1 {
}
} catch (Exception e) {
logger.error("Error in Openstack Adapter callback", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), Components.OPENSTACK);
}
}
@@ -152,7 +153,7 @@ public class NetworkAdapterRestV1 {
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on Openstack Async-Response", TargetEntity.SO);
+ "Error timed out waiting on Openstack Async-Response", ONAPComponents.SO);
}
public void handleSyncError(DelegateExecution execution) {
@@ -160,6 +161,6 @@ public class NetworkAdapterRestV1 {
String responseString = (String) execution.getVariable(NETWORK_SYNC_RESPONSE);
String errorMessage = "Error with Openstack Adapter Sync Request: StatusCode = " + statusCode + " Response = "
+ responseString;
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, TargetEntity.OPENSTACK);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, errorMessage, Components.OPENSTACK);
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
index 127d21c0ed..79ccd9216f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasks.java
@@ -24,6 +24,7 @@ package org.onap.so.bpmn.infrastructure.appc.tasks;
import java.util.HashMap;
import java.util.List;
+import java.util.Map;
import java.util.Optional;
import org.onap.so.logger.LoggingAnchor;
import org.json.JSONArray;
@@ -31,6 +32,7 @@ import org.json.JSONObject;
import org.onap.aai.domain.yang.Vserver;
import org.onap.appc.client.lcm.model.Action;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.json.JsonUtils;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
@@ -60,6 +62,8 @@ public class AppcRunTasks {
public static final String ROLLBACK_VNF_STOP = "rollbackVnfStop";
public static final String ROLLBACK_VNF_LOCK = "rollbackVnfLock";
public static final String ROLLBACK_QUIESCE_TRAFFIC = "rollbackQuiesceTraffic";
+ public static final String CONTROLLER_TYPE_DEFAULT = "APPC";
+ public static final String GENERIC_APPC_ERROR_CODE = "1002";
@Autowired
private ExceptionBuilder exceptionUtil;
@Autowired
@@ -139,7 +143,12 @@ public class AppcRunTasks {
ControllerSelectionReference controllerSelectionReference = catalogDbClient
.getControllerSelectionReferenceByVnfTypeAndActionCategory(vnfType, action.toString());
- String controllerType = controllerSelectionReference.getControllerName();
+ String controllerType = null;
+ if (controllerSelectionReference != null) {
+ controllerType = controllerSelectionReference.getControllerName();
+ } else {
+ controllerType = CONTROLLER_TYPE_DEFAULT;
+ }
String vfModuleId = null;
VfModule vfModule = null;
@@ -153,12 +162,16 @@ public class AppcRunTasks {
HashMap<String, String> payloadInfo = buildPayloadInfo(vnfName, aicIdentity, vnfHostIpAddress, vmIdList,
vserverIdList, identityUrl, vfModuleId);
- Optional<String> payload = null;
+ Optional<String> payload = Optional.empty();
RequestParameters requestParameters = gBBInput.getRequestContext().getRequestParameters();
if (requestParameters != null) {
String pay = requestParameters.getPayload();
if (pay != null) {
payload = Optional.of(pay);
+ } else {
+ String payloadFromUserParams =
+ buildPayloadFromUserParams(gBBInput.getRequestContext().getUserParams());
+ payload = Optional.of(payloadFromUserParams);
}
}
logger.debug("Running APP-C action: {}", action.toString());
@@ -169,7 +182,9 @@ public class AppcRunTasks {
mapRollbackVariables(execution, action, appcCode);
} catch (Exception e) {
logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION.toString(),
- "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(), "APPC Error", e);
+ "Caught exception in runAppcCommand", "BPMN", ErrorCode.UnknownError.getValue(),
+ "Error on request to APPC", e);
+ appcCode = GENERIC_APPC_ERROR_CODE;
appcMessage = e.getMessage();
}
@@ -212,6 +227,21 @@ public class AppcRunTasks {
return payloadInfo;
}
+ protected String buildPayloadFromUserParams(Map<String, Object> userParams) {
+ if (userParams == null || userParams.size() == 0) {
+ return null;
+ }
+
+ String payload = "{}";
+ for (Map.Entry<String, Object> entry : userParams.entrySet()) {
+ payload = JsonUtils.addJsonValue(payload, entry.getKey(), (String) entry.getValue());
+ }
+
+ payload = payload.replaceAll("\"", "\\\\\"");
+ payload = payload.replaceAll("\n", "");
+ return payload;
+ }
+
protected void getVserversForAppc(BuildingBlockExecution execution, GenericVnf vnf) throws Exception {
AAIResultWrapper aaiRW = aaiVnfResources.queryVnfWrapperById(vnf);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
new file mode 100644
index 0000000000..566cdccd50
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/exceptions/UnassignNetworkException.java
@@ -0,0 +1,14 @@
+package org.onap.so.bpmn.infrastructure.flowspecific.exceptions;
+
+public class UnassignNetworkException extends Exception {
+
+ private static final long serialVersionUID = 2864418350216433736L;
+
+ public UnassignNetworkException() {
+ super();
+ }
+
+ public UnassignNetworkException(String message) {
+ super(message);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
index bc71fc6f67..9413e8ef2e 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnf.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 TechMahindra.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,8 +21,10 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
+import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
import java.util.Map;
+import java.util.Optional;
import java.util.UUID;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
@@ -33,15 +36,15 @@ import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
import org.onap.so.client.cds.beans.ConfigAssignPropertiesForVnf;
import org.onap.so.client.cds.beans.ConfigAssignRequestVnf;
import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.serviceinstancebeans.Service;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
- *
* Get vnf related data and config assign
- *
*/
@Component
public class ConfigAssignVnf {
@@ -51,48 +54,42 @@ public class ConfigAssignVnf {
private static final String ACTION_NAME = "config-assign";
private static final String MODE = "sync";
+ private final ExtractPojosForBB extractPojosForBB;
+ private final ExceptionBuilder exceptionBuilder;
+
@Autowired
- private ExceptionBuilder exceptionUtil;
- @Autowired
- private ExtractPojosForBB extractPojosForBB;
+ public ConfigAssignVnf(ExtractPojosForBB extractPojosForBB, ExceptionBuilder exceptionBuilder) {
+ this.extractPojosForBB = extractPojosForBB;
+ this.exceptionBuilder = exceptionBuilder;
+ }
/**
* Getting the vnf data, blueprint name, blueprint version etc and setting them in execution object and calling the
* subprocess.
- *
- * @param execution
*/
public void preProcessAbstractCDSProcessing(BuildingBlockExecution execution) {
logger.info("Start preProcessAbstractCDSProcessing ");
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
ServiceInstance serviceInstance =
extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
-
- List<Map<String, Object>> userParams =
- execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams();
-
ConfigAssignPropertiesForVnf configAssignPropertiesForVnf = new ConfigAssignPropertiesForVnf();
configAssignPropertiesForVnf.setServiceInstanceId(serviceInstance.getServiceInstanceId());
configAssignPropertiesForVnf
.setServiceModelUuid(serviceInstance.getModelInfoServiceInstance().getModelUuid());
configAssignPropertiesForVnf
- .setVnfCustomizationUuid(vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
- configAssignPropertiesForVnf.setVnfId(vnf.getVnfId());
- configAssignPropertiesForVnf.setVnfName(vnf.getVnfName());
-
- for (Map<String, Object> params : userParams) {
- for (Map.Entry<String, Object> entry : params.entrySet()) {
- configAssignPropertiesForVnf.setUserParam(entry.getKey(), entry.getValue());
- }
- }
-
+ .setVnfCustomizationUuid(genericVnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ configAssignPropertiesForVnf.setVnfId(genericVnf.getVnfId());
+ configAssignPropertiesForVnf.setVnfName(genericVnf.getVnfName());
+ setUserParamsInConfigAssignPropertiesForVnf(configAssignPropertiesForVnf,
+ execution.getGeneralBuildingBlock().getRequestContext().getRequestParameters().getUserParams(),
+ genericVnf);
ConfigAssignRequestVnf configAssignRequestVnf = new ConfigAssignRequestVnf();
- configAssignRequestVnf.setResolutionKey(vnf.getVnfName());
+ configAssignRequestVnf.setResolutionKey(genericVnf.getVnfName());
configAssignRequestVnf.setConfigAssignPropertiesForVnf(configAssignPropertiesForVnf);
- String blueprintName = vnf.getModelInfoGenericVnf().getBlueprintName();
- String blueprintVersion = vnf.getModelInfoGenericVnf().getBlueprintVersion();
+ String blueprintName = genericVnf.getModelInfoGenericVnf().getBlueprintName();
+ String blueprintVersion = genericVnf.getModelInfoGenericVnf().getBlueprintVersion();
logger.debug(" BlueprintName : " + blueprintName + " BlueprintVersion : " + blueprintVersion);
AbstractCDSPropertiesBean abstractCDSPropertiesBean = new AbstractCDSPropertiesBean();
@@ -109,9 +106,48 @@ public class ConfigAssignVnf {
abstractCDSPropertiesBean.setActionName(ACTION_NAME);
abstractCDSPropertiesBean.setMode(MODE);
execution.setVariable("executionObject", abstractCDSPropertiesBean);
-
} catch (Exception ex) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
+ logger.error("An exception occurred when creating ConfigAssignPropertiesForVnf for CDS request", ex);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, ex);
+ }
+ }
+
+ private void setUserParamsInConfigAssignPropertiesForVnf(ConfigAssignPropertiesForVnf configAssignProperties,
+ List<Map<String, Object>> userParamsFromRequest, GenericVnf vnf) throws Exception {
+ Service service = getServiceFromRequestUserParams(userParamsFromRequest);
+ List<Map<String, String>> instanceParamsList =
+ getInstanceParamForVnf(service, vnf.getModelInfoGenericVnf().getModelCustomizationUuid());
+ instanceParamsList
+ .forEach(instanceParamsMap -> instanceParamsMap.forEach(configAssignProperties::setUserParam));
+ }
+
+ private Service getServiceFromRequestUserParams(List<Map<String, Object>> userParams) throws Exception {
+ Map<String, Object> serviceMap = userParams.stream().filter(key -> key.containsKey("service")).findFirst()
+ .orElseThrow(() -> new Exception("Can not find service in userParams section in generalBuildingBlock"));
+ return convertServiceFromJsonToServiceObject((String) serviceMap.get("service"));
+ }
+
+ private Service convertServiceFromJsonToServiceObject(String serviceFromJson) throws Exception {
+ try {
+ return new ObjectMapper().readValue(serviceFromJson, Service.class);
+ } catch (Exception e) {
+ logger.error(String.format(
+ "An exception occurred while converting json object to Service object. The json is: %s",
+ serviceFromJson), e);
+ throw e;
+ }
+ }
+
+ private List<Map<String, String>> getInstanceParamForVnf(Service service, String genericVnfModelCustomizationUuid)
+ throws Exception {
+ Optional<Vnfs> foundedVnf = service.getResources().getVnfs().stream()
+ .filter(vnfs -> vnfs.getModelInfo().getModelCustomizationId().equals(genericVnfModelCustomizationUuid))
+ .findFirst();
+ if (foundedVnf.isPresent()) {
+ return foundedVnf.get().getInstanceParams();
+ } else {
+ throw new Exception(String.format("Can not find vnf for genericVnfModelCustomizationUuid: %s",
+ genericVnfModelCustomizationUuid));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
index c9a937b824..f95e7afed9 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBB.java
@@ -24,19 +24,22 @@ package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
import java.util.Optional;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.flowspecific.exceptions.UnassignNetworkException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.AAINetworkResources;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class UnassignNetworkBB {
-
+ private static final Logger logger = LoggerFactory.getLogger(UnassignNetworkBB.class);
private static String messageCannotPerformUnassign =
"Cannot perform Unassign Network. Network is still related to ";
private static String messageErrorRollback = " Rollback is not possible. Please restore data manually.";
@@ -71,7 +74,8 @@ public class UnassignNetworkBB {
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg);
+ logger.error("ErrorUnassignNetworkBB: {}", msg);
+ throw new UnassignNetworkException(msg);
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
index 080d6d34b1..192cb3fc90 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasks.java
@@ -32,7 +32,7 @@ import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.orchestration.SDNCVnfResources;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.client.orchestration.SDNCVfModuleResources;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -80,13 +80,13 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
@@ -121,9 +121,9 @@ public class SDNCQueryTasks {
} catch (BadResponseException ex) {
logger.error("Exception occurred for BadResponse ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
@@ -158,18 +158,18 @@ public class SDNCQueryTasks {
// module id, then we should throw
// the error as normal
if (!ResourceKey.VF_MODULE_ID.equals(bbException.getResourceKey())) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, bbException, ONAPComponents.SO);
}
} catch (BadResponseException ex) {
logger.error("Error occurred for BadResponseException in SDNCQueryTasks queryVfModuleForVolumeGroup ", ex);
if (!ex.getMessage().equals(NO_RESPONSE_FROM_SDNC)) {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SDNC);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SDNC);
} else {
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
} catch (Exception ex) {
logger.error("Exception occurred", ex);
- exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, TargetEntity.SO);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex, ONAPComponents.SO);
}
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
index 03714db943..3383fde0a8 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasks.java
@@ -37,7 +37,7 @@ import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -80,19 +80,19 @@ public class SDNCRequestTasks {
} catch (PathNotFoundException e) {
logger.error("Error Parsing SDNC Response. Could not find read final ack indicator from JSON.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Recieved invalid response from SDNC, unable to read message content.", TargetEntity.SO);
+ "Recieved invalid response from SDNC, unable to read message content.", ONAPComponents.SO);
} catch (MapperException e) {
logger.error("Failed to map SDNC object to JSON prior to POST.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Failed to map SDNC object to JSON prior to POST.", TargetEntity.SO);
+ "Failed to map SDNC object to JSON prior to POST.", ONAPComponents.SO);
} catch (BadResponseException e) {
logger.error("Did not receive a successful response from SDNC.", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getLocalizedMessage(),
- TargetEntity.SDNC);
+ ONAPComponents.SDNC);
} catch (HttpClientErrorException e) {
logger.error("HttpClientErrorException: 404 Not Found, Failed to contact SDNC", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "SDNC cannot be contacted.",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
@@ -123,17 +123,17 @@ public class SDNCRequestTasks {
}
} catch (SDNCErrorResponseException e) {
logger.error("SDNC error response - " + e.getMessage());
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), TargetEntity.SDNC);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e.getMessage(), ONAPComponents.SDNC);
} catch (Exception e) {
logger.error("Error processing SDNC callback", e);
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, "Error processing SDNC callback",
- TargetEntity.SO);
+ ONAPComponents.SO);
}
}
public void handleTimeOutException(DelegateExecution execution) {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000,
- "Error timed out waiting on SDNC Async-Response", TargetEntity.SO);
+ "Error timed out waiting on SDNC Async-Response", ONAPComponents.SO);
}
protected boolean convertIndicatorToBoolean(String finalMessageIndicator) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
index 52d294955a..11cac08f57 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/validations/CloudRegionOrchestrationValidator.java
@@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.validations;
import java.util.Optional;
import java.util.regex.Pattern;
+import org.onap.logging.filter.base.ONAPComponents;
import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.common.listener.validation.PreBuildingBlockValidator;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
@@ -62,7 +63,7 @@ public class CloudRegionOrchestrationValidator implements PreBuildingBlockValida
}
} catch (Exception e) {
logger.error("failed to validate", e);
- exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e, ONAPComponents.SO);
}
return Optional.empty();
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
index e809ecd0ae..206942fcb1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/FlowCompletionTasks.java
@@ -20,27 +20,14 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import java.util.ArrayList;
-import java.util.List;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.onap.so.bpmn.common.BuildingBlockExecution;
-import org.onap.so.bpmn.common.workflow.context.WorkflowCallbackResponse;
-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.exception.ExceptionBuilder;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
-import org.onap.so.serviceinstancebeans.RequestReferences;
-import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class FlowCompletionTasks {
@@ -50,7 +37,9 @@ public class FlowCompletionTasks {
@Autowired
private RequestsDbClient requestDbclient;
+
public void updateRequestDbStatus(BuildingBlockExecution execution) {
+
try {
String requestId = execution.getGeneralBuildingBlock().getRequestContext().getMsoRequestId();
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
index 8822bc39dd..64f0072991 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidator.java
@@ -153,16 +153,6 @@ public class OrchestrationStatusValidator {
.getOrchestrationStatusStateTransitionDirective(buildingBlockDetail.getResourceType(),
orchestrationStatus, buildingBlockDetail.getTargetAction());
- if (aLaCarte && ResourceType.VF_MODULE.equals(buildingBlockDetail.getResourceType())
- && OrchestrationAction.CREATE.equals(buildingBlockDetail.getTargetAction())
- && OrchestrationStatus.PENDING_ACTIVATION.equals(orchestrationStatus)) {
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf =
- extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
- orchestrationStatusStateTransitionDirective = processPossibleSecondStageofVfModuleCreate(execution,
- previousOrchestrationStatusValidationResult, genericVnf,
- orchestrationStatusStateTransitionDirective);
- }
-
if (orchestrationStatusStateTransitionDirective
.getFlowDirective() == OrchestrationStatusValidationDirective.FAIL) {
throw new OrchestrationStatusValidationException(
@@ -187,23 +177,4 @@ public class OrchestrationStatusValidator {
exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, e);
}
}
-
- private OrchestrationStatusStateTransitionDirective processPossibleSecondStageofVfModuleCreate(
- BuildingBlockExecution execution,
- OrchestrationStatusValidationDirective previousOrchestrationStatusValidationResult,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf genericVnf,
- OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective) {
- if (previousOrchestrationStatusValidationResult != null && previousOrchestrationStatusValidationResult
- .equals(OrchestrationStatusValidationDirective.SILENT_SUCCESS)) {
- String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
- if (genericVnf.getModelInfoGenericVnf() != null) {
- multiStageDesign = genericVnf.getModelInfoGenericVnf().getMultiStageDesign();
- }
- if (multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
- orchestrationStatusStateTransitionDirective
- .setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
- }
- }
- return orchestrationStatusStateTransitionDirective;
- }
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 1f07166b60..11c6455474 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -197,7 +197,9 @@ public class WorkflowAction {
suppressRollback = false;
}
execution.setVariable("suppressRollback", suppressRollback);
+ boolean isResume = false;
if (isUriResume(uri)) {
+ isResume = true;
logger.debug("replacing URI {}", uri);
uri = bbInputSetupUtils.loadOriginalInfraActiveRequestById(requestId).getRequestUrl();
logger.debug("for RESUME with original value {}", uri);
@@ -225,6 +227,12 @@ public class WorkflowAction {
if (flowsToExecute == null) {
buildAndThrowException(execution, "Could not resume Macro flow. Error loading execution path.");
}
+ } else if (aLaCarte && isResume) {
+ flowsToExecute = bbInputSetupUtils.loadOriginalFlowExecutionPath(requestId);
+ if (flowsToExecute == null) {
+ buildAndThrowException(execution,
+ "Could not resume request with request Id: " + requestId + ". No flowsToExecute was found");
+ }
} else {
if (aLaCarte) {
if (orchFlows == null || orchFlows.isEmpty()) {
@@ -387,7 +395,7 @@ public class WorkflowAction {
flowNames.add(ebb.getBuildingBlock().getBpmnFlowName());
}
- if (!aLaCarte) {
+ if (!isResume) {
bbInputSetupUtils.persistFlowExecutionPath(requestId, flowsToExecute);
}
execution.setVariable("flowNames", flowNames);
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
index be3e06c9ea..56cd9fd70f 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailure.java
@@ -39,6 +39,8 @@ import org.springframework.stereotype.Component;
@Component
public class WorkflowActionBBFailure {
+ private static final String DEACTIVATE_FABRIC_CONFIGURATION_FLOW = "DeactivateFabricConfigurationBB";
+ private static final String UNASSIGN_FABRIC_CONFIGURATION_FLOW = "UnassignFabricConfigurationBB";
private static final Logger logger = LoggerFactory.getLogger(WorkflowActionBBFailure.class);
public static final String ROLLBACK_TARGET_STATE = "rollbackTargetState";
@Autowired
@@ -96,6 +98,16 @@ public class WorkflowActionBBFailure {
String rollbackTargetState = (String) execution.getVariable(ROLLBACK_TARGET_STATE);
request.setRequestStatus(rollbackTargetState);
} else if (isRollbackFailure) {
+ if (ebb != null && ebb.getBuildingBlock() != null && ebb.getBuildingBlock().getBpmnFlowName() != null) {
+ String flowName = ebb.getBuildingBlock().getBpmnFlowName();
+ if (DEACTIVATE_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)
+ || UNASSIGN_FABRIC_CONFIGURATION_FLOW.equalsIgnoreCase(flowName)) {
+ String statusMessage = String.format(
+ "%s Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
+ request.getStatusMessage());
+ request.setStatusMessage(statusMessage);
+ }
+ }
Optional<String> rollbackErrorMsgOp = retrieveErrorMessage(execution);
if (rollbackErrorMsgOp.isPresent()) {
rollbackErrorMsg = rollbackErrorMsgOp.get();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index d5798150d1..39aa9d6c41 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -38,6 +38,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.aai.AAIObjectType;
+import org.onap.so.client.aai.entities.Configuration;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
import org.onap.so.db.catalog.client.CatalogDbClient;
@@ -309,7 +310,8 @@ public class WorkflowActionBBTasks {
rollbackFlowsFiltered.addAll(rollbackFlows);
if ("RollbackToAssigned".equals(handlingCode) || ROLLBACKTOCREATED.equals(handlingCode)) {
for (int i = 0; i < rollbackFlows.size(); i++) {
- if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign")) {
+ if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Unassign") && !rollbackFlows
+ .get(i).getBuildingBlock().getBpmnFlowName().contains("FabricConfiguration")) {
rollbackFlowsFiltered.remove(rollbackFlows.get(i));
} else if (rollbackFlows.get(i).getBuildingBlock().getBpmnFlowName().contains("Delete")
&& ROLLBACKTOCREATED.equals(handlingCode)) {
@@ -398,7 +400,7 @@ public class WorkflowActionBBTasks {
if (fabricConfig != null && fabricConfig.getConfigurationResource() != null
&& fabricConfig.getConfigurationResource().getToscaNodeType() != null
&& fabricConfig.getConfigurationResource().getToscaNodeType().contains(FABRIC_CONFIGURATION)) {
- String configurationId = UUID.randomUUID().toString();
+ String configurationId = getConfigurationId(vnfc);
ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys();
configurationResourceKeys.setCvnfcCustomizationUUID(modelCustomizationId);
configurationResourceKeys.setVfModuleCustomizationUUID(vfModuleCustomizationUUID);
@@ -429,6 +431,17 @@ public class WorkflowActionBBTasks {
}
}
+ protected String getConfigurationId(Vnfc vnfc) {
+ List<Configuration> configurations =
+ workflowAction.getRelatedResourcesInVnfc(vnfc, Configuration.class, AAIObjectType.CONFIGURATION);
+ if (!configurations.isEmpty()) {
+ Configuration configuration = configurations.get(0);
+ return configuration.getConfigurationId();
+ } else {
+ return UUID.randomUUID().toString();
+ }
+ }
+
protected ExecuteBuildingBlock getExecuteBBForConfig(String bbName, ExecuteBuildingBlock ebb,
String configurationId, ConfigurationResourceKeys configurationResourceKeys) {
ExecuteBuildingBlock configBB = new ExecuteBuildingBlock();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
index 173e776af9..d78fa69680 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapper.java
@@ -269,6 +269,7 @@ public class NetworkAdapterObjectMapper {
org.onap.so.openstack.beans.Subnet.class) == null) {
PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet> personMap =
new PropertyMap<org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet, org.onap.so.openstack.beans.Subnet>() {
+ @Override
protected void configure() {
map().setSubnetName(source.getSubnetName());
map(source.getSubnetId(), destination.getSubnetId());
@@ -387,7 +388,7 @@ public class NetworkAdapterObjectMapper {
createNetworkRequest.setSkipAAI(true);
createNetworkRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
// TODO confirm value - false by default
- createNetworkRequest.setFailIfExists(true);
+ createNetworkRequest.setFailIfExists(false);
// NetworkTechnology(NetworkTechnology.NEUTRON); NOOP - default
return createNetworkRequest;
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
index e24e86285c..9af2128f63 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfAdapterClientImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -33,11 +33,16 @@ import org.onap.so.adapters.vnfrest.RollbackVfModuleResponse;
import org.onap.so.adapters.vnfrest.UpdateVfModuleRequest;
import org.onap.so.adapters.vnfrest.UpdateVfModuleResponse;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.onap.so.client.adapter.vnf.mapper.VnfAdapterVfModuleObjectMapper;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class VnfAdapterClientImpl implements VnfAdapterClient {
+ private static final Logger logger = LoggerFactory.getLogger(VnfAdapterClientImpl.class);
+
private static final String VF_MODULES = "/vf-modules/";
private VnfAdapterRestProperties props;
@@ -57,6 +62,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + "/vf-modules").build()).post(req,
CreateVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in createVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -69,6 +75,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId + "/rollback").build()).delete(req,
RollbackVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in rollbackVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -80,6 +87,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
.delete(req, DeleteVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in deleteVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -91,6 +99,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, this.getUri("/" + aaiVnfId + VF_MODULES + aaiVfModuleId).build())
.put(req, UpdateVfModuleResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in updateVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -122,6 +131,7 @@ public class VnfAdapterClientImpl implements VnfAdapterClient {
return new AdapterRestClient(this.props, builder.build(), MediaType.APPLICATION_JSON,
MediaType.APPLICATION_JSON).get(QueryVfModuleResponse.class).get();
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in queryVfModule", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
index 2af4d5f1fa..c5e8bf7416 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/VnfVolumeAdapterClientImpl.java
@@ -7,9 +7,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -34,11 +34,15 @@ import org.onap.so.adapters.vnfrest.UpdateVolumeGroupRequest;
import org.onap.so.adapters.vnfrest.UpdateVolumeGroupResponse;
import org.onap.so.client.RestClient;
import org.onap.so.client.adapter.rest.AdapterRestClient;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@Component
public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
+ private static final Logger logger = LoggerFactory.getLogger(VnfVolumeAdapterClientImpl.class);
+
private final VnfVolumeAdapterRestProperties props;
public VnfVolumeAdapterClientImpl() {
@@ -50,6 +54,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("").post(req, CreateVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in createVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -60,6 +65,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("/" + aaiVolumeGroupId).delete(req, DeleteVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in deleteVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -71,6 +77,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
return this.getAdapterRestClient("/" + aaiVolumeGroupId + "/rollback").delete(req,
RollbackVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in rollbackVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -81,6 +88,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
try {
return this.getAdapterRestClient("/" + aaiVolumeGroupId).put(req, UpdateVolumeGroupResponse.class);
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in updateVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
@@ -94,6 +102,7 @@ public class VnfVolumeAdapterClientImpl implements VnfVolumeAdapterClient {
requestId, serviceInstanceId);
return this.getAdapterRestClient(path).get(QueryVolumeGroupResponse.class).get();
} catch (InternalServerErrorException e) {
+ logger.error("InternalServerErrorException in queryVNFVolumes", e);
throw new VnfAdapterClientException(e.getMessage());
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
index 6daed56675..6278d48e03 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/AttributeNameValue.java
@@ -23,10 +23,10 @@ package org.onap.so.client.adapter.vnf.mapper;
import java.io.Serializable;
public class AttributeNameValue implements Serializable {
- private final static long serialVersionUID = -5215028275587848311L;
+ private static final long serialVersionUID = -5215028275587848311L;
private String attributeName;
- private Object attributeValue;
+ private transient Object attributeValue;
public AttributeNameValue(String attributeName, Object attributeValue) {
this.attributeName = attributeName;
@@ -51,7 +51,7 @@ public class AttributeNameValue implements Serializable {
@Override
public String toString() {
- return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName.toString())
+ return new StringBuilder().append("{\"attribute_name\": \"").append(attributeName)
.append("\", \"attribute_value\": \"").append(attributeValue.toString()).append("\"}").toString();
}
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
index a78870afc4..ebebae3cce 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapper.java
@@ -78,7 +78,7 @@ public class VnfAdapterObjectMapper {
createVolumeGroupRequest.setSkipAAI(true);
createVolumeGroupRequest.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
- createVolumeGroupRequest.setFailIfExists(true);
+ createVolumeGroupRequest.setFailIfExists(false);
createVolumeGroupRequest.setMsoRequest(createMsoRequest(requestContext, serviceInstance));
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
index 5c69987a54..685531e9a7 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterVfModuleObjectMapper.java
@@ -33,7 +33,6 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
-import java.util.Map.Entry;
import java.util.Optional;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.StringUtils;
@@ -76,10 +75,10 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.onap.so.entity.MsoRequest;
import org.onap.so.jsonpath.JsonPathUtil;
import org.onap.so.openstack.utils.MsoMulticloudUtils;
-import org.onap.so.client.adapter.vnf.mapper.exceptions.MissingValueTagException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -151,7 +150,7 @@ public class VnfAdapterVfModuleObjectMapper {
createVfModuleRequest.setSkipAAI(true);
createVfModuleRequest.setBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
- createVfModuleRequest.setFailIfExists(true);
+ createVfModuleRequest.setFailIfExists(false);
MsoRequest msoRequest = buildMsoRequest(requestContext, serviceInstance);
createVfModuleRequest.setMsoRequest(msoRequest);
@@ -481,7 +480,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
}
sbInterfaceRoutePrefixes.append("]");
- if (interfaceRoutePrefixesList.size() > 0) {
+ if (!interfaceRoutePrefixesList.isEmpty()) {
paramsMap.put(key + UNDERSCORE + networkKey + "_route_prefixes",
sbInterfaceRoutePrefixes.toString());
}
@@ -508,7 +507,7 @@ public class VnfAdapterVfModuleObjectMapper {
sriovFilterBuf.append(heatVlanFilterValue);
}
}
- if (heatVlanFiltersList.size() > 0) {
+ if (!heatVlanFiltersList.isEmpty()) {
paramsMap.put(networkKey + "_ATT_VF_VLAN_FILTER", sriovFilterBuf.toString());
}
}
@@ -540,7 +539,7 @@ public class VnfAdapterVfModuleObjectMapper {
String ipVersion = ipAddress.getIpVersion();
for (int b = 0; b < ipsList.size(); b++) {
String ipAddressValue = ipsList.get(b);
- if (ipVersion.equals("ipv4")) {
+ if ("ipv4".equals(ipVersion)) {
if (b != ipsList.size() - 1) {
sbIpv4Ips.append(ipAddressValue + ",");
} else {
@@ -548,7 +547,7 @@ public class VnfAdapterVfModuleObjectMapper {
}
paramsMap.put(key + UNDERSCORE + networkKey + IP + UNDERSCORE + b,
ipAddressValue);
- } else if (ipVersion.equals("ipv6")) {
+ } else if ("ipv6".equals(ipVersion)) {
if (b != ipsList.size() - 1) {
sbIpv6Ips.append(ipAddressValue + ",");
} else {
@@ -897,6 +896,7 @@ public class VnfAdapterVfModuleObjectMapper {
try {
json = mapper.writeValueAsString(obj);
} catch (JsonProcessingException e) {
+ logger.error("JsonProcessingException in convertToString", e);
json = "{}";
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
new file mode 100644
index 0000000000..9dd0365e7a
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/buildingblock/HomingV2Test.java
@@ -0,0 +1,149 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 Nokia.
+ * ================================================================================
+ * 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.buildingblock;
+
+import static org.mockito.BDDMockito.then;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_OOF;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SNIRO;
+import static org.onap.so.bpmn.buildingblock.HomingV2.HOMING_SOLUTION;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+
+public class HomingV2Test {
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldCallSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(sniroHoming).should().callSniro(givenExecution);
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToSniroShouldProcessSniro() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_SNIRO);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(sniroHoming).should().processSolution(givenExecution, "dummy");
+ then(oofHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldCallOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionSetToOofShouldProcessOof() {
+ HashMap<String, Object> userParams = new HashMap<>();
+ userParams.put(HOMING_SOLUTION, HOMING_OOF);
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(userParams);
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldCallOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.callHoming(givenExecution);
+
+ then(oofHoming).should().callOof(givenExecution);
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ @Test
+ public void whenHomingSolutionNotSetShouldProcessOof() {
+ BuildingBlockExecution givenExecution = createBuildingBlockExecutionMock(new HashMap<>());
+
+ OofHomingV2 oofHoming = mock(OofHomingV2.class);
+ SniroHomingV2 sniroHoming = mock(SniroHomingV2.class);
+
+ HomingV2 homingV2 = new HomingV2(oofHoming, sniroHoming);
+ homingV2.processSolution(givenExecution, "dummy");
+
+ then(oofHoming).should().processSolution(givenExecution, "dummy");
+ then(sniroHoming).shouldHaveZeroInteractions();
+ }
+
+ private BuildingBlockExecution createBuildingBlockExecutionMock(Map<String, Object> userParams) {
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ GeneralBuildingBlock generalBuildingBlock = mock(GeneralBuildingBlock.class);
+ RequestContext requestContext = mock(RequestContext.class);
+ RequestParameters requestParameters = mock(RequestParameters.class);
+ List<Map<String, Object>> userParamsList = new ArrayList<>();
+
+ userParamsList.add(userParams);
+
+ when(execution.getGeneralBuildingBlock()).thenReturn(generalBuildingBlock);
+ when(generalBuildingBlock.getRequestContext()).thenReturn(requestContext);
+ when(requestContext.getRequestParameters()).thenReturn(requestParameters);
+ when(requestParameters.getUserParams()).thenReturn(userParamsList);
+
+ return execution;
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
index c0056291ef..1fde3f4fbc 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/activity/ExecuteActivityTest.java
@@ -92,6 +92,19 @@ public class ExecuteActivityTest extends BaseTaskTest {
}
@Test
+ public void executeException_Test() throws Exception {
+ execution.setVariable("workflowSyncAckSent", true);
+ execution.setVariable("testProcessKey", "testProcessKeyValue");
+ thrown.expect(BpmnError.class);
+ executeActivity.execute(execution);
+ String errorMessage = (String) execution.getVariable("ExecuteActivityErrorMessage");
+ assertEquals(errorMessage, "not implemented");
+ WorkflowException workflowException = (WorkflowException) execution.getVariable("WorkflowException");
+ assertEquals(workflowException.getErrorMessage(), "not implemented");
+ assertEquals(workflowException.getErrorCode(), 7000);
+ }
+
+ @Test
public void buildAndThrowException_Test() throws Exception {
doNothing().when(workflowActionBBFailure).updateRequestStatusToFailed(execution);
doReturn("Process key").when(exceptionBuilder).getProcessKey(execution);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
index 8aea2d2650..3994208d23 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/adapter/network/tasks/NetworkAdapterRestV1Test.java
@@ -39,7 +39,8 @@ import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.client.exception.BadResponseException;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.client.exception.MapperException;
-import org.onap.so.utils.TargetEntity;
+import org.onap.so.utils.Components;
+import org.onap.logging.filter.base.ONAPComponents;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyInt;
import static org.mockito.ArgumentMatchers.eq;
@@ -113,7 +114,7 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
delegateExecution.setVariable("NetworkAResponse_MESSAGE", updateNetworkResponse.toXmlString());
doThrow(new BpmnError("MSOWorkflowException")).when(exceptionBuilder).buildAndThrowWorkflowException(
- any(DelegateExecution.class), anyInt(), any(String.class), any(TargetEntity.class));
+ any(DelegateExecution.class), anyInt(), any(String.class), any(ONAPComponents.class));
try {
networkAdapterRestV1Tasks.processCallback(delegateExecution);
@@ -122,6 +123,6 @@ public class NetworkAdapterRestV1Test extends BaseTaskTest {
}
assertNull(delegateExecution.getVariable("updateNetworkResponse"));
verify(exceptionBuilder, times(1)).buildAndThrowWorkflowException(any(DelegateExecution.class), eq(7000),
- eq("test error message"), eq(TargetEntity.OPENSTACK));
+ eq("test error message"), eq(Components.OPENSTACK));
}
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
index cc25689358..f0c333007e 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/appc/tasks/AppcRunTasksTest.java
@@ -33,6 +33,8 @@ import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import java.nio.file.Files;
import java.nio.file.Paths;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Optional;
import org.junit.Test;
import org.mockito.InjectMocks;
@@ -168,6 +170,21 @@ public class AppcRunTasksTest extends BaseTaskTest {
assertEquals(vmIdList, expectedVmIdList);
}
+ @Test
+ public void testUserParams() throws Exception {
+ Map<String, Object> userParams = new HashMap<String, Object>();
+ userParams.put("existing_software_version", "3.1");
+ userParams.put("new_software_version", "3.2");
+ userParams.put("operations_timeout", "150000");
+
+ String actualPayload = appcRunTasks.buildPayloadFromUserParams(userParams);
+ System.out.println(actualPayload);
+ String expectedPayload =
+ "{\\\"operations_timeout\\\":\\\"150000\\\",\\\"existing_software_version\\\":\\\"3.1\\\",\\\"new_software_version\\\":\\\"3.2\\\"}";
+ assertEquals(expectedPayload, actualPayload.replaceAll(" ", ""));
+
+ }
+
private void mockReferenceResponse() {
ControllerSelectionReference reference = new ControllerSelectionReference();
reference.setControllerName("TEST-CONTROLLER-NAME");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
index 7d96a18305..468bc7d8f6 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/ConfigAssignVnfTest.java
@@ -3,13 +3,14 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2019 TechMahindra.
+ * Copyright (C) 2019 Nokia.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,57 +21,139 @@
package org.onap.so.bpmn.infrastructure.flowspecific.tasks;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.doThrow;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import java.util.UUID;
-import org.camunda.bpm.engine.delegate.BpmnError;
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
import org.junit.Before;
import org.junit.Test;
-import org.mockito.ArgumentMatchers;
-import org.mockito.InjectMocks;
-import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
-import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestParameters;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoGenericVnf;
+import org.onap.so.bpmn.servicedecomposition.modelinfo.ModelInfoServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.cds.beans.AbstractCDSPropertiesBean;
+import org.onap.so.client.exception.ExceptionBuilder;
-public class ConfigAssignVnfTest extends BaseTaskTest {
- @InjectMocks
- private ConfigAssignVnf configAssignVnf = new ConfigAssignVnf();
+public class ConfigAssignVnfTest {
- private GenericVnf genericVnf;
- private ServiceInstance serviceInstance;
- private RequestContext requestContext;
- private String msoRequestId;
+ private static final String GENERIC_VNF_ID = "vnfId_configVnfTest";
+ private static final String GENERIC_VNF_NAME = "vnfName_configVnfTest";
+ private static final String VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+ private static final String SERVICE_INSTANCE_ID = "serviceInst_configTest";
+ private static final String SERVICE_MODEL_UUID = "5af91c26-8418-4d3f-944c-965842deda94";
+ private static final String TARGET_VNF_MODEL_CUSTOMIZATION_UUID = "0c1ac643-377e-475b-be50-6be65f91a7ad";
+ private static final String GENERAL_BLOCK_EXECUTION_MAP_KEY = "gBBInput";
+ private static final int THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES = 8;
+
+ private static final String USER_PARAMS_FROM_REQUEST = "{\"resources\":{\"vnfs\":["
+ + "{\"modelInfo\":{\"modelCustomizationId\":\"" + VNF_MODEL_CUSTOMIZATION_UUID + "\"},"
+ + "\"instanceParams\":[{\"paramName1\":\"paramValue1\",\"paramName2\":\"paramValue2\"},{\"paramName3\":\"paramValue3\"}]},"
+ + "{\"modelInfo\":{\"modelCustomizationId\":\"2d1ac656-377e-467b-be50-6ce65f66a7ca\"},"
+ + "\"instanceParams\":[{\"parName4\":\"parValue4\",\"parName5\":\"parValue5\"}]}]}}\n";
+
+
+ private ConfigAssignVnf testedObject;
+
+ private BuildingBlockExecution buildingBlockExecution;
+ private ExtractPojosForBB extractPojosForBB;
@Before
- public void before() throws BBObjectNotFoundException {
- genericVnf = setGenericVnf();
- serviceInstance = setServiceInstance();
- msoRequestId = UUID.randomUUID().toString();
- requestContext = setRequestContext();
- requestContext.setMsoRequestId(msoRequestId);
- gBBInput.setRequestContext(requestContext);
-
- doThrow(new BpmnError("BPMN Error")).when(exceptionUtil)
- .buildAndThrowWorkflowException(any(BuildingBlockExecution.class), eq(7000), any(Exception.class));
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.GENERIC_VNF_ID)))
- .thenReturn(genericVnf);
- when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
- .thenReturn(serviceInstance);
+ public void setup() {
+ buildingBlockExecution = createBuildingBlockExecution();
+ extractPojosForBB = mock(ExtractPojosForBB.class);
+ testedObject = new ConfigAssignVnf(extractPojosForBB, new ExceptionBuilder());
}
@Test
- public void preProcessAbstractCDSProcessingTest() throws Exception {
+ public void prepareAbstractCDSPropertiesBean_success() throws Exception {
+ // given
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.GENERIC_VNF_ID))
+ .thenReturn(createGenericVnf());
+ when(extractPojosForBB.extractByKey(buildingBlockExecution, ResourceKey.SERVICE_INSTANCE_ID))
+ .thenReturn(createServiceInstance());
+ // when
+ testedObject.preProcessAbstractCDSProcessing(buildingBlockExecution);
+ // then
+ verifyConfigAssignPropertiesJsonContent();
+ }
- configAssignVnf.preProcessAbstractCDSProcessing(execution);
+ private void verifyConfigAssignPropertiesJsonContent() throws Exception {
+ AbstractCDSPropertiesBean abstractCDSPropertiesBean = buildingBlockExecution.getVariable("executionObject");
+ String payload = abstractCDSPropertiesBean.getRequestObject();
+ ObjectMapper mapper = new ObjectMapper();
+ JsonNode payloadJson = mapper.readTree(payload);
+ JsonNode configAssignPropertiesNode = payloadJson.findValue("config-assign-properties");
+ assertThat(configAssignPropertiesNode.size()).isEqualTo(THE_NUMBER_OF_EXPECTED_CONFIG_PROPERTIES);
+ assertThat(configAssignPropertiesNode.get("service-instance-id").asText()).isEqualTo(SERVICE_INSTANCE_ID);
+ assertThat(configAssignPropertiesNode.get("vnf-id").asText()).isEqualTo(GENERIC_VNF_ID);
+ assertThat(configAssignPropertiesNode.get("vnf-name").asText()).isEqualTo(GENERIC_VNF_NAME);
+ assertThat(configAssignPropertiesNode.get("service-model-uuid").asText()).isEqualTo(SERVICE_MODEL_UUID);
+ assertThat(configAssignPropertiesNode.get("vnf-customization-uuid").asText())
+ .isEqualTo(VNF_MODEL_CUSTOMIZATION_UUID);
+ assertThat(configAssignPropertiesNode.has("paramName1")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName1").asText()).isEqualTo("paramValue1");
+ assertThat(configAssignPropertiesNode.has("paramName2")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName2").asText()).isEqualTo("paramValue2");
+ assertThat(configAssignPropertiesNode.has("paramName3")).isTrue();
+ assertThat(configAssignPropertiesNode.get("paramName3").asText()).isEqualTo("paramValue3");
+ }
- assertTrue(true);
+ private BuildingBlockExecution createBuildingBlockExecution() {
+ DelegateExecution execution = new DelegateExecutionFake();
+ execution.setVariable(GENERAL_BLOCK_EXECUTION_MAP_KEY, createGeneralBuildingBlock());
+ return new DelegateExecutionImpl(execution);
}
+ private ServiceInstance createServiceInstance() {
+ ServiceInstance serviceInstance = new ServiceInstance();
+ serviceInstance.setServiceInstanceId(SERVICE_INSTANCE_ID);
+ ModelInfoServiceInstance modelInfoServiceInstance = new ModelInfoServiceInstance();
+ modelInfoServiceInstance.setModelUuid(SERVICE_MODEL_UUID);
+ serviceInstance.setModelInfoServiceInstance(modelInfoServiceInstance);
+ return serviceInstance;
+ }
+
+ private GenericVnf createGenericVnf() {
+ GenericVnf genericVnf = new GenericVnf();
+ genericVnf.setVnfId(GENERIC_VNF_ID);
+ genericVnf.setVnfName(GENERIC_VNF_NAME);
+ ModelInfoGenericVnf modelInfoGenericVnf = new ModelInfoGenericVnf();
+ modelInfoGenericVnf.setModelCustomizationUuid(TARGET_VNF_MODEL_CUSTOMIZATION_UUID);
+ modelInfoGenericVnf.setBlueprintName("blueprintTest");
+ modelInfoGenericVnf.setBlueprintVersion("blueprintVerTest");
+ genericVnf.setModelInfoGenericVnf(modelInfoGenericVnf);
+ return genericVnf;
+ }
+
+ private GeneralBuildingBlock createGeneralBuildingBlock() {
+ GeneralBuildingBlock generalBuildingBlock = new GeneralBuildingBlock();
+ RequestContext requestContext = new RequestContext();
+ RequestParameters requestParameters = new RequestParameters();
+ requestParameters.setUserParams(createRequestUserParams());
+ requestContext.setRequestParameters(requestParameters);
+ generalBuildingBlock.setRequestContext(requestContext);
+ return generalBuildingBlock;
+ }
+
+ private List<Map<String, Object>> createRequestUserParams() {
+ List<Map<String, Object>> userParams = new ArrayList<>();
+ Map<String, Object> userParamMap = new HashMap<>();
+ userParamMap.put("service", USER_PARAMS_FROM_REQUEST);
+ userParams.add(userParamMap);
+ return userParams;
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
index bacc57758b..ed55c56231 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/flowspecific/tasks/UnassignNetworkBBTest.java
@@ -40,9 +40,7 @@ import org.onap.so.bpmn.common.BuildingBlockExecution;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
-import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
import org.onap.so.client.aai.entities.AAIResultWrapper;
-import org.springframework.beans.factory.annotation.Autowired;
public class UnassignNetworkBBTest extends BaseTaskTest {
@@ -84,6 +82,15 @@ public class UnassignNetworkBBTest extends BaseTaskTest {
}
@Test
+ public void checkRelationshipRelatedToUnassignNetworkExceptionTest() throws Exception {
+ String msg = "Cannot perform Unassign Network. Network is still related to vf-module";
+ expectedException.expect(BpmnError.class);
+ doReturn(true).when(networkBBUtils).isRelationshipRelatedToExists(any(Optional.class), eq("vf-module"));
+ unassignNetworkBB.checkRelationshipRelatedTo(execution, "vf-module");
+ assertEquals(execution.getVariable("ErrorUnassignNetworkBB"), msg);
+ }
+
+ @Test
public void getCloudSdncRegion25Test() throws Exception {
CloudRegion cloudRegion = setCloudRegion();
cloudRegion.setCloudRegionVersion("2.5");
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
index 0ba9237aaf..e158925568 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCQueryTasksTest.java
@@ -44,8 +44,8 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.client.exception.BBObjectNotFoundException;
import org.onap.so.client.exception.BadResponseException;
-import org.onap.so.utils.TargetEntities;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.ONAPComponents;
public class SDNCQueryTasksTest extends BaseTaskTest {
@InjectMocks
@@ -65,7 +65,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
vfModule = setVfModule();
doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(
- any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(TargetEntities.class));
+ any(BuildingBlockExecution.class), eq(7000), any(Exception.class), any(ONAPComponentsList.class));
when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
.thenReturn(serviceInstance);
@@ -98,7 +98,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -109,7 +109,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModule(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -133,7 +133,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -144,7 +144,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVnf(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
@@ -169,7 +169,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SDNC);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SDNC);
}
@Test
@@ -180,7 +180,7 @@ public class SDNCQueryTasksTest extends BaseTaskTest {
expectedException.expect(BpmnError.class);
sdncQueryTasks.queryVfModuleForVolumeGroup(execution);
- verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, TargetEntity.SO);
+ verify(exceptionUtil, times(1)).buildAndThrowWorkflowException(execution, 700, exception, ONAPComponents.SO);
}
@Test
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
index 0fc33fe5ce..e435909f59 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/sdnc/tasks/SDNCRequestTasksTest.java
@@ -49,7 +49,7 @@ import org.onap.so.client.exception.MapperException;
import org.onap.so.client.sdnc.SDNCClient;
import org.onap.so.client.sdnc.beans.SDNCRequest;
import org.onap.so.client.sdnc.endpoint.SDNCTopology;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
import com.fasterxml.jackson.core.JsonParseException;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
index b371e3a48a..ffe48876c4 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/OrchestrationStatusValidatorTest.java
@@ -21,6 +21,7 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.doReturn;
@@ -50,7 +51,6 @@ import org.onap.so.db.catalog.beans.OrchestrationStatusValidationDirective;
import org.onap.so.db.catalog.beans.ResourceType;
import org.springframework.beans.factory.annotation.Autowired;
-@Ignore
public class OrchestrationStatusValidatorTest extends BaseTaskTest {
@InjectMocks
protected OrchestrationStatusValidator orchestrationStatusValidator = new OrchestrationStatusValidator();
@@ -72,6 +72,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstance =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance();
+ serviceInstance.setServiceInstanceId("serviceInstanceId");
+ serviceInstance.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.SERVICE_INSTANCE_ID)))
+ .thenReturn(serviceInstance);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
@@ -115,6 +122,13 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration configuration =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setOrchestrationStatus(OrchestrationStatus.PRECREATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.CONFIGURATION_ID)))
+ .thenReturn(configuration);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -134,6 +148,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
execution.getVariable("orchestrationStatusValidationResult"));
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_buildingBlockDetailNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -147,6 +162,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationFail() throws Exception {
expectedException.expect(BpmnError.class);
@@ -178,6 +194,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
}
+ @Ignore
@Test
public void test_validateOrchestrationStatus_orchestrationValidationNotFound() throws Exception {
expectedException.expect(BpmnError.class);
@@ -228,8 +245,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
orchestrationStatusValidator.validateOrchestrationStatus(execution);
- assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
- execution.getVariable("orchestrationStatusValidationResult"));
+ assertNull(execution.getVariable("orchestrationStatusValidationResult"));
}
@Test
@@ -247,6 +263,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -257,7 +279,7 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
- orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.FAIL);
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
orchestrationStatusStateTransitionDirective.setId(1);
orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
@@ -288,6 +310,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
setGenericVnf().setModelInfoGenericVnf(modelInfoGenericVnf);
setVfModule().setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
buildingBlockDetail.setBuildingBlockName("CreateVfModuleBB");
buildingBlockDetail.setId(1);
@@ -338,6 +366,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -380,6 +414,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -422,6 +462,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -464,6 +510,12 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
doReturn(buildingBlockDetail).when(catalogDbClient).getBuildingBlockDetail(flowToBeCalled);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.PENDING_ACTIVATION);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
new OrchestrationStatusStateTransitionDirective();
orchestrationStatusStateTransitionDirective
@@ -482,4 +534,39 @@ public class OrchestrationStatusValidatorTest extends BaseTaskTest {
assertEquals(OrchestrationStatusValidationDirective.SILENT_SUCCESS,
execution.getVariable("orchestrationStatusValidationResult"));
}
+
+ @Test
+ public void continueValidationActivatedTest() throws Exception {
+ String flowToBeCalled = "DeactivateVnfBB";
+ BuildingBlockDetail buildingBlockDetail = new BuildingBlockDetail();
+ buildingBlockDetail.setBuildingBlockName(flowToBeCalled);
+ buildingBlockDetail.setId(1);
+ buildingBlockDetail.setResourceType(ResourceType.VF_MODULE);
+ buildingBlockDetail.setTargetAction(OrchestrationAction.DEACTIVATE);
+ when(catalogDbClient.getBuildingBlockDetail(flowToBeCalled)).thenReturn(buildingBlockDetail);
+
+ org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule vfModule =
+ new org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule();
+ vfModule.setVfModuleId("vfModuleId");
+ vfModule.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ when(extractPojosForBB.extractByKey(any(), ArgumentMatchers.eq(ResourceKey.VF_MODULE_ID))).thenReturn(vfModule);
+
+ OrchestrationStatusStateTransitionDirective orchestrationStatusStateTransitionDirective =
+ new OrchestrationStatusStateTransitionDirective();
+ orchestrationStatusStateTransitionDirective.setFlowDirective(OrchestrationStatusValidationDirective.CONTINUE);
+ orchestrationStatusStateTransitionDirective.setId(1);
+ orchestrationStatusStateTransitionDirective.setOrchestrationStatus(OrchestrationStatus.ACTIVATED);
+ orchestrationStatusStateTransitionDirective.setResourceType(ResourceType.VF_MODULE);
+ orchestrationStatusStateTransitionDirective.setTargetAction(OrchestrationAction.DEACTIVATE);
+ doReturn(orchestrationStatusStateTransitionDirective).when(catalogDbClient)
+ .getOrchestrationStatusStateTransitionDirective(ResourceType.VF_MODULE, OrchestrationStatus.ACTIVATED,
+ OrchestrationAction.DEACTIVATE);
+
+ execution.setVariable("aLaCarte", true);
+ execution.setVariable("flowToBeCalled", flowToBeCalled);
+ orchestrationStatusValidator.validateOrchestrationStatus(execution);
+
+ assertEquals(OrchestrationStatusValidationDirective.CONTINUE,
+ execution.getVariable("orchestrationStatusValidationResult"));
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
index 2d48d02774..573601b20f 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBFailureTest.java
@@ -41,6 +41,8 @@ import org.mockito.Spy;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -140,6 +142,31 @@ public class WorkflowActionBBFailureTest extends BaseTaskTest {
}
@Test
+ public void updateRequestStatusToFailedRollbackFabric() {
+ ExecuteBuildingBlock ebb = new ExecuteBuildingBlock();
+ BuildingBlock bb = new BuildingBlock();
+ bb.setBpmnFlowName("UnassignFabricConfigurationBB");
+ ebb.setBuildingBlock(bb);
+ execution.setVariable("buildingBlock", ebb);
+ execution.setVariable("mso-request-id", "123");
+ execution.setVariable("isRollbackComplete", false);
+ execution.setVariable("isRollback", true);
+ InfraActiveRequests req = new InfraActiveRequests();
+ req.setStatusMessage("PINC failure.");
+ WorkflowException wfe = new WorkflowException("processKey123", 1, "error in rollback");
+ execution.setVariable("WorkflowException", wfe);
+ doReturn(req).when(requestsDbClient).getInfraActiveRequestbyRequestId("123");
+ doNothing().when(requestsDbClient).updateInfraActiveRequests(isA(InfraActiveRequests.class));
+ workflowActionBBFailure.updateRequestStatusToFailed(execution);
+ String errorMsg = (String) execution.getVariable("RollbackErrorMessage");
+ assertEquals("error in rollback", errorMsg);
+ assertEquals(
+ "PINC failure. Warning: The vf-module is active but configuration was not removed completely for one or more VMs.",
+ req.getStatusMessage());
+ assertEquals(Status.FAILED.toString(), req.getRequestStatus());
+ }
+
+ @Test
public void updateRequestStatusToRolledback() {
execution.setVariable("mso-request-id", "123");
execution.setVariable("isRollbackComplete", true);
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index aac09b4475..ac7d82cd51 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -328,6 +328,51 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
}
@Test
+ public void rollbackExecutionRollbackToAssignedWithFabricTest() {
+ execution.setVariable("isRollback", false);
+ execution.setVariable("handlingCode", "RollbackToAssigned");
+ List<ExecuteBuildingBlock> flowsToExecute = new ArrayList();
+ ExecuteBuildingBlock ebb1 = new ExecuteBuildingBlock();
+ BuildingBlock bb1 = new BuildingBlock();
+ bb1.setBpmnFlowName("AssignVfModuleBB");
+ ebb1.setBuildingBlock(bb1);
+ flowsToExecute.add(ebb1);
+ ExecuteBuildingBlock ebb2 = new ExecuteBuildingBlock();
+ BuildingBlock bb2 = new BuildingBlock();
+ bb2.setBpmnFlowName("CreateVfModuleBB");
+ ebb2.setBuildingBlock(bb2);
+ flowsToExecute.add(ebb2);
+ ExecuteBuildingBlock ebb3 = new ExecuteBuildingBlock();
+ BuildingBlock bb3 = new BuildingBlock();
+ bb3.setBpmnFlowName("ActivateVfModuleBB");
+ ebb3.setBuildingBlock(bb3);
+ flowsToExecute.add(ebb3);
+ ExecuteBuildingBlock ebb4 = new ExecuteBuildingBlock();
+ BuildingBlock bb4 = new BuildingBlock();
+ bb4.setBpmnFlowName("AssignFabricConfigurationBB");
+ ebb4.setBuildingBlock(bb4);
+ flowsToExecute.add(ebb4);
+ ExecuteBuildingBlock ebb5 = new ExecuteBuildingBlock();
+ BuildingBlock bb5 = new BuildingBlock();
+ bb5.setBpmnFlowName("ActivateFabricConfigurationBB");
+ ebb5.setBuildingBlock(bb5);
+ flowsToExecute.add(ebb5);
+
+ execution.setVariable("flowsToExecute", flowsToExecute);
+ execution.setVariable("gCurrentSequence", 5);
+
+ workflowActionBBTasks.rollbackExecutionPath(execution);
+ List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
+ assertEquals(0, execution.getVariable("gCurrentSequence"));
+ assertEquals(4, ebbs.size());
+ assertEquals("DeactivateFabricConfigurationBB", ebbs.get(0).getBuildingBlock().getBpmnFlowName());
+ assertEquals("UnassignFabricConfigurationBB", ebbs.get(1).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeactivateVfModuleBB", ebbs.get(2).getBuildingBlock().getBpmnFlowName());
+ assertEquals("DeleteVfModuleBB", ebbs.get(3).getBuildingBlock().getBpmnFlowName());
+
+ }
+
+ @Test
public void rollbackExecutionRollbackToCreatedTest() {
execution.setVariable("isRollback", false);
execution.setVariable("handlingCode", "RollbackToCreated");
@@ -417,4 +462,22 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
workflowActionBBTasks.updateInstanceId(execution);
Mockito.verify(reqMock, Mockito.times(1)).setServiceInstanceId(instanceId);
}
+
+ @Test
+ public void getConfigurationId() {
+ org.onap.aai.domain.yang.Vnfc vnfc = new org.onap.aai.domain.yang.Vnfc();
+ vnfc.setModelInvariantId("modelInvariantId");
+ vnfc.setVnfcName("testVnfcName");
+ List<org.onap.aai.domain.yang.Configuration> configurations =
+ new ArrayList<org.onap.aai.domain.yang.Configuration>();
+ org.onap.aai.domain.yang.Configuration configuration = new org.onap.aai.domain.yang.Configuration();
+ configuration.setConfigurationId("configurationId");
+ configuration.setModelCustomizationId("modelCustimizationId");
+ configuration.setConfigurationName("testConfigurationName");
+ configurations.add(configuration);
+ doReturn(configurations.get(0).getConfigurationId()).when(workflowActionBBTasks).getConfigurationId(vnfc);
+ assertEquals(workflowActionBBTasks.getConfigurationId(vnfc), "configurationId");
+ }
+
+
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index eea885288e..be6fc94890 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -45,11 +45,9 @@ import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.UUID;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -66,7 +64,6 @@ import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.aai.domain.yang.GenericVnfs;
import org.onap.aai.domain.yang.L3Network;
-import org.onap.aai.domain.yang.L3Networks;
import org.onap.aai.domain.yang.Relationship;
import org.onap.aai.domain.yang.RelationshipList;
import org.onap.aai.domain.yang.ServiceInstance;
@@ -80,7 +77,6 @@ import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
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.modelinfo.ModelInfoVfModule;
import org.onap.so.bpmn.servicedecomposition.tasks.exceptions.DuplicateNameException;
import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
@@ -103,8 +99,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.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.beans.RequestProcessingData;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
@@ -1476,9 +1470,19 @@ public class WorkflowActionTest extends BaseTaskTest {
}
@Test
+ public void extractResourceIdAndTypeFromUriResumeTest() {
+ Resource resource = workflowAction.extractResourceIdAndTypeFromUri(
+ "http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume");
+ assertEquals(resource.getResourceId(), "33cb74cd-9cb3-4090-a3c0-1b8c8e235847");
+ }
+
+ @Test
public void isUriResumeTest() {
assertTrue(workflowAction.isUriResume(
"http://localhost:9100/onap/so/infra/orchestrationRequests/v7/requests/2f8ab587-ef6a-4456-b7b2-d73f9363dabd/resume"));
+ assertTrue(workflowAction.isUriResume(
+ " http://localhost:9100/onap/so/infra/serviceInstantiation/v7/serviceInstances/4ff87c63-461b-4d83-8121-d351e6db216c/vnfs/eea9b93b-b5b9-4fad-9c35-12d52e4b683f/vfModules/33cb74cd-9cb3-4090-a3c0-1b8c8e235847/resume"));
+
assertFalse(workflowAction.isUriResume("/v6/serviceInstances/123/vnfs/1234/vfmodules/5678/replace"));
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
index d6485bd57f..109dc55294 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/network/mapper/NetworkAdapterObjectMapperTest.java
@@ -106,7 +106,7 @@ public class NetworkAdapterObjectMapperTest extends TestDataSetup {
expectedCreateNetworkRequest.setNetworkName(l3Network.getNetworkName());
expectedCreateNetworkRequest.setNetworkType(l3Network.getNetworkType());
expectedCreateNetworkRequest.setBackout(false);
- expectedCreateNetworkRequest.setFailIfExists(true);
+ expectedCreateNetworkRequest.setFailIfExists(false);
expectedCreateNetworkRequest.setNetworkTechnology("CONTRAIL");
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(requestContext.getMsoRequestId());
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
index 4450e4a9f4..2e77023757 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/client/adapter/vnf/mapper/VnfAdapterObjectMapperTest.java
@@ -34,7 +34,6 @@ import java.util.List;
import java.util.Map;
import org.junit.After;
import org.junit.Before;
-import org.junit.Ignore;
import org.junit.Test;
import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
@@ -135,7 +134,7 @@ public class VnfAdapterObjectMapperTest {
expectedCreateVolumeGroupRequest.setSkipAAI(true);
expectedCreateVolumeGroupRequest
.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
- expectedCreateVolumeGroupRequest.setFailIfExists(true);
+ expectedCreateVolumeGroupRequest.setFailIfExists(false);
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(requestContext.getMsoRequestId());
@@ -215,7 +214,7 @@ public class VnfAdapterObjectMapperTest {
expectedCreateVolumeGroupRequest.setSkipAAI(true);
expectedCreateVolumeGroupRequest
.setSuppressBackout(Boolean.TRUE.equals(orchestrationContext.getIsRollbackEnabled()));
- expectedCreateVolumeGroupRequest.setFailIfExists(true);
+ expectedCreateVolumeGroupRequest.setFailIfExists(false);
MsoRequest msoRequest = new MsoRequest();
msoRequest.setRequestId(requestContext.getMsoRequestId());
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
index d7e282dda7..19d42dddb9 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/NetworkMapper/createNetworkRequest.json
@@ -33,7 +33,7 @@
"policyFqdns": [],
"routeTableFqdns": []
},
- "failIfExists": true,
+ "failIfExists": false,
"backout": false,
"msoRequest": {
"requestId": "6cfde724-76c7-4747-bcb3-67a59a46ca95",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
index f655e9aa13..5975cb21fe 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleAddonRequest.json
@@ -12,7 +12,7 @@
"baseVfModuleStackId": "baseVfModuleStackId",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json
index 3387b6d87e..19acec0373 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequest.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json
index 8721bdc865..aa4ada059d 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestDhcpDisabled.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json
index 04f64790c4..f7fb1e9f44 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestMultipleDhcp.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json
index 1b57fcd33c..e06f9cbf36 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestNoUserParams.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json
index a13740cf80..b97bab4149 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestTrueBackout.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": true,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
index 5468e21ee3..7b78510f56 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithCloudResources.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json
index dd8e62c0a0..83ba299914 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleRequestWithSingleAvailabilityZone.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json
index d44b1924cc..aaee92b083 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithNoEnvironmentAndWorkloadContextRequest.json
@@ -10,7 +10,7 @@
"modelCustomizationUuid": "vfModuleModelCustomizationUuid",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
index 0d103926b9..a419c2ee59 100644
--- a/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
+++ b/bpmn/so-bpmn-tasks/src/test/resources/__files/BuildingBlocks/VnfAndVfModuleMapper/vnfAdapterCreateVfModuleWithVolumeGroupRequest.json
@@ -12,7 +12,7 @@
"volumeGroupStackId": "volumeGroupStackId",
"skipAAI": true,
"backout": false,
- "failIfExists": true,
+ "failIfExists": false,
"msoRequest":
{
"requestId": "requestId",
diff --git a/common/pom.xml b/common/pom.xml
index 2553038e6b..1f7f044fc8 100644
--- a/common/pom.xml
+++ b/common/pom.xml
@@ -118,11 +118,6 @@
<artifactId>spring-security-web</artifactId>
</dependency>
<dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.2.2</version>
- </dependency>
- <dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
</dependency>
@@ -191,7 +186,11 @@
<artifactId>javatuples</artifactId>
<version>1.2</version>
</dependency>
-
+ <dependency>
+ <groupId>org.camunda.bpm</groupId>
+ <artifactId>camunda-external-task-client</artifactId>
+ <version>1.1.1</version>
+ </dependency>
</dependencies>
<dependencyManagement>
<dependencies>
diff --git a/common/src/main/java/org/onap/so/client/BaseClient.java b/common/src/main/java/org/onap/so/client/BaseClient.java
index d939a33358..24c83cbcab 100644
--- a/common/src/main/java/org/onap/so/client/BaseClient.java
+++ b/common/src/main/java/org/onap/so/client/BaseClient.java
@@ -22,7 +22,8 @@ package org.onap.so.client;
import java.util.ArrayList;
import java.util.List;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.core.ParameterizedTypeReference;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
@@ -80,7 +81,8 @@ public class BaseClient<I, O> {
RestTemplate restTemplate = new RestTemplate();
restTemplate
.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
ResponseEntity<O> responseEntity =
restTemplate.exchange(getTargetUrl(), method, requestEntity, typeRef, uriVariables);
return responseEntity.getBody();
diff --git a/common/src/main/java/org/onap/so/client/HttpClient.java b/common/src/main/java/org/onap/so/client/HttpClient.java
index 715ba32831..63a4b1cd65 100644
--- a/common/src/main/java/org/onap/so/client/HttpClient.java
+++ b/common/src/main/java/org/onap/so/client/HttpClient.java
@@ -24,22 +24,22 @@ import java.net.URL;
import java.util.Map;
import java.util.Optional;
import static org.apache.commons.lang3.StringUtils.*;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class HttpClient extends RestClient {
protected final Logger log = LoggerFactory.getLogger(HttpClient.class);
- private TargetEntity targetEntity;
+ private ONAPComponents targetEntity;
- HttpClient(URL host, String contentType, TargetEntity targetEntity) {
+ HttpClient(URL host, String contentType, ONAPComponents targetEntity) {
super(host, contentType);
this.targetEntity = targetEntity;
}
@Override
- public TargetEntity getTargetEntity() {
+ public ONAPComponents getTargetEntity() {
return targetEntity;
}
diff --git a/common/src/main/java/org/onap/so/client/HttpClientFactory.java b/common/src/main/java/org/onap/so/client/HttpClientFactory.java
index d02c18ff56..3a8a9ee1bd 100644
--- a/common/src/main/java/org/onap/so/client/HttpClientFactory.java
+++ b/common/src/main/java/org/onap/so/client/HttpClientFactory.java
@@ -21,19 +21,19 @@ package org.onap.so.client;
import java.net.URL;
import javax.ws.rs.core.MediaType;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class HttpClientFactory {
- public HttpClient newJsonClient(URL host, TargetEntity targetEntity) {
+ public HttpClient newJsonClient(URL host, ONAPComponents targetEntity) {
return new HttpClient(host, MediaType.APPLICATION_JSON, targetEntity);
}
- public HttpClient newXmlClient(URL host, TargetEntity targetEntity) {
+ public HttpClient newXmlClient(URL host, ONAPComponents targetEntity) {
return new HttpClient(host, MediaType.APPLICATION_XML, targetEntity);
}
- public HttpClient newTextXmlClient(URL host, TargetEntity targetEntity) {
+ public HttpClient newTextXmlClient(URL host, ONAPComponents targetEntity) {
return new HttpClient(host, MediaType.TEXT_XML, targetEntity);
}
}
diff --git a/common/src/main/java/org/onap/so/client/RestClient.java b/common/src/main/java/org/onap/so/client/RestClient.java
index d3a4d444f7..077ba24c2b 100644
--- a/common/src/main/java/org/onap/so/client/RestClient.java
+++ b/common/src/main/java/org/onap/so/client/RestClient.java
@@ -44,11 +44,12 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriBuilder;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.filter.base.ONAPComponentsList;
+import org.onap.logging.filter.base.PayloadLoggingClientFilter;
import org.onap.so.client.policy.CommonObjectMapperProvider;
-import org.onap.so.logging.jaxrs.filter.JaxRsClientLogging;
-import org.onap.so.logging.jaxrs.filter.PayloadLoggingFilter;
+import org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
@@ -71,7 +72,8 @@ public abstract class RestClient {
protected String accept;
protected String contentType;
protected String requestId = "";
- protected JaxRsClientLogging jaxRsClientLogging;
+ protected SOMetricLogClientFilter metricLogClientFilter;
+ protected MDCSetup mdcSetup = new MDCSetup();
protected RestProperties props;
protected RestClient(RestProperties props, Optional<URI> path) {
@@ -179,18 +181,18 @@ public abstract class RestClient {
return ClientBuilder.newBuilder().build();
}
- protected abstract TargetEntity getTargetEntity();
+ protected abstract ONAPComponentsList getTargetEntity();
protected void initializeClient(Client client) {
if (this.enableLogging()) {
- client.register(new PayloadLoggingFilter(this.getMaxPayloadSize()));
+ client.register(new PayloadLoggingClientFilter(this.getMaxPayloadSize()));
}
CommonObjectMapperProvider provider = this.getCommonObjectMapperProvider();
client.register(new JacksonJsonProvider(provider.getMapper()));
- jaxRsClientLogging = new JaxRsClientLogging();
- jaxRsClientLogging.setTargetService(getTargetEntity());
- client.register(jaxRsClientLogging);
+ metricLogClientFilter = new SOMetricLogClientFilter();
+ mdcSetup.setTargetEntity(getTargetEntity());
+ client.register(metricLogClientFilter);
if (!path.isPresent()) {
webTarget = client.target(host.toString());
diff --git a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
index 0633ae74c9..f8587ff776 100644
--- a/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
+++ b/common/src/main/java/org/onap/so/client/RestTemplateConfig.java
@@ -20,8 +20,9 @@
package org.onap.so.client;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.configuration.rest.HttpComponentsClientConfiguration;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
@@ -45,7 +46,8 @@ public class RestTemplateConfig {
final RestTemplate restTemplate = new RestTemplate();
restTemplate
.setRequestFactory(new BufferingClientHttpRequestFactory(new HttpComponentsClientHttpRequestFactory()));
- restTemplate.getInterceptors().add(new SpringClientFilter());
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
return restTemplate;
}
@@ -56,7 +58,8 @@ public class RestTemplateConfig {
httpComponentsClientConfiguration.httpComponentsClientHttpRequestFactory();
final RestTemplate restTemplate =
new RestTemplate(new BufferingClientHttpRequestFactory(clientHttpRequestFactory));
- restTemplate.getInterceptors().add(new SpringClientFilter());
+ restTemplate.getInterceptors().add(new SOSpringClientFilter());
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
return restTemplate;
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
index 2fe3910486..e255b297ed 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIErrorFormatter.java
@@ -50,6 +50,8 @@ public class AAIErrorFormatter {
}
protected String format(String s, List<String> variables) {
- return String.format(s.replaceAll("%(\\d+)", "%$1\\$s"), variables.toArray());
+ s = s.replaceAll("%(\\d(?!\\d))", "%$1\\$s");
+ s = s.replaceAll("%(\\d{2})", "%%$1");
+ return String.format(s, variables.toArray());
}
}
diff --git a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
index b546aaa23e..610ff728e9 100644
--- a/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
+++ b/common/src/main/java/org/onap/so/client/aai/AAIRestClient.java
@@ -26,7 +26,7 @@ import java.util.Optional;
import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.graphinventory.GraphInventoryPatchConverter;
import org.onap.so.client.graphinventory.GraphInventoryRestClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class AAIRestClient extends GraphInventoryRestClient {
@@ -38,8 +38,8 @@ public class AAIRestClient extends GraphInventoryRestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.AAI;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.AAI;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
index d6c7072c14..88899a7097 100644
--- a/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
+++ b/common/src/main/java/org/onap/so/client/adapter/rest/AdapterRestClient.java
@@ -29,7 +29,7 @@ import org.onap.so.client.RestClient;
import org.onap.so.client.policy.CommonObjectMapperProvider;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class AdapterRestClient extends RestClient {
@@ -46,8 +46,8 @@ public class AdapterRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.OPENSTACK_ADAPTER;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.OPENSTACK_ADAPTER;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
index 68b4e84448..e0c8d4ba80 100644
--- a/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
+++ b/common/src/main/java/org/onap/so/client/dmaap/rest/DMaaPRestClient.java
@@ -22,11 +22,15 @@ package org.onap.so.client.dmaap.rest;
import java.net.URL;
import java.util.Map;
+import java.util.UUID;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
import org.onap.so.client.RestClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.slf4j.MDC;
public class DMaaPRestClient extends RestClient {
+ private static final String SO = "SO";
private final String auth;
private final String key;
@@ -37,8 +41,8 @@ public class DMaaPRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.DMAAP;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.DMAAP;
}
@Override
@@ -46,6 +50,10 @@ public class DMaaPRestClient extends RestClient {
if (auth != null && !auth.isEmpty() && key != null && !key.isEmpty()) {
addBasicAuthHeader(auth, key);
}
+ String onapRequestId = UUID.randomUUID().toString();
+ headerMap.put(ONAPLogConstants.Headers.REQUEST_ID, onapRequestId);
+ if (MDC.get(ONAPLogConstants.MDCs.REQUEST_ID) != null) {
+ headerMap.put(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ }
}
-
}
diff --git a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
index 434c65da46..babfa14d71 100644
--- a/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
+++ b/common/src/main/java/org/onap/so/client/graphinventory/GraphInventoryRestClient.java
@@ -28,7 +28,8 @@ import org.onap.so.client.ResponseExceptionMapper;
import org.onap.so.client.RestClientSSL;
import org.onap.so.client.RestProperties;
import org.onap.so.client.policy.CommonObjectMapperProvider;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.filter.base.ONAPComponentsList;
public abstract class GraphInventoryRestClient extends RestClientSSL {
@@ -42,7 +43,7 @@ public abstract class GraphInventoryRestClient extends RestClientSSL {
}
@Override
- public abstract TargetEntity getTargetEntity();
+ public abstract ONAPComponentsList getTargetEntity();
@Override
protected abstract void initializeHeaderMap(Map<String, String> headerMap);
diff --git a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
index 507f1130b5..147f688ea8 100644
--- a/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
+++ b/common/src/main/java/org/onap/so/client/grm/GRMRestClient.java
@@ -25,7 +25,7 @@ import java.net.URI;
import java.util.Map;
import java.util.Optional;
import org.onap.so.client.RestClient;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class GRMRestClient extends RestClient {
@@ -37,8 +37,8 @@ public class GRMRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.GRM;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.GRM;
}
@Override
diff --git a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
index 95bc4282ae..33ece07e3d 100644
--- a/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
+++ b/common/src/main/java/org/onap/so/client/policy/PolicyRestClient.java
@@ -26,7 +26,7 @@ import java.util.Optional;
import javax.ws.rs.core.UriBuilder;
import org.onap.so.client.RestClient;
import org.onap.so.client.policy.entities.PolicyServiceType;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class PolicyRestClient extends RestClient {
@@ -38,8 +38,8 @@ public class PolicyRestClient extends RestClient {
}
@Override
- public TargetEntity getTargetEntity() {
- return TargetEntity.POLICY;
+ public ONAPComponents getTargetEntity() {
+ return ONAPComponents.POLICY;
}
@Override
diff --git a/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
new file mode 100644
index 0000000000..9f71e61e1f
--- /dev/null
+++ b/common/src/main/java/org/onap/so/externaltasks/logging/AuditMDCSetup.java
@@ -0,0 +1,56 @@
+package org.onap.so.externaltasks.logging;
+
+import java.time.ZoneOffset;
+import java.time.ZonedDateTime;
+import java.time.format.DateTimeFormatter;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.filter.base.ONAPComponents;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+
+@Component
+public class AuditMDCSetup {
+
+ private static final Logger logger = LoggerFactory.getLogger(AuditMDCSetup.class);
+
+ private MDCSetup mdcSetup = new MDCSetup();
+
+ public void setupMDC(ExternalTask externalTask) {
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
+ ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
+ String msoRequestId = externalTask.getVariable("mso-request-id");
+ if (msoRequestId != null && !msoRequestId.isEmpty()) {
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, msoRequestId);
+ }
+ MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, externalTask.getTopicName());
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, ONAPComponents.OPENSTACK_ADAPTER.toString());
+ setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ setElapsedTime();
+ mdcSetup.setServerFQDN();
+ logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
+ }
+
+ public void setElapsedTime() {
+ DateTimeFormatter timeFormatter = DateTimeFormatter.ISO_ZONED_DATE_TIME;
+ MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, Long.toString(System.currentTimeMillis() - ZonedDateTime
+ .parse(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP), timeFormatter).toInstant().toEpochMilli()));
+ }
+
+ public void setResponseCode(String code) {
+ MDC.put(MdcConstants.OPENSTACK_STATUS_CODE, code);
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, code);
+ }
+
+ public void clearClientMDCs() {
+ MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
+ MDC.remove(MdcConstants.OPENSTACK_STATUS_CODE);
+ MDC.remove(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP);
+ MDC.remove(ONAPLogConstants.MDCs.ELAPSED_TIME);
+ MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
index 83b860ff01..2010bc1988 100644
--- a/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
+++ b/common/src/main/java/org/onap/so/logger/HttpHeadersConstants.java
@@ -21,13 +21,5 @@
package org.onap.so.logger;
public class HttpHeadersConstants {
- public static final String HEADER_FROM_APP_ID = "X-FromAppId";
- public static final String ONAP_PARTNER_NAME = "X-ONAP-PartnerName";
- public static final String HEADER_REQUEST_ID = "X-RequestId";
- public static final String TRANSACTION_ID = "X-TransactionID";
- public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
- public static final String ONAP_REQUEST_ID = "X-ONAP-RequestID";
- public static final String CLIENT_ID = "X-ClientID";
- public static final String INVOCATION_ID_HEADER = "X-InvocationID";
public static final String REQUESTOR_ID = "X-RequestorID";
}
diff --git a/common/src/main/java/org/onap/so/logger/LogConstants.java b/common/src/main/java/org/onap/so/logger/LogConstants.java
index 30915c6171..3dc0c062c6 100644
--- a/common/src/main/java/org/onap/so/logger/LogConstants.java
+++ b/common/src/main/java/org/onap/so/logger/LogConstants.java
@@ -21,8 +21,6 @@
package org.onap.so.logger;
public class LogConstants {
- public static final String TARGET_ENTITY_HEADER = "X-Target-Entity";
- public static final String UNKNOWN_TARGET_ENTITY = "Unknown-Target-Entity";
public static final String HTTP_URL = "Http-Url";
public static final String URI_BASE = "Uri-Base";
}
diff --git a/common/src/main/java/org/onap/so/logger/MdcConstants.java b/common/src/main/java/org/onap/so/logger/MdcConstants.java
index 33fceb2f0f..4c6672e59f 100644
--- a/common/src/main/java/org/onap/so/logger/MdcConstants.java
+++ b/common/src/main/java/org/onap/so/logger/MdcConstants.java
@@ -21,14 +21,6 @@
package org.onap.so.logger;
public class MdcConstants {
- public static final String INVOCATION_ID = "InvocationID";
- public static final String RESPONSECODE = "ResponseCode";
- public static final String RESPONSEDESC = "ResponseDesc";
- public static final String ECOMP_REQUEST_ID = "X-ECOMP-RequestID";
- public static final String CLIENT_ID = "X-ClientID";
- public static final String PARTNERNAME = "PartnerName";
- public static final String SERVICE_NAME = "ServiceName";
- public static final String STATUSCODE = "StatusCode";
- public static final String ENDTIME = "EndTimestamp";
public static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName";
+ public static final String OPENSTACK_STATUS_CODE = "OpenstackStatusCode";
}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
deleted file mode 100644
index 5dbf88d346..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsClientLogging.java
+++ /dev/null
@@ -1,136 +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.logging.jaxrs.filter;
-
-
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.utils.TargetEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-import javax.annotation.Priority;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.Providers;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.UUID;
-
-@SuppressWarnings("SpringJavaInjectionPointsAutowiringInspection")
-@Component
-@Priority(0)
-public class JaxRsClientLogging implements ClientRequestFilter, ClientResponseFilter {
-
- @Context
- private Providers providers;
-
- private static final String TRACE = "trace-#";
- private static final String SO = "SO";
- private static Logger logger = LoggerFactory.getLogger(JaxRsClientLogging.class);
-
- public void setTargetService(TargetEntity targetEntity) {
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, targetEntity.toString());
- }
-
- @Override
- public void filter(ClientRequestContext clientRequest) {
- try {
- setupMDC(clientRequest);
- setupHeaders(clientRequest);
- logger.info(ONAPLogConstants.Markers.INVOKE, "Invoke");
- } catch (Exception e) {
- logger.warn("Error in incoming JAX-RS Inteceptor", e);
- }
- }
-
- private void setupHeaders(ClientRequestContext clientRequest) {
- MultivaluedMap<String, Object> headers = clientRequest.getHeaders();
- headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest));
- headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO);
- }
-
- private void setupMDC(ClientRequestContext clientRequest) {
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getUri().toString());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- setInvocationId();
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY));
- }
-
- private String extractRequestID(ClientRequestContext clientRequest) {
- String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) {
- requestId = UUID.randomUUID().toString();
- logger.warn("Could not Find Request ID Generating New One: {}", clientRequest.getUri().getPath());
- }
- return requestId;
- }
-
- private void setInvocationId() {
- String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
-
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
-
- try {
- String statusCode;
- if (Response.Status.Family.familyOf(responseContext.getStatus())
- .equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- logger.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn");
- clearClientMDCs();
- } catch (Exception e) {
- logger.warn("Error in outgoing JAX-RS Inteceptor", e);
- }
- }
-
- private void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP);
- }
-
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
deleted file mode 100644
index 7e2b603ba6..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/JaxRsFilterLogging.java
+++ /dev/null
@@ -1,173 +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.logging.jaxrs.filter;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.lang.annotation.Annotation;
-import java.lang.reflect.Type;
-import java.util.UUID;
-import javax.annotation.Priority;
-import javax.servlet.http.HttpServletRequest;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.MessageBodyWriter;
-import javax.ws.rs.ext.Provider;
-import javax.ws.rs.ext.Providers;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logger.HttpHeadersConstants;
-import org.onap.so.logger.LogConstants;
-import org.onap.so.logger.MdcConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-@Priority(1)
-@Provider
-@Component
-public class JaxRsFilterLogging implements ContainerRequestFilter, ContainerResponseFilter {
-
- protected static Logger logger = LoggerFactory.getLogger(JaxRsFilterLogging.class);
-
- @Context
- private HttpServletRequest httpServletRequest;
-
- @Context
- private Providers providers;
-
- @Autowired
- private MDCSetup mdcSetup;
-
- @Override
- public void filter(ContainerRequestContext containerRequest) {
- try {
- MultivaluedMap<String, String> headers = containerRequest.getHeaders();
- setRequestId(headers);
- containerRequest.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
- setInvocationId(headers);
- setServiceName(containerRequest);
- setMDCPartnerName(headers);
- mdcSetup.setServerFQDN();
- mdcSetup.setClientIPAddress(httpServletRequest);
- mdcSetup.setInstanceUUID();
- mdcSetup.setEntryTimeStamp();
- MDC.put(HttpHeadersConstants.REQUESTOR_ID, headers.getFirst("X-RequestorID"));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(LogConstants.URI_BASE, containerRequest.getUriInfo().getBaseUri().toString());
- MDC.put(MdcConstants.ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- } catch (Exception e) {
- logger.warn("Error in incoming JAX-RS Inteceptor", e);
- }
- }
-
- @Override
- public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
- throws IOException {
- try {
- setResponseStatusCode(responseContext);
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, payloadMessage(responseContext));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
- MDC.clear();
- } catch (Exception e) {
- MDC.clear();
- logger.warn("Error in outgoing JAX-RS Inteceptor", e);
- }
- }
-
- private void setResponseStatusCode(ContainerResponseContext responseContext) {
- String statusCode;
- if (Response.Status.Family.familyOf(responseContext.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
-
- private String payloadMessage(ContainerResponseContext responseContext) throws IOException {
- String message = "";
- if (responseContext.hasEntity()) {
- ByteArrayOutputStream baos = new ByteArrayOutputStream();
- Class<?> entityClass = responseContext.getEntityClass();
- Type entityType = responseContext.getEntityType();
- Annotation[] entityAnnotations = responseContext.getEntityAnnotations();
- MediaType mediaType = responseContext.getMediaType();
- @SuppressWarnings("unchecked")
- MessageBodyWriter<Object> bodyWriter = (MessageBodyWriter<Object>) providers
- .getMessageBodyWriter(entityClass, entityType, entityAnnotations, mediaType);
- bodyWriter.writeTo(responseContext.getEntity(), entityClass, entityType, entityAnnotations, mediaType,
- responseContext.getHeaders(), baos);
- message = message.concat(new String(baos.toByteArray()));
- }
- return message;
- }
-
- private void setRequestId(MultivaluedMap<String, String> headers) {
- String requestId = headers.getFirst(ONAPLogConstants.Headers.REQUEST_ID);
- if (requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
-
- private void setInvocationId(MultivaluedMap<String, String> headers) {
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, findInvocationId(headers));
- }
-
- private void setMDCPartnerName(MultivaluedMap<String, String> headers) {
- String partnerName = headers.getFirst(ONAPLogConstants.Headers.PARTNER_NAME);
- if (partnerName == null || partnerName.isEmpty())
- partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
- }
-
- private String findInvocationId(MultivaluedMap<String, String> headers) {
- String invocationId = headers.getFirst(ONAPLogConstants.Headers.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- return invocationId;
- }
-
- private void setServiceName(ContainerRequestContext containerRequest) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, containerRequest.getUriInfo().getPath());
- }
-
- private void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- }
-
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
deleted file mode 100644
index 607f067ec4..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/MDCSetup.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.logging.jaxrs.filter;
-
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.Map;
-import java.util.UUID;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Response;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-
-@Component
-public class MDCSetup {
-
- protected static Logger logger = LoggerFactory.getLogger(MDCSetup.class);
-
- private static final String INSTANCE_UUID = UUID.randomUUID().toString();
-
- public void setInstanceUUID() {
- MDC.put(ONAPLogConstants.MDCs.INSTANCE_UUID, INSTANCE_UUID);
- }
-
- public void setServerFQDN() {
- String serverFQDN = "";
- InetAddress addr = null;
- try {
- addr = InetAddress.getLocalHost();
- serverFQDN = addr.toString();
- } catch (UnknownHostException e) {
- logger.warn("Cannot Resolve Host Name");
- serverFQDN = "";
- }
- MDC.put(ONAPLogConstants.MDCs.SERVER_FQDN, serverFQDN);
- }
-
- public void setClientIPAddress(HttpServletRequest httpServletRequest) {
- String remoteIpAddress = "";
- if (httpServletRequest != null) {
- remoteIpAddress = httpServletRequest.getRemoteAddr();
- }
- MDC.put(ONAPLogConstants.MDCs.CLIENT_IP_ADDRESS, remoteIpAddress);
- }
-
- public void setEntryTimeStamp() {
- MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- }
-
- public void setServiceName(HttpServletRequest request) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
- }
-
- public void setRequestId(Map<String, String> headers) {
- String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID);
- if (requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
-
- public void setInvocationId(Map<String, String> headers) {
- String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
- public void setMDCPartnerName(Map<String, String> headers) {
- String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME);
- if (partnerName == null || partnerName.isEmpty())
- partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
- }
-
-
- public void setResponseStatusCode(HttpServletResponse response) {
- String statusCode;
- if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
deleted file mode 100644
index 21c0b52a91..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/PayloadLoggingFilter.java
+++ /dev/null
@@ -1,158 +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.logging.jaxrs.filter;
-
-import java.io.BufferedInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FilterOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import javax.annotation.Priority;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import javax.ws.rs.ext.Provider;
-import javax.ws.rs.ext.WriterInterceptor;
-import javax.ws.rs.ext.WriterInterceptorContext;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-@Provider
-@Priority(1)
-public class PayloadLoggingFilter implements ClientRequestFilter, ClientResponseFilter, WriterInterceptor {
-
- private static final Logger logger = LoggerFactory.getLogger(PayloadLoggingFilter.class);
- private static final String ENTITY_STREAM_PROPERTY = "LoggingFilter.entityStream";
- private static final Charset DEFAULT_CHARSET = StandardCharsets.UTF_8;
- private final int maxEntitySize;
-
- public PayloadLoggingFilter() {
- maxEntitySize = 1024 * 1024;
- }
-
- public PayloadLoggingFilter(int maxPayloadSize) {
- this.maxEntitySize = Integer.min(maxPayloadSize, 1024 * 1024);
- }
-
- private void log(StringBuilder sb) {
- logger.debug(sb.toString());
- }
-
- protected InputStream logInboundEntity(final StringBuilder b, InputStream stream, final Charset charset)
- throws IOException {
- if (!stream.markSupported()) {
- stream = new BufferedInputStream(stream);
- }
- stream.mark(maxEntitySize + 1);
- final byte[] entity = new byte[maxEntitySize + 1];
- final int entitySize = stream.read(entity);
- if (entitySize != -1) {
- b.append(new String(entity, 0, Math.min(entitySize, maxEntitySize), charset));
- }
- if (entitySize > maxEntitySize) {
- b.append("...more...");
- }
- b.append('\n');
- stream.reset();
- return stream;
- }
-
- @Override
- public void filter(ClientRequestContext requestContext) throws IOException {
- if (requestContext.hasEntity()) {
- final OutputStream stream = new LoggingStream(requestContext.getEntityStream());
- requestContext.setEntityStream(stream);
- requestContext.setProperty(ENTITY_STREAM_PROPERTY, stream);
- }
- String method = formatMethod(requestContext);
- log(new StringBuilder("Making " + method + " request to: " + requestContext.getUri() + "\nRequest Headers: "
- + requestContext.getHeaders().toString()));
-
- }
-
- @Override
- public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- final StringBuilder sb = new StringBuilder();
- if (responseContext.hasEntity()) {
- responseContext.setEntityStream(logInboundEntity(sb, responseContext.getEntityStream(), DEFAULT_CHARSET));
- String method = formatMethod(requestContext);
- log(sb.insert(0, "Response from " + method + ": " + requestContext.getUri() + "\nResponse Headers: "
- + responseContext.getHeaders().toString()));
- }
- }
-
- @Override
- public void aroundWriteTo(WriterInterceptorContext context) throws IOException, WebApplicationException {
- final LoggingStream stream = (LoggingStream) context.getProperty(ENTITY_STREAM_PROPERTY);
- context.proceed();
- if (stream != null) {
- log(stream.getStringBuilder(DEFAULT_CHARSET));
- }
- }
-
- private class LoggingStream extends FilterOutputStream {
-
- private final StringBuilder sb = new StringBuilder();
- private final ByteArrayOutputStream baos = new ByteArrayOutputStream();
-
- LoggingStream(OutputStream out) {
- super(out);
- }
-
- StringBuilder getStringBuilder(Charset charset) {
- // write entity to the builder
- final byte[] entity = baos.toByteArray();
-
- sb.append(new String(entity, 0, entity.length, charset));
- if (entity.length > maxEntitySize) {
- sb.append("...more...");
- }
- sb.append('\n');
-
- return sb;
- }
-
- @Override
- public void write(final int i) throws IOException {
- if (baos.size() <= maxEntitySize) {
- baos.write(i);
- }
- out.write(i);
- }
- }
-
- private String formatMethod(ClientRequestContext requestContext) {
- String method = requestContext.getHeaderString("X-HTTP-Method-Override");
- if (method == null) {
- method = requestContext.getMethod();
- } else {
- method = requestContext.getMethod() + " (overridden to " + method + ")";
- }
-
- return method;
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
new file mode 100644
index 0000000000..5ae1082464
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOAuditLogContainerFilter.java
@@ -0,0 +1,34 @@
+package org.onap.so.logging.jaxrs.filter;
+
+import javax.annotation.Priority;
+import javax.ws.rs.container.ContainerRequestContext;
+import javax.ws.rs.container.ContainerResponseContext;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.HttpHeadersConstants;
+import org.onap.so.logger.LogConstants;
+import org.slf4j.MDC;
+import org.springframework.stereotype.Component;
+import org.onap.logging.filter.base.AuditLogContainerFilter;
+
+@Priority(1)
+@Component
+public class SOAuditLogContainerFilter extends AuditLogContainerFilter {
+
+ private static final String ORIGINAL_PARTNER_NAME = "OriginalPartnerName";
+
+ @Override
+ protected void additionalPreHandling(ContainerRequestContext request) {
+ request.setProperty("requestId", MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ MDC.put(ORIGINAL_PARTNER_NAME, MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ String requestorId = request.getHeaders().getFirst("X-RequestorID");
+ if (requestorId != null) {
+ MDC.put(HttpHeadersConstants.REQUESTOR_ID, requestorId);
+ }
+ MDC.put(LogConstants.URI_BASE, request.getUriInfo().getBaseUri().toString());
+ }
+
+ @Override
+ protected void additionalPostHandling(ContainerResponseContext response) {
+ // override to add additional post handling
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
new file mode 100644
index 0000000000..3b6b5216e0
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOMetricLogClientFilter.java
@@ -0,0 +1,61 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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 javax.ws.rs.client.ClientRequestContext;
+import javax.ws.rs.client.ClientResponseContext;
+import org.onap.logging.filter.base.MetricLogClientFilter;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+
+
+public class SOMetricLogClientFilter extends MetricLogClientFilter {
+
+ protected static Logger logger = LoggerFactory.getLogger(SOMetricLogClientFilter.class);
+ private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
+
+ @Override
+ public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) {
+ try {
+ setLogTimestamp();
+ setElapsedTimeInvokeTimestamp();
+ setResponseStatusCode(responseContext.getStatus());
+ setResponseDescription(responseContext.getStatus());
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(responseContext.getStatus()));
+ logger.info(INVOKE_RETURN, "InvokeReturn");
+ clearClientMDCs();
+ setOpenStackResponseCode();
+ } catch (Exception e) {
+ logger.warn("Error in JAX-RS request,response client filter", e);
+ }
+ }
+
+ protected void setOpenStackResponseCode() {
+ if (MDC.get(MdcConstants.OPENSTACK_STATUS_CODE) != null) {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
new file mode 100644
index 0000000000..d8ce17a277
--- /dev/null
+++ b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SOSpringClientFilter.java
@@ -0,0 +1,68 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2019 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.io.IOException;
+import java.util.UUID;
+import org.onap.logging.filter.spring.SpringClientFilter;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.slf4j.Marker;
+import org.slf4j.MarkerFactory;
+import org.springframework.http.HttpRequest;
+import org.springframework.http.client.ClientHttpRequestInterceptor;
+import org.springframework.http.client.ClientHttpResponse;
+import org.springframework.stereotype.Component;
+
+@Component
+public class SOSpringClientFilter extends SpringClientFilter implements ClientHttpRequestInterceptor {
+
+ private final Logger logger = LoggerFactory.getLogger(this.getClass());
+ private static final Marker INVOKE_RETURN = MarkerFactory.getMarker("INVOKE-RETURN");
+
+ @Override
+ protected void post(HttpRequest request, ClientHttpResponse response) {
+ setLogTimestamp();
+ setElapsedTimeInvokeTimestamp();
+ try {
+ setResponseStatusCode(response.getRawStatusCode());
+ int statusCode = response.getRawStatusCode();
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(statusCode));
+ setResponseDescription(statusCode);
+ } catch (IOException e) {
+ logger.error("Unable to get statusCode from response");
+ }
+
+
+ logger.info(INVOKE_RETURN, "InvokeReturn");
+ clearClientMDCs();
+ setOpenStackResponseCode();
+ }
+
+ protected void setOpenStackResponseCode() {
+ if (MDC.get(MdcConstants.OPENSTACK_STATUS_CODE) != null) {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ }
+ }
+}
diff --git a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java b/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
deleted file mode 100644
index c763dd4374..0000000000
--- a/common/src/main/java/org/onap/so/logging/jaxrs/filter/SpringClientFilter.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.logging.jaxrs.filter;
-
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logger.LogConstants;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.http.HttpHeaders;
-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.util.StreamUtils;
-import java.io.IOException;
-import java.nio.charset.Charset;
-import java.time.ZoneOffset;
-import java.time.ZonedDateTime;
-import java.time.format.DateTimeFormatter;
-import java.util.List;
-import java.util.UUID;
-import javax.ws.rs.core.Response;
-
-public class SpringClientFilter implements ClientHttpRequestInterceptor {
-
- private final Logger log = LoggerFactory.getLogger(this.getClass());
-
- private static final String TRACE = "trace-#";
- private static final String SO = "SO";
-
- @Override
- public ClientHttpResponse intercept(HttpRequest request, byte[] body, ClientHttpRequestExecution execution)
- throws IOException {
- processRequest(request, body);
- ClientHttpResponse response = execution.execute(request, body);
- processResponse(response);
- return response;
- }
-
- private void processRequest(HttpRequest request, byte[] body) throws IOException {
- setInvocationId();
- setupHeaders(request);
- setupMDC(request);
- if (log.isDebugEnabled()) {
- log.debug("===========================request begin================================================");
- log.debug("URI : {}", request.getURI());
- log.debug("Method : {}", request.getMethod());
- log.debug("Headers : {}", request.getHeaders());
- log.debug("Request body: {}", new String(body, "UTF-8"));
- log.debug("==========================request end================================================");
- }
- }
-
- private void setupHeaders(HttpRequest clientRequest) {
- HttpHeaders headers = clientRequest.getHeaders();
- headers.add(ONAPLogConstants.Headers.REQUEST_ID, extractRequestID(clientRequest));
- headers.add(ONAPLogConstants.Headers.INVOCATION_ID, MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID));
- headers.add(ONAPLogConstants.Headers.PARTNER_NAME, SO);
- }
-
- private String extractRequestID(HttpRequest clientRequest) {
- String requestId = MDC.get(ONAPLogConstants.MDCs.REQUEST_ID);
- if (requestId == null || requestId.isEmpty() || requestId.equals(TRACE)) {
- requestId = UUID.randomUUID().toString();
- log.warn("Could not Find Request ID Generating New One: {}", clientRequest.getURI());
- }
- return requestId;
- }
-
- private void setupMDC(HttpRequest clientRequest) {
- MDC.put(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP,
- ZonedDateTime.now(ZoneOffset.UTC).format(DateTimeFormatter.ISO_INSTANT));
- MDC.put(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME, clientRequest.getURI().toString());
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- MDC.put(ONAPLogConstants.MDCs.TARGET_ENTITY, extractTargetEntity(clientRequest));
- }
-
- private String extractTargetEntity(HttpRequest clientRequest) {
- HttpHeaders headers = clientRequest.getHeaders();
- String headerTargetEntity = null;
- List<String> headerTargetEntityList = headers.get(LogConstants.TARGET_ENTITY_HEADER);
- if (headerTargetEntityList != null && !headerTargetEntityList.isEmpty())
- headerTargetEntity = headerTargetEntityList.get(0);
- String targetEntity = MDC.get(ONAPLogConstants.MDCs.TARGET_ENTITY);
- if (targetEntity != null && !targetEntity.isEmpty()) {
- return targetEntity;
- } else if (headerTargetEntity != null && !headerTargetEntity.isEmpty()) {
- targetEntity = headerTargetEntity;
- } else {
- targetEntity = LogConstants.UNKNOWN_TARGET_ENTITY;
- log.warn("Could not Target Entity: {}", clientRequest.getURI());
- }
- return targetEntity;
- }
-
- private void setInvocationId() {
- String invocationId = MDC.get(ONAPLogConstants.MDCs.INVOCATION_ID);
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
-
- private void processResponse(ClientHttpResponse response) throws IOException {
- if (log.isDebugEnabled()) {
- log.debug("============================response begin==========================================");
- log.debug("Status code : {}", response.getStatusCode());
- log.debug("Status text : {}", response.getStatusText());
- log.debug("Headers : {}", response.getHeaders());
- log.debug("Response body: {}", StreamUtils.copyToString(response.getBody(), Charset.defaultCharset()));
- log.debug("=======================response end=================================================");
- }
- String statusCode;
- if (Response.Status.Family.familyOf(response.getRawStatusCode()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getRawStatusCode()));
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "");
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- log.info(ONAPLogConstants.Markers.INVOKE_RETURN, "InvokeReturn");
- clearClientMDCs();
- }
-
- private void clearClientMDCs() {
- MDC.remove(ONAPLogConstants.MDCs.INVOCATION_ID);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION);
- MDC.remove(ONAPLogConstants.MDCs.RESPONSE_CODE);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_ENTITY);
- MDC.remove(ONAPLogConstants.MDCs.PARTNER_NAME);
- MDC.remove(ONAPLogConstants.MDCs.TARGET_SERVICE_NAME);
- MDC.remove(ONAPLogConstants.MDCs.INVOKE_TIMESTAMP);
- }
-}
diff --git a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java b/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
deleted file mode 100644
index fa5a5d5da4..0000000000
--- a/common/src/main/java/org/onap/so/logging/spring/interceptor/LoggingInterceptor.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.so.logging.spring.interceptor;
-
-import java.util.Collections;
-import java.util.Map;
-import java.util.UUID;
-import java.util.stream.Collectors;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.Providers;
-import org.onap.logging.ref.slf4j.ONAPLogConstants;
-import org.onap.so.logging.jaxrs.filter.MDCSetup;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.servlet.ModelAndView;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-@Component
-public class LoggingInterceptor extends HandlerInterceptorAdapter {
-
- Logger logger = LoggerFactory.getLogger(LoggingInterceptor.class);
-
- @Autowired
- private MDCSetup mdcSetup;
-
- @Context
- private Providers providers;
-
- @Override
- public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler)
- throws Exception {
-
- Map<String, String> headers = Collections.list((request).getHeaderNames()).stream()
- .collect(Collectors.toMap(h -> h, request::getHeader));
- setRequestId(headers);
- setInvocationId(headers);
- setServiceName(request);
- setMDCPartnerName(headers);
- mdcSetup.setClientIPAddress(request);
- mdcSetup.setEntryTimeStamp();
- mdcSetup.setInstanceUUID();
- mdcSetup.setServerFQDN();
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
- logger.info(ONAPLogConstants.Markers.ENTRY, "Entering");
- if (logger.isDebugEnabled())
- logRequestInformation(request);
- return true;
- }
-
- protected void logRequestInformation(HttpServletRequest request) {
- Map<String, String> headers = Collections.list((request).getHeaderNames()).stream()
- .collect(Collectors.toMap(h -> h, request::getHeader));
-
- logger.debug("===========================request begin================================================");
- logger.debug("URI : {}", request.getRequestURI());
- logger.debug("Method : {}", request.getMethod());
- logger.debug("Headers : {}", headers);
- logger.debug("==========================request end================================================");
-
- }
-
- @Override
- public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler,
- ModelAndView modelAndView) throws Exception {
- setResponseStatusCode(response);
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION, "");
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_CODE, String.valueOf(response.getStatus()));
- logger.info(ONAPLogConstants.Markers.EXIT, "Exiting.");
- MDC.clear();
- }
-
- protected void setResponseStatusCode(HttpServletResponse response) {
- String statusCode;
- if (Response.Status.Family.familyOf(response.getStatus()).equals(Response.Status.Family.SUCCESSFUL)) {
- statusCode = ONAPLogConstants.ResponseStatus.COMPLETED.toString();
- } else {
- statusCode = ONAPLogConstants.ResponseStatus.ERROR.toString();
- }
- MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, statusCode);
- }
-
- protected void setServiceName(HttpServletRequest request) {
- MDC.put(ONAPLogConstants.MDCs.SERVICE_NAME, request.getRequestURI());
- }
-
- protected void setRequestId(Map<String, String> headers) {
- String requestId = headers.get(ONAPLogConstants.Headers.REQUEST_ID.toLowerCase());
- if (requestId == null || requestId.isEmpty())
- requestId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, requestId);
- }
-
- protected void setInvocationId(Map<String, String> headers) {
- String invocationId = headers.get(ONAPLogConstants.Headers.INVOCATION_ID.toLowerCase());
- if (invocationId == null || invocationId.isEmpty())
- invocationId = UUID.randomUUID().toString();
- MDC.put(ONAPLogConstants.MDCs.INVOCATION_ID, invocationId);
- }
-
- protected void setMDCPartnerName(Map<String, String> headers) {
- String partnerName = headers.get(ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase());
- if (partnerName == null || partnerName.isEmpty())
- partnerName = "";
- MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
- }
-
-
-}
diff --git a/common/src/main/java/org/onap/so/utils/Components.java b/common/src/main/java/org/onap/so/utils/Components.java
new file mode 100644
index 0000000000..0713723264
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/Components.java
@@ -0,0 +1,7 @@
+package org.onap.so.utils;
+
+import org.onap.logging.filter.base.ONAPComponentsList;
+
+public enum Components implements ONAPComponentsList {
+ OPENSTACK, UNKNOWN;
+}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
new file mode 100644
index 0000000000..e43b431821
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskServiceUtils.java
@@ -0,0 +1,46 @@
+package org.onap.so.utils;
+
+import java.security.GeneralSecurityException;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.camunda.bpm.client.interceptor.ClientRequestInterceptor;
+import org.camunda.bpm.client.interceptor.auth.BasicAuthProvider;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class ExternalTaskServiceUtils {
+
+ @Autowired
+ public Environment env;
+
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskServiceUtils.class);
+
+ public ExternalTaskClient createExternalTaskClient() throws Exception {
+ String auth = getAuth();
+ ClientRequestInterceptor interceptor = createClientInterceptor(auth);
+ return ExternalTaskClient.create().baseUrl(env.getRequiredProperty("mso.workflow.endpoint")).maxTasks(1)
+ .addInterceptor(interceptor).asyncResponseTimeout(120000).build();
+ }
+
+ protected ClientRequestInterceptor createClientInterceptor(String auth) {
+ return new BasicAuthProvider(env.getRequiredProperty("mso.config.cadi.aafId"), auth);
+ }
+
+ protected String getAuth() throws Exception {
+ try {
+ return CryptoUtils.decrypt(env.getRequiredProperty("mso.auth"), env.getRequiredProperty("mso.msoKey"));
+ } catch (IllegalStateException | GeneralSecurityException e) {
+ logger.error("Error Decrypting Password", e);
+ throw new Exception("Cannot load password");
+ }
+ }
+
+ public int getMaxClients() {
+ return Integer.parseInt(env.getProperty("workflow.topics.maxClients", "3"));
+ }
+
+
+}
diff --git a/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
new file mode 100644
index 0000000000..a2aed638fe
--- /dev/null
+++ b/common/src/main/java/org/onap/so/utils/ExternalTaskUtils.java
@@ -0,0 +1,36 @@
+package org.onap.so.utils;
+
+import org.camunda.bpm.client.task.ExternalTask;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.slf4j.MDC;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public abstract class ExternalTaskUtils {
+
+ @Autowired
+ Environment env;
+
+ private static final Logger logger = LoggerFactory.getLogger(ExternalTaskUtils.class);
+
+ public long calculateRetryDelay(int currentRetries) {
+ int retrySequence = getRetrySequence().length - currentRetries;
+ return Integer.parseInt(getRetrySequence()[retrySequence]) * getRetryMutiplier();
+ }
+
+ protected Long getRetryMutiplier() {
+ return Long.parseLong(env.getProperty("mso.workflow.topics.retryMultiplier", "6000"));
+ }
+
+ protected String[] getRetrySequence() {
+ String[] seq = {"1", "1", "2", "3", "5", "8", "13", "20"};
+ if (env.getProperty("mso.workflow.topics.retrySequence") != null) {
+ seq = env.getProperty("mso.workflow.topics.retrySequence", String[].class);
+ }
+ return seq;
+ }
+}
diff --git a/common/src/main/java/org/onap/so/utils/TargetEntity.java b/common/src/main/java/org/onap/so/utils/TargetEntity.java
deleted file mode 100644
index 3a3ec91d2f..0000000000
--- a/common/src/main/java/org/onap/so/utils/TargetEntity.java
+++ /dev/null
@@ -1,59 +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.utils;
-
-import java.util.EnumSet;
-
-public enum TargetEntity implements TargetEntities {
- OPENSTACK_ADAPTER,
- BPMN,
- GRM,
- AAI,
- DMAAP,
- POLICY,
- CATALOG_DB,
- REQUEST_DB,
- VNF_ADAPTER,
- SDNC_ADAPTER,
- SNIRO,
- SDC,
- EXTERNAL,
- MULTICLOUD,
- OOF,
- SDNC,
- SO,
- UNKNOWN,
- OPENSTACK;
-
- private static final String PREFIX = "SO";
-
- public static EnumSet<TargetEntity> getSOInternalComponents() {
- return EnumSet.of(OPENSTACK_ADAPTER, BPMN, CATALOG_DB, REQUEST_DB, VNF_ADAPTER, SDNC_ADAPTER);
- }
-
- @Override
- public String toString() {
- if (getSOInternalComponents().contains(this))
- return TargetEntity.PREFIX + "." + this.name();
- else
- return this.name();
- }
-}
diff --git a/common/src/test/java/org/onap/so/client/HttpClientTest.java b/common/src/test/java/org/onap/so/client/HttpClientTest.java
index b12ed5956a..a01e2bb812 100644
--- a/common/src/test/java/org/onap/so/client/HttpClientTest.java
+++ b/common/src/test/java/org/onap/so/client/HttpClientTest.java
@@ -32,7 +32,7 @@ import java.net.MalformedURLException;
import java.net.URL;
import org.junit.Rule;
import org.junit.Test;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import com.github.tomakehurst.wiremock.junit.WireMockRule;
public class HttpClientTest {
@@ -49,7 +49,7 @@ public class HttpClientTest {
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("")));
URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post");
- HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN);
+ HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN);
client.addBasicAuthHeader(
"97FF88AB352DA16E00DDD81E3876431DEF8744465DACA489EB3B3BE1F10F63EDA1715E626D0A4827A3E19CD88421BF",
@@ -68,7 +68,7 @@ public class HttpClientTest {
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("")));
URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post");
- HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN);
+ HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN);
client.addAdditionalHeader("Accept", "application/json");
client.addAdditionalHeader("id", null);
@@ -86,7 +86,7 @@ public class HttpClientTest {
.willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json").withBody("")));
URL url = new URL("http://localhost:" + wireMockConfig().portNumber() + "/services/sdnc/post");
- HttpClient client = httpClientFactory.newJsonClient(url, TargetEntity.BPMN);
+ HttpClient client = httpClientFactory.newJsonClient(url, ONAPComponents.BPMN);
client.addBasicAuthHeader("", "12345");
client.addAdditionalHeader("Accept", "application/json");
diff --git a/common/src/test/java/org/onap/so/client/RestClientTest.java b/common/src/test/java/org/onap/so/client/RestClientTest.java
index 745dee23e8..cd00a9e4de 100644
--- a/common/src/test/java/org/onap/so/client/RestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/RestClientTest.java
@@ -39,7 +39,7 @@ import org.junit.runner.RunWith;
import org.mockito.ArgumentMatchers;
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
@RunWith(MockitoJUnitRunner.class)
public class RestClientTest {
@@ -82,7 +82,7 @@ public class RestClientTest {
private RestClient buildSpy() throws MalformedURLException, IllegalArgumentException, UriBuilderException {
RestClient client = httpClientFactory.newJsonClient(UriBuilder.fromUri("http://localhost/test").build().toURL(),
- TargetEntity.BPMN);
+ ONAPComponents.BPMN);
return spy(client);
}
diff --git a/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
index 2ef50dd77b..3587c71de0 100644
--- a/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
+++ b/common/src/test/java/org/onap/so/client/aai/AAIErrorFormatterTest.java
@@ -79,6 +79,22 @@ public class AAIErrorFormatterTest {
}
@Test
+ public void errorMessageOnPercentEncodedTest() {
+ ServiceException svcException = new ServiceException();
+ svcException.setText("test my%20Test %1 message - %2");
+ svcException.setVariables(Arrays.asList("error", "service exception %1 test"));
+
+ RequestError requestError = new RequestError();
+ requestError.setServiceException(svcException);
+
+ doReturn(requestError).when(errorObj).getRequestError();
+
+ AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
+ String result = formatter.getMessage();
+ assertEquals("equal", "test my%20Test error message - service exception error test", result);
+ }
+
+ @Test
public void testGetMessageNoParsable() {
errorObj.setRequestError(null);
AAIErrorFormatter formatter = new AAIErrorFormatter(errorObj);
diff --git a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
index bc600310b3..5075da3b7a 100644
--- a/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
+++ b/common/src/test/java/org/onap/so/client/adapter/rest/AdapterRestClientTest.java
@@ -34,7 +34,7 @@ import org.junit.Before;
import org.junit.Test;
import org.onap.so.client.policy.JettisonStyleMapperProvider;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
public class AdapterRestClientTest {
@@ -88,9 +88,9 @@ public class AdapterRestClientTest {
}
@Test
- public void getTargetEntity_success() throws URISyntaxException {
+ public void getONAPComponents_success() throws URISyntaxException {
AdapterRestClient testedObject = new AdapterRestClient(adapterRestPropertiesMock, new URI(""));
- assertThat(testedObject.getTargetEntity()).isEqualTo(TargetEntity.OPENSTACK_ADAPTER);
+ assertThat(testedObject.getTargetEntity()).isEqualTo(ONAPComponents.OPENSTACK_ADAPTER);
}
@Test
diff --git a/common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java b/common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java
new file mode 100644
index 0000000000..8006423e75
--- /dev/null
+++ b/common/src/test/java/org/onap/so/client/dmaap/rest/DMaaPRestClientTest.java
@@ -0,0 +1,96 @@
+/*-
+ * ============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.dmaap.rest;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+import org.junit.Test;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.slf4j.MDC;
+
+public class DMaaPRestClientTest {
+
+ URL url;
+ private final String contentType = "application/json";
+ private final String auth = "";
+ private final String key = "";
+
+
+ @Test
+ public void headerMapTest() {
+
+ try {
+ url = new URL("http://testhost.com");
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+ map.put(ONAPLogConstants.MDCs.REQUEST_ID, "1234");
+ assertNotNull(map);
+ assertEquals("Found expected RequesttId", "1234", map.get(ONAPLogConstants.MDCs.REQUEST_ID));
+
+ }
+
+ @Test
+ public void headerMapInvocationIdNotNullTest() {
+
+ try {
+ url = new URL("http://testhost.com");
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+ MDC.put(ONAPLogConstants.MDCs.REQUEST_ID, "1234");
+ DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+
+ assertNotNull(map);
+ assertEquals("Found expected RequestId", "1234", map.get(ONAPLogConstants.Headers.INVOCATION_ID));
+
+ }
+
+ @Test
+ public void headerMapInvocationIdNullTest() {
+
+ try {
+ url = new URL("http://testhost.com");
+ } catch (MalformedURLException e) {
+
+ throw new RuntimeException(e);
+ }
+
+ DMaaPRestClient client = new DMaaPRestClient(url, contentType, auth, key);
+ Map<String, String> map = new HashMap<>();
+ client.initializeHeaderMap(map);
+
+ assertNotNull(map);
+ assertEquals("header not found as expected", null, map.get(ONAPLogConstants.Headers.INVOCATION_ID));
+
+ }
+}
diff --git a/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
new file mode 100644
index 0000000000..c4609f0336
--- /dev/null
+++ b/common/src/test/java/org/onap/so/externaltasks/logging/AuditMDCSetupTest.java
@@ -0,0 +1,93 @@
+package org.onap.so.externaltasks.logging;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.Mockito.doReturn;
+import org.camunda.bpm.client.task.ExternalTask;
+import org.junit.After;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.logging.filter.base.MDCSetup;
+import org.onap.logging.ref.slf4j.ONAPLogConstants;
+import org.onap.so.logger.MdcConstants;
+import org.slf4j.MDC;
+
+@RunWith(MockitoJUnitRunner.class)
+public class AuditMDCSetupTest {
+
+ @Mock
+ private ExternalTask externalTask;
+
+ @Mock
+ private MDCSetup mdcSet;
+
+ @Spy
+ @InjectMocks
+ private AuditMDCSetup mdcSetup;
+
+ private String requestId = "9bb86b8d-a02f-4a0b-81a9-2eb963850009";
+ private String serviceName = "testServiceName";
+
+ @After
+ public void tearDown() {
+ MDC.clear();
+ }
+
+ @Test
+ public void setupMDCTest() {
+ doReturn(requestId).when(externalTask).getVariable("mso-request-id");
+ doReturn(serviceName).when(externalTask).getTopicName();
+
+ mdcSetup.setupMDC(externalTask);
+
+ assertNotNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertEquals(requestId, MDC.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertEquals(serviceName, MDC.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("SO.OPENSTACK_ADAPTER", MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
+ MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ }
+
+ @Test
+ public void setElapsedTimeTest() {
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
+
+ mdcSetup.setElapsedTime();
+
+ assertNotNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
+ }
+
+ @Test
+ public void setResponseCodeTest() {
+ mdcSetup.setResponseCode(ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+
+ assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
+ MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertEquals(ONAPLogConstants.ResponseStatus.INPROGRESS.toString(),
+ MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ }
+
+ @Test
+ public void clearClientMDCsTest() {
+ MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ MDC.put(MdcConstants.OPENSTACK_STATUS_CODE, ONAPLogConstants.ResponseStatus.INPROGRESS.toString());
+ MDC.put(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP, "2019-06-18T02:09:06.024Z");
+ MDC.put(ONAPLogConstants.MDCs.ELAPSED_TIME, "318");
+ MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, "SO.OPENSTACK_ADAPTER");
+
+ mdcSetup.clearClientMDCs();
+
+ assertNull(MDC.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertNull(MDC.get(MdcConstants.OPENSTACK_STATUS_CODE));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.ELAPSED_TIME));
+ assertNull(MDC.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java
new file mode 100644
index 0000000000..b2db986d02
--- /dev/null
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskServiceUtilsTest.java
@@ -0,0 +1,61 @@
+package org.onap.so.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.mockito.Mockito.doReturn;
+import org.camunda.bpm.client.ExternalTaskClient;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.Spy;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExternalTaskServiceUtilsTest {
+
+ @Spy
+ @InjectMocks
+ private ExternalTaskServiceUtils utils = new ExternalTaskServiceUtils();
+
+ @Mock
+ private Environment mockEnv;
+
+ @Mock
+ private ExternalTaskClient mockClient;
+
+ @Before
+ public void setup() {
+ MockitoAnnotations.initMocks(this);
+ doReturn("3").when(mockEnv).getProperty("workflow.topics.maxClients", "3");
+ doReturn("07a7159d3bf51a0e53be7a8f89699be7").when(mockEnv).getRequiredProperty("mso.msoKey");
+ doReturn("6B466C603A260F3655DBF91E53CE54667041C01406D10E8CAF9CC24D8FA5388D06F90BFE4C852052B436").when(mockEnv)
+ .getRequiredProperty("mso.auth");
+ doReturn("someid").when(mockEnv).getRequiredProperty("mso.config.cadi.aafId");
+ doReturn("http://camunda.com").when(mockEnv).getRequiredProperty("mso.workflow.endpoint");
+ }
+
+ @Test
+ public void testCreateExternalTaskClient() throws Exception {
+ ExternalTaskClient actualClient = utils.createExternalTaskClient();
+ Assert.assertNotNull(actualClient);
+ }
+
+ @Test
+ public void testGetAuth() throws Exception {
+ String actual = utils.getAuth();
+ String expected = "Att32054Life!@";
+ assertEquals(expected, actual);
+ }
+
+ @Test
+ public void testGetMaxClients() throws Exception {
+ int actual = utils.getMaxClients();
+ int expected = 3;
+ assertEquals(expected, actual);
+ }
+
+}
diff --git a/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
new file mode 100644
index 0000000000..f918781b39
--- /dev/null
+++ b/common/src/test/java/org/onap/so/utils/ExternalTaskUtilsTest.java
@@ -0,0 +1,65 @@
+package org.onap.so.utils;
+
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.springframework.core.env.Environment;
+
+@RunWith(MockitoJUnitRunner.class)
+public class ExternalTaskUtilsTest {
+
+ @Mock
+ private Environment mockenv;
+
+ @InjectMocks
+ private ExternalTaskUtils externalTaskUtilsAnony = new ExternalTaskUtils() {
+
+ };
+
+ @Test
+ public void retry_sequence_calculation_Test() {
+ Mockito.when(mockenv.getProperty("mso.workflow.topics.retryMultiplier", "6000")).thenReturn("6000");
+ long firstRetry = externalTaskUtilsAnony.calculateRetryDelay(8);
+ assertEquals(6000L, firstRetry);
+ long secondRetry = externalTaskUtilsAnony.calculateRetryDelay(7);
+ assertEquals(6000L, secondRetry);
+ long thirdRetry = externalTaskUtilsAnony.calculateRetryDelay(6);
+ assertEquals(12000L, thirdRetry);
+ long fourthRetry = externalTaskUtilsAnony.calculateRetryDelay(5);
+ assertEquals(18000L, fourthRetry);
+ long fifthRetry = externalTaskUtilsAnony.calculateRetryDelay(4);
+ assertEquals(30000L, fifthRetry);
+ long sixRetry = externalTaskUtilsAnony.calculateRetryDelay(3);
+ assertEquals(48000L, sixRetry);
+ long seventhRetry = externalTaskUtilsAnony.calculateRetryDelay(2);
+ assertEquals(78000L, seventhRetry);
+ long eigthRetry = externalTaskUtilsAnony.calculateRetryDelay(1);
+ assertEquals(120000L, eigthRetry);
+ }
+
+ @Test
+ public void retry_sequence_Test() {
+ Mockito.when(mockenv.getProperty("mso.workflow.topics.retryMultiplier", "6000")).thenReturn("6000");
+ long firstRetry = externalTaskUtilsAnony.calculateRetryDelay(8);
+ assertEquals(6000L, firstRetry);
+ long secondRetry = externalTaskUtilsAnony.calculateRetryDelay(7);
+ assertEquals(6000L, secondRetry);
+ long thirdRetry = externalTaskUtilsAnony.calculateRetryDelay(6);
+ assertEquals(12000L, thirdRetry);
+ long fourthRetry = externalTaskUtilsAnony.calculateRetryDelay(5);
+ assertEquals(18000L, fourthRetry);
+ long fifthRetry = externalTaskUtilsAnony.calculateRetryDelay(4);
+ assertEquals(30000L, fifthRetry);
+ long sixRetry = externalTaskUtilsAnony.calculateRetryDelay(3);
+ assertEquals(48000L, sixRetry);
+ long seventhRetry = externalTaskUtilsAnony.calculateRetryDelay(2);
+ assertEquals(78000L, seventhRetry);
+ long eigthRetry = externalTaskUtilsAnony.calculateRetryDelay(1);
+ assertEquals(120000L, eigthRetry);
+ }
+
+}
diff --git a/cxf-logging/pom.xml b/cxf-logging/pom.xml
index 2c891f2c4a..f0c969aeb1 100644
--- a/cxf-logging/pom.xml
+++ b/cxf-logging/pom.xml
@@ -37,11 +37,6 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
- <dependency>
- <groupId>org.onap.logging-analytics</groupId>
- <artifactId>logging-slf4j</artifactId>
- <version>1.2.2</version>
- </dependency>
</dependencies>
<build>
<resources>
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
index a6cce27f91..f6ac449057 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingInInterceptor.java
@@ -75,7 +75,7 @@ public class SOAPLoggingInInterceptor extends AbstractSoapInterceptor {
// CXF Appears to flatten headers to lower case
private void setMDCPartnerName(Map<String, List<String>> headers) {
- String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), "");
+ String partnerName = getValueOrDefault(headers, ONAPLogConstants.Headers.PARTNER_NAME.toLowerCase(), "UNKNOWN");
MDC.put(ONAPLogConstants.MDCs.PARTNER_NAME, partnerName);
}
diff --git a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
index 92b266870c..3785d3165f 100644
--- a/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
+++ b/cxf-logging/src/main/java/org/onap/so/logging/cxf/interceptor/SOAPLoggingOutInterceptor.java
@@ -51,7 +51,7 @@ public class SOAPLoggingOutInterceptor extends AbstractSoapInterceptor {
Exception ex = message.getContent(Exception.class);
if (ex == null) {
MDC.put(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE,
- ONAPLogConstants.ResponseStatus.COMPLETED.toString());
+ ONAPLogConstants.ResponseStatus.COMPLETE.toString());
} else {
int responseCode = 0;
responseCode = (int) message.get(Message.RESPONSE_CODE);
diff --git a/deployment-configs/src/main/resources/logger/logback-spring.xml b/deployment-configs/src/main/resources/logger/logback-spring.xml
new file mode 100644
index 0000000000..607d7b1f74
--- /dev/null
+++ b/deployment-configs/src/main/resources/logger/logback-spring.xml
@@ -0,0 +1,231 @@
+<!-- ============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========================================================= -->
+
+<configuration scan="false" debug="false">
+ <contextListener class="org.onap.so.logger.LoggerStartupListener" />
+
+ <property name="queueSize" value="256" />
+ <property name="maxFileSize" value="200MB" />
+ <property name="maxHistory" value="30" />
+ <property name="totalSizeCap" value="10GB" />
+
+ <!-- log file names -->
+ <property name="errorLogName" value="error" />
+ <property name="metricsLogName" value="metrics" />
+ <property name="auditLogName" value="audit" />
+ <property name="debugLogName" value="debug" />
+ <property name="cadiLogName" value="cadi" />
+
+ <property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
+
+ <property name="errorPattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode}|%X{ErrorDesc}|%msg%n" />
+
+ <property name="debugPattern"
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
+
+ <property name="auditPattern"
+ value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" />
+
+ <property name="metricPattern"
+ value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" />
+
+ <property name="defaultPattern"
+ value="%nopexception%logger
+ \t%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}
+ \t%level
+ \t%replace(%replace(%message){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%mdc){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%rootException){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%replace(%replace(%marker){'\t','\\\\t'}){'\n','\\\\n'}
+ \t%thread
+ \t%n" />
+
+ <appender name="Audit"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${auditLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${auditLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${auditPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncAudit" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Audit" />
+ </appender>
+
+ <appender name="Metric"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE-RETURN</marker>
+ </evaluator>
+ <onMismatch>DENY</onMismatch>
+ <onMatch>ACCEPT</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${metricsLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${metricsLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${metricPattern}</pattern>
+ </encoder>
+ </appender>
+
+
+ <appender name="asyncMetric" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Metric" />
+ </appender>
+
+ <appender name="Error"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.classic.filter.LevelFilter">
+ <level>ERROR</level>
+ <onMatch>ACCEPT</onMatch>
+ <onMismatch>DENY</onMismatch>
+ </filter>
+ <file>${logs_dir:-.}/${errorLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${errorLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${errorPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncError" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Error" />
+ </appender>
+
+ <appender name="Debug"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <filter class="ch.qos.logback.core.filter.EvaluatorFilter">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE</marker>
+ <marker>INVOKE-RETURN</marker>
+ <marker>ENTRY</marker>
+ <marker>EXIT</marker>
+ </evaluator>
+ <onMismatch>ACCEPT</onMismatch>
+ <onMatch>DENY</onMatch>
+ </filter>
+ <file>${logs_dir:-.}/${debugLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${debugLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncDebug" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Debug" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <appender name="Cadi"
+ class="ch.qos.logback.core.rolling.RollingFileAppender">
+ <file>${logs_dir:-.}/${cadiLogName}.log</file>
+ <rollingPolicy
+ class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
+ <fileNamePattern>${logs_dir:-.}/${cadiLogName}.%d{yyyy-MM-dd}.%i.log.zip
+ </fileNamePattern>
+ <maxFileSize>${maxFileSize}</maxFileSize>
+ <maxHistory>${maxHistory}</maxHistory>
+ <totalSizeCap>${totalSizeCap}</totalSizeCap>
+ </rollingPolicy>
+ <encoder>
+ <pattern>${debugPattern}</pattern>
+ </encoder>
+ </appender>
+
+ <appender name="asyncCadi" class="ch.qos.logback.classic.AsyncAppender">
+ <queueSize>256</queueSize>
+ <appender-ref ref="Cadi" />
+ <includeCallerData>true</includeCallerData>
+ </appender>
+
+ <!-- Spring related loggers -->
+ <logger name="org.springframework" level="WARN" />
+ <logger
+ name="org.springframework.security.authentication.dao.DaoAuthenticationProvider"
+ level="DEBUG" />
+
+ <!-- Camunda related loggers -->
+ <logger name="org.camunda.bpm.engine.jobexecutor.level" level="DEBUG" />
+ <logger
+ name="org.camunda.bpm.engine.impl.persistence.entity.JobEntity.level"
+ level="DEBUG" />
+
+ <logger name="org.flywaydb" level="DEBUG"/>
+ <logger name="org.apache.wire" level="DEBUG" />
+ <logger name="org.onap" level="DEBUG" />
+ <logger name="org.apache.cxf.interceptor" level="DEBUG" />
+ <logger name="com.woorea.openstack.connector" level="DEBUG" />
+
+ <!-- AAF Logs go here-->
+ <logger name="org.apache.catalina.core.ContainerBase" level="INFO" additivity="false">
+ <appender-ref ref="asyncCadi" />
+ </logger>
+
+ <logger name="org.reflections.Reflections" level="ERROR" additivity="false">
+ <appender-ref ref="asyncCadi" />
+ </logger>
+
+ <logger name="AUDIT" level="INFO" additivity="false">
+ <appender-ref ref="asyncAudit" />
+ </logger>
+
+ <logger name="METRIC" level="INFO" additivity="false">
+ <appender-ref ref="asyncMetric" />
+ </logger>
+
+ <root level="INFO">
+ <appender-ref ref="asyncDebug" />
+ <appender-ref ref="asyncError" />
+ <appender-ref ref="asyncAudit" />
+ <appender-ref ref="asyncMetric" />
+ </root>
+
+</configuration>
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
index 3880bd43b1..0f51341a61 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/camundabeans/CamundaVIDRequest.java
@@ -116,6 +116,9 @@ public class CamundaVIDRequest {
return serviceInput;
}
+ @JsonProperty(CommonConstants.GENERATE_IDS)
+ private CamundaBooleanInput generateIds;
+
@JsonProperty(CommonConstants.CAMUNDA_SERVICE_INPUT)
public void setServiceInput(CamundaInput serviceInput) {
this.serviceInput = serviceInput;
@@ -347,6 +350,12 @@ public class CamundaVIDRequest {
return "CamundaRequest";
}
+ public CamundaBooleanInput getGenerateIds() {
+ return generateIds;
+ }
+ public void setGenerateIds(CamundaBooleanInput generateIds) {
+ this.generateIds = generateIds;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
index 5dd99f51cd..bc8af6e690 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CamundaClient.java
@@ -99,6 +99,7 @@ public class CamundaClient extends RequestClient {
return response;
}
+ @Override
public HttpResponse post(RequestClientParameter parameterObject) throws IOException {
HttpPost post = new HttpPost(url);
logger.debug(CAMUNDA_URL_MESAGE + url);
@@ -110,7 +111,7 @@ public class CamundaClient extends RequestClient {
parameterObject.getVnfType(), parameterObject.getVfModuleType(), parameterObject.getNetworkType(),
parameterObject.getRequestDetails(), parameterObject.getApiVersion(), parameterObject.isaLaCarte(),
parameterObject.getRequestUri(), parameterObject.getRecipeParamXsd(),
- parameterObject.getInstanceGroupId());
+ parameterObject.getInstanceGroupId(), parameterObject.isGenerateIdsOnly());
StringEntity input = new StringEntity(jsonReq);
input.setContentType(CommonConstants.CONTENT_TYPE_JSON);
@@ -169,7 +170,7 @@ public class CamundaClient extends RequestClient {
String serviceInstanceId, String pnfCorrelationId, String vnfId, String vfModuleId, String volumeGroupId,
String networkId, String configurationId, String serviceType, String vnfType, String vfModuleType,
String networkType, String requestDetails, String apiVersion, boolean aLaCarte, String requestUri,
- String paramXsd, String instanceGroupId) {
+ String paramXsd, String instanceGroupId, boolean generateIdsOnly) {
String jsonReq = null;
try {
@@ -196,6 +197,8 @@ public class CamundaClient extends RequestClient {
CamundaInput requestUriInput = new CamundaInput();
CamundaInput recipeParamsInput = new CamundaInput();
CamundaInput instanceGroupIdInput = new CamundaInput();
+ CamundaBooleanInput generateIds = new CamundaBooleanInput();
+
requestIdInput.setValue(StringUtils.defaultString(requestId));
isBaseVfModuleInput.setValue(isBaseVfModule);
@@ -217,6 +220,7 @@ public class CamundaClient extends RequestClient {
requestUriInput.setValue(StringUtils.defaultString(requestUri));
recipeParamsInput.setValue(paramXsd);
instanceGroupIdInput.setValue(StringUtils.defaultString(instanceGroupId));
+ generateIds.setValue(generateIdsOnly);
serviceInput.setValue(requestDetails);
camundaRequest.setServiceInput(serviceInput);
@@ -242,6 +246,7 @@ public class CamundaClient extends RequestClient {
camundaRequest.setRequestUri(requestUriInput);
camundaRequest.setRecipeParams(recipeParamsInput);
camundaRequest.setInstanceGroupId(instanceGroupIdInput);
+ camundaRequest.setGenerateIds(generateIds);
ObjectMapper mapper = new ObjectMapper();
mapper.configure(SerializationFeature.WRAP_ROOT_VALUE, true);
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
index e48c98a395..6d2bbfc613 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/CommonConstants.java
@@ -81,6 +81,7 @@ public final class CommonConstants {
public static final String X_LATEST_VERSION = "X-LatestVersion";
public static final String INSTANCE_GROUP_ID = "instanceGroupId";
public static final String INSTANCE_GROUP_INSTANCE_ID = "instanceGroupInstanceId";
+ public static final String GENERATE_IDS = "generateIdsOnly";
private CommonConstants() {
// prevent creating an instance of this class
diff --git a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
index 20c512af37..e098ea4354 100644
--- a/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
+++ b/mso-api-handlers/mso-api-handler-common/src/main/java/org/onap/so/apihandler/common/RequestClientParameter.java
@@ -44,6 +44,7 @@ public class RequestClientParameter {
private String recipeParamXsd;
private String requestUri;
private String instanceGroupId;
+ private boolean generateIdsOnly;
private RequestClientParameter(Builder builder) {
requestId = builder.requestId;
@@ -67,7 +68,7 @@ public class RequestClientParameter {
aLaCarte = builder.aLaCarte;
requestUri = builder.requestUri;
instanceGroupId = builder.instanceGroupId;
-
+ generateIdsOnly = builder.generateIdsOnly;
}
public String getRequestId() {
@@ -154,6 +155,14 @@ public class RequestClientParameter {
return instanceGroupId;
}
+ public boolean isGenerateIdsOnly() {
+ return generateIdsOnly;
+ }
+
+ public void setGenerateIdsOnly(boolean generateIdsOnly) {
+ this.generateIdsOnly = generateIdsOnly;
+ }
+
public static class Builder {
private String requestId;
private boolean isBaseVfModule = false;
@@ -176,6 +185,7 @@ public class RequestClientParameter {
private String recipeParamXsd;
private String requestUri;
private String instanceGroupId;
+ private boolean generateIdsOnly;
public Builder setRequestId(String requestId) {
this.requestId = requestId;
@@ -282,6 +292,11 @@ public class RequestClientParameter {
return this;
}
+ public Builder setGenerateIds(boolean generateIdsOnly) {
+ this.generateIdsOnly = generateIdsOnly;
+ return this;
+ }
+
public RequestClientParameter build() {
return new RequestClientParameter(this);
}
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
index 36d004e87d..94c62a9689 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
+++ b/mso-api-handlers/mso-api-handler-common/src/test/java/org/onap/so/apihandler/common/CamundaClientTest.java
@@ -47,11 +47,11 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
+import org.skyscreamer.jsonassert.JSONAssert;
import org.springframework.mock.env.MockEnvironment;
import com.fasterxml.jackson.core.JsonGenerationException;
import com.fasterxml.jackson.databind.JsonMappingException;
-
/**
* This class implements test methods of Camunda Beans.
*
@@ -164,10 +164,10 @@ public class CamundaClientTest {
String testResult = testClient.wrapVIDRequest(requestId, isBaseVfModule, recipeTimeout, requestAction,
serviceInstanceId, pnfCorrelationId, vnfId, vfModuleId, volumeGroupId, networkId, configurationId,
serviceType, vnfType, vfModuleType, networkType, requestDetails, apiVersion, aLaCarte, requestUri, "",
- instanceGroupId);
+ instanceGroupId, false);
String expected = inputStream("/WrappedVIDRequest.json");
- assertEquals(expected, testResult);
+ JSONAssert.assertEquals(expected, testResult, false);
}
@Test
diff --git a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
index b9d0a8c3c6..3353f8c7ce 100644
--- a/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
+++ b/mso-api-handlers/mso-api-handler-common/src/test/resources/CamundaClientTest/WrappedVIDRequest.json
@@ -1 +1,102 @@
-{"variables":{"bpmnRequest":{"value":"{requestDetails: }","type":"String"},"requestId":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"mso-request-id":{"value":"f7ce78bb-423b-11e7-93f8-0050569a796","type":"String"},"isBaseVfModule":{"value":true,"type":"Boolean"},"recipeTimeout":{"value":10000,"type":"Integer"},"requestAction":{"value":"createInstance","type":"String"},"serviceInstanceId":{"value":"12345679","type":"String"},"pnfCorrelationId":{"value":"12345679","type":"String"},"vnfId":{"value":"234567891","type":"String"},"vfModuleId":{"value":"345678912","type":"String"},"volumeGroupId":{"value":"456789123","type":"String"},"networkId":{"value":"567891234","type":"String"},"configurationId":{"value":"678912345","type":"String"},"serviceType":{"value":"testService","type":"String"},"vnfType":{"value":"testVnf","type":"String"},"vfModuleType":{"value":"vfModuleType","type":"String"},"networkType":{"value":"networkType","type":"String"},"recipeParams":{"value":"","type":"String"},"host":{"value":null,"type":"String"},"apiVersion":{"value":"6","type":"String"},"aLaCarte":{"value":true,"type":"Boolean"},"requestUri":{"value":"v7/serviceInstances/assign","type":"String"},"instanceGroupId":{"value":"ff305d54-75b4-431b-adb2-eb6b9e5ff000","type":"String"}}} \ No newline at end of file
+{
+ "variables": {
+ "bpmnRequest": {
+ "value": "{requestDetails: }",
+ "type": "String"
+ },
+ "requestId": {
+ "value": "f7ce78bb-423b-11e7-93f8-0050569a796",
+ "type": "String"
+ },
+ "mso-request-id": {
+ "value": "f7ce78bb-423b-11e7-93f8-0050569a796",
+ "type": "String"
+ },
+ "isBaseVfModule": {
+ "value": true,
+ "type": "Boolean"
+ },
+ "recipeTimeout": {
+ "value": 10000,
+ "type": "Integer"
+ },
+ "requestAction": {
+ "value": "createInstance",
+ "type": "String"
+ },
+ "serviceInstanceId": {
+ "value": "12345679",
+ "type": "String"
+ },
+ "pnfCorrelationId": {
+ "value": "12345679",
+ "type": "String"
+ },
+ "vnfId": {
+ "value": "234567891",
+ "type": "String"
+ },
+ "vfModuleId": {
+ "value": "345678912",
+ "type": "String"
+ },
+ "volumeGroupId": {
+ "value": "456789123",
+ "type": "String"
+ },
+ "networkId": {
+ "value": "567891234",
+ "type": "String"
+ },
+ "configurationId": {
+ "value": "678912345",
+ "type": "String"
+ },
+ "serviceType": {
+ "value": "testService",
+ "type": "String"
+ },
+ "vnfType": {
+ "value": "testVnf",
+ "type": "String"
+ },
+ "vfModuleType": {
+ "value": "vfModuleType",
+ "type": "String"
+ },
+ "networkType": {
+ "value": "networkType",
+ "type": "String"
+ },
+ "recipeParams": {
+ "value": "",
+ "type": "String"
+ },
+ "host": {
+ "value": null,
+ "type": "String"
+ },
+ "apiVersion": {
+ "value": "6",
+ "type": "String"
+ },
+ "aLaCarte": {
+ "value": true,
+ "type": "Boolean"
+ },
+ "requestUri": {
+ "value": "v7/serviceInstances/assign",
+ "type": "String"
+ },
+ "instanceGroupId": {
+ "value": "ff305d54-75b4-431b-adb2-eb6b9e5ff000",
+ "type": "String"
+ },
+ "generateIdsOnly": {
+ "value": false,
+ "type": "Boolean"
+ }
+ }
+}
+
+
diff --git a/mso-api-handlers/mso-api-handler-infra/pom.xml b/mso-api-handlers/mso-api-handler-infra/pom.xml
index a3b9827d9f..bb726e68aa 100644
--- a/mso-api-handlers/mso-api-handler-infra/pom.xml
+++ b/mso-api-handlers/mso-api-handler-infra/pom.xml
@@ -18,7 +18,7 @@
<camunda.bpm.assert.version>1.2</camunda.bpm.assert.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
- <swagger-version>1.3.0</swagger-version>
+ <swagger.version>2.0.8</swagger.version>
<jax-rs-version>1.1.1</jax-rs-version>
<json4s-jackson-version>3.6.0</json4s-jackson-version>
<json4s-core-version>3.6.0</json4s-core-version>
@@ -56,10 +56,16 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-annotations</artifactId>
+ <version>${swagger.version}</version>
+ </dependency>
<dependency>
- <groupId>io.swagger</groupId>
- <artifactId>swagger-jersey2-jaxrs</artifactId>
- <version>1.5.16</version>
+ <groupId>io.swagger.core.v3</groupId>
+ <artifactId>swagger-jaxrs2</artifactId>
+ <version>2.0.6</version>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
index 5beb4810ec..482fd8868a 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ApiHandlerApplication.java
@@ -21,7 +21,7 @@
package org.onap.so.apihandlerinfra;
import java.util.concurrent.Executor;
-import org.onap.so.logging.jaxrs.filter.MDCTaskDecorator;
+import org.onap.logging.filter.spring.MDCTaskDecorator;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
index d3a279fd8e..650922094d 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/E2EServiceInstances.java
@@ -76,13 +76,19 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/e2eServiceInstances")
-@Api(value = "/onap/so/infra/e2eServiceInstances", description = "API Requests for E2E Service Instances")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/e2eServiceInstances",
+ description = "API Requests for E2E Service Instances"))
+
public class E2EServiceInstances {
private HashMap<String, String> instanceIdMap = new HashMap<>();
@@ -119,7 +125,8 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create an E2E Service Instance on a version provided", response = Response.class)
+ @Operation(description = "Create an E2E Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response createE2EServiceInstance(String request, @PathParam("version") String version) throws ApiException {
return processE2EserviceInstances(request, Action.createInstance, null, version);
@@ -135,8 +142,9 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update an E2E Service Instance on a version provided and serviceId",
- response = Response.class)
+ @Operation(description = "Update an E2E Service Instance on a version provided and serviceId",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response updateE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceId") String serviceId) throws ApiException {
@@ -155,7 +163,9 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete E2E Service Instance on a specified version and serviceId", response = Response.class)
+ @Operation(description = "Delete E2E Service Instance on a specified version and serviceId",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response deleteE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam(SERVICE_ID) String serviceId) throws ApiException {
@@ -166,8 +176,9 @@ public class E2EServiceInstances {
@GET
@Path("/{version:[vV][3-5]}/{serviceId}/operations/{operationId}")
- @ApiOperation(value = "Find e2eServiceInstances Requests for a given serviceId and operationId",
- response = Response.class)
+ @Operation(description = "Find e2eServiceInstances Requests for a given serviceId and operationId",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
public Response getE2EServiceInstances(@PathParam(SERVICE_ID) String serviceId,
@PathParam("version") String version, @PathParam("operationId") String operationId) {
@@ -184,7 +195,8 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}/scale")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Scale E2E Service Instance on a specified version", response = Response.class)
+ @Operation(description = "Scale E2E Service Instance on a specified version", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response scaleE2EServiceInstance(String request, @PathParam("version") String version,
@PathParam(SERVICE_ID) String serviceId) throws ApiException {
@@ -203,9 +215,10 @@ public class E2EServiceInstances {
@Path("/{version:[vV][3-5]}/{serviceId}/modeldifferences")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(
- value = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ",
- response = Response.class)
+ @Operation(
+ description = "Find added and deleted resources of target model for the e2eserviceInstance on a given serviceId ",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response compareModelwithTargetVersion(String request, @PathParam("serviceId") String serviceId,
@PathParam("version") String version) throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
index 0379ae3578..5327211280 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/GlobalHealthcheckHandler.java
@@ -53,13 +53,18 @@ import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/globalhealthcheck")
-@Api(value = "/globalhealthcheck", description = "APIH Infra Global Health Check")
+@OpenAPIDefinition(info = @Info(title = "/globalhealthcheck", description = "APIH Infra Global Health Check"))
public class GlobalHealthcheckHandler {
private static Logger logger = LoggerFactory.getLogger(GlobalHealthcheckHandler.class);
protected static final String CONTEXTPATH_PROPERTY = "management.endpoints.web.base-path";
@@ -98,7 +103,8 @@ public class GlobalHealthcheckHandler {
@GET
@Produces("application/json")
- @ApiOperation(value = "Performing global health check", response = Response.class)
+ @Operation(description = "Performing global health check", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response globalHealthcheck(@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn,
@Context ContainerRequestContext requestContext) {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
index 15572f2b39..d3bd769386 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/InstanceManagement.java
@@ -23,8 +23,6 @@
package org.onap.so.apihandlerinfra;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
@@ -61,10 +59,18 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.HashMap;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/instanceManagement")
-@Api(value = "/onap/so/infra/instanceManagement", description = "Infrastructure API Requests for Instance Management")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/instanceManagement",
+ description = "Infrastructure API Requests for Instance Management"))
public class InstanceManagement {
private static Logger logger = LoggerFactory.getLogger(InstanceManagement.class);
@@ -87,7 +93,8 @@ public class InstanceManagement {
@Path("/{version:[vV][1]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/workflows/{workflowUuid}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Execute custom workflow", response = Response.class)
+ @Operation(description = "Execute custom workflow", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response executeCustomWorkflow(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
index e162a67680..271efddc71 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/JerseyConfiguration.java
@@ -20,10 +20,15 @@
package org.onap.so.apihandlerinfra;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import javax.annotation.PostConstruct;
+import javax.servlet.ServletConfig;
import javax.ws.rs.ApplicationPath;
+import javax.ws.rs.core.Context;
import org.glassfish.jersey.server.ResourceConfig;
import org.glassfish.jersey.servlet.ServletProperties;
+import org.onap.logging.filter.base.Constants;
import org.onap.so.apihandler.filters.RequestIdFilter;
import org.onap.so.apihandlerinfra.exceptions.ApiExceptionMapper;
import org.onap.so.apihandlerinfra.infra.rest.Network;
@@ -39,12 +44,16 @@ import org.onap.so.apihandlerinfra.infra.rest.exception.mapper.WorkflowEngineCon
import org.onap.so.apihandlerinfra.tenantisolation.CloudOrchestration;
import org.onap.so.apihandlerinfra.tenantisolation.CloudResourcesOrchestration;
import org.onap.so.apihandlerinfra.tenantisolation.ModelDistributionRequest;
-import org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging;
+import org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter;
import org.onap.so.web.exceptions.RuntimeExceptionMapper;
import org.springframework.context.annotation.Configuration;
-import io.swagger.jaxrs.config.BeanConfig;
-import io.swagger.jaxrs.listing.ApiListingResource;
-import io.swagger.jaxrs.listing.SwaggerSerializers;
+import io.swagger.v3.jaxrs2.integration.JaxrsOpenApiContextBuilder;
+import io.swagger.v3.jaxrs2.integration.resources.AcceptHeaderOpenApiResource;
+import io.swagger.v3.jaxrs2.integration.resources.OpenApiResource;
+import io.swagger.v3.oas.integration.OpenApiConfigurationException;
+import io.swagger.v3.oas.integration.SwaggerConfiguration;
+import io.swagger.v3.oas.models.OpenAPI;
+import io.swagger.v3.oas.models.info.Info;
@Configuration
@ApplicationPath("/")
@@ -52,6 +61,7 @@ public class JerseyConfiguration extends ResourceConfig {
@PostConstruct
public void setUp() {
+ System.setProperty(Constants.Property.PARTNER_NAME, "SO.APIH");
register(GlobalHealthcheckHandler.class);
register(NodeHealthcheckHandler.class);
register(ServiceInstances.class);
@@ -64,11 +74,11 @@ public class JerseyConfiguration extends ResourceConfig {
register(Network.class);
register(Volumes.class);
register(ServiceInstance.class);
- register(JaxRsFilterLogging.class);
+ register(SOAuditLogContainerFilter.class);
register(ManualTasks.class);
register(TasksHandler.class);
- register(ApiListingResource.class);
- register(SwaggerSerializers.class);
+ register(OpenApiResource.class);
+ register(AcceptHeaderOpenApiResource.class);
register(ApiExceptionMapper.class);
register(RuntimeExceptionMapper.class);
register(RequestIdFilter.class);
@@ -86,12 +96,21 @@ public class JerseyConfiguration extends ResourceConfig {
register(com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider.class);
register(ModelDistributionRequest.class);
property(ServletProperties.FILTER_FORWARD_ON_404, true);
- BeanConfig beanConfig = new BeanConfig();
- beanConfig.setVersion("1.0.2");
- beanConfig.setSchemes(new String[] {"https"});
- beanConfig.setResourcePackage("org.onap.so.apihandlerinfra");
- beanConfig.setPrettyPrint(true);
- beanConfig.setScan(true);
+
+ OpenAPI oas = new OpenAPI();
+ Info info = new Info();
+ info.title("Swagger apihandlerinfra bootstrap code");
+ info.setVersion("1.0.2");
+
+ SwaggerConfiguration oasConfig = new SwaggerConfiguration().openAPI(oas).prettyPrint(true)
+ .resourcePackages(Stream.of("org.onap.so.apihandlerinfra").collect(Collectors.toSet()));
+
+ try {
+ new JaxrsOpenApiContextBuilder().application(this).openApiConfiguration(oasConfig).buildContext(true);
+ } catch (OpenApiConfigurationException e) {
+ throw new RuntimeException(e.getMessage(), e);
+ }
+
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
index b9b7fcc0d4..4bafb40b32 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ManualTasks.java
@@ -34,7 +34,6 @@ import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
-import org.onap.so.logger.LoggingAnchor;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.onap.so.apihandler.common.ErrorNumbers;
@@ -52,6 +51,7 @@ import org.onap.so.apihandlerinfra.tasksbeans.Value;
import org.onap.so.apihandlerinfra.tasksbeans.Variables;
import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
+import org.onap.so.logger.LoggingAnchor;
import org.onap.so.logger.MessageEnum;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,8 +60,11 @@ import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
-import io.swagger.annotations.ApiOperation;
-
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("/tasks")
@Component
@@ -85,7 +88,8 @@ public class ManualTasks {
@Path("/{version:[vV]1}/{taskId}/complete")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Complete specified task", response = Response.class)
+ @Operation(description = "Complete specified task", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response completeTask(String request, @PathParam("version") String version,
@PathParam("taskId") String taskId, @Context ContainerRequestContext requestContext) throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
index 3337c62afd..e56ee24baf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/NodeHealthcheckHandler.java
@@ -22,7 +22,19 @@
package org.onap.so.apihandlerinfra;
-import java.net.UnknownHostException;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
+import org.apache.http.HttpStatus;
+import org.onap.so.logger.LoggingAnchor;
+import org.onap.so.logger.MessageEnum;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
import javax.transaction.Transactional;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -30,17 +42,10 @@ import javax.ws.rs.Produces;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
-import org.onap.so.logger.LoggingAnchor;
-import org.apache.http.HttpStatus;
-import org.onap.so.logger.MessageEnum;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.stereotype.Component;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import java.net.UnknownHostException;
@Path("/nodehealthcheck")
-@Api(value = "/nodehealthcheck", description = "API Handler Infra Node Health Check")
+@OpenAPIDefinition(info = @Info(title = "/nodehealthcheck", description = "API Handler Infra Node Health Check"))
@Component
public class NodeHealthcheckHandler {
@@ -53,7 +58,8 @@ public class NodeHealthcheckHandler {
@GET
@Produces("text/html")
- @ApiOperation(value = "Performing node health check", response = Response.class)
+ @Operation(description = "Performing node health check", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response nodeHealthcheck(@Context ContainerRequestContext requestContext) throws UnknownHostException {
// Generated RequestId
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
index 8896e93175..46bec9829b 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/OrchestrationRequests.java
@@ -73,12 +73,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/orchestrationRequests")
-@Api(value = "onap/so/infra/orchestrationRequests", description = "API Requests for Orchestration requests")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests",
+ description = "API Requests for Orchestration requests"))
+
@Component
public class OrchestrationRequests {
@@ -99,7 +105,8 @@ public class OrchestrationRequests {
@GET
@Path("/{version:[vV][4-7]}/{requestId}")
- @ApiOperation(value = "Find Orchestrated Requests for a given requestId", response = Response.class)
+ @Operation(description = "Find Orchestrated Requests for a given requestId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@PathParam("requestId") String requestId,
@@ -120,33 +127,21 @@ public class OrchestrationRequests {
throw new ValidateException.Builder("Request Id " + requestId + " is not a valid UUID",
HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).errorInfo(errorLoggerInfo).build();
}
+
+ infraActiveRequest = infraActiveRequestLookup(requestId);
+
try {
- infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
requestProcessingData = requestsDbClient.getRequestProcessingDataBySoRequestId(requestId);
-
} catch (Exception e) {
- logger.error("Exception occurred", e);
+ logger.error("Exception occurred while communicating with RequestDb during requestProcessingData lookup ",
+ e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
- ValidateException validateException =
- new ValidateException.Builder("Exception while communciate with Request DB - Infra Request Lookup",
- HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
- .errorInfo(errorLoggerInfo).build();
-
- throw validateException;
-
- }
-
- if (infraActiveRequest == null) {
-
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
- ErrorCode.BusinessProcesssError).build();
-
- ValidateException validateException =
- new ValidateException.Builder("Orchestration RequestId " + requestId + " is not found in DB",
- HttpStatus.SC_NO_CONTENT, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR)
- .errorInfo(errorLoggerInfo).build();
+ ValidateException validateException = new ValidateException.Builder(
+ "Exception occurred while communicating with RequestDb during requestProcessingData lookup",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
+ .errorInfo(errorLoggerInfo).build();
throw validateException;
}
@@ -164,7 +159,8 @@ public class OrchestrationRequests {
@GET
@Path("/{version:[vV][4-7]}")
- @ApiOperation(value = "Find Orchestrated Requests for a URI Information", response = Response.class)
+ @Operation(description = "Find Orchestrated Requests for a URI Information", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Produces(MediaType.APPLICATION_JSON)
@Transactional
public Response getOrchestrationRequest(@Context UriInfo ui, @PathParam("version") String version,
@@ -221,7 +217,8 @@ public class OrchestrationRequests {
@Path("/{version: [vV][4-7]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unlock Orchestrated Requests for a given requestId", response = Response.class)
+ @Operation(description = "Unlock Orchestrated Requests for a given requestId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
@PathParam("version") String version) throws ApiException {
@@ -229,8 +226,6 @@ public class OrchestrationRequests {
logger.debug("requestId is: {}", requestId);
ServiceInstancesRequest sir;
- InfraActiveRequests infraActiveRequest;
-
try {
ObjectMapper mapper = new ObjectMapper();
sir = mapper.readValue(requestJSON, ServiceInstancesRequest.class);
@@ -260,41 +255,26 @@ public class OrchestrationRequests {
throw validateException;
}
- infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
- if (infraActiveRequest == null) {
- ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND,
- ErrorCode.BusinessProcesssError).build();
-
- ValidateException validateException =
- new ValidateException.Builder("Null response from RequestDB when searching by RequestId",
- HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
- .build();
-
- throw validateException;
+ InfraActiveRequests infraActiveRequest = infraActiveRequestLookup(requestId);
+ String status = infraActiveRequest.getRequestStatus();
+ if (Status.IN_PROGRESS.toString().equalsIgnoreCase(status) || Status.PENDING.toString().equalsIgnoreCase(status)
+ || Status.PENDING_MANUAL_TASK.toString().equalsIgnoreCase(status)) {
+ infraActiveRequest.setRequestStatus(Status.UNLOCKED.toString());
+ infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
+ infraActiveRequest.setRequestId(requestId);
+ requestsDbClient.save(infraActiveRequest);
} else {
- String status = infraActiveRequest.getRequestStatus();
- if (Status.IN_PROGRESS.toString().equalsIgnoreCase(status)
- || Status.PENDING.toString().equalsIgnoreCase(status)
- || Status.PENDING_MANUAL_TASK.toString().equalsIgnoreCase(status)) {
- infraActiveRequest.setRequestStatus(Status.UNLOCKED.toString());
- infraActiveRequest.setLastModifiedBy(Constants.MODIFIED_BY_APIHANDLER);
- infraActiveRequest.setRequestId(requestId);
- requestsDbClient.save(infraActiveRequest);
- } else {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError)
- .build();
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ATTRIBUTE_NOT_FOUND, ErrorCode.DataError).build();
- ValidateException validateException = new ValidateException.Builder(
- "Orchestration RequestId " + requestId + " has a status of " + status
- + " and can not be unlocked",
- HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
- .build();
+ ValidateException validateException = new ValidateException.Builder(
+ "Orchestration RequestId " + requestId + " has a status of " + status + " and can not be unlocked",
+ HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo)
+ .build();
- throw validateException;
- }
+ throw validateException;
}
return Response.status(HttpStatus.SC_NO_CONTENT).entity("").build();
}
@@ -543,4 +523,34 @@ public class OrchestrationRequests {
addedRequestProcessingData.add(finalProcessingData);
return addedRequestProcessingData;
}
+
+ protected InfraActiveRequests infraActiveRequestLookup(String requestId) throws ApiException {
+ InfraActiveRequests infraActiveRequest = null;
+ try {
+ infraActiveRequest = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
+ } catch (Exception e) {
+ logger.error("Exception occurred while communicating with RequestDb during InfraActiveRequest lookup ", e);
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.AvailabilityError).build();
+
+ ValidateException validateException = new ValidateException.Builder(
+ "Exception occurred while communicating with RequestDb during InfraActiveRequest lookup",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.NO_COMMUNICATION_TO_REQUESTS_DB).cause(e)
+ .errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+
+ if (infraActiveRequest == null) {
+ ErrorLoggerInfo errorLoggerInfo = new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR,
+ ErrorCode.BusinessProcesssError).build();
+
+ ValidateException validateException = new ValidateException.Builder(
+ "Null response from RequestDB when searching by RequestId " + requestId, HttpStatus.SC_NOT_FOUND,
+ ErrorNumbers.SVC_DETAILED_SERVICE_ERROR).errorInfo(errorLoggerInfo).build();
+
+ throw validateException;
+ }
+ return infraActiveRequest;
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
index 2fddfd9a95..8cdc2aaaf4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/RequestHandlerUtils.java
@@ -4,6 +4,7 @@
* ================================================================================
* Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
* Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Modifications Copyright (c) 2019 Samsung
* ================================================================================
@@ -55,13 +56,22 @@ import org.onap.so.apihandlerinfra.exceptions.BPMNFailureException;
import org.onap.so.apihandlerinfra.exceptions.ClientConnectionException;
import org.onap.so.apihandlerinfra.exceptions.ContactCamundaException;
import org.onap.so.apihandlerinfra.exceptions.DuplicateRequestException;
+import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.exceptions.VfModuleNotFoundException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.constants.Status;
+import org.onap.so.db.catalog.beans.NetworkResource;
+import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.Recipe;
+import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.catalog.beans.VfModule;
+import org.onap.so.db.catalog.beans.VfModuleCustomization;
+import org.onap.so.db.catalog.beans.VnfRecipe;
+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;
@@ -69,13 +79,19 @@ import org.onap.so.exceptions.ValidationException;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.LogConstants;
import org.onap.so.logger.MessageEnum;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.Networks;
import org.onap.so.serviceinstancebeans.RelatedInstance;
import org.onap.so.serviceinstancebeans.RelatedInstanceList;
+import org.onap.so.serviceinstancebeans.RequestDetails;
import org.onap.so.serviceinstancebeans.RequestParameters;
+import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
+import org.onap.so.serviceinstancebeans.VfModules;
+import org.onap.so.serviceinstancebeans.Vnfs;
import org.onap.so.utils.UUIDChecker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -84,7 +100,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component;
-import org.springframework.web.client.HttpStatusCodeException;
import org.springframework.web.client.RestClientException;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
@@ -95,6 +110,8 @@ public class RequestHandlerUtils extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(RequestHandlerUtils.class);
private static final String SAVE_TO_DB = "save instance to db";
+ private static final String NAME = "name";
+ private static final String VALUE = "value";
@Autowired
private Environment env;
@@ -119,13 +136,14 @@ public class RequestHandlerUtils extends AbstractRestHandler {
public Response postBPELRequest(InfraActiveRequests currentActiveReq, RequestClientParameter requestClientParameter,
String orchestrationUri, String requestScope) throws ApiException {
- RequestClient requestClient = null;
HttpResponse response = null;
+ RequestClient requestClient = null;
+
try {
requestClient = reqClientFactory.getRequestClient(orchestrationUri);
response = requestClient.post(requestClientParameter);
} catch (Exception e) {
-
+ logger.error("Error posting request to BPMN", e);
ErrorLoggerInfo errorLoggerInfo =
new ErrorLoggerInfo.Builder(MessageEnum.APIH_BPEL_COMMUNICATE_ERROR, ErrorCode.AvailabilityError)
.errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
@@ -134,7 +152,6 @@ public class RequestHandlerUtils extends AbstractRestHandler {
new ClientConnectionException.Builder(url, HttpStatus.SC_BAD_GATEWAY,
ErrorNumbers.SVC_NO_SERVER_RESOURCES).cause(e).errorInfo(errorLoggerInfo).build();
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
-
throw clientException;
}
@@ -144,9 +161,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
ErrorCode.BusinessProcesssError).errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
ClientConnectionException clientException = new ClientConnectionException.Builder(requestClient.getUrl(),
HttpStatus.SC_BAD_GATEWAY, ErrorNumbers.SVC_NO_SERVER_RESOURCES).errorInfo(errorLoggerInfo).build();
-
updateStatus(currentActiveReq, Status.FAILED, clientException.getMessage());
-
throw clientException;
}
@@ -232,6 +247,9 @@ public class RequestHandlerUtils extends AbstractRestHandler {
}
}
+
+
+ @Override
public void updateStatus(InfraActiveRequests aq, Status status, String errorMessage)
throws RequestDbFailureException {
if ((status == Status.FAILED) || (status == Status.COMPLETE)) {
@@ -412,6 +430,7 @@ public class RequestHandlerUtils extends AbstractRestHandler {
throw dupException;
}
+ @Override
public String getRequestId(ContainerRequestContext requestContext) throws ValidateException {
String requestId = null;
if (requestContext.getProperty("requestId") != null) {
@@ -686,4 +705,567 @@ public class RequestHandlerUtils extends AbstractRestHandler {
"(?s)(\"requestInfo\"\\s*?:\\s*?\\{.*?\"requestorId\"\\s*?:\\s*?\")(.*?)(\"[ ]*(?:,|\\R|\\}))",
"$1" + newRequestorId + "$3");
}
+
+ public RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
+ boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
+ RecipeLookupResult recipeLookupResult = null;
+ // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT recipe for the requested action
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ // Query MSO Catalog DB
+
+ if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
+ recipeLookupResult = getDefaultVnfUri(sir, action);
+ } else if (action == Action.addMembers || action == Action.removeMembers) {
+ recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
+ } else if (modelInfo.getModelType().equals(ModelType.service)) {
+ try {
+ recipeLookupResult = getServiceURI(sir, action, alaCarteFlag);
+ } catch (IOException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.vfModule)
+ || modelInfo.getModelType().equals(ModelType.volumeGroup)
+ || modelInfo.getModelType().equals(ModelType.vnf)) {
+ try {
+ recipeLookupResult = getVnfOrVfModuleUri(sir, action);
+ } catch (ValidationException e) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+
+ updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.network)) {
+ try {
+ recipeLookupResult = getNetworkUri(sir, action);
+ } catch (ValidationException e) {
+
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ ValidateException validateException =
+ new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
+ ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
+ updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
+
+ throw validateException;
+ }
+ } else if (modelInfo.getModelType().equals(ModelType.instanceGroup)) {
+ recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
+ }
+
+ if (recipeLookupResult == null) {
+ ErrorLoggerInfo errorLoggerInfo =
+ new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
+ .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
+
+
+ RecipeNotFoundException recipeNotFoundExceptionException =
+ new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.",
+ HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo)
+ .build();
+
+ updateStatus(currentActiveReq, Status.FAILED, recipeNotFoundExceptionException.getMessage());
+ throw recipeNotFoundExceptionException;
+ }
+ return recipeLookupResult;
+ }
+
+ protected RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action,
+ boolean alaCarteFlag) throws IOException {
+ // SERVICE REQUEST
+ // Construct the default service name
+ // TODO need to make this a configurable property
+ String defaultServiceModelName = getDefaultModel(servInstReq);
+ RequestDetails requestDetails = servInstReq.getRequestDetails();
+ ModelInfo modelInfo = requestDetails.getModelInfo();
+ org.onap.so.db.catalog.beans.Service serviceRecord;
+ List<org.onap.so.db.catalog.beans.Service> serviceRecordList;
+ ServiceRecipe recipe = null;
+
+ if (alaCarteFlag) {
+ serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ if (serviceRecord != null) {
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
+ action.toString());
+ }
+ } else {
+ serviceRecord = catalogDbClient.getServiceByID(modelInfo.getModelVersionId());
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(),
+ action.toString());
+ if (recipe == null) {
+ serviceRecordList = catalogDbClient
+ .getServiceByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
+ if (!serviceRecordList.isEmpty()) {
+ for (org.onap.so.db.catalog.beans.Service record : serviceRecordList) {
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(record.getModelUUID(),
+ action.toString());
+ if (recipe != null) {
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // if an aLaCarte flag was sent in the request, throw an error if the recipe was not found
+ RequestParameters reqParam = requestDetails.getRequestParameters();
+ if (reqParam != null && alaCarteFlag && recipe == null) {
+ return null;
+ } else if (!alaCarteFlag && recipe != null && Action.createInstance.equals(action)) {
+ mapToLegacyRequest(requestDetails);
+ } else if (recipe == null) { // aLaCarte wasn't sent, so we'll try the default
+ serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
+ recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
+ action.toString());
+ }
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(serviceRecord.getModelUUID());
+ }
+ if (recipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
+ }
+
+ protected void mapToLegacyRequest(RequestDetails requestDetails) throws IOException {
+ RequestParameters reqParam;
+ if (requestDetails.getRequestParameters() == null) {
+ reqParam = new RequestParameters();
+ } else {
+ reqParam = requestDetails.getRequestParameters();
+ }
+ if (requestDetails.getCloudConfiguration() == null) {
+ CloudConfiguration cloudConfig = configureCloudConfig(reqParam);
+ if (cloudConfig != null) {
+ requestDetails.setCloudConfiguration(cloudConfig);
+ }
+ }
+
+ List<Map<String, Object>> userParams = configureUserParams(reqParam);
+ if (!userParams.isEmpty()) {
+ if (reqParam == null) {
+ requestDetails.setRequestParameters(new RequestParameters());
+ }
+ requestDetails.getRequestParameters().setUserParams(userParams);
+ }
+ }
+
+ private Service serviceMapper(Map<String, Object> params) throws IOException {
+ ObjectMapper obj = new ObjectMapper();
+ String input = obj.writeValueAsString(params.get("service"));
+ return obj.readValue(input, Service.class);
+ }
+
+ private void addUserParams(Map<String, Object> targetUserParams, List<Map<String, String>> sourceUserParams) {
+ for (Map<String, String> map : sourceUserParams) {
+ for (Map.Entry<String, String> entry : map.entrySet()) {
+ targetUserParams.put(entry.getKey(), entry.getValue());
+ }
+ }
+ }
+
+ protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
+ logger.debug("Configuring UserParams for Macro Request");
+ Map<String, Object> userParams = new HashMap<>();
+
+ for (Map<String, Object> params : reqParams.getUserParams()) {
+ if (params.containsKey("service")) {
+ Service service = serviceMapper(params);
+
+ addUserParams(userParams, service.getInstanceParams());
+
+ for (Networks network : service.getResources().getNetworks()) {
+ addUserParams(userParams, network.getInstanceParams());
+ }
+
+ for (Vnfs vnf : service.getResources().getVnfs()) {
+ addUserParams(userParams, vnf.getInstanceParams());
+
+ for (VfModules vfModule : vnf.getVfModules()) {
+ addUserParams(userParams, vfModule.getInstanceParams());
+ }
+ }
+ }
+ }
+
+ return mapFlatMapToNameValue(userParams);
+ }
+
+ protected List<Map<String, Object>> mapFlatMapToNameValue(Map<String, Object> flatMap) {
+ List<Map<String, Object>> targetUserParams = new ArrayList<>();
+
+ for (Map.Entry<String, Object> map : flatMap.entrySet()) {
+ Map<String, Object> targetMap = new HashMap<>();
+ targetMap.put(NAME, map.getKey());
+ targetMap.put(VALUE, map.getValue());
+ targetUserParams.add(targetMap);
+ }
+ return targetUserParams;
+ }
+
+ protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
+
+ for (Map<String, Object> params : reqParams.getUserParams()) {
+ if (params.containsKey("service")) {
+ Service service = serviceMapper(params);
+
+ Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ } else {
+ for (Networks network : service.getResources().getNetworks()) {
+ targetConfiguration = addCloudConfig(network.getCloudConfiguration());
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+ }
+
+ for (Vnfs vnf : service.getResources().getVnfs()) {
+ targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+
+ for (VfModules vfModule : vnf.getVfModules()) {
+ targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
+
+ if (targetConfiguration.isPresent()) {
+ return targetConfiguration.get();
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return null;
+ }
+
+ private RecipeLookupResult getDefaultVnfUri(ServiceInstancesRequest sir, Actions action) {
+ String defaultSource = getDefaultModel(sir);
+ VnfRecipe vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ if (vnfRecipe == null) {
+ return null;
+ }
+ return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ }
+
+
+ private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
+ String defaultNetworkType = getDefaultModel(sir);
+ ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
+ String modelName = modelInfo.getModelName();
+ Recipe recipe = null;
+
+ if (modelInfo.getModelCustomizationId() != null) {
+ NetworkResourceCustomization networkResourceCustomization = catalogDbClient
+ .getNetworkResourceCustomizationByModelCustomizationUUID(modelInfo.getModelCustomizationId());
+ if (networkResourceCustomization != null) {
+ NetworkResource networkResource = networkResourceCustomization.getNetworkResource();
+ if (networkResource != null) {
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(networkResource.getModelUUID());
+ }
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(networkResource.getModelName(),
+ action.toString());
+ } else {
+ throw new ValidationException("no catalog entry found");
+ }
+ } else if (action != Action.deleteInstance) {
+ throw new ValidationException("modelCustomizationId for networkResourceCustomization lookup", true);
+ }
+ } else {
+ // ok for version < 3 and action delete
+ if (modelName != null) {
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
+ }
+ }
+
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(defaultNetworkType, action.toString());
+ }
+
+ return recipe != null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
+ }
+
+
+ private Optional<CloudConfiguration> addCloudConfig(CloudConfiguration sourceCloudConfiguration) {
+ CloudConfiguration targetConfiguration = new CloudConfiguration();
+ if (sourceCloudConfiguration != null) {
+ targetConfiguration.setAicNodeClli(sourceCloudConfiguration.getAicNodeClli());
+ targetConfiguration.setTenantId(sourceCloudConfiguration.getTenantId());
+ targetConfiguration.setLcpCloudRegionId(sourceCloudConfiguration.getLcpCloudRegionId());
+ targetConfiguration.setCloudOwner(sourceCloudConfiguration.getCloudOwner());
+ return Optional.of(targetConfiguration);
+ }
+ return Optional.empty();
+ }
+
+ private RecipeLookupResult getVnfOrVfModuleUri(ServiceInstancesRequest servInstReq, Actions action)
+ throws ValidationException {
+
+ ModelInfo modelInfo = servInstReq.getRequestDetails().getModelInfo();
+ String vnfComponentType = modelInfo.getModelType().name();
+
+ RelatedInstanceList[] instanceList = null;
+ if (servInstReq.getRequestDetails() != null) {
+ instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
+ }
+
+ Recipe recipe;
+ String defaultSource = getDefaultModel(servInstReq);
+ String modelCustomizationId = modelInfo.getModelCustomizationId();
+ String modelCustomizationName = modelInfo.getModelCustomizationName();
+ String relatedInstanceModelVersionId = null;
+ String relatedInstanceModelInvariantId = null;
+ String relatedInstanceVersion = null;
+ String relatedInstanceModelCustomizationName = null;
+
+ if (instanceList != null) {
+
+ for (RelatedInstanceList relatedInstanceList : instanceList) {
+
+ RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
+ ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
+ relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
+ relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
+ }
+
+ if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
+ relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
+ relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId();
+ relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
+ relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName();
+ }
+ }
+
+ if (modelInfo.getModelType().equals(ModelType.vnf)) {
+ // a. For a vnf request (only create, no update currently):
+ // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate catalog DB has record in
+ // vnf_resource_customization.model_customization_uuid.
+ // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
+ // pre-v3), then modelInfo.modelCustomizationName must have
+ // been provided (else create request should be rejected). APIH should use the
+ // relatedInstance.modelInfo[service].modelVersionId** + modelInfo[vnf].modelCustomizationName
+ // to “join�? service_to_resource_customizations with vnf_resource_customization to confirm a
+ // vnf_resource_customization.model_customization_uuid record exists.
+ // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
+ // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to lookup modelVersionId
+ // (MODEL_UUID) in SERVICE table.
+ // iii. Regardless of how the value was provided/obtained above, APIH must always populate
+ // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO generated
+ // during 1707 data migration if VID did not provide it originally on request.
+ // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN (must still be populated
+ // in A&AI).
+ // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use modelCustomizationId to
+ // look it up in our catalog to construct vnf-type value to pass to BPMN.
+
+ VnfResource vnfResource = null;
+ VnfResourceCustomization vrc = null;
+ // Validation for vnfResource
+
+ if (modelCustomizationId != null) {
+ vrc = catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelCustomizationId);
+ if (vrc != null) {
+ vnfResource = vrc.getVnfResources();
+ }
+ } else {
+ org.onap.so.db.catalog.beans.Service service =
+ catalogDbClient.getServiceByID(relatedInstanceModelVersionId);
+ if (service == null) {
+ service = catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(relatedInstanceVersion,
+ relatedInstanceModelInvariantId);
+ }
+
+ if (service == null) {
+ throw new ValidationException("service in relatedInstance");
+ }
+ for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
+ if (vnfResourceCustom.getModelInstanceName().equals(modelCustomizationName)) {
+ vrc = vnfResourceCustom;
+ }
+ }
+
+ if (vrc != null) {
+ vnfResource = vrc.getVnfResources();
+ modelInfo.setModelCustomizationId(vrc.getModelCustomizationUUID());
+ modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUUID());
+ }
+ }
+
+ if (vnfResource == null) {
+ throw new ValidationException("vnfResource");
+ } else {
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vnfResource.getModelUUID());
+ }
+ }
+
+ VnfRecipe vnfRecipe = null;
+
+ if (vrc != null) {
+ String nfRole = vrc.getNfRole();
+ if (nfRole != null) {
+ vnfRecipe =
+ catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
+ }
+ }
+
+ if (vnfRecipe == null) {
+ vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ }
+
+ if (vnfRecipe == null) {
+ return null;
+ }
+
+ return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
+ } else {
+ /*
+ * (v5-v7) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
+ * pre-v3), then modelInfo.modelCustomizationName must have // been provided (else create request should
+ * be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId +
+ * modelInfo[vnf].modelCustomizationName // to join vnf_to_resource_customizations with
+ * vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record
+ * exists. // Once the vnfs model_customization_uuid has been obtained, use it to find all vfModule
+ * customizations for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. //
+ * For each vf_module_cust_model_customization_uuid value returned, use that UUID to query
+ * vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId to // confirm
+ * record matches request data (and to identify the modelCustomizationId associated with the vfModule in
+ * the request). This means taking each record found // in vf_module_customization and looking up in
+ * vf_module (using vf_module_customization’s FK into vf_module) to find a match on
+ * MODEL_INVARIANT_UUID (modelInvariantId) // and MODEL_VERSION (modelVersion).
+ */
+ VfModuleCustomization vfmc = null;
+ VnfResource vnfr;
+ VnfResourceCustomization vnfrc;
+ VfModule vfModule = null;
+
+ if (modelInfo.getModelCustomizationId() != null) {
+ vfmc = catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
+ } else {
+ vnfr = catalogDbClient.getVnfResourceByModelUUID(relatedInstanceModelVersionId);
+ if (vnfr == null) {
+ vnfr = catalogDbClient.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
+ relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+ vnfrc = catalogDbClient.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(
+ relatedInstanceModelCustomizationName, vnfr);
+
+ List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
+
+ String vfModuleModelUUID = modelInfo.getModelVersionId();
+ for (VfModuleCustomization vf : list) {
+ VfModuleCustomization vfmCustom;
+ if (vfModuleModelUUID != null) {
+ vfmCustom = catalogDbClient
+ .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
+ vf.getModelCustomizationUUID(), vfModuleModelUUID);
+ if (vfmCustom != null) {
+ vfModule = vfmCustom.getVfModule();
+ }
+ } else {
+ vfmCustom = catalogDbClient
+ .getVfModuleCustomizationByModelCuztomizationUUID(vf.getModelCustomizationUUID());
+ if (vfmCustom != null) {
+ vfModule = vfmCustom.getVfModule();
+ } else {
+ vfModule = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(
+ relatedInstanceModelInvariantId, relatedInstanceVersion);
+ }
+ }
+
+ if (vfModule != null) {
+ modelInfo.setModelCustomizationId(vf.getModelCustomizationUUID());
+ modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUUID());
+ break;
+ }
+ }
+ }
+
+ if (vfmc == null && vfModule == null) {
+ throw new ValidationException("vfModuleCustomization");
+ } else if (vfModule == null && vfmc != null) {
+ vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in
+ // VfModuleCustomization table
+ }
+
+ if (modelInfo.getModelVersionId() == null) {
+ modelInfo.setModelVersionId(vfModule.getModelUUID());
+ }
+
+
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ vfModule.getModelUUID(), vnfComponentType, action.toString());
+ if (recipe == null) {
+ List<VfModule> vfModuleRecords = catalogDbClient
+ .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
+ if (!vfModuleRecords.isEmpty()) {
+ for (VfModule record : vfModuleRecords) {
+ recipe = catalogDbClient
+ .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ record.getModelUUID(), vnfComponentType, action.toString());
+ if (recipe != null) {
+ break;
+ }
+ }
+ }
+ }
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ defaultSource, vnfComponentType, action.toString());
+ if (recipe == null) {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(
+ vnfComponentType, action.toString());
+ }
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ }
+ } else {
+
+ if (modelInfo.getModelType().equals(ModelType.vnf)) {
+ recipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
+ if (recipe == null) {
+ return null;
+ }
+ } else {
+ recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
+ defaultSource, vnfComponentType, action.toString());
+
+ if (recipe == null) {
+ return null;
+ }
+ }
+ }
+
+ return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
+ }
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
index ed300d95c2..7cf9e338a8 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequest.java
@@ -57,11 +57,17 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.HttpClientErrorException;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/orchestrationRequests")
-@Api(value = "onap/so/infra/orchestrationRequests")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/orchestrationRequests"))
+
@Component
public class ResumeOrchestrationRequest {
private static Logger logger = LoggerFactory.getLogger(ResumeOrchestrationRequest.class);
@@ -84,7 +90,8 @@ public class ResumeOrchestrationRequest {
@Path("/{version:[vV][7]}/{requestId}/resume")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Resume request for a given requestId", response = Response.class)
+ @Operation(description = "Resume request for a given requestId", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response resumeOrchestrationRequest(@PathParam("requestId") String requestId,
@PathParam("version") String version, @Context ContainerRequestContext requestContext) throws ApiException {
@@ -144,7 +151,7 @@ public class ResumeOrchestrationRequest {
Boolean aLaCarte = sir.getRequestDetails().getRequestParameters().getALaCarte();
String pnfCorrelationId = serviceInstances.getPnfCorrelationId(sir);
- RecipeLookupResult recipeLookupResult = serviceInstances.getServiceInstanceOrchestrationURI(sir, action,
+ RecipeLookupResult recipeLookupResult = requestHandlerUtils.getServiceInstanceOrchestrationURI(sir, action,
msoRequest.getAlacarteFlag(sir), currentActiveRequest);
requestDbSave(currentActiveRequest);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
index 7c7223e596..91c62180fc 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/ServiceInstances.java
@@ -24,10 +24,7 @@
package org.onap.so.apihandlerinfra;
import java.io.IOException;
-import java.util.ArrayList;
import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
import java.util.Optional;
import javax.transaction.Transactional;
import javax.ws.rs.Consumes;
@@ -47,60 +44,45 @@ import org.onap.so.apihandler.common.CommonConstants;
import org.onap.so.apihandler.common.ErrorNumbers;
import org.onap.so.apihandler.common.RequestClientParameter;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
-import org.onap.so.apihandlerinfra.exceptions.RecipeNotFoundException;
import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.apihandlerinfra.infra.rest.handler.AbstractRestHandler;
import org.onap.so.apihandlerinfra.infra.rest.validators.RequestValidatorListenerRunner;
import org.onap.so.apihandlerinfra.logging.ErrorLoggerInfo;
import org.onap.so.constants.Status;
-import org.onap.so.db.catalog.beans.NetworkResource;
-import org.onap.so.db.catalog.beans.NetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.Recipe;
-import org.onap.so.db.catalog.beans.ServiceRecipe;
-import org.onap.so.db.catalog.beans.VfModule;
-import org.onap.so.db.catalog.beans.VfModuleCustomization;
-import org.onap.so.db.catalog.beans.VnfRecipe;
-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.ErrorCode;
import org.onap.so.logger.MessageEnum;
-import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
-import org.onap.so.serviceinstancebeans.Networks;
-import org.onap.so.serviceinstancebeans.RelatedInstance;
-import org.onap.so.serviceinstancebeans.RelatedInstanceList;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.RequestReferences;
-import org.onap.so.serviceinstancebeans.Service;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.onap.so.serviceinstancebeans.ServiceInstancesResponse;
-import org.onap.so.serviceinstancebeans.VfModules;
-import org.onap.so.serviceinstancebeans.Vnfs;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
-@Api(value = "/onap/so/infra/serviceInstantiation", description = "Infrastructure API Requests for Service Instances")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/serviceInstantiation",
+ description = "Infrastructure API Requests for Service Instances"))
public class ServiceInstances extends AbstractRestHandler {
private static Logger logger = LoggerFactory.getLogger(MsoRequest.class);
- private static String NAME = "name";
- private static String VALUE = "value";
private static String uriPrefix = "/serviceInstantiation/";
private static final String SAVE_TO_DB = "save instance to db";
@@ -129,7 +111,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create a Service Instance on a version provided", response = Response.class)
+ @Operation(description = "Create a Service Instance on a version provided", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createServiceInstance(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -142,7 +125,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Activate provided Service Instance", response = Response.class)
+ @Operation(description = "Activate provided Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response activateServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -158,7 +142,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate provided Service Instance", response = Response.class)
+ @Operation(description = "Deactivate provided Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivateServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -174,7 +159,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Service Instance", response = Response.class)
+ @Operation(description = "Delete provided Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -190,7 +176,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/assign")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Assign Service Instance", response = Response.class)
+ @Operation(description = "Assign Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response assignServiceInstance(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -203,7 +190,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/unassign")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unassign Service Instance", response = Response.class)
+ @Operation(description = "Unassign Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response unassignServiceInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -219,7 +207,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create Port Mirroring Configuration", response = Response.class)
+ @Operation(description = "Create Port Mirroring Configuration", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createPortConfiguration(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -235,7 +224,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Port", response = Response.class)
+ @Operation(description = "Delete provided Port", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deletePortConfiguration(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -253,7 +243,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/enablePort")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Enable Port Mirroring", response = Response.class)
+ @Operation(description = "Enable Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response enablePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -271,7 +262,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/disablePort")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Disable Port Mirroring", response = Response.class)
+ @Operation(description = "Disable Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response disablePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -289,7 +281,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Activate Port Mirroring", response = Response.class)
+ @Operation(description = "Activate Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response activatePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -307,7 +300,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/configurations/{configurationInstanceId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate Port Mirroring", response = Response.class)
+ @Operation(description = "Deactivate Port Mirroring", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivatePort(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -325,7 +319,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/addRelationships")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Add Relationships to a Service Instance", response = Response.class)
+ @Operation(description = "Add Relationships to a Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response addRelationships(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -341,7 +336,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/removeRelationships")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Remove Relationships from Service Instance", response = Response.class)
+ @Operation(description = "Remove Relationships from Service Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response removeRelationships(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -357,7 +353,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VNF on a specified version and serviceInstance", response = Response.class)
+ @Operation(description = "Create VNF on a specified version and serviceInstance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -378,7 +375,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Replace provided VNF instance", response = Response.class)
+ @Operation(description = "Replace provided VNF instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response replaceVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -395,8 +393,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VNF on a specified version, serviceInstance and vnfInstance",
- response = Response.class)
+ @Operation(description = "Update VNF on a specified version, serviceInstance and vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -413,7 +412,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/applyUpdatedConfig")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Apply updated configuration", response = Response.class)
+ @Operation(description = "Apply updated configuration", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response applyUpdatedConfig(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -429,7 +429,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/recreate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Recreate VNF Instance", response = Response.class)
+ @Operation(description = "Recreate VNF Instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
public Response recreateVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -445,7 +446,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided VNF instance", response = Response.class)
+ @Operation(description = "Delete provided VNF instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteVnfInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -462,8 +464,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance",
- response = Response.class)
+ @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -480,8 +483,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/replace")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VfModule on a specified version, serviceInstance and vnfInstance",
- response = Response.class)
+ @Operation(description = "Create VfModule on a specified version, serviceInstance and vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response replaceVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -500,8 +504,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",
- response = Response.class)
+ @Operation(description = "Update VfModule on a specified version, serviceInstance, vnfInstance and vfModule",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -520,7 +525,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][6-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/inPlaceSoftwareUpdate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Perform VNF software update", response = Response.class)
+ @Operation(description = "Perform VNF software update", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response inPlaceSoftwareUpdate(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -537,7 +543,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided VfModule instance", response = Response.class)
+ @Operation(description = "Delete provided VfModule instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -556,7 +563,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}/deactivateAndCloudDelete")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate and Cloud Delete VfModule instance", response = Response.class)
+ @Operation(description = "Deactivate and Cloud Delete VfModule instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivateAndCloudDeleteVfModuleInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -576,7 +584,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/scaleOut")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "VF Auto Scale Out", response = Response.class)
+ @Operation(description = "VF Auto Scale Out", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response scaleOutVfModule(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -593,8 +602,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance",
- response = Response.class)
+ @Operation(description = "Create VolumeGroup on a specified version, serviceInstance, vnfInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createVolumeGroupInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -611,8 +621,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",
- response = Response.class)
+ @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, vnfInstance and volumeGroup",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateVolumeGroupInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -631,7 +642,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided VolumeGroup instance", response = Response.class)
+ @Operation(description = "Delete provided VolumeGroup instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteVolumeGroupInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
@@ -650,8 +662,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create NetworkInstance on a specified version and serviceInstance ",
- response = Response.class)
+ @Operation(description = "Create NetworkInstance on a specified version and serviceInstance ",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createNetworkInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
@@ -667,8 +680,9 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update VolumeGroup on a specified version, serviceInstance, networkInstance",
- response = Response.class)
+ @Operation(description = "Update VolumeGroup on a specified version, serviceInstance, networkInstance",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateNetworkInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -686,7 +700,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][5-7]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Network instance", response = Response.class)
+ @Operation(description = "Delete provided Network instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteNetworkInstance(String request, @PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
@@ -704,7 +719,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create instanceGroups", response = Response.class)
+ @Operation(description = "Create instanceGroups", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createInstanceGroups(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -717,7 +733,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete instanceGroup", response = Response.class)
+ @Operation(description = "Delete instanceGroup", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteInstanceGroups(@PathParam("version") String version,
@PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext)
@@ -733,7 +750,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/addMembers")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Add instanceGroup members", response = Response.class)
+ @Operation(description = "Add instanceGroup members", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response addInstanceGroupMembers(String request, @PathParam("version") String version,
@PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext)
@@ -749,7 +767,8 @@ public class ServiceInstances extends AbstractRestHandler {
@Path("/{version:[vV][7]}/instanceGroups/{instanceGroupId}/removeMembers")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Remove instanceGroup members", response = Response.class)
+ @Operation(description = "Remove instanceGroup members", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response removeInstanceGroupMembers(String request, @PathParam("version") String version,
@PathParam("instanceGroupId") String instanceGroupId, @Context ContainerRequestContext requestContext)
@@ -848,7 +867,7 @@ public class ServiceInstances extends AbstractRestHandler {
serviceResponse.setRequestReferences(referencesResponse);
RecipeLookupResult recipeLookupResult =
- getServiceInstanceOrchestrationURI(sir, action, alaCarteFlag, currentActiveReq);
+ requestHandlerUtils.getServiceInstanceOrchestrationURI(sir, action, alaCarteFlag, currentActiveReq);
String serviceInstanceType = requestHandlerUtils.getServiceType(requestScope, sir, alaCarteFlag);
ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
@@ -1038,580 +1057,6 @@ public class ServiceInstances extends AbstractRestHandler {
.orElse("");
}
- protected RecipeLookupResult getServiceInstanceOrchestrationURI(ServiceInstancesRequest sir, Actions action,
- boolean alaCarteFlag, InfraActiveRequests currentActiveReq) throws ApiException {
- RecipeLookupResult recipeLookupResult = null;
- // if the aLaCarte flag is set to TRUE, the API-H should choose the VID_DEFAULT
- // recipe for the requested action
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
- // Query MSO Catalog DB
-
- if (action == Action.applyUpdatedConfig || action == Action.inPlaceSoftwareUpdate) {
- recipeLookupResult = getDefaultVnfUri(sir, action);
- } else if (action == Action.addMembers || action == Action.removeMembers) {
- recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
- } else if (modelInfo.getModelType().equals(ModelType.service)) {
- try {
- recipeLookupResult = getServiceURI(sir, action, alaCarteFlag);
- } catch (IOException e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
-
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
- }
- } else if (modelInfo.getModelType().equals(ModelType.vfModule)
- || modelInfo.getModelType().equals(ModelType.volumeGroup)
- || modelInfo.getModelType().equals(ModelType.vnf)) {
- try {
- recipeLookupResult = getVnfOrVfModuleUri(sir, action);
- } catch (ValidationException e) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
-
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
- }
- } else if (modelInfo.getModelType().equals(ModelType.network)) {
- try {
- recipeLookupResult = getNetworkUri(sir, action);
- } catch (ValidationException e) {
-
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_REQUEST_VALIDATION_ERROR, ErrorCode.SchemaError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- ValidateException validateException =
- new ValidateException.Builder(e.getMessage(), HttpStatus.SC_BAD_REQUEST,
- ErrorNumbers.SVC_BAD_PARAMETER).cause(e).errorInfo(errorLoggerInfo).build();
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED, validateException.getMessage());
-
- throw validateException;
- }
- } else if (modelInfo.getModelType().equals(ModelType.instanceGroup)) {
- recipeLookupResult = new RecipeLookupResult("/mso/async/services/WorkflowActionBB", 180);
- }
-
- if (recipeLookupResult == null) {
- ErrorLoggerInfo errorLoggerInfo =
- new ErrorLoggerInfo.Builder(MessageEnum.APIH_DB_ACCESS_EXC, ErrorCode.DataError)
- .errorSource(Constants.MSO_PROP_APIHANDLER_INFRA).build();
-
- RecipeNotFoundException recipeNotFoundExceptionException =
- new RecipeNotFoundException.Builder("Recipe could not be retrieved from catalog DB.",
- HttpStatus.SC_NOT_FOUND, ErrorNumbers.SVC_GENERAL_SERVICE_ERROR).errorInfo(errorLoggerInfo)
- .build();
-
- requestHandlerUtils.updateStatus(currentActiveReq, Status.FAILED,
- recipeNotFoundExceptionException.getMessage());
- throw recipeNotFoundExceptionException;
- }
- return recipeLookupResult;
- }
-
- protected RecipeLookupResult getServiceURI(ServiceInstancesRequest servInstReq, Actions action,
- boolean alaCarteFlag) throws IOException {
- // SERVICE REQUEST
- // Construct the default service name
- // TODO need to make this a configurable property
- String defaultServiceModelName = requestHandlerUtils.getDefaultModel(servInstReq);
- RequestDetails requestDetails = servInstReq.getRequestDetails();
- ModelInfo modelInfo = requestDetails.getModelInfo();
- org.onap.so.db.catalog.beans.Service serviceRecord;
- List<org.onap.so.db.catalog.beans.Service> serviceRecordList;
- ServiceRecipe recipe = null;
-
- if (alaCarteFlag) {
- serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
- if (serviceRecord != null) {
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
- action.toString());
- }
- } else {
- serviceRecord = catalogDbClient.getServiceByID(modelInfo.getModelVersionId());
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(modelInfo.getModelVersionId(),
- action.toString());
- if (recipe == null) {
- serviceRecordList = catalogDbClient
- .getServiceByModelInvariantUUIDOrderByModelVersionDesc(modelInfo.getModelInvariantId());
- if (!serviceRecordList.isEmpty()) {
- for (org.onap.so.db.catalog.beans.Service record : serviceRecordList) {
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(record.getModelUUID(),
- action.toString());
- if (recipe != null) {
- break;
- }
- }
- }
- }
- }
-
- // if an aLaCarte flag was sent in the request, throw an error if the recipe was
- // not found
- RequestParameters reqParam = requestDetails.getRequestParameters();
- if (reqParam != null && alaCarteFlag && recipe == null) {
- return null;
- } else if (!alaCarteFlag && recipe != null && Action.createInstance.equals(action)) {
- mapToLegacyRequest(requestDetails);
- } else if (recipe == null) { // aLaCarte wasn't sent, so we'll try the default
- serviceRecord = catalogDbClient.getFirstByModelNameOrderByModelVersionDesc(defaultServiceModelName);
- recipe = catalogDbClient.getFirstByServiceModelUUIDAndAction(serviceRecord.getModelUUID(),
- action.toString());
- }
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(serviceRecord.getModelUUID());
- }
- if (recipe == null) {
- return null;
- }
- return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
- }
-
- protected void mapToLegacyRequest(RequestDetails requestDetails) throws IOException {
- RequestParameters reqParam;
- if (requestDetails.getRequestParameters() == null) {
- reqParam = new RequestParameters();
- } else {
- reqParam = requestDetails.getRequestParameters();
- }
- if (requestDetails.getCloudConfiguration() == null) {
- CloudConfiguration cloudConfig = configureCloudConfig(reqParam);
- if (cloudConfig != null) {
- requestDetails.setCloudConfiguration(cloudConfig);
- }
- }
-
- List<Map<String, Object>> userParams = configureUserParams(reqParam);
- if (!userParams.isEmpty()) {
- if (reqParam == null) {
- requestDetails.setRequestParameters(new RequestParameters());
- }
- requestDetails.getRequestParameters().setUserParams(userParams);
- }
- }
-
- protected CloudConfiguration configureCloudConfig(RequestParameters reqParams) throws IOException {
-
- for (Map<String, Object> params : reqParams.getUserParams()) {
- if (params.containsKey("service")) {
- Service service = serviceMapper(params);
-
- Optional<CloudConfiguration> targetConfiguration = addCloudConfig(service.getCloudConfiguration());
-
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- } else {
- for (Networks network : service.getResources().getNetworks()) {
- targetConfiguration = addCloudConfig(network.getCloudConfiguration());
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- }
- }
-
- for (Vnfs vnf : service.getResources().getVnfs()) {
- targetConfiguration = addCloudConfig(vnf.getCloudConfiguration());
-
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- }
-
- for (VfModules vfModule : vnf.getVfModules()) {
- targetConfiguration = addCloudConfig(vfModule.getCloudConfiguration());
-
- if (targetConfiguration.isPresent()) {
- return targetConfiguration.get();
- }
- }
- }
- }
- }
- }
-
- return null;
- }
-
- private Optional<CloudConfiguration> addCloudConfig(CloudConfiguration sourceCloudConfiguration) {
- CloudConfiguration targetConfiguration = new CloudConfiguration();
- if (sourceCloudConfiguration != null) {
- targetConfiguration.setAicNodeClli(sourceCloudConfiguration.getAicNodeClli());
- targetConfiguration.setTenantId(sourceCloudConfiguration.getTenantId());
- targetConfiguration.setLcpCloudRegionId(sourceCloudConfiguration.getLcpCloudRegionId());
- targetConfiguration.setCloudOwner(sourceCloudConfiguration.getCloudOwner());
- return Optional.of(targetConfiguration);
- }
- return Optional.empty();
- }
-
- protected List<Map<String, Object>> configureUserParams(RequestParameters reqParams) throws IOException {
- logger.debug("Configuring UserParams for Macro Request");
- Map<String, Object> userParams = new HashMap<>();
-
- for (Map<String, Object> params : reqParams.getUserParams()) {
- if (params.containsKey("service")) {
- Service service = serviceMapper(params);
-
- addUserParams(userParams, service.getInstanceParams());
-
- for (Networks network : service.getResources().getNetworks()) {
- addUserParams(userParams, network.getInstanceParams());
- }
-
- for (Vnfs vnf : service.getResources().getVnfs()) {
- addUserParams(userParams, vnf.getInstanceParams());
-
- for (VfModules vfModule : vnf.getVfModules()) {
- addUserParams(userParams, vfModule.getInstanceParams());
- }
- }
- }
- }
-
- return mapFlatMapToNameValue(userParams);
- }
-
- private Service serviceMapper(Map<String, Object> params) throws IOException {
- ObjectMapper obj = new ObjectMapper();
- String input = obj.writeValueAsString(params.get("service"));
- return obj.readValue(input, Service.class);
- }
-
- private void addUserParams(Map<String, Object> targetUserParams, List<Map<String, String>> sourceUserParams) {
- for (Map<String, String> map : sourceUserParams) {
- for (Map.Entry<String, String> entry : map.entrySet()) {
- targetUserParams.put(entry.getKey(), entry.getValue());
- }
- }
- }
-
- protected List<Map<String, Object>> mapFlatMapToNameValue(Map<String, Object> flatMap) {
- List<Map<String, Object>> targetUserParams = new ArrayList<>();
-
- for (Map.Entry<String, Object> map : flatMap.entrySet()) {
- Map<String, Object> targetMap = new HashMap<>();
- targetMap.put(NAME, map.getKey());
- targetMap.put(VALUE, map.getValue());
- targetUserParams.add(targetMap);
- }
- return targetUserParams;
- }
-
- private RecipeLookupResult getVnfOrVfModuleUri(ServiceInstancesRequest servInstReq, Actions action)
- throws ValidationException {
-
- ModelInfo modelInfo = servInstReq.getRequestDetails().getModelInfo();
- String vnfComponentType = modelInfo.getModelType().name();
-
- RelatedInstanceList[] instanceList = null;
- if (servInstReq.getRequestDetails() != null) {
- instanceList = servInstReq.getRequestDetails().getRelatedInstanceList();
- }
-
- Recipe recipe;
- String defaultSource = requestHandlerUtils.getDefaultModel(servInstReq);
- String modelCustomizationId = modelInfo.getModelCustomizationId();
- String modelCustomizationName = modelInfo.getModelCustomizationName();
- String relatedInstanceModelVersionId = null;
- String relatedInstanceModelInvariantId = null;
- String relatedInstanceVersion = null;
- String relatedInstanceModelCustomizationName = null;
-
- if (instanceList != null) {
-
- for (RelatedInstanceList relatedInstanceList : instanceList) {
-
- RelatedInstance relatedInstance = relatedInstanceList.getRelatedInstance();
- ModelInfo relatedInstanceModelInfo = relatedInstance.getModelInfo();
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.service)) {
- relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
- relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
- }
-
- if (relatedInstanceModelInfo.getModelType().equals(ModelType.vnf)) {
- relatedInstanceModelVersionId = relatedInstanceModelInfo.getModelVersionId();
- relatedInstanceModelInvariantId = relatedInstanceModelInfo.getModelInvariantId();
- relatedInstanceVersion = relatedInstanceModelInfo.getModelVersion();
- relatedInstanceModelCustomizationName = relatedInstanceModelInfo.getModelCustomizationName();
- }
- }
-
- if (modelInfo.getModelType().equals(ModelType.vnf)) {
- // a. For a vnf request (only create, no update currently):
- // i. (v3-v4) If modelInfo.modelCustomizationId is provided, use it to validate
- // catalog DB has record in
- // vnf_resource_customization.model_customization_uuid.
- // ii. (v2-v4) If modelInfo.modelCustomizationId is NOT provided (because it is
- // a pre-1702 ASDC model or
- // pre-v3), then modelInfo.modelCustomizationName must have
- // been provided (else create request should be rejected). APIH should use the
- // relatedInstance.modelInfo[service].modelVersionId** +
- // modelInfo[vnf].modelCustomizationName
- // to “join�? service_to_resource_customizations with
- // vnf_resource_customization to confirm a
- // vnf_resource_customization.model_customization_uuid record exists.
- // **If relatedInstance.modelInfo[service].modelVersionId was not provided, use
- // relatedInstance.modelInfo[service].modelInvariantId + modelVersion instead to
- // lookup modelVersionId
- // (MODEL_UUID) in SERVICE table.
- // iii. Regardless of how the value was provided/obtained above, APIH must
- // always populate
- // vnfModelCustomizationId in bpmnRequest. It would be assumed it was MSO
- // generated
- // during 1707 data migration if VID did not provide it originally on request.
- // iv. Note: continue to construct the “vnf-type�? value and pass to BPMN
- // (must still be populated
- // in A&AI).
- // 1. If modelCustomizationName is NOT provided on a vnf/vfModule request, use
- // modelCustomizationId to
- // look it up in our catalog to construct vnf-type value to pass to BPMN.
-
- VnfResource vnfResource = null;
- VnfResourceCustomization vrc = null;
- // Validation for vnfResource
-
- if (modelCustomizationId != null) {
- vrc = catalogDbClient.getVnfResourceCustomizationByModelCustomizationUUID(modelCustomizationId);
- if (vrc != null) {
- vnfResource = vrc.getVnfResources();
- }
- } else {
- org.onap.so.db.catalog.beans.Service service =
- catalogDbClient.getServiceByID(relatedInstanceModelVersionId);
- if (service == null) {
- service = catalogDbClient.getServiceByModelVersionAndModelInvariantUUID(relatedInstanceVersion,
- relatedInstanceModelInvariantId);
- }
-
- if (service == null) {
- throw new ValidationException("service in relatedInstance");
- }
- for (VnfResourceCustomization vnfResourceCustom : service.getVnfCustomizations()) {
- if (vnfResourceCustom.getModelInstanceName().equals(modelCustomizationName)) {
- vrc = vnfResourceCustom;
- }
- }
-
- if (vrc != null) {
- vnfResource = vrc.getVnfResources();
- modelInfo.setModelCustomizationId(vrc.getModelCustomizationUUID());
- modelInfo.setModelCustomizationUuid(vrc.getModelCustomizationUUID());
- }
- }
-
- if (vnfResource == null) {
- throw new ValidationException("vnfResource");
- } else {
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(vnfResource.getModelUUID());
- }
- }
-
- VnfRecipe vnfRecipe = null;
-
- if (vrc != null) {
- String nfRole = vrc.getNfRole();
- if (nfRole != null) {
- vnfRecipe =
- catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(vrc.getNfRole(), action.toString());
- }
- }
-
- if (vnfRecipe == null) {
- vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
- }
-
- if (vnfRecipe == null) {
- return null;
- }
-
- return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
- } else {
- /*
- * (v5-v7) If modelInfo.modelCustomizationId is NOT provided (because it is a pre-1702 ASDC model or
- * pre-v3), then modelInfo.modelCustomizationName must have // been provided (else create request should
- * be rejected). APIH should use the relatedInstance.modelInfo[vnf].modelVersionId +
- * modelInfo[vnf].modelCustomizationName // to join vnf_to_resource_customizations with
- * vf_resource_customization to confirm a vf_resource_customization.model_customization_uuid record
- * exists. // Once the vnfs model_customization_uuid has been obtained, use it to find all vfModule
- * customizations for that vnf customization in the vnf_res_custom_to_vf_module_custom join table. //
- * For each vf_module_cust_model_customization_uuid value returned, use that UUID to query
- * vf_module_customization table along with modelInfo[vfModule|volumeGroup].modelVersionId to // confirm
- * record matches request data (and to identify the modelCustomizationId associated with the vfModule in
- * the request). This means taking each record found // in vf_module_customization and looking up in
- * vf_module (using vf_module_customization’s FK into vf_module) to find a match on
- * MODEL_INVARIANT_UUID (modelInvariantId) // and MODEL_VERSION (modelVersion).
- */
- VfModuleCustomization vfmc = null;
- VnfResource vnfr;
- VnfResourceCustomization vnfrc;
- VfModule vfModule = null;
-
- if (modelInfo.getModelCustomizationId() != null) {
- vfmc = catalogDbClient
- .getVfModuleCustomizationByModelCuztomizationUUID(modelInfo.getModelCustomizationId());
- } else {
- vnfr = catalogDbClient.getVnfResourceByModelUUID(relatedInstanceModelVersionId);
- if (vnfr == null) {
- vnfr = catalogDbClient.getFirstVnfResourceByModelInvariantUUIDAndModelVersion(
- relatedInstanceModelInvariantId, relatedInstanceVersion);
- }
- vnfrc = catalogDbClient.getFirstVnfResourceCustomizationByModelInstanceNameAndVnfResources(
- relatedInstanceModelCustomizationName, vnfr);
-
- List<VfModuleCustomization> list = vnfrc.getVfModuleCustomizations();
-
- String vfModuleModelUUID = modelInfo.getModelVersionId();
- for (VfModuleCustomization vf : list) {
- VfModuleCustomization vfmCustom;
- if (vfModuleModelUUID != null) {
- vfmCustom = catalogDbClient
- .getVfModuleCustomizationByModelCustomizationUUIDAndVfModuleModelUUID(
- vf.getModelCustomizationUUID(), vfModuleModelUUID);
- if (vfmCustom != null) {
- vfModule = vfmCustom.getVfModule();
- }
- } else {
- vfmCustom = catalogDbClient
- .getVfModuleCustomizationByModelCuztomizationUUID(vf.getModelCustomizationUUID());
- if (vfmCustom != null) {
- vfModule = vfmCustom.getVfModule();
- } else {
- vfModule = catalogDbClient.getVfModuleByModelInvariantUUIDAndModelVersion(
- relatedInstanceModelInvariantId, relatedInstanceVersion);
- }
- }
-
- if (vfModule != null) {
- modelInfo.setModelCustomizationId(vf.getModelCustomizationUUID());
- modelInfo.setModelCustomizationUuid(vf.getModelCustomizationUUID());
- break;
- }
- }
- }
-
- if (vfmc == null && vfModule == null) {
- throw new ValidationException("vfModuleCustomization");
- } else if (vfModule == null && vfmc != null) {
- vfModule = vfmc.getVfModule(); // can't be null as vfModuleModelUUID is not-null property in
- // VfModuleCustomization table
- }
-
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(vfModule.getModelUUID());
- }
-
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- vfModule.getModelUUID(), vnfComponentType, action.toString());
- if (recipe == null) {
- List<VfModule> vfModuleRecords = catalogDbClient
- .getVfModuleByModelInvariantUUIDOrderByModelVersionDesc(vfModule.getModelInvariantUUID());
- if (!vfModuleRecords.isEmpty()) {
- for (VfModule record : vfModuleRecords) {
- recipe = catalogDbClient
- .getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- record.getModelUUID(), vnfComponentType, action.toString());
- if (recipe != null) {
- break;
- }
- }
- }
- }
- if (recipe == null) {
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- defaultSource, vnfComponentType, action.toString());
- if (recipe == null) {
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVnfComponentTypeAndAction(
- vnfComponentType, action.toString());
- }
-
- if (recipe == null) {
- return null;
- }
- }
- }
- } else {
-
- if (modelInfo.getModelType().equals(ModelType.vnf)) {
- recipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
- if (recipe == null) {
- return null;
- }
- } else {
- recipe = catalogDbClient.getFirstVnfComponentsRecipeByVfModuleModelUUIDAndVnfComponentTypeAndAction(
- defaultSource, vnfComponentType, action.toString());
-
- if (recipe == null) {
- return null;
- }
- }
- }
-
- return new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout());
- }
-
- private RecipeLookupResult getDefaultVnfUri(ServiceInstancesRequest sir, Actions action) {
-
- String defaultSource = requestHandlerUtils.getDefaultModel(sir);
-
- VnfRecipe vnfRecipe = catalogDbClient.getFirstVnfRecipeByNfRoleAndAction(defaultSource, action.toString());
-
- if (vnfRecipe == null) {
- return null;
- }
-
- return new RecipeLookupResult(vnfRecipe.getOrchestrationUri(), vnfRecipe.getRecipeTimeout());
- }
-
- private RecipeLookupResult getNetworkUri(ServiceInstancesRequest sir, Actions action) throws ValidationException {
-
- String defaultNetworkType = requestHandlerUtils.getDefaultModel(sir);
-
- ModelInfo modelInfo = sir.getRequestDetails().getModelInfo();
- String modelName = modelInfo.getModelName();
- Recipe recipe = null;
-
- if (modelInfo.getModelCustomizationId() != null) {
- NetworkResourceCustomization networkResourceCustomization = catalogDbClient
- .getNetworkResourceCustomizationByModelCustomizationUUID(modelInfo.getModelCustomizationId());
- if (networkResourceCustomization != null) {
- NetworkResource networkResource = networkResourceCustomization.getNetworkResource();
- if (networkResource != null) {
- if (modelInfo.getModelVersionId() == null) {
- modelInfo.setModelVersionId(networkResource.getModelUUID());
- }
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(networkResource.getModelName(),
- action.toString());
- } else {
- throw new ValidationException("no catalog entry found");
- }
- } else if (action != Action.deleteInstance) {
- throw new ValidationException("modelCustomizationId for networkResourceCustomization lookup", true);
- }
- } else {
- // ok for version < 3 and action delete
- if (modelName != null) {
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(modelName, action.toString());
- }
- }
-
- if (recipe == null) {
- recipe = catalogDbClient.getFirstNetworkRecipeByModelNameAndAction(defaultNetworkType, action.toString());
- }
-
- return recipe != null ? new RecipeLookupResult(recipe.getOrchestrationUri(), recipe.getRecipeTimeout()) : null;
- }
-
private Response configurationRecipeLookup(String requestJSON, Action action, HashMap<String, String> instanceIdMap,
String version, String requestId, String requestUri) throws ApiException {
String serviceInstanceId;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
index 89885f33c2..09a1d9e5a6 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/TasksHandler.java
@@ -59,11 +59,16 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/tasks")
-@Api(value = "onap/so/infra/tasks", description = "Queries of Manual Tasks")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/tasks", description = "Queries of Manual Tasks"))
@Component
public class TasksHandler {
@@ -81,7 +86,8 @@ public class TasksHandler {
@Path("/{version:[vV]1}")
@GET
- @ApiOperation(value = "Finds Manual Tasks", response = Response.class)
+ @Operation(description = "Finds Manual Tasks", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response queryFilters(@QueryParam("taskId") String taskId,
@QueryParam("originalRequestId") String originalRequestId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
index b57bb5d1d8..925d10179f 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/WorkflowSpecificationsHandler.java
@@ -59,11 +59,17 @@ import org.springframework.stereotype.Component;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Path("onap/so/infra/workflowSpecifications")
-@Api(value = "onap/so/infra/workflowSpecifications", description = "Queries of Workflow Specifications")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/workflowSpecifications",
+ description = "Queries of Workflow Specifications"))
@Component
public class WorkflowSpecificationsHandler {
@@ -79,7 +85,8 @@ public class WorkflowSpecificationsHandler {
@Path("/{version:[vV]1}/workflows")
@GET
- @ApiOperation(value = "Finds Workflow Specifications", response = Response.class)
+ @Operation(description = "Finds Workflow Specifications", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response queryWorkflowSpecifications(@QueryParam("vnfModelVersionId") String vnfModelVersionId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
index ec3df21fdb..483ac47235 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Network.java
@@ -44,7 +44,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -61,7 +65,8 @@ public class Network {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/networks/{networkInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete provided Network instance", response = Response.class)
+ @Operation(description = "Delete provided Network instance", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deleteNetworkInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
index 07e8092449..135667d3e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/ServiceInstance.java
@@ -44,7 +44,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -61,7 +65,8 @@ public class ServiceInstance {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a Service instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a Service instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteServiceInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @Context ContainerRequestContext requestContext)
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
index 1b9eb1f802..4a86d944cf 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/VfModules.java
@@ -45,7 +45,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -62,7 +66,8 @@ public class VfModules {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/vfModules/{vfmoduleInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVfModuleInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
index a8ccdeecac..edb09083d4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Vnf.java
@@ -43,7 +43,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/serviceInstantiation")
@@ -60,7 +64,8 @@ public class Vnf {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a Vnf instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a Vnf instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVnfInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
index d3e394d6d8..3154c86046 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/Volumes.java
@@ -46,7 +46,11 @@ import org.slf4j.MDC;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Component;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component("VolumesV8")
@Path("/onap/so/infra/serviceInstantiation")
@@ -66,7 +70,8 @@ public class Volumes {
@Path("/{version:[vV][8]}/serviceInstances/{serviceInstanceId}/vnfs/{vnfInstanceId}/volumeGroups/{volumeGroupInstanceId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Delete a VfModule instance", response = ServiceInstancesResponse.class)
+ @Operation(description = "Delete a VfModule instance", responses = @ApiResponse(content = @Content(
+ array = @ArraySchema(schema = @Schema(implementation = ServiceInstancesResponse.class)))))
@Transactional
public Response deleteVfModuleInstance(@PathParam("version") String version,
@PathParam("serviceInstanceId") String serviceInstanceId, @PathParam("vnfInstanceId") String vnfInstanceId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
index e157d926f3..1011454906 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/infra/rest/handler/VnfRestHandler.java
@@ -3,6 +3,7 @@
* ONAP - SO
* ================================================================================
* Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * Modifications Copyright (C) 2019 IBM.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -100,8 +101,7 @@ public class VnfRestHandler extends AbstractRestHandler {
checkDuplicateRequest(instanceIdMap, ModelType.vnf, instanceName, requestId);
}
- public Recipe findVnfModuleRecipe(String modelCustomizationId, String modelType, String action)
- throws NoRecipeException {
+ public Recipe findVnfModuleRecipe(String modelCustomizationId, String modelType, String action) {
VnfRecipe recipe = new VnfRecipe();
recipe.setOrchestrationUri("/mso/async/services/WorkflowActionBB");
return recipe;
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
index d3fb7986ce..877376cc79 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudOrchestration.java
@@ -61,12 +61,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/cloudResources")
-@Api(value = "/onap/so/infra/cloudResources", description = "API Requests for cloud resources - Tenant Isolation")
+@OpenAPIDefinition(info = @Info(title = "/onap/so/infra/cloudResources",
+ description = "API Requests for cloud resources - Tenant Isolation"))
public class CloudOrchestration {
private static Logger logger = LoggerFactory.getLogger(CloudOrchestration.class);
@@ -85,7 +91,8 @@ public class CloudOrchestration {
@Path("/{version:[vV][1]}/operationalEnvironments")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Create an Operational Environment", response = Response.class)
+ @Operation(description = "Create an Operational Environment", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response createOperationEnvironment(String request, @PathParam("version") String version,
@Context ContainerRequestContext requestContext) throws ApiException {
@@ -97,7 +104,8 @@ public class CloudOrchestration {
@Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/activate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Activate an Operational Environment", response = Response.class)
+ @Operation(description = "Activate an Operational Environment", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response activateOperationEnvironment(String request, @PathParam("version") String version,
@PathParam("operationalEnvironmentId") String operationalEnvironmentId,
@@ -112,7 +120,8 @@ public class CloudOrchestration {
@Path("/{version:[vV][1]}/operationalEnvironments/{operationalEnvironmentId}/deactivate")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Deactivate an Operational Environment", response = Response.class)
+ @Operation(description = "Deactivate an Operational Environment", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response deactivateOperationEnvironment(String request, @PathParam("version") String version,
@PathParam("operationalEnvironmentId") String operationalEnvironmentId,
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
index e9cd303c0b..47d6932730 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/CloudResourcesOrchestration.java
@@ -62,13 +62,18 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("onap/so/infra/cloudResourcesRequests")
-@Api(value = "onap/so/infra/cloudResourcesRequests",
- description = "API GET Requests for cloud resources - Tenant Isolation")
+@OpenAPIDefinition(info = @Info(title = "onap/so/infra/cloudResourcesRequests",
+ description = "API GET Requests for cloud resources - Tenant Isolation"))
public class CloudResourcesOrchestration {
private static Logger logger = LoggerFactory.getLogger(CloudResourcesOrchestration.class);
@@ -83,7 +88,7 @@ public class CloudResourcesOrchestration {
@Path("/{version: [vV][1]}/{requestId}/unlock")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Unlock CloudOrchestration requests for a specified requestId")
+ @Operation(description = "Unlock CloudOrchestration requests for a specified requestId")
@Transactional
public Response unlockOrchestrationRequest(String requestJSON, @PathParam("requestId") String requestId,
@PathParam("version") String version) throws ApiException {
@@ -167,8 +172,9 @@ public class CloudResourcesOrchestration {
@Path("/{version:[vV][1]}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Get status of an Operational Environment based on filter criteria",
- response = Response.class)
+ @Operation(description = "Get status of an Operational Environment based on filter criteria",
+ responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response getOperationEnvironmentStatusFilter(@Context UriInfo ui, @PathParam("version") String version)
throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
index ef5abe9f74..2f922220c9 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/ModelDistributionRequest.java
@@ -55,12 +55,18 @@ import org.springframework.stereotype.Component;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
+import io.swagger.v3.oas.annotations.OpenAPIDefinition;
+import io.swagger.v3.oas.annotations.Operation;
+import io.swagger.v3.oas.annotations.info.Info;
+import io.swagger.v3.oas.annotations.media.ArraySchema;
+import io.swagger.v3.oas.annotations.media.Content;
+import io.swagger.v3.oas.annotations.media.Schema;
+import io.swagger.v3.oas.annotations.responses.ApiResponse;
@Component
@Path("/onap/so/infra/modelDistributions")
-@Api(value = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions")
+@OpenAPIDefinition(
+ info = @Info(title = "/onap/so/infra/modelDistributions", description = "API Requests for Model Distributions"))
public class ModelDistributionRequest {
private static Logger logger = LoggerFactory.getLogger(ModelDistributionRequest.class);
@@ -71,7 +77,8 @@ public class ModelDistributionRequest {
@Path("/{version:[vV][1]}/distributions/{distributionId}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
- @ApiOperation(value = "Update model distribution status", response = Response.class)
+ @Operation(description = "Update model distribution status", responses = @ApiResponse(
+ content = @Content(array = @ArraySchema(schema = @Schema(implementation = Response.class)))))
@Transactional
public Response updateModelDistributionStatus(String requestJSON, @PathParam("version") String version,
@PathParam("distributionId") String distributionId) throws ApiException {
diff --git a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
index 18ca6d3086..de5edb5b54 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/main/java/org/onap/so/apihandlerinfra/tenantisolation/helpers/SDCClientHelper.java
@@ -38,7 +38,7 @@ import org.onap.so.client.HttpClientFactory;
import org.onap.so.logger.ErrorCode;
import org.onap.so.logger.MessageEnum;
import org.onap.so.utils.CryptoUtils;
-import org.onap.so.utils.TargetEntity;
+import org.onap.logging.filter.base.ONAPComponents;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -105,7 +105,7 @@ public class SDCClientHelper {
URL url = new URL(urlString);
- HttpClient httpClient = httpClientFactory.newJsonClient(url, TargetEntity.SDC);
+ HttpClient httpClient = httpClientFactory.newJsonClient(url, ONAPComponents.SDC);
httpClient.addBasicAuthHeader(sdcClientAuth, msoKey);
httpClient.addAdditionalHeader("X-ECOMP-InstanceID", sdcActivateInstanceId);
httpClient.addAdditionalHeader("X-ECOMP-RequestID", UUID.randomUUID().toString());
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
index 9fc9e4a51b..276f891eb2 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/InstanceManagementTest.java
@@ -29,9 +29,10 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertThat;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -81,7 +82,7 @@ public class InstanceManagementTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(CLIENT_ID, "VID");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
index ad0a878931..8a112e3fdd 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ManualTasksTest.java
@@ -28,15 +28,15 @@ import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static org.onap.so.logger.MdcConstants.ECOMP_REQUEST_ID;
-import static org.onap.so.logger.MdcConstants.ENDTIME;
-import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
-import static org.onap.so.logger.MdcConstants.PARTNERNAME;
-import static org.onap.so.logger.MdcConstants.RESPONSECODE;
-import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
-import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
-import static org.onap.so.logger.MdcConstants.STATUSCODE;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ECOMP_REQUEST_ID;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.INVOCATION_ID;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.PARTNER_NAME;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_CODE;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.LOG_TIMESTAMP;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.SERVICE_NAME;
+import static org.onap.logging.ref.slf4j.ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
import java.io.IOException;
import java.util.Map;
import javax.ws.rs.core.MediaType;
@@ -110,27 +110,27 @@ public class ManualTasksTest extends BaseTest {
assertThat(realResponse, sameBeanAs(expectedResponse));
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(STATUSCODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ assertEquals("INPROGRESS", mdc.get(RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
+ assertNotNull(mdc.get(LOG_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("202", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
+ assertEquals("202", mdc.get(RESPONSE_CODE));
+ assertEquals("UNKNOWN", mdc.get(PARTNER_NAME));
assertEquals("tasks/v1/55/complete", mdc.get(SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
+ assertEquals("COMPLETE", mdc.get(RESPONSE_STATUS_CODE));
+ assertNotNull(mdc.get(RESPONSE_DESCRIPTION));
assertEquals("application/json", response.getHeaders().get(HttpHeaders.CONTENT_TYPE).get(0));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
index 12f0ffcc11..151785dbeb 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsTest.java
@@ -335,7 +335,7 @@ public class OrchestrationRequestsTest extends BaseTest {
expectedRequestError = new RequestError();
se = new ServiceException();
se.setMessageId(ErrorNumbers.SVC_DETAILED_SERVICE_ERROR);
- se.setText("Null response from RequestDB when searching by RequestId");
+ se.setText("Null response from RequestDB when searching by RequestId " + INVALID_REQUEST_ID);
expectedRequestError.setServiceException(se);
builder = UriComponentsBuilder.fromHttpUrl(
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
index 627bbc631d..47aa3cccb5 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/OrchestrationRequestsUnitTest.java
@@ -21,6 +21,7 @@
package org.onap.so.apihandlerinfra;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.hamcrest.CoreMatchers.containsString;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertEquals;
@@ -39,6 +40,7 @@ import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.apihandler.common.ResponseBuilder;
import org.onap.so.apihandlerinfra.exceptions.ApiException;
+import org.onap.so.apihandlerinfra.exceptions.ValidateException;
import org.onap.so.constants.OrchestrationRequestFormat;
import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
@@ -327,4 +329,13 @@ public class OrchestrationRequestsUnitTest {
assertEquals(Status.FAILED.toString(), result);
}
+
+ @Test
+ public void infraActiveRequestNullValidationExceptionTest() throws ApiException {
+ iar.setRequestId(REQUEST_ID);
+ thrown.expect(ValidateException.class);
+ thrown.expectMessage(containsString("Null response from RequestDB when searching by RequestId " + REQUEST_ID));
+ orchestrationRequests.infraActiveRequestLookup(iar.getRequestId());
+ }
+
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
index e4532cd8d7..d0561a4518 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/RequestHandlerUtilsTest.java
@@ -30,9 +30,10 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
import java.io.IOException;
import java.net.MalformedURLException;
import java.net.URL;
@@ -95,7 +96,7 @@ public class RequestHandlerUtilsTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(CLIENT_ID, "VID");
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
index 1e755419be..7f5f0dc931 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ResumeOrchestrationRequestTest.java
@@ -21,6 +21,7 @@ package org.onap.so.apihandlerinfra;
import static com.shazam.shazamcrest.MatcherAssert.assertThat;
import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyBoolean;
import static org.mockito.ArgumentMatchers.anyString;
@@ -30,7 +31,6 @@ import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.doThrow;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import static org.junit.Assert.assertEquals;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Paths;
@@ -56,10 +56,10 @@ import org.onap.so.constants.Status;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.ModelType;
import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
import org.springframework.web.client.HttpClientErrorException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import org.onap.so.serviceinstancebeans.ModelType;
@RunWith(MockitoJUnitRunner.class)
public class ResumeOrchestrationRequestTest {
@@ -258,7 +258,7 @@ public class ResumeOrchestrationRequestTest {
when(requestHandler.convertJsonToServiceInstanceRequest(anyString(), any(Actions.class), anyString(),
anyString())).thenReturn(sir);
when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
- doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
+ doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sir, action, aLaCarte,
currentActiveRequest);
doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sir);
@@ -311,7 +311,7 @@ public class ResumeOrchestrationRequestTest {
anyString())).thenReturn(sirNullALaCarte);
when(serviceInstances.getPnfCorrelationId(any(ServiceInstancesRequest.class))).thenReturn("pnfCorrelationId");
doReturn(false).when(msoRequest).getAlacarteFlag(sirNullALaCarte);
- doReturn(lookupResult).when(serviceInstances).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
+ doReturn(lookupResult).when(requestHandler).getServiceInstanceOrchestrationURI(sirNullALaCarte, action, false,
currentActiveRequest);
doReturn(requestClientParameter).when(resumeReq).setRequestClientParameter(lookupResult, version,
infraActiveRequest, currentActiveRequest, "pnfCorrelationId", aLaCarte, sirNullALaCarte);
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
index 48a5343104..61654d18e4 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/apihandlerinfra/ServiceInstancesTest.java
@@ -33,17 +33,10 @@ import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
-import static org.onap.so.logger.HttpHeadersConstants.ONAP_REQUEST_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.ONAP_REQUEST_ID;
import static org.onap.so.logger.HttpHeadersConstants.REQUESTOR_ID;
-import static org.onap.so.logger.HttpHeadersConstants.TRANSACTION_ID;
-import static org.onap.so.logger.MdcConstants.CLIENT_ID;
-import static org.onap.so.logger.MdcConstants.ENDTIME;
-import static org.onap.so.logger.MdcConstants.INVOCATION_ID;
-import static org.onap.so.logger.MdcConstants.PARTNERNAME;
-import static org.onap.so.logger.MdcConstants.RESPONSECODE;
-import static org.onap.so.logger.MdcConstants.RESPONSEDESC;
-import static org.onap.so.logger.MdcConstants.SERVICE_NAME;
-import static org.onap.so.logger.MdcConstants.STATUSCODE;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.TRANSACTION_ID;
+import static org.onap.logging.filter.base.Constants.HttpHeaders.CLIENT_ID;
import java.io.File;
import java.io.IOException;
import java.net.MalformedURLException;
@@ -64,7 +57,6 @@ import org.onap.so.apihandlerinfra.exceptions.RequestDbFailureException;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceRecipe;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.logger.HttpHeadersConstants;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -121,7 +113,7 @@ public class ServiceInstancesTest extends BaseTest {
// set headers
headers = new HttpHeaders();
headers.set(ONAPLogConstants.Headers.PARTNER_NAME, "test_name");
- headers.set(HttpHeadersConstants.TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
+ headers.set(TRANSACTION_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAP_REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(ONAPLogConstants.MDCs.REQUEST_ID, "32807a28-1a14-4b88-b7b3-2950918aa76d");
headers.set(CLIENT_ID, "VID");
@@ -229,27 +221,29 @@ public class ServiceInstancesTest extends BaseTest {
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", mdc.get(SERVICE_NAME));
- assertEquals("INPROGRESS", mdc.get(STATUSCODE));
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging")
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",
+ mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("EXIT")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.ENTRY_TIMESTAMP));
- assertNotNull(mdc.get(ENDTIME));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.LOG_TIMESTAMP));
assertNotNull(mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertNotNull(mdc.get(INVOCATION_ID));
- assertEquals("202", mdc.get(RESPONSECODE));
- assertEquals("UNKNOWN", mdc.get(PARTNERNAME));
- assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances", mdc.get(SERVICE_NAME));
- assertEquals("COMPLETE", mdc.get(STATUSCODE));
- assertNotNull(mdc.get(RESPONSEDESC));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
+ assertEquals("202", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
+ assertEquals("UNKNOWN", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
+ assertEquals("onap/so/infra/serviceInstantiation/v5/serviceInstances",
+ mdc.get(ONAPLogConstants.MDCs.SERVICE_NAME));
+ assertEquals("COMPLETE", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
+ assertNotNull(mdc.get(ONAPLogConstants.MDCs.RESPONSE_DESCRIPTION));
assertEquals("0", response.getHeaders().get("X-MinorVersion").get(0));
assertEquals("0", response.getHeaders().get("X-PatchVersion").get(0));
assertEquals("5.0.0", response.getHeaders().get("X-LatestVersion").get(0));
@@ -406,6 +400,15 @@ public class ServiceInstancesTest extends BaseTest {
.withStatus(HttpStatus.SC_NOT_FOUND)));
assertEquals(Response.Status.NOT_FOUND.getStatusCode(), response.getStatusCode().value());
+
+ for (ILoggingEvent logEvent : TestAppender.events) {
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.SOAuditLogContainerFilter")
+ && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
+ Map<String, String> mdc = logEvent.getMDCPropertyMap();
+ assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
+ assertNotNull(mdc.get("PartnerName"));
+ }
+ }
}
@Test
@@ -2263,7 +2266,7 @@ public class ServiceInstancesTest extends BaseTest {
RequestParameters requestParameters = request.getRequestDetails().getRequestParameters();
String userParamsTxt = inputStream("/userParams.txt");
- List<Map<String, Object>> userParams = servInstances.configureUserParams(requestParameters);
+ List<Map<String, Object>> userParams = requestHandlerUtils.configureUserParams(requestParameters);
System.out.println(userParams);
assertTrue(userParams.size() > 0);
assertTrue(userParams.get(0).containsKey("name"));
@@ -2277,7 +2280,7 @@ public class ServiceInstancesTest extends BaseTest {
ServiceInstancesRequest request =
mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
CloudConfiguration cloudConfig =
- servInstances.configureCloudConfig(request.getRequestDetails().getRequestParameters());
+ requestHandlerUtils.configureCloudConfig(request.getRequestDetails().getRequestParameters());
assertEquals("mdt25b", cloudConfig.getLcpCloudRegionId());
assertEquals("aefb697db6524ddebfe4915591b0a347", cloudConfig.getTenantId());
@@ -2290,7 +2293,7 @@ public class ServiceInstancesTest extends BaseTest {
mapper.readValue(inputStream("/MacroServiceInstance.json"), ServiceInstancesRequest.class);
ServiceInstancesRequest expected =
mapper.readValue(inputStream("/LegacyMacroServiceInstance.json"), ServiceInstancesRequest.class);
- servInstances.mapToLegacyRequest(request.getRequestDetails());
+ requestHandlerUtils.mapToLegacyRequest(request.getRequestDetails());
System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(request));
assertThat(request, sameBeanAs(expected));
}
@@ -2571,11 +2574,11 @@ public class ServiceInstancesTest extends BaseTest {
assertEquals(response.getHeaders().get(TRANSACTION_ID).get(0), "32807a28-1a14-4b88-b7b3-2950918aa76d");
for (ILoggingEvent logEvent : TestAppender.events) {
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsFilterLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOAuditLogContainerFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("ENTRY")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertEquals("32807a28-1a14-4b88-b7b3-2950918aa76d", mdc.get(ONAPLogConstants.MDCs.REQUEST_ID));
- assertEquals("VID", mdc.get(PARTNERNAME));
+ assertEquals("VID", mdc.get(ONAPLogConstants.MDCs.PARTNER_NAME));
}
}
}
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
index f178a3c0cb..cfb865c9e1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/java/org/onap/so/client/grm/GRMClientTest.java
@@ -82,15 +82,15 @@ public class GRMClientTest extends BaseTest {
boolean foundInvoke = false;
boolean foundInvokeReturn = false;
for (ILoggingEvent logEvent : TestAppender.events)
- if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging")
+ if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter")
&& logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("GRM", mdc.get("TargetEntity"));
assertEquals("INPROGRESS", mdc.get(ONAPLogConstants.MDCs.RESPONSE_STATUS_CODE));
foundInvoke = true;
- } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.JaxRsClientLogging")
- && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE_RETURN")) {
+ } else if (logEvent.getLoggerName().equals("org.onap.so.logging.jaxrs.filter.SOMetricLogClientFilter")
+ && logEvent.getMarker() != null && logEvent.getMarker().getName().equals("INVOKE-RETURN")) {
Map<String, String> mdc = logEvent.getMDCPropertyMap();
assertNotNull(mdc.get(ONAPLogConstants.MDCs.INVOCATION_ID));
assertEquals("200", mdc.get(ONAPLogConstants.MDCs.RESPONSE_CODE));
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql
index 6d8e2e8b09..d5575804ae 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/InfraActiveRequestsReset.sql
@@ -1,10 +1,10 @@
-INSERT INTO requestdb.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, REQUEST_URL) VALUES
+INSERT INTO requestdb.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, 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, REQUEST_URL) 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, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '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":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', '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.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_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}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', '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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '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": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-INSERT INTO requestdb.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, REQUEST_URL) VALUES
+INSERT INTO requestdb.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, 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, REQUEST_URL) VALUES
('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, '{"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-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, '{"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', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"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":"Infra_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":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
index 22f68e0579..72922ae9c1 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/data.sql
@@ -1,12 +1,12 @@
--Changes here should also be made in InfraActiveRequestsReset.sql to be re-inserted after tests
-INSERT INTO requestdb.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, REQUEST_URL) VALUES
+INSERT INTO requestdb.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, 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, REQUEST_URL) 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, '{"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('00032ab7-na18-42e5-965d-8ea592502018', '00032ab7-fake-42e5-965d-8ea592502018', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '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":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, null),
('00093944-bf16-4373-ab9a-3adfe730ff2d', null, 'createInstance', 'FAILED', '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.', '100', '2017-07-11 18:33:26', '2017-07-11 18:33:26', 'VID', null, null, null, null, null, '19123c2924c648eb8e42a3c1f14b7682', null, null, null, '{"modelInfo":{"modelInvariantId":"9647dfc4-2083-11e7-93ae-92361f002671","modelType":"service","modelName":"Infra_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}}', null, 'APIH', null, null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', null, 'MSODEV_1707_SI_v10_011-4', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, '{"requestDetails": {"modelInfo":{"modelType":"vfModule","modelName":"test::base::module-0"},"requestInfo":{"source":"VID"},"cloudConfiguration":{"tenantId":"6accefef3cb442ff9e644d589fb04107","lcpCloudRegionId":"n6"}}}', '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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('5ffbabd6-b793-4377-a1ab-082670fbc7ac', '5ffbabd6-b793-4377-a1ab-082670fbc7ac', 'deleteInstance', 'PENDING', 'Vf Module deletion pending.', '0', '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": "test::base::module-0","modelVersionId": "20c4431c-246d-11e7-93ae-92361f002671","modelInvariantId": "78ca26d0-246d-11e7-93ae-92361f002671","modelVersion": "2","modelCustomizationId": "cb82ffd8-252a-11e7-93ae-92361f002671"},"cloudConfiguration": {"lcpCloudRegionId": "n6","tenantId": "0422ffb57ba042c0800a29dc85ca70f8"},"requestInfo": {"instanceName": "MSO-DEV-VF-1806BB-v10-base-it2-1","source": "VID","suppressRollback": false,"requestorId": "xxxxxx"},"relatedInstanceList": [{"relatedInstance": {"instanceId": "76fa8849-4c98-473f-b431-2590b192a653","modelInfo": {"modelType": "service","modelName": "Infra_v10_Service","modelVersionId": "5df8b6de-2083-11e7-93ae-92361f002671","modelInvariantId": "9647dfc4-2083-11e7-93ae-92361f002671","modelVersion": "1.0"}}},{"relatedInstance": {"instanceId": "d57970e1-5075-48a5-ac5e-75f2d6e10f4c","modelInfo": {"modelType": "vnf","modelName": "v10","modelVersionId": "ff2ae348-214a-11e7-93ae-92361f002671","modelInvariantId": "2fff5b20-214b-11e7-93ae-92361f002671","modelVersion": "1.0","modelCustomizationId": "68dc9a92-214c-11e7-93ae-92361f002671","modelCustomizationName": "v10 1"}}}],"requestParameters": {"usePreload": true,"userParams": []}}}', null, 'BPMN', '2016-12-22 19:00:28', null, null, null, 'c7d527b1-7a91-49fd-b97d-1c8c0f4a7992', null, 'test::base::module-0', null, 'n6', null, null, null, null, null, 'vfModule', 'deleteInstance', 'e3b5744d-2ad1-4cdd-8390-c999a38829bc', null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-INSERT INTO requestdb.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, REQUEST_URL) VALUES
+INSERT INTO requestdb.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, 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, REQUEST_URL) VALUES
('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, '{"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-n6-3100-0927-1","suppressRollback":false,"requestorId":"xxxxxx"},"relatedInstanceList":null,"subscriberInfo":{"globalSubscriberId":"MSO_1610_dev","subscriberName":"MSO_1610_dev"},"cloudConfiguration":{"aicNodeClli":null,"tenantId":"19123c2924c648eb8e42a3c1f14b7682","lcpCloudRegionId":"n6"},"requestParameters":{"subscriptionServiceType":"MSO-dev-service-type","userParams":[{"name":"someUserParam","value":"someValue"}],"aLaCarte":true,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'CreateGenericALaCarteServiceInstance', '2017-09-28 12:45:52', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'service', 'createInstance', 'b2f59173-b7e5-4e0f-8440-232fd601b865', 'DEV-n6-3100-0927-1', 'xxxxxx', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, '{"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', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, null),
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"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":"Infra_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":"n6"},"requestParameters":{"subscriptionServiceType":null,"userParams":[],"aLaCarte":false,"autoBuildVfModules":false,"cascadeDelete":false,"usePreload":true},"project":null,"owningEntity":null,"platform":null,"lineOfBusiness":null}', null, 'APIH', '2017-09-26 16:09:29', null, null, null, null, null, null, null, 'n6', null, null, null, null, null, 'configuration', 'activateInstance', '9e15a443-af65-4f05-9000-47ae495e937d', null, 'xxxxxx', '26ef7f15-57bb-48df-8170-e59edc26234c', null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
index ee53e491a4..2129dc2ede 100644
--- a/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-api-handler-infra/src/test/resources/schema.sql
@@ -1276,7 +1276,7 @@ CREATE TABLE `infra_active_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
@@ -1329,7 +1329,7 @@ CREATE TABLE `archived_infra_requests` (
`VF_MODULE_NAME` varchar(200) DEFAULT NULL,
`VF_MODULE_MODEL_NAME` varchar(200) DEFAULT NULL,
`AAI_SERVICE_ID` varchar(50) DEFAULT NULL,
- `AIC_CLOUD_REGION` varchar(11) DEFAULT NULL,
+ `CLOUD_REGION` varchar(11) DEFAULT NULL,
`CALLBACK_URL` varchar(200) DEFAULT NULL,
`CORRELATOR` varchar(80) DEFAULT NULL,
`NETWORK_ID` varchar(45) DEFAULT NULL,
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql
index 43571e42fc..bfd3d2160a 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/afterMigrate.sql
@@ -4,7 +4,7 @@ insert into operation_status(service_id, operation_id, service_name, user_id, re
('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, request_url) values
+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, 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, request_url) 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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
diff --git a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
index 192e6d55b6..22e84344f7 100644
--- a/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
+++ b/mso-api-handlers/mso-requests-db-repositories/src/test/resources/schema.sql
@@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
VF_MODULE_NAME VARCHAR SELECTIVITY 8,
VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3,
AAI_SERVICE_ID VARCHAR SELECTIVITY 1,
- AIC_CLOUD_REGION VARCHAR SELECTIVITY 1,
+ CLOUD_REGION VARCHAR SELECTIVITY 1,
CALLBACK_URL VARCHAR SELECTIVITY 1,
CORRELATOR VARCHAR SELECTIVITY 1,
NETWORK_ID VARCHAR SELECTIVITY 2,
@@ -102,11 +102,11 @@ CREATE TABLE IF NOT EXISTS PUBLIC.INFRA_ACTIVE_REQUESTS(
ROLLBACK_EXT_SYSTEM_ERROR_SOURCE VARCHAR SELECTIVITY 1
);
-INSERT INTO PUBLIC.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, REQUEST_URL) VALUES
+INSERT INTO PUBLIC.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, 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, REQUEST_URL) 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, '{"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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, '{"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', null, 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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, STRINGDECODE('<?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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
-INSERT INTO PUBLIC.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, REQUEST_URL) VALUES
+INSERT INTO PUBLIC.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, 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, REQUEST_URL) VALUES
('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, '{"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', 'md5621', null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('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, '{"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', null, null, null, null, null, null, null, null, 'mtn16', null, null, null, null, null, 'service', 'createInstance', null, null, null, null, null, null, null, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances'),
('0017f68c-eb2d-45bb-b7c7-ec31b37dc349', null, 'activateInstance', 'UNLOCKED', null, '20', '2017-09-26 16:09:29', null, 'VID', null, null, null, null, null, null, null, null, null, '{"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, 'http://localhost:8080/onap/so/infra/serviceInstantiation/v7/serviceInstances');
@@ -151,7 +151,7 @@ CREATE CACHED TABLE PUBLIC.ARCHIVED_INFRA_REQUESTS(
VF_MODULE_NAME VARCHAR SELECTIVITY 8,
VF_MODULE_MODEL_NAME VARCHAR SELECTIVITY 3,
AAI_SERVICE_ID VARCHAR SELECTIVITY 1,
- AIC_CLOUD_REGION VARCHAR SELECTIVITY 1,
+ CLOUD_REGION VARCHAR SELECTIVITY 1,
CALLBACK_URL VARCHAR SELECTIVITY 1,
CORRELATOR VARCHAR SELECTIVITY 1,
NETWORK_ID VARCHAR SELECTIVITY 2,
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
index d0a4aa2c5f..1f5fb8f77e 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraActiveRequests.java
@@ -23,8 +23,8 @@ package org.onap.so.db.request.beans;
import java.util.Objects;
import javax.persistence.Entity;
import javax.persistence.Table;
-import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
/**
* InfraActiveRequests generated by hbm2java
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
index 05845dd058..73e5e16324 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/beans/InfraRequests.java
@@ -117,7 +117,7 @@ public abstract class InfraRequests implements java.io.Serializable {
private String vfModuleModelName;
@Column(name = "AAI_SERVICE_ID", length = 50)
private String aaiServiceId;
- @Column(name = "AIC_CLOUD_REGION", length = 11)
+ @Column(name = "CLOUD_REGION", length = 11)
private String aicCloudRegion;
@Column(name = "CALLBACK_URL", length = 200)
private String callBackUrl;
diff --git a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
index 9be92ad93a..99c1d1ea72 100644
--- a/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
+++ b/mso-api-handlers/mso-requests-db/src/main/java/org/onap/so/db/request/client/RequestsDbClient.java
@@ -32,6 +32,7 @@ import javax.annotation.PostConstruct;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.db.request.beans.ArchivedInfraRequests;
import org.onap.so.db.request.beans.InfraActiveRequests;
import org.onap.so.db.request.beans.OperationStatus;
@@ -44,7 +45,7 @@ import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus;
import org.onap.so.db.request.beans.WatchdogDistributionStatus;
import org.onap.so.db.request.beans.WatchdogServiceModVerIdLookup;
import org.onap.so.db.request.data.controller.InstanceNameDuplicateCheckRequest;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Primary;
@@ -157,7 +158,8 @@ public class RequestsDbClient {
return Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
.setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
+ restTemplate.getInterceptors().add((new SOSpringClientFilter()));
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
index 93e2992d3f..9691eff5f5 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/beans/OrchestrationStatus.java
@@ -22,6 +22,7 @@ package org.onap.so.db.catalog.beans;
public enum OrchestrationStatus {
ACTIVE("Active", "active"),
+ ACTIVATED("Activated", "activated"),
ASSIGNED("Assigned", "assigned"),
CREATED("Created", "created"),
INVENTORIED("Inventoried", "inventoried"),
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
index 23539b074d..e60ef9727e 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/client/CatalogDbClient.java
@@ -30,6 +30,8 @@ import javax.persistence.EntityNotFoundException;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriBuilder;
import org.apache.http.HttpStatus;
+import org.onap.logging.filter.base.Constants;
+import org.onap.logging.filter.spring.SpringClientPayloadFilter;
import org.onap.so.db.catalog.beans.BuildingBlockDetail;
import org.onap.so.db.catalog.beans.CloudSite;
import org.onap.so.db.catalog.beans.CloudifyManager;
@@ -64,7 +66,7 @@ import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
import org.onap.so.db.catalog.beans.macro.RainyDayHandlerStatus;
import org.onap.so.logger.LogConstants;
-import org.onap.so.logging.jaxrs.filter.SpringClientFilter;
+import org.onap.so.logging.jaxrs.filter.SOSpringClientFilter;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -366,12 +368,13 @@ public class CatalogDbClient {
ClientFactory clientFactory =
Configuration.builder().setClientHttpRequestFactory(factory).setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
+ restTemplate.getInterceptors().add((new SOSpringClientFilter()));
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
request.getHeaders().add(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY);
return execution.execute(request, body);
});
}).build().buildClientFactory();
@@ -415,12 +418,13 @@ public class CatalogDbClient {
ClientFactory clientFactory = Configuration.builder().setBaseUri(baseUri).setClientHttpRequestFactory(factory)
.setRestTemplateConfigurer(restTemplate -> {
- restTemplate.getInterceptors().add((new SpringClientFilter()));
+ restTemplate.getInterceptors().add((new SOSpringClientFilter()));
+ restTemplate.getInterceptors().add((new SpringClientPayloadFilter()));
restTemplate.getInterceptors().add((request, body, execution) -> {
request.getHeaders().add(HttpHeaders.AUTHORIZATION, auth);
- request.getHeaders().add(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ request.getHeaders().add(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY);
return execution.execute(request, body);
});
}).build().buildClientFactory();
@@ -762,6 +766,11 @@ public class CatalogDbClient {
this.postSingleResource(cloudSiteClient, cloudSite);
}
+ public List<CloudSite> getCloudSites() {
+ return this.getMultipleResources(cloudSiteClient, UriBuilder.fromUri(endpoint + CLOUD_SITE).build());
+ }
+
+
public CloudSite getCloudSiteByClliAndAicVersion(String clli, String cloudVersion) {
return this.getSingleResource(cloudSiteClient, getUri(UriBuilder.fromUri(findByClliAndCloudVersion)
.queryParam(CLLI, clli).queryParam(CLOUD_VERSION, cloudVersion).build().toString()));
@@ -1007,7 +1016,7 @@ public class CatalogDbClient {
headers.set(HttpHeaders.AUTHORIZATION, msoAdaptersAuth);
headers.set(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON);
headers.set(HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON);
- headers.set(LogConstants.TARGET_ENTITY_HEADER, TARGET_ENTITY);
+ headers.set(Constants.HttpHeaders.TARGET_ENTITY_HEADER, TARGET_ENTITY);
return headers;
}
diff --git a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
index 898911fd1c..d49d5e864d 100644
--- a/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
+++ b/mso-catalog-db/src/main/java/org/onap/so/db/catalog/data/repository/ServiceRecipeRepository.java
@@ -25,7 +25,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
@RepositoryRestResource(collectionResourceRel = "serviceRecipe", path = "serviceRecipe")
-public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Long> {
+public interface ServiceRecipeRepository extends JpaRepository<ServiceRecipe, Integer> {
ServiceRecipe findByActionAndServiceModelUUID(String action, String serviceModelUUID);
ServiceRecipe findByAction(String action);
diff --git a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
index e1de3317e7..c68495d27e 100644
--- a/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
+++ b/packages/docker/src/main/docker/docker-files/configs/logging/logback-spring.xml
@@ -1,12 +1,12 @@
-<!-- ============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
+<!-- ============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========================================================= -->
<configuration scan="true" debug="false">
@@ -23,20 +23,20 @@
<property name="metricsLogName" value="metrics" />
<property name="auditLogName" value="audit" />
<property name="debugLogName" value="debug" />
-
+
<property name="currentTimeStamp" value="%d{&quot;yyyy-MM-dd'T'HH:mm:ss.SSSXXX&quot;,UTC}"/>
<property name="errorPattern"
value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%thread|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%.-5level|%X{ErrorCode:-500}|%X{ErrorDesc}|%msg%n" />
<property name="debugPattern"
- value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}| %logger{50} - %msg%n" />
+ value="%d{yyyy-MM-dd'T'HH:mm:ss.SSSXXX}|%X{RequestID}|%logger{50} - %msg%n" />
<property name="auditPattern"
- value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||||||%msg%n" />
+ value="%X{EntryTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%marker|%mdc|||%msg%n" />
<property name="metricPattern"
- value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{Timer}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|||||%msg%n" />
+ value="%X{InvokeTimestamp}|%date{yyyy-MM-dd'T'HH:mm:ss.SSSXXX,UTC}|%X{RequestID}|%X{ServiceInstanceId}|%thread||%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDesc}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}||||%X{TargetVirtualEntity}|%marker|%mdc|||%msg%n" />
<property name="defaultPattern"
value="%nopexception%logger
@@ -52,7 +52,7 @@
<appender name="Audit"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>EXIT</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
@@ -80,8 +80,8 @@
<appender name="Metric"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
- <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
- <marker>INVOKE_RETURN</marker>
+ <evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
+ <marker>INVOKE-RETURN</marker>
</evaluator>
<onMismatch>DENY</onMismatch>
<onMatch>ACCEPT</onMatch>
@@ -137,7 +137,7 @@
<filter class="ch.qos.logback.core.filter.EvaluatorFilter">
<evaluator class="ch.qos.logback.classic.boolex.OnMarkerEvaluator">
<marker>INVOKE</marker>
- <marker>INVOKE_RETURN</marker>
+ <marker>INVOKE-RETURN</marker>
<marker>ENTRY</marker>
<marker>EXIT</marker>
</evaluator>
@@ -180,6 +180,7 @@
<logger name="org.onap" level="DEBUG" />
<logger name="com.att.ecomp" level="DEBUG" />
<logger name="org.apache.cxf.interceptor" level="DEBUG" />
+ <logger name="com.att.commons" level="DEBUG" />
<logger name="AUDIT" level="INFO" additivity="false">
<appender-ref ref="asyncAudit" />
diff --git a/pom.xml b/pom.xml
index d5cd1f4a0b..ac9126b612 100644
--- a/pom.xml
+++ b/pom.xml
@@ -636,6 +636,21 @@
<!-- Dependencies -->
<dependencies>
<dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-slf4j</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-filter-base</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
+ <groupId>org.onap.logging-analytics</groupId>
+ <artifactId>logging-filter-spring</artifactId>
+ <version>1.5.0</version>
+ </dependency>
+ <dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
</dependency>
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
index 71294bfffe..5adfc049af 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/app.module.ts
@@ -19,7 +19,7 @@ See the License for the specific language governing permissions and
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@est.tech, waqas.ikram@est.tech
*/
import { BrowserModule } from '@angular/platform-browser';
@@ -35,13 +35,13 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { DetailsComponent } from './details/details.component';
import { ToastrNotificationService } from './toastr-notification-service.service';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatSelectModule, MatNativeDateModule, MatDatepickerModule, MatCardModule, MatPaginatorModule, MatSortModule } from '@angular/material';
+import { MatFormFieldModule, MatInputModule, MatTableModule, MatTabsModule, MatSelectModule, MatNativeDateModule, MatDatepickerModule, MatCardModule, MatPaginatorModule, MatSortModule, MatIconModule } from '@angular/material';
import { NgxSpinnerModule } from 'ngx-spinner';
import { RouterModule, Routes } from '@angular/router';
import { APP_BASE_HREF } from '@angular/common';
import { LoginComponent } from './login/login.component';
-import {BasicAuthInterceptor} from "./basic-auth.interceptor";
-import {ErrorInterceptor} from "./error.interceptor";
+import { BasicAuthInterceptor } from "./basic-auth.interceptor";
+import { ErrorInterceptor } from "./error.interceptor";
@NgModule({
declarations: [
@@ -70,6 +70,7 @@ import {ErrorInterceptor} from "./error.interceptor";
RouterModule,
MatPaginatorModule,
MatSortModule,
+ MatIconModule,
RouterModule.forRoot([]),
ReactiveFormsModule
],
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html
index a98095ca00..8ad955f38e 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.html
@@ -17,12 +17,23 @@ See the License for the specific language governing permissions and
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@est.tech, waqas.ikram@est.tech
-->
<div class="completeForm">
<div class="topCanvas">
- <section class="canvas" id="canvas"></section>
+ <div class="navigation">
+ <button class="zoomButton" mat-icon-button title="zoom in" (click)="zoomIn()">
+ <mat-icon>zoom_in</mat-icon>
+ </button>
+ <button class="zoomButton" mat-icon-button title="zoom out" (click)="zoomOut()">
+ <mat-icon>zoom_out</mat-icon>
+ </button>
+ <button class="zoomButton" mat-icon-button title="reset zoom" (click)="resetZoom()">
+ <mat-icon>all_out</mat-icon>
+ </button>
+ </div>
+ <div #canvas class="canvas" id="canvas"></div>
<mat-card class="besideCanvas" id="besideCanvas">
<mat-card-title>Process Information</mat-card-title>
<br />
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss
index 2789723964..b96fe4ace2 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.scss
@@ -17,23 +17,39 @@ See the License for the specific language governing permissions and
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@est.tech, waqas.ikram@est.tech
*/
#canvas {
background: white;
padding: 0;
- margin: 0;
+ margin-left: -43px;
width: 70%;
height: 470px;
margin-top: 0;
- box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
+ box-shadow: 0 8px 10px 1px rgba(0,0,0,.2);
+}
+
+.navigation {
+ background: #e6e6e6;
+ width: 40px;
+ box-shadow: -5px 8px 10px 1px rgba(0,0,0,.2);
+ height: 470px;
+ border: 1px;
+ border-color: black;
+ position: relative;
+}
+
+.zoomButton {
+ padding-top: 8px;
+ background: none;
+ border: none;
}
#besideCanvas {
background: white;
padding-left: 20px;
margin: 0;
- width: 28%;
+ width: 25%;
height: 470px;
margin-top: 0;
box-shadow: 0 5px 5px -3px rgba(0,0,0,.2), 0 8px 10px 1px rgba(0,0,0,.14), 0 3px 14px 2px rgba(0,0,0,.12);
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts
index 7106a87937..a42fa3f5a6 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/details/details.component.ts
@@ -17,7 +17,7 @@ See the License for the specific language governing permissions and
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@est.tech, waqas.ikram@est.tech
*/
import { Component, OnInit } from '@angular/core';
@@ -34,6 +34,7 @@ import { MatTabsModule } from '@angular/material/tabs';
import { VariableInstance } from '../model/variableInstance.model';
import { ToastrNotificationService } from '../toastr-notification-service.service';
import { NgxSpinnerService } from 'ngx-spinner';
+import { ElementRef, ViewChild } from '@angular/core';
@Component({
selector: 'app-details',
@@ -43,6 +44,9 @@ import { NgxSpinnerService } from 'ngx-spinner';
})
export class DetailsComponent implements OnInit {
+
+ @ViewChild("canvas") elementReference: ElementRef;
+
bpmnViewer: any;
processInstanceID: string;
@@ -82,7 +86,8 @@ export class DetailsComponent implements OnInit {
async (data: ProcessDefinitionDetail) => {
this.processDefinition = data;
console.log(data);
- await this.displayCamundaflow(this.processDefinition.processDefinitionXml, this.activityInstance, this.router);
+ await this.displayCamundaflow(this.processDefinition.processDefinitionXml, this.activityInstance,
+ this.router, this.spinner, this.popup);
}, error => {
console.log(error);
this.popup.error("Unable to get process definition for id: " + procDefId + " Error code:" + error.status);
@@ -104,30 +109,53 @@ export class DetailsComponent implements OnInit {
});
}
- displayCamundaflow(bpmnXml, activities: ActivityInstance[], r: Router) {
- this.spinner.show();
+ displayCamundaflow(bpmnXml, activities: ActivityInstance[], router: Router,
+ spinner: NgxSpinnerService, popup: ToastrNotificationService) {
+ spinner.show();
this.bpmnViewer.importXML(bpmnXml, (error) => {
if (error) {
console.error('Unable to load BPMN flow ', error);
- this.popup.error('Unable to load BPMN flow ');
- this.spinner.hide();
+ popup.error('Unable to load BPMN flow ');
+ spinner.hide();
} else {
- this.spinner.hide();
- var canvas = this.bpmnViewer.get('canvas');
+ spinner.hide();
+ let canvas = this.bpmnViewer.get('canvas');
var eventBus = this.bpmnViewer.get('eventBus');
- eventBus.on('element.click', function(e) {
+ var elementRegistry = this.bpmnViewer.get('elementRegistry');
+ var overlays = this.bpmnViewer.get('overlays');
- activities.forEach(a => {
- if (a.activityId == e.element.id && a.calledProcessInstanceId !== null) {
- console.log("will drill down to : " + a.calledProcessInstanceId);
- r.navigate(['/details/' + a.calledProcessInstanceId]);
- this.spinner.show();
- }
- });
+ activities.forEach(a => {
+ if (a.calledProcessInstanceId !== null) {
+ var element = elementRegistry.get(a.activityId);
+ let newNode = document.createElement('div');
+ newNode.className = 'highlight-overlay';
+ newNode.id = element.id;
+ newNode.style.width = element.width + "px";
+ newNode.style.height = element.height + "px";
+ newNode.style.cursor = "pointer";
+
+ overlays.add(a.activityId, {
+ position: {
+ top: -5,
+ left: -5
+ },
+ html: newNode
+ });
+
+ newNode.addEventListener('click', function(e) {
+ console.log("clicked on: " + e.srcElement.id)
+ activities.forEach(a => {
+ if (a.activityId == e.srcElement.id && a.calledProcessInstanceId !== null) {
+ console.log("will drill down to : " + a.calledProcessInstanceId);
+ router.navigate(['/details/' + a.calledProcessInstanceId]);
+ }
+ });
+ });
+ }
});
// zoom to fit full viewport
- canvas.zoom('fit-viewport');
+ canvas.zoom('fit-viewport', 'auto');
activities.forEach(a => {
canvas.addMarker(a.activityId, 'highlight');
});
@@ -135,6 +163,26 @@ export class DetailsComponent implements OnInit {
});
}
+ zoomIn() {
+ this.bpmnViewer.get('zoomScroll').zoom(1, {
+ x: this.elementReference.nativeElement.offsetWidth / 2,
+ y: this.elementReference.nativeElement.offsetHeight / 2
+ });
+ }
+
+ zoomOut() {
+ this.bpmnViewer.get('zoomScroll').zoom(-1, {
+ x: this.elementReference.nativeElement.offsetWidth / 2,
+ y: this.elementReference.nativeElement.offsetHeight / 2
+ });
+ }
+ resetZoom() {
+ let canvas = this.bpmnViewer.get('canvas');
+ canvas.resized();
+ canvas.zoom('fit-viewport', 'auto');
+
+ }
+
getVarInst(procInstId: string) {
this.data.getVariableInstance(procInstId).subscribe(
(data: VariableInstance[]) => {
diff --git a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts
index 16d274f16a..b22fa6ee9c 100644
--- a/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts
+++ b/so-monitoring/so-monitoring-ui/src/main/frontend/src/app/http-error-handler.service.ts
@@ -17,7 +17,7 @@ See the License for the specific language governing permissions and
SPDX-License-Identifier: Apache-2.0
============LICENSE_END=========================================================
-@authors: ronan.kenny@ericsson.com, waqas.ikram@ericsson.com
+@authors: ronan.kenny@est.tech, waqas.ikram@est.tech
*/
import { Injectable } from '@angular/core';
@@ -44,9 +44,9 @@ export class HttpErrorHandlerService {
this.popup.error("Internal Service Error occured for operation: " + operation + " please check backend service log. status code: " + error.status);
}
console.error(
- 'Backend returned code ${error.status}, ' +
- 'body was: ${error.error}');
- return throwError(error.error || "Internal Service Error occured for operation: " + operation + " please check backend service log. status code: " + error.status);
+ 'Backend returned status code: ', error.status + ' from URL ' + url);
+ return throwError(error.error || "Internal Service Error occured for operation: " +
+ operation + ". Please check backend service log. Status code: " + error.status);
};
}
diff --git a/version.properties b/version.properties
index f78f30b18d..9eb3b93ac9 100644
--- a/version.properties
+++ b/version.properties
@@ -4,7 +4,7 @@
major=1
minor=5
-patch=1
+patch=3
base_version=${major}.${minor}.${patch}
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java
index 9cb0702ee0..0818ea363f 100644
--- a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/controllers/TestSvnfmController.java
@@ -20,9 +20,12 @@
package org.onap.svnfm.simulator.controllers;
+import static org.assertj.core.api.Assertions.assertThat;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.eq;
import static org.mockito.Mockito.when;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.delete;
+import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
@@ -35,18 +38,35 @@ import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.constants.Constant;
import org.onap.svnfm.simulator.controller.SvnfmController;
import org.onap.svnfm.simulator.repository.VnfmCacheRepository;
import org.onap.svnfm.simulator.services.SvnfmService;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
+import org.springframework.test.web.servlet.MvcResult;
+import org.springframework.test.web.servlet.ResultActions;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
@RunWith(MockitoJUnitRunner.class)
public class TestSvnfmController {
+ private static final String VNF_INSTANCES_URL = "/vnf_instances/";
+ private static final String VNFD_ID = "vnfdId";
+ private static final String VNF_INSTANCE_NAME = "vnfInstanceName";
+ private static final String VNF_INSTANCE_DESCRIPTION = "vnfInstanceDescription";
+ private static final String VNF_INSTANCE_ID = "vnfInstanceId";
+ private static final String VNF_OPERATION_ID = "vnfOperationId";
+ private static final String VNF_INSTANTIATE_URL = "/instantiate";
+ private static final String VNF_TERMINATE_URL = "/terminate";
+ private static final String VNF_LCM_OP_OCC_ID = "vnfLcmOpOccId";
+ private static final String VNF_OPERATION_STATUS_URL = "/vnf_lcm_op_occs/";
+ private static final String SUBSCRIPTIONS_URL = "/subscriptions";
+
@InjectMocks
private SvnfmController svnfmController;
@@ -68,18 +88,96 @@ public class TestSvnfmController {
public void createVnfInstanceTest() throws Exception {
final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
- createVnfRequest.setVnfdId("123456798");
- createVnfRequest.setVnfInstanceName("createVnfInstanceTest");
- createVnfRequest.setVnfInstanceDescription("createVnfInstanceTest");
+ createVnfRequest.setVnfdId(VNFD_ID);
+ createVnfRequest.setVnfInstanceName(VNF_INSTANCE_NAME);
+ createVnfRequest.setVnfInstanceDescription(VNF_INSTANCE_DESCRIPTION);
when(vnfmCacheRepository.createVnf(eq(createVnfRequest), anyString())).thenReturn(new InlineResponse201());
final String body = (new ObjectMapper()).valueToTree(createVnfRequest).toString();
this.mockMvc
- .perform(post(Constant.BASE_URL + "/vnf_instances").content(body)
+ .perform(post(Constant.BASE_URL + VNF_INSTANCES_URL).content(body)
.contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
.andExpect(status().isCreated()).andExpect(content().contentType(MediaType.APPLICATION_JSON));
}
-}
+ @Test
+ public void test_getVnf_usingValidVnfInstanceId_vnfInstanceRetrievedSuccessfully() throws Exception {
+ final InlineResponse201 inlineResponse201 = new InlineResponse201();
+ inlineResponse201.setId(VNF_INSTANCE_ID);
+ inlineResponse201.setVnfInstanceName(VNF_INSTANCE_NAME);
+
+ when(vnfmCacheRepository.getVnf(VNF_INSTANCE_ID)).thenReturn(inlineResponse201);
+
+ final ResultActions resultActions = this.mockMvc
+ .perform(get(Constant.BASE_URL + VNF_INSTANCES_URL + VNF_INSTANCE_ID)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isOk()).andExpect(content().contentType(MediaType.APPLICATION_JSON_UTF8));
+
+ final MvcResult result = resultActions.andReturn();
+ final String content = result.getResponse().getContentAsString();
+ final InlineResponse201 response201 = new ObjectMapper().readValue(content, InlineResponse201.class);
+ assertThat(response201.getId()).isEqualTo(VNF_INSTANCE_ID);
+ assertThat(response201.getVnfInstanceName()).isEqualTo(VNF_INSTANCE_NAME);
+ }
+
+ @Test
+ public void test_instantiateVnf_usingValidVnfInstanceId_returnsHttpStatusAccepted() throws Exception {
+ when(svnfmService.instantiateVnf(VNF_INSTANCE_ID)).thenReturn(VNF_OPERATION_ID);
+
+ this.mockMvc
+ .perform(post(Constant.BASE_URL + VNF_INSTANCES_URL + VNF_INSTANCE_ID + VNF_INSTANTIATE_URL)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isAccepted()).andExpect(content().contentType(MediaType.APPLICATION_JSON));
+ }
+
+ @Test
+ public void test_deleteVnf_usingValidVnfInstanceId_returnsHttpStatusNoContent() throws Exception {
+ this.mockMvc
+ .perform(delete(Constant.BASE_URL + VNF_INSTANCES_URL + VNF_INSTANCE_ID)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isNoContent()).andExpect(content().contentType(MediaType.APPLICATION_JSON));
+ }
+ @Test
+ public void test_terminateVnf_usingValidVnfInstanceId_returnsHttpStatusIsAccepted() throws Exception {
+ when(svnfmService.terminateVnf(VNF_INSTANCE_ID)).thenReturn(VNF_OPERATION_ID);
+
+ this.mockMvc
+ .perform(post(Constant.BASE_URL + VNF_INSTANCES_URL + VNF_INSTANCE_ID + VNF_TERMINATE_URL)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isAccepted()).andExpect(content().contentType(MediaType.APPLICATION_JSON));
+ }
+
+ @Test
+ public void test_getOperationStatus_usingValidOperationId_operationStatusRetrievedSuccessfully() throws Exception {
+ final InlineResponse200 inlineResponse200 = new InlineResponse200();
+ inlineResponse200.setId(VNF_LCM_OP_OCC_ID);
+ inlineResponse200.setOperation(OperationEnum.INSTANTIATE);
+
+ when(svnfmService.getOperationStatus(VNF_LCM_OP_OCC_ID)).thenReturn(inlineResponse200);
+
+ final ResultActions resultActions = this.mockMvc
+ .perform(get(Constant.BASE_URL + VNF_OPERATION_STATUS_URL + VNF_LCM_OP_OCC_ID)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .andExpect(content().contentType(MediaType.APPLICATION_JSON)).andExpect(status().isOk());
+
+ final MvcResult result = resultActions.andReturn();
+ final String content = result.getResponse().getContentAsString();
+ final InlineResponse200 response200 = new ObjectMapper().readValue(content, InlineResponse200.class);
+ assertThat(response200.getId()).isEqualTo(VNF_LCM_OP_OCC_ID);
+ assertThat(response200.getOperation()).isEqualTo(OperationEnum.INSTANTIATE);
+ }
+
+ @Test
+ public void test_subscribeForNotifications_usingValidSubscriptionRequest_returnsHttpStatusCreated()
+ throws Exception {
+ final LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest();
+ final String body = (new ObjectMapper()).valueToTree(lccnSubscriptionRequest).toString();
+
+ this.mockMvc
+ .perform(post(Constant.BASE_URL + SUBSCRIPTIONS_URL).content(body)
+ .contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON))
+ .andExpect(status().isCreated()).andExpect(content().contentType(MediaType.APPLICATION_JSON));
+ }
+}
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java
index 46030e94d3..b74cd689c8 100644
--- a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/InstantiateOperatorProgressorTest.java
@@ -21,16 +21,20 @@
package org.onap.svnfm.simulator.services;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
import java.util.ArrayList;
import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.mockito.Mockito;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantRequest;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201AddResources;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.InlineResponse201VimConnections;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
import org.onap.svnfm.simulator.config.ApplicationConfig;
@@ -60,6 +64,7 @@ public class InstantiateOperatorProgressorTest {
svnfmServiceMock = mock(SvnfmService.class);
VnfOperation vnfOperation = new VnfOperation();
vnfOperation.setVnfInstanceId(VNF_INSTANCE_ID);
+ vnfOperation.setOperation(OperationEnum.OPERATE);
testedObject = new InstantiateOperationProgressor(vnfOperation, svnfmServiceMock, null, new ApplicationConfig(),
createVnfds(), createSubscriptionService());
}
@@ -117,6 +122,13 @@ public class InstantiateOperatorProgressorTest {
assertThat(testedObject.getRemoveResources("anyVnfId")).isEmpty();
}
+ @Test
+ public void test_buildGrantRequest_usingValidVnfInstanceId_grantRequestRetrievedSuccessfully() {
+ when(svnfmServiceMock.getVnf(Mockito.eq(VNF_INSTANCE_ID))).thenReturn(createInlineResponse201());
+ GrantRequest grantRequest = testedObject.buildGrantRequest();
+ assertThat(grantRequest.getVnfdId().equals(VNF_ID));
+ }
+
private Vnfds createVnfds() {
Vnfd vnfd = new Vnfd();
vnfd.setVnfdId(VNF_ID);
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
index ed77775421..2eca37ba6c 100644
--- a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/SvnfmServiceTest.java
@@ -21,13 +21,21 @@
package org.onap.svnfm.simulator.services;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.junit.Assert.assertNull;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.CreateVnfRequest;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum;
import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
import org.onap.svnfm.simulator.config.ApplicationConfig;
import org.onap.svnfm.simulator.constants.Constant;
+import org.onap.svnfm.simulator.model.VnfInstance;
+import org.onap.svnfm.simulator.model.VnfOperation;
import org.onap.svnfm.simulator.model.Vnfds;
import org.onap.svnfm.simulator.repository.VnfOperationRepository;
import org.onap.svnfm.simulator.repository.VnfmRepository;
@@ -37,14 +45,21 @@ import org.springframework.cache.support.SimpleValueWrapper;
public class SvnfmServiceTest {
+ private static final String VNFD_ID = "vnfdId";
+ private static final String VNF_INSTANCE_NAME = "vnfInstanceName";
+ private static final String VNF_INSTANCE_ID = "vnfInstanceId";
+ private static final String OPERATION_ID = "operationId";
private SvnfmService testedObject;
private CacheManager cacheManagerMock;
+ private VnfmHelper vnfmHelperMock;
+ private VnfmRepository vnfmRepositoryMock;
+ private VnfOperationRepository vnfOperationRepositoryMock;
@Before
public void setup() {
- VnfmRepository vnfmRepositoryMock = mock(VnfmRepository.class);
- VnfOperationRepository vnfOperationRepositoryMock = mock(VnfOperationRepository.class);
- VnfmHelper vnfmHelperMock = mock(VnfmHelper.class);
+ vnfmRepositoryMock = mock(VnfmRepository.class);
+ vnfOperationRepositoryMock = mock(VnfOperationRepository.class);
+ vnfmHelperMock = mock(VnfmHelper.class);
ApplicationConfig applicationConfigMock = mock(ApplicationConfig.class);
cacheManagerMock = mock(CacheManager.class);
Vnfds vnfdsMock = mock(Vnfds.class);
@@ -57,18 +72,16 @@ public class SvnfmServiceTest {
@Test
public void getVnfSuccessful() {
// given
- String vnfId = "vnfId";
- String vnfInstanceName = "testVnf";
Cache cacheMock = mock(Cache.class);
SimpleValueWrapper simpleValueWrapperMock = mock(SimpleValueWrapper.class);
when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
- when(cacheMock.get(vnfId)).thenReturn(simpleValueWrapperMock);
- when(simpleValueWrapperMock.get()).thenReturn(prepareInlineResponse(vnfId, vnfInstanceName));
+ when(cacheMock.get(VNF_INSTANCE_ID)).thenReturn(simpleValueWrapperMock);
+ when(simpleValueWrapperMock.get()).thenReturn(getInlineResponse(VNFD_ID, VNF_INSTANCE_NAME));
// when
- InlineResponse201 result = testedObject.getVnf(vnfId);
+ InlineResponse201 result = testedObject.getVnf(VNF_INSTANCE_ID);
// then
- assertThat(result.getVnfdId()).isEqualTo(vnfId);
- assertThat(result.getVnfInstanceName()).isEqualTo(vnfInstanceName);
+ assertThat(result.getVnfdId()).isEqualTo(VNFD_ID);
+ assertThat(result.getVnfInstanceName()).isEqualTo(VNF_INSTANCE_NAME);
}
@Test
@@ -82,31 +95,109 @@ public class SvnfmServiceTest {
@Test
public void getVnf_ifWrapperNullThenReturnNull() {
// given
- String vnfId = "vnfId";
Cache cacheMock = mock(Cache.class);
when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
- when(cacheMock.get(vnfId)).thenReturn(null);
+ when(cacheMock.get(VNF_INSTANCE_ID)).thenReturn(null);
// then
- assertThat(testedObject.getVnf(vnfId)).isNull();
+ assertThat(testedObject.getVnf(VNF_INSTANCE_ID)).isNull();
}
@Test
public void getVnf_ifResultIsNullThenReturnNull() {
// when
- String vnfId = "vnfId";
Cache cacheMock = mock(Cache.class);
SimpleValueWrapper simpleValueWrapperMock = mock(SimpleValueWrapper.class);
when(cacheManagerMock.getCache(Constant.IN_LINE_RESPONSE_201_CACHE)).thenReturn(cacheMock);
- when(cacheMock.get(vnfId)).thenReturn(simpleValueWrapperMock);
+ when(cacheMock.get(VNF_INSTANCE_ID)).thenReturn(simpleValueWrapperMock);
when(simpleValueWrapperMock.get()).thenReturn(null);
// then
- assertThat(testedObject.getVnf(vnfId)).isNull();
+ assertThat(testedObject.getVnf(VNF_INSTANCE_ID)).isNull();
}
- private InlineResponse201 prepareInlineResponse(String vnfId, String vnfInstanceName) {
+ @Test
+ public void test_createVnf_usingValidCreateVnfRequest_vnfInstanceCreatedSuccessfully() throws Exception {
+ // given
+ final CreateVnfRequest createVnfRequest = getCreateVnfRequest();
+ final VnfInstance vnfInstance = getVnfInstance();
+ final InlineResponse201 inlineResponse201 = getInlineResponse(VNFD_ID, VNF_INSTANCE_NAME);
+ when(vnfmHelperMock.createVnfInstance(createVnfRequest, VNF_INSTANCE_ID)).thenReturn(vnfInstance);
+ when(vnfmRepositoryMock.save(vnfInstance)).thenReturn(vnfInstance);
+ when(vnfmHelperMock.getInlineResponse201(vnfInstance)).thenReturn(inlineResponse201);
+ // when
+ final InlineResponse201 result = testedObject.createVnf(createVnfRequest, VNF_INSTANCE_ID);
+ // then
+ assertThat(result.getVnfdId()).isEqualTo(VNFD_ID);
+ assertThat(result.getVnfInstanceName()).isEqualTo(VNF_INSTANCE_NAME);
+ }
+
+ @Test
+ public void test_createVnf_illegalAccessExceptionThrown_returnsNull() throws Exception {
+ // given
+ final CreateVnfRequest createVnfRequest = getCreateVnfRequest();
+ final VnfInstance vnfInstance = getVnfInstance();
+ when(vnfmHelperMock.createVnfInstance(createVnfRequest, VNF_INSTANCE_ID)).thenReturn(vnfInstance);
+ when(vnfmRepositoryMock.save(vnfInstance)).thenReturn(vnfInstance);
+ when(vnfmHelperMock.getInlineResponse201(vnfInstance)).thenThrow(new IllegalAccessException());
+ // when
+ final InlineResponse201 result = testedObject.createVnf(createVnfRequest, VNF_INSTANCE_ID);
+ // then
+ assertNull(result);
+ }
+
+ @Test
+ public void test_getOperationStatus_usingValidOperationId_operationStatusRetrievedSuccessfully() {
+ // given
+ final OperationEnum operationEnum = OperationEnum.OPERATE;
+ final VnfOperation vnfOperation = getVnfOperation(OPERATION_ID, operationEnum);
+ final List<VnfOperation> vnfOperations = new ArrayList<>();
+ vnfOperations.add(vnfOperation);
+ when(vnfOperationRepositoryMock.findAll()).thenReturn(vnfOperations);
+ // when
+ final InlineResponse200 result = testedObject.getOperationStatus(OPERATION_ID);
+ // then
+ assertThat(result.getId()).isEqualTo(OPERATION_ID);
+ assertThat(result.getOperation()).isEqualTo(operationEnum);
+ }
+
+ @Test
+ public void test_getOperationStatus_usingInvalidOperationId_returnsNull() {
+ // given
+ final OperationEnum operationEnum = OperationEnum.OPERATE;
+ final VnfOperation vnfOperation = getVnfOperation(OPERATION_ID, operationEnum);
+ final List<VnfOperation> vnfOperations = new ArrayList<>();
+ vnfOperations.add(vnfOperation);
+ when(vnfOperationRepositoryMock.findAll()).thenReturn(vnfOperations);
+ // when
+ InlineResponse200 result = testedObject.getOperationStatus("invalidOperationId");
+ // then
+ assertNull(result);
+ }
+
+ private InlineResponse201 getInlineResponse(String vnfdId, String vnfInstanceName) {
InlineResponse201 response201 = new InlineResponse201();
- response201.setVnfdId(vnfId);
+ response201.setVnfdId(vnfdId);
response201.vnfInstanceName(vnfInstanceName);
return response201;
}
+
+ private CreateVnfRequest getCreateVnfRequest() {
+ final CreateVnfRequest createVnfRequest = new CreateVnfRequest();
+ createVnfRequest.setVnfdId(VNFD_ID);
+ createVnfRequest.setVnfInstanceName(VNF_INSTANCE_NAME);
+ return createVnfRequest;
+ }
+
+ private VnfInstance getVnfInstance() {
+ final VnfInstance vnfInstance = new VnfInstance();
+ vnfInstance.setVnfdId(VNFD_ID);
+ vnfInstance.setVnfInstanceName(VNF_INSTANCE_NAME);
+ return vnfInstance;
+ }
+
+ private VnfOperation getVnfOperation(String operationId, OperationEnum operationEnum) {
+ final VnfOperation vnfOperation = new VnfOperation();
+ vnfOperation.setId(operationId);
+ vnfOperation.setOperation(operationEnum);
+ return vnfOperation;
+ }
}
diff --git a/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/TerminateOperationProgressorTest.java b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/TerminateOperationProgressorTest.java
new file mode 100644
index 0000000000..c7237a860c
--- /dev/null
+++ b/vnfm-simulator/vnfm-service/src/test/java/org/onap/svnfm/simulator/services/TerminateOperationProgressorTest.java
@@ -0,0 +1,157 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * Copyright (C) 2019 Nordix Foundation.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.svnfm.simulator.services;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import java.util.ArrayList;
+import java.util.List;
+import org.junit.Before;
+import org.junit.Test;
+import org.mockito.Mock;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.grant.model.GrantsAddResources;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse200.OperationEnum;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoResourceHandle;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo;
+import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.LccnSubscriptionRequest;
+import org.onap.svnfm.simulator.config.ApplicationConfig;
+import org.onap.svnfm.simulator.model.VnfOperation;
+import org.onap.svnfm.simulator.model.Vnfds;
+import org.onap.svnfm.simulator.model.Vnfds.Vnfc;
+import org.onap.svnfm.simulator.model.Vnfds.Vnfd;
+
+public class TerminateOperationProgressorTest {
+
+ private static final String VNFD_ID = "vnfdId";
+ private static final String VNFC_TYPE = "COMPUTE";
+ private static final String VDU_ID = "vduId";
+ private static final String VNF_INSTANCE_ID = "vnfInstanceId";
+
+ @Mock
+ private SvnfmService svnfmService;
+
+ private TerminateOperationProgressor testedObject;
+
+ @Before
+ public void setup() {
+ svnfmService = mock(SvnfmService.class);
+ VnfOperation vnfOperation = new VnfOperation();
+ vnfOperation.setVnfInstanceId(VNF_INSTANCE_ID);
+ vnfOperation.setOperation(OperationEnum.OPERATE);
+ testedObject = new TerminateOperationProgressor(vnfOperation, svnfmService, null, new ApplicationConfig(),
+ createVnfds(), createSubscriptionService());
+ }
+
+ @Test
+ public void test_getAddResources_usingValidVnfdId_returnsEmptyList() {
+ List<GrantsAddResources> results = testedObject.getAddResources(VNFD_ID);
+ assertThat(results.isEmpty());
+ }
+
+ @Test
+ public void test_getRemoveResources_usingValidVnfdId_retrievesGrantsAddResourcesSuccessfully() {
+ // given
+ InlineResponse201 inlineResponse201 = createInlineResponse201();
+ InlineResponse201InstantiatedVnfInfo inlineResponse201InstantiatedVnfInfo =
+ setupInlineResponseInstantiatedVnfInfo();
+ inlineResponse201.setInstantiatedVnfInfo(inlineResponse201InstantiatedVnfInfo);
+
+ when(svnfmService.getVnf(VNF_INSTANCE_ID)).thenReturn(inlineResponse201);
+
+ // when
+ List<GrantsAddResources> result = testedObject.getRemoveResources(VNFD_ID);
+
+ // then
+ assertThat(result).hasSize(1);
+ GrantsAddResources grantsAddResourcesResult = result.get(0);
+ assertThat(grantsAddResourcesResult.getType()).hasToString(VNFC_TYPE);
+ assertThat(grantsAddResourcesResult.getVduId()).isEqualTo(VDU_ID);
+ }
+
+ @Test
+ public void test_getVnfcChangeType_isEnumRemoved() {
+ assertThat(testedObject.getVnfcChangeType().getValue()).isEqualTo("REMOVED");
+ }
+
+ private Vnfds createVnfds() {
+ Vnfd vnfd = new Vnfd();
+ vnfd.setVnfdId(VNFD_ID);
+ List<Vnfc> vnfcList = new ArrayList<>();
+ vnfcList.add(createVnfc());
+ vnfd.setVnfcList(vnfcList);
+ List<Vnfd> vnfdList = new ArrayList<>();
+ vnfdList.add(vnfd);
+
+ Vnfds vnfds = new Vnfds();
+ vnfds.setVnfdList(vnfdList);
+ return vnfds;
+ }
+
+ private Vnfc createVnfc() {
+ Vnfc vnfc = new Vnfc();
+ String vnfcId = "vnfcId";
+ vnfc.setVnfcId(vnfcId);
+ vnfc.setType(VNFC_TYPE);
+ String resourceTemplateId = "resTempId";
+ vnfc.setResourceTemplateId(resourceTemplateId);
+ vnfc.setVduId(VDU_ID);
+ String resourceDefinitionId = "resourceDefinitionId";
+ vnfc.setGrantResourceId(resourceDefinitionId);
+ return vnfc;
+ }
+
+ private SubscriptionService createSubscriptionService() {
+ SubscriptionService subscriptionService = new SubscriptionService();
+ LccnSubscriptionRequest lccnSubscriptionRequest = new LccnSubscriptionRequest();
+ String callbackUri = "/lcn/uriest";
+ lccnSubscriptionRequest.setCallbackUri(callbackUri);
+ subscriptionService.registerSubscription(lccnSubscriptionRequest);
+ return subscriptionService;
+ }
+
+ private InlineResponse201 createInlineResponse201() {
+ InlineResponse201 inlineResponse201 = new InlineResponse201();
+ inlineResponse201.setVnfdId(VNFD_ID);
+ return inlineResponse201;
+ }
+
+ private InlineResponse201InstantiatedVnfInfo setupInlineResponseInstantiatedVnfInfo() {
+ InlineResponse201InstantiatedVnfInfo inlineResponse201InstantiatedVnfInfo =
+ new InlineResponse201InstantiatedVnfInfo();
+ List<InlineResponse201InstantiatedVnfInfoVnfcResourceInfo> resultList = new ArrayList<>();
+ InlineResponse201InstantiatedVnfInfoVnfcResourceInfo resourceInfo =
+ new InlineResponse201InstantiatedVnfInfoVnfcResourceInfo();
+ String resourceInfoId = "resourceInfoId";
+ resourceInfo.setId(resourceInfoId);
+ resourceInfo.setVduId((VDU_ID));
+ InlineResponse201InstantiatedVnfInfoResourceHandle resourceHandle =
+ new InlineResponse201InstantiatedVnfInfoResourceHandle();
+ resourceInfo.setComputeResource(resourceHandle);
+ resultList.add(resourceInfo);
+ inlineResponse201InstantiatedVnfInfo.setVnfcResourceInfo(resultList);
+ String flavourId = "flavourId";
+ inlineResponse201InstantiatedVnfInfo.setFlavourId(flavourId);
+ return inlineResponse201InstantiatedVnfInfo;
+ }
+}